[tracker/ontology-cope] squash, bugfix, that box thing doesn't work of course (stack)
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/ontology-cope] squash, bugfix, that box thing doesn't work of course (stack)
- Date: Tue, 16 Feb 2010 17:03:28 +0000 (UTC)
commit a2b143bf3b46038b01e6ae146c480ec4274ae516
Author: Philip Van Hoof <philip codeminded be>
Date: Tue Feb 16 18:02:56 2010 +0100
squash, bugfix, that box thing doesn't work of course (stack)
src/libtracker-data/tracker-data-manager.c | 29 ++++++++++++++-------------
1 files changed, 15 insertions(+), 14 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-manager.c b/src/libtracker-data/tracker-data-manager.c
index 9d431d6..e67bd7c 100644
--- a/src/libtracker-data/tracker-data-manager.c
+++ b/src/libtracker-data/tracker-data-manager.c
@@ -68,10 +68,6 @@ static gchar *ontologies_dir;
static gboolean initialized;
static gboolean in_journal_replay;
-typedef struct {
- time_t value;
-} WrappedTimeT;
-
static void
load_ontology_statement (const gchar *ontology_file,
gint subject_id,
@@ -1307,22 +1303,22 @@ tracker_data_manager_init (TrackerDBManagerFlags flags,
NULL);
while (tracker_db_cursor_iter_next (cursor)) {
- WrappedTimeT box;
const gchar *onto_uri = tracker_db_cursor_get_string (cursor, 0);
+ /* It's stored as an int in the db anyway. This is caused by
+ * string_to_gvalue in tracker-data-update.c */
+ gint value = tracker_db_cursor_get_int (cursor, 1);
- /* This cast in to time_t because it's stored as an int in the db
- * anyway. This is caused by string_to_gvalue in tracker-data-update.c */
- box.value = (time_t) tracker_db_cursor_get_int (cursor, 1);
-
- g_hash_table_insert (ontos_table, g_strdup (onto_uri), &box);
+ g_hash_table_insert (ontos_table, g_strdup (onto_uri),
+ GINT_TO_POINTER (value));
}
g_object_unref (cursor);
for (l = sorted; l; l = l->next) {
- WrappedTimeT *box;
TrackerOntology *ontology;
gchar *ontology_file;
+ gboolean found;
+ gpointer value;
ontology_file = g_build_filename (ontologies_dir, l->data, NULL);
ontology = get_ontology_from_file (ontology_file);
@@ -1334,10 +1330,15 @@ tracker_data_manager_init (TrackerDBManagerFlags flags,
continue;
}
- box = g_hash_table_lookup (ontos_table, tracker_ontology_get_uri (ontology));
+ found = g_hash_table_lookup_extended (ontos_table,
+ tracker_ontology_get_uri (ontology),
+ NULL, &value);
- if (box) {
- if (box->value != tracker_ontology_get_last_modified (ontology)) {
+ if (found) {
+ gint val = GPOINTER_TO_INT (value);
+ /* We can't do better than this cast, it's stored as an int in the
+ * db. See above comment for more info. */
+ if (val != (gint) tracker_ontology_get_last_modified (ontology)) {
g_print ("%s NOT up to date\n", ontology_file);
} else {
g_print ("%s up to date\n", ontology_file);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]