tracker r3017 - in trunk: . src/libtracker-db



Author: mr
Date: Wed Mar  4 16:07:49 2009
New Revision: 3017
URL: http://svn.gnome.org/viewvc/tracker?rev=3017&view=rev

Log:
	* src/libtracker-db/tracker-db-index.c:
	(tracker_db_index_get_word_hits), (tracker_db_index_add_word),
	(tracker_db_index_remove_dud_hits): Make sure we check the
	priv->readonly property before trying to add or remove words from
	the QDBM index. As you may see from now on, this indicates that
	the only time we remove duds and words from the index is when the
	trackerd process finds them and it *ONLY* opens the index as
	readonly. We need to fix this removing dud issue ASAP - bring on
	FTS support!


Modified:
   trunk/ChangeLog
   trunk/src/libtracker-db/tracker-db-index.c

Modified: trunk/src/libtracker-db/tracker-db-index.c
==============================================================================
--- trunk/src/libtracker-db/tracker-db-index.c	(original)
+++ trunk/src/libtracker-db/tracker-db-index.c	Wed Mar  4 16:07:49 2009
@@ -1151,7 +1151,6 @@
 		return NULL;
 	}
 
-
 	details = NULL;
 
 	if (count) {
@@ -1159,7 +1158,7 @@
 	}
 
 	if ((tmp = dpget (priv->index, word, -1, 0, MAX_HIT_BUFFER, &tsiz)) != NULL) {
-		if (tsiz >= (gint) sizeof (TrackerDBIndexItem)) {
+		if (tsiz >= sizeof (TrackerDBIndexItem)) {
 			details = (TrackerDBIndexItem *) tmp;
 
 			if (count) {
@@ -1168,7 +1167,6 @@
 		}
 	}
 
-
 	return details;
 }
 
@@ -1190,6 +1188,8 @@
 
 	priv = TRACKER_DB_INDEX_GET_PRIVATE (indez);
 
+	g_return_if_fail (priv->readonly == FALSE);
+
 	if (G_UNLIKELY (!priv->cur_cache)) {
 		priv->cur_cache = index_cache_new ();
 	}
@@ -1273,9 +1273,9 @@
 	gint		       tsiz;
 	gboolean	       retval = FALSE;
 
-	g_return_val_if_fail (indez, FALSE);
-	g_return_val_if_fail (word, FALSE);
-	g_return_val_if_fail (dud_list, FALSE);
+	g_return_val_if_fail (indez != NULL, FALSE);
+	g_return_val_if_fail (word != NULL, FALSE);
+	g_return_val_if_fail (dud_list != NULL, FALSE);
 
 	if (!check_index_is_up_to_date (indez)) {
 		return TRUE;
@@ -1283,8 +1283,8 @@
 
 	priv = TRACKER_DB_INDEX_GET_PRIVATE (indez);
 
-	g_return_val_if_fail (priv->index, FALSE);
-
+	g_return_val_if_fail (priv->readonly == FALSE, FALSE);
+	g_return_val_if_fail (priv->index != NULL, FALSE);
 
 	/* Check if existing record is there  */
 	tmp = dpget (priv->index,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]