[epiphany] Making history 2038-safe (bug 765808)
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Making history 2038-safe (bug 765808)
- Date: Mon, 17 Oct 2016 01:57:29 +0000 (UTC)
commit ada95daa920d58682cf5c1962cfc2097f7832f5e
Author: Paula Tavares <paulatavaresfranca gmail com>
Date: Sat Oct 15 16:01:03 2016 -0300
Making history 2038-safe (bug 765808)
lib/ephy-sqlite-statement.c | 17 +++++++++++++++++
lib/ephy-sqlite-statement.h | 2 ++
lib/history/ephy-history-service-urls-table.c | 14 +++++++-------
lib/history/ephy-history-service.c | 4 ++--
lib/history/ephy-history-service.h | 2 +-
lib/history/ephy-history-types.c | 2 +-
lib/history/ephy-history-types.h | 6 +++---
src/ephy-history-window.c | 2 +-
8 files changed, 34 insertions(+), 15 deletions(-)
---
diff --git a/lib/ephy-sqlite-statement.c b/lib/ephy-sqlite-statement.c
index 8773073..9bfa7d3 100644
--- a/lib/ephy-sqlite-statement.c
+++ b/lib/ephy-sqlite-statement.c
@@ -141,6 +141,17 @@ ephy_sqlite_statement_bind_int (EphySQLiteStatement *self, int column, int value
}
gboolean
+ephy_sqlite_statement_bind_int64 (EphySQLiteStatement *self, int column, gint64 value, GError **error)
+{
+ if (sqlite3_bind_int64 (self->prepared_statement, column + 1, value) != SQLITE_OK) {
+ ephy_sqlite_connection_get_error (self->connection, error);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+gboolean
ephy_sqlite_statement_bind_double (EphySQLiteStatement *self, int column, double value, GError **error)
{
if (sqlite3_bind_double (self->prepared_statement, column + 1, value) != SQLITE_OK) {
@@ -232,6 +243,12 @@ ephy_sqlite_statement_get_column_as_int (EphySQLiteStatement *self, int column)
return sqlite3_column_int (self->prepared_statement, column);
}
+gint64
+ephy_sqlite_statement_get_column_as_int64 (EphySQLiteStatement *self, int column)
+{
+ return sqlite3_column_int64 (self->prepared_statement, column);
+}
+
double
ephy_sqlite_statement_get_column_as_double (EphySQLiteStatement *self, int column)
{
diff --git a/lib/ephy-sqlite-statement.h b/lib/ephy-sqlite-statement.h
index 2a0238b..20d0eb4 100644
--- a/lib/ephy-sqlite-statement.h
+++ b/lib/ephy-sqlite-statement.h
@@ -32,6 +32,7 @@ G_DECLARE_FINAL_TYPE (EphySQLiteStatement, ephy_sqlite_statement, EPHY, SQLITE_S
gboolean ephy_sqlite_statement_bind_null (EphySQLiteStatement *statement, int
column, GError **error);
gboolean ephy_sqlite_statement_bind_boolean (EphySQLiteStatement *statement, int
column, gboolean value, GError **error);
gboolean ephy_sqlite_statement_bind_int (EphySQLiteStatement *statement, int
column, int value, GError **error);
+gboolean ephy_sqlite_statement_bind_int64 (EphySQLiteStatement *statement, int
column, gint64 value, GError **error);
gboolean ephy_sqlite_statement_bind_double (EphySQLiteStatement *statement, int
column, double value, GError **error);
gboolean ephy_sqlite_statement_bind_string (EphySQLiteStatement *statement, int
column, const char *value, GError **error);
gboolean ephy_sqlite_statement_bind_blob (EphySQLiteStatement *statement, int
column, const void *value, int length, GError **error);
@@ -44,6 +45,7 @@ EphySQLiteColumnType ephy_sqlite_statement_get_column_type (EphySQLite
int ephy_sqlite_statement_get_column_size (EphySQLiteStatement *statement, int
column);
int ephy_sqlite_statement_get_column_as_boolean (EphySQLiteStatement *statement, int
column);
int ephy_sqlite_statement_get_column_as_int (EphySQLiteStatement *statement, int
column);
+gint64 ephy_sqlite_statement_get_column_as_int64 (EphySQLiteStatement *statement, int
column);
double ephy_sqlite_statement_get_column_as_double (EphySQLiteStatement *statement, int
column);
const char* ephy_sqlite_statement_get_column_as_string (EphySQLiteStatement *statement, int
column);
const void* ephy_sqlite_statement_get_column_as_blob (EphySQLiteStatement *statement, int
column);
diff --git a/lib/history/ephy-history-service-urls-table.c b/lib/history/ephy-history-service-urls-table.c
index 332eb89..9afe5bd 100644
--- a/lib/history/ephy-history-service-urls-table.c
+++ b/lib/history/ephy-history-service-urls-table.c
@@ -114,9 +114,9 @@ ephy_history_service_get_url_row (EphyHistoryService *self, const char *url_stri
url->visit_count = ephy_sqlite_statement_get_column_as_int (statement, 3),
url->typed_count = ephy_sqlite_statement_get_column_as_int (statement, 4),
- url->last_visit_time = ephy_sqlite_statement_get_column_as_int (statement, 5);
+ url->last_visit_time = ephy_sqlite_statement_get_column_as_int64 (statement, 5);
url->hidden = ephy_sqlite_statement_get_column_as_int (statement, 6);
- url->thumbnail_time = ephy_sqlite_statement_get_column_as_int (statement, 7);
+ url->thumbnail_time = ephy_sqlite_statement_get_column_as_int64 (statement, 7);
g_object_unref (statement);
return url;
@@ -144,7 +144,7 @@ ephy_history_service_add_url_row (EphyHistoryService *self, EphyHistoryURL *url)
ephy_sqlite_statement_bind_string (statement, 1, url->title, &error) == FALSE ||
ephy_sqlite_statement_bind_int (statement, 2, url->visit_count, &error) == FALSE ||
ephy_sqlite_statement_bind_int (statement, 3, url->typed_count, &error) == FALSE ||
- ephy_sqlite_statement_bind_int (statement, 4, url->last_visit_time, &error) == FALSE ||
+ ephy_sqlite_statement_bind_int64 (statement, 4, url->last_visit_time, &error) == FALSE ||
ephy_sqlite_statement_bind_int (statement, 5, url->host->id, &error) == FALSE) {
g_warning ("Could not insert URL into urls table: %s", error->message);
g_error_free (error);
@@ -184,9 +184,9 @@ ephy_history_service_update_url_row (EphyHistoryService *self, EphyHistoryURL *u
if (ephy_sqlite_statement_bind_string (statement, 0, url->title, &error) == FALSE ||
ephy_sqlite_statement_bind_int (statement, 1, url->visit_count, &error) == FALSE ||
ephy_sqlite_statement_bind_int (statement, 2, url->typed_count, &error) == FALSE ||
- ephy_sqlite_statement_bind_int (statement, 3, url->last_visit_time, &error) == FALSE ||
+ ephy_sqlite_statement_bind_int64 (statement, 3, url->last_visit_time, &error) == FALSE ||
ephy_sqlite_statement_bind_int (statement, 4, url->hidden, &error) == FALSE ||
- ephy_sqlite_statement_bind_int (statement, 5, url->thumbnail_time, &error) == FALSE ||
+ ephy_sqlite_statement_bind_int64 (statement, 5, url->thumbnail_time, &error) == FALSE ||
ephy_sqlite_statement_bind_int (statement, 6, url->id, &error) == FALSE) {
g_warning ("Could not modify URL in urls table: %s", error->message);
g_error_free (error);
@@ -209,12 +209,12 @@ create_url_from_statement (EphySQLiteStatement *statement)
ephy_sqlite_statement_get_column_as_string (statement, 2),
ephy_sqlite_statement_get_column_as_int (statement, 3),
ephy_sqlite_statement_get_column_as_int (statement, 4),
- ephy_sqlite_statement_get_column_as_int (statement, 5));
+ ephy_sqlite_statement_get_column_as_int64 (statement, 5));
url->id = ephy_sqlite_statement_get_column_as_int (statement, 0);
url->host = ephy_history_host_new (NULL, NULL, 0, 1.0);
url->hidden = ephy_sqlite_statement_get_column_as_int (statement, 6);
- url->thumbnail_time = ephy_sqlite_statement_get_column_as_int (statement, 7);
+ url->thumbnail_time = ephy_sqlite_statement_get_column_as_int64 (statement, 7);
url->host->id = ephy_sqlite_statement_get_column_as_int (statement, 8);
return url;
diff --git a/lib/history/ephy-history-service.c b/lib/history/ephy-history-service.c
index 0da7df6..6c82ac5 100644
--- a/lib/history/ephy-history-service.c
+++ b/lib/history/ephy-history-service.c
@@ -949,7 +949,7 @@ ephy_history_service_execute_set_url_thumbnail_time (EphyHistoryService *self,
EphyHistoryURL *url,
gpointer *result)
{
- int thumbnail_time;
+ gint64 thumbnail_time;
if (self->read_only)
return FALSE;
@@ -969,7 +969,7 @@ ephy_history_service_execute_set_url_thumbnail_time (EphyHistoryService *self,
void
ephy_history_service_set_url_thumbnail_time (EphyHistoryService *self,
const char *orig_url,
- int thumbnail_time,
+ gint64 thumbnail_time,
GCancellable *cancellable,
EphyHistoryJobCallback callback,
gpointer user_data)
diff --git a/lib/history/ephy-history-service.h b/lib/history/ephy-history-service.h
index 07ad5cc..07454ad 100644
--- a/lib/history/ephy-history-service.h
+++ b/lib/history/ephy-history-service.h
@@ -41,7 +41,7 @@ void ephy_history_service_query_visits (EphyHisto
void ephy_history_service_query_urls (EphyHistoryService *self,
EphyHistoryQuery *query, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data);
void ephy_history_service_set_url_title (EphyHistoryService *self, const char
*url, const char *title, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data);
void ephy_history_service_set_url_hidden (EphyHistoryService *self, const char
*url, gboolean hidden, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data);
-void ephy_history_service_set_url_thumbnail_time (EphyHistoryService *self, const char
*orig_url, int thumbnail_time, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer
user_data);
+void ephy_history_service_set_url_thumbnail_time (EphyHistoryService *self, const char
*orig_url, gint64 thumbnail_time, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer
user_data);
void ephy_history_service_set_url_zoom_level (EphyHistoryService *self, const char
*url, const double zoom_level, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer
user_data);
void ephy_history_service_get_host_for_url (EphyHistoryService *self, const char
*url, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data);
void ephy_history_service_get_hosts (EphyHistoryService *self,
GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data);
diff --git a/lib/history/ephy-history-types.c b/lib/history/ephy-history-types.c
index e4254b7..b72a44b 100644
--- a/lib/history/ephy-history-types.c
+++ b/lib/history/ephy-history-types.c
@@ -121,7 +121,7 @@ ephy_history_host_free (EphyHistoryHost *host)
}
EphyHistoryURL *
-ephy_history_url_new (const char *url, const char *title, int visit_count, int typed_count, int
last_visit_time)
+ephy_history_url_new (const char *url, const char *title, int visit_count, int typed_count, gint64
last_visit_time)
{
EphyHistoryURL *history_url = g_slice_alloc0 (sizeof (EphyHistoryURL));
history_url->id = -1;
diff --git a/lib/history/ephy-history-types.h b/lib/history/ephy-history-types.h
index fc2629f..7911638 100644
--- a/lib/history/ephy-history-types.h
+++ b/lib/history/ephy-history-types.h
@@ -73,8 +73,8 @@ typedef struct _EphyHistoryURL
char* title;
int visit_count;
int typed_count;
- int last_visit_time;
- int thumbnail_time;
+ gint64 last_visit_time;
+ gint64 thumbnail_time;
gboolean hidden;
EphyHistoryHost *host;
} EphyHistoryURL;
@@ -111,7 +111,7 @@ EphyHistoryHost * ephy_history_host_new (const char *url, const ch
EphyHistoryHost * ephy_history_host_copy (EphyHistoryHost *original);
void ephy_history_host_free (EphyHistoryHost *host);
-EphyHistoryURL * ephy_history_url_new (const char *url, const char* title, int visit_count,
int typed_count, int last_visit_time);
+EphyHistoryURL * ephy_history_url_new (const char *url, const char *title, int visit_count,
int typed_count, gint64 last_visit_time);
EphyHistoryURL * ephy_history_url_copy (EphyHistoryURL *url);
void ephy_history_url_free (EphyHistoryURL *url);
diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c
index b4d9a3a..e8a39d2 100644
--- a/src/ephy-history-window.c
+++ b/src/ephy-history-window.c
@@ -688,7 +688,7 @@ convert_date_data_func (GtkTreeViewColumn *column,
gpointer user_data)
{
int col_id = GPOINTER_TO_INT (user_data);
- int value;
+ gint64 value;
time_t time;
char *friendly;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]