tracker r2534 - in trunk: . src/tracker-indexer



Author: carlosg
Date: Thu Nov 20 15:29:11 2008
New Revision: 2534
URL: http://svn.gnome.org/viewvc/tracker?rev=2534&view=rev

Log:
2008-11-20  Carlos Garnacho  <carlos imendio com>

        * src/tracker-indexer/tracker-metadata-utils.c: Leave one place for
        the trailing NULL in the batch and hints arrays so they can behave
        like GStrv. Also initialize the array and set freed elements to NULL
        so we don't end up with dangling pointers.

Modified:
   trunk/ChangeLog
   trunk/src/tracker-indexer/tracker-metadata-utils.c

Modified: trunk/src/tracker-indexer/tracker-metadata-utils.c
==============================================================================
--- trunk/src/tracker-indexer/tracker-metadata-utils.c	(original)
+++ trunk/src/tracker-indexer/tracker-metadata-utils.c	Thu Nov 20 15:29:11 2008
@@ -47,8 +47,8 @@
 #define TEXT_MAX_SIZE		     1048576  /* bytes */
 #define TEXT_CHECK_SIZE		     65535    /* bytes */
 
-static gchar   *batch[51];
-static gchar   *hints[51];
+static gchar   *batch[51] = { 0 };
+static gchar   *hints[51] = { 0 };
 static guint    count = 0;
 static gboolean timeout_runs = FALSE;
 
@@ -712,6 +712,8 @@
 		for (i = 0; i <= count; i++) {
 			g_free (batch[i]);
 			g_free (hints[i]);
+			batch[i] = NULL;
+			hints[i] = NULL;
 		}
 
 		count = 0;
@@ -748,7 +750,7 @@
 		tried = TRUE;
 	}
 
-	if (count < 51 && thumbnail_this (thumbnailable, mime)) {
+	if (count < 50 && thumbnail_this (thumbnailable, mime)) {
 		gchar *utf_path;
 
 		utf_path = g_filename_to_utf8 (path, -1, NULL, NULL, NULL);
@@ -769,7 +771,7 @@
 		}
 	}
 
-	if (count == 51) {
+	if (count == 50) {
 		request_thumbnails (NULL);
 	}
 #endif /* HAVE_HILDON_THUMBNAIL */



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