[tracker] Fixed evolution plugin 64bit compiler warnings & broken for loop



commit 737a2d7c12a22e9d8b477022a5749ecc35086370
Author: Martyn Russell <martyn imendio com>
Date:   Mon Jun 29 11:40:05 2009 +0100

    Fixed evolution plugin 64bit compiler warnings & broken for loop

 src/plugins/evolution/tracker-evolution-plugin.c |   92 +++++++++++-----------
 1 files changed, 46 insertions(+), 46 deletions(-)
---
diff --git a/src/plugins/evolution/tracker-evolution-plugin.c b/src/plugins/evolution/tracker-evolution-plugin.c
index dbdc9f1..9b5b560 100644
--- a/src/plugins/evolution/tracker-evolution-plugin.c
+++ b/src/plugins/evolution/tracker-evolution-plugin.c
@@ -524,59 +524,59 @@ queued_set_free (QueuedSet *queued_set)
 static gboolean 
 many_idle_handler (gpointer user_data)
 {
-	guint i;
-	QueuedSet *queued_set = (gpointer) 1;
-
-	for (i = 0; i < QUEUED_SETS_PER_MAINLOOP && queued_set ; i++) {
+	QueuedSet *queued_set;
+	gint popped;
 
-		if (!many_queue) {
-			return FALSE;
-		}
+	g_return_val_if_fail (QUEUED_SETS_PER_MAINLOOP > 0, FALSE);
 
-		queued_set = g_queue_pop_head (many_queue);
-
-		if (queued_set) {
-
-			TrackerEvolutionPlugin *self = queued_set->self;
-			TrackerEvolutionPluginPrivate *priv = TRACKER_EVOLUTION_PLUGIN_GET_PRIVATE (self);
-
-			/* During initial introduction the client-registrar might 
-			 * decide to crash, disconnect, stop listening. That 
-			 * would result in critical warnings so we start ignoring
-			 * as soon as service_gone has removed the registrar. 
-			 *
-			 * We nonetheless need to handle these items to clean up
-			 * the queue properly, of course. */
-
-			if (priv->registrars && g_hash_table_lookup (priv->registrars, queued_set->sender)) {
-				dbus_g_proxy_call_no_reply (queued_set->registrar,
-							    "SetMany",
-							    G_TYPE_STRV, queued_set->subjects,
-							    TRACKER_TYPE_G_STRV_ARRAY, queued_set->predicates_array,
-							    TRACKER_TYPE_G_STRV_ARRAY, queued_set->values_array,
-							    G_TYPE_UINT, (guint) time (NULL),
-							    G_TYPE_INVALID, 
-							    G_TYPE_INVALID);
-			} else {
-				guint t;
-
-				/* Performance improvement: remove all that had 
-				 * this disconnected registrar from the queue */
+	if (!many_queue) {
+		return FALSE;
+	}
 
-				for (i = 0; t < many_queue->length; t++) {
-					QueuedSet *remove_candidate;
-					remove_candidate = g_queue_peek_nth (many_queue, t);
-					if (remove_candidate->registrar == queued_set->registrar) {
-						queued_set_free (g_queue_pop_nth (many_queue, t));
-					}
+	for (queued_set  = g_queue_pop_head (many_queue), popped = 1; 
+	     queued_set != NULL && popped < QUEUED_SETS_PER_MAINLOOP; 
+	     queued_set  = g_queue_pop_head (many_queue), popped++) {
+		TrackerEvolutionPlugin *self = queued_set->self;
+		TrackerEvolutionPluginPrivate *priv = TRACKER_EVOLUTION_PLUGIN_GET_PRIVATE (self);
+		
+		/* During initial introduction the client-registrar might 
+		 * decide to crash, disconnect, stop listening. That 
+		 * would result in critical warnings so we start ignoring
+		 * as soon as service_gone has removed the registrar. 
+		 *
+		 * We nonetheless need to handle these items to clean up
+		 * the queue properly, of course. */
+		
+		if (priv->registrars && g_hash_table_lookup (priv->registrars, queued_set->sender)) {
+			dbus_g_proxy_call_no_reply (queued_set->registrar,
+						    "SetMany",
+						    G_TYPE_STRV, queued_set->subjects,
+						    TRACKER_TYPE_G_STRV_ARRAY, queued_set->predicates_array,
+						    TRACKER_TYPE_G_STRV_ARRAY, queued_set->values_array,
+						    G_TYPE_UINT, (guint) time (NULL),
+						    G_TYPE_INVALID, 
+						    G_TYPE_INVALID);
+		} else {
+			gint i;
+			
+			/* Performance improvement: remove all that had 
+			 * this disconnected registrar from the queue */
+			
+			for (i = 0; i < many_queue->length; i++) {
+				QueuedSet *remove_candidate;
+				
+				remove_candidate = g_queue_peek_nth (many_queue, i);
+				
+				if (remove_candidate->registrar == queued_set->registrar) {
+					queued_set_free (g_queue_pop_nth (many_queue, i));
 				}
 			}
-
-			queued_set_free (queued_set);
-		} 
+		}
+		
+		queued_set_free (queued_set);
 	}
 
-	return (gboolean) queued_set;
+	return queued_set ? TRUE : FALSE;
 }
 
 static void



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