[maemo-commits] [maemo-commits] r16726 - projects/haf/trunk/hildon-thumbnail/daemon/plugins

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Nov 18 13:15:31 EET 2008
Author: pvanhoof
Date: 2008-11-18 13:15:29 +0200 (Tue, 18 Nov 2008)
New Revision: 16726

Modified:
   projects/haf/trunk/hildon-thumbnail/daemon/plugins/gdkpixbuf-jpeg-out-plugin.c
Log:
Cleaning up

Modified: projects/haf/trunk/hildon-thumbnail/daemon/plugins/gdkpixbuf-jpeg-out-plugin.c
===================================================================
--- projects/haf/trunk/hildon-thumbnail/daemon/plugins/gdkpixbuf-jpeg-out-plugin.c	2008-11-18 11:05:23 UTC (rev 16725)
+++ projects/haf/trunk/hildon-thumbnail/daemon/plugins/gdkpixbuf-jpeg-out-plugin.c	2008-11-18 11:15:29 UTC (rev 16726)
@@ -61,16 +61,19 @@
 {
 #ifdef HAVE_SQLITE3
 	gchar *retval = NULL;
-	gchar *dbfile;
 	sqlite3_stmt *stmt;
 	gint result = SQLITE_OK;
 
-	dbfile = g_build_filename (g_get_home_dir (), ".thumbnails", 
+
+	if (!db) {
+		gchar *dbfile;
+		dbfile = g_build_filename (g_get_home_dir (), ".thumbnails", 
 				   "meta.db", NULL);
+		if (g_file_test (dbfile, G_FILE_TEST_EXISTS))
+			sqlite3_open (dbfile, &db);
+		g_free (dbfile);
+	}
 
-	if (!db)
-		sqlite3_open (dbfile, &db);
-
 	if (db) {
 		const unsigned char *tmp;
 		gchar *sql = g_strdup_printf ("select URI from jpegthumbnails where Path = '%s'",
@@ -101,7 +104,6 @@
 			}
 		}
 	}
-	g_free (dbfile);
 
 	return retval;
 #else
@@ -195,16 +197,16 @@
 	if (!nerror) {
 #ifdef HAVE_SQLITE3
 		gchar *dbfile;
-		sqlite3_stmt *stmt;
 		gboolean create;
 
-		dbfile = g_build_filename (g_get_home_dir (), ".thumbnails", 
+		if (!db) {
+			gchar *dbfile;
+			dbfile = g_build_filename (g_get_home_dir (), ".thumbnails", 
 					   "meta.db", NULL);
-
-		create = !g_file_test (dbfile, G_FILE_TEST_EXISTS);
-
-		if (!db)
+			create = !g_file_test (dbfile, G_FILE_TEST_EXISTS);
 			sqlite3_open (dbfile, &db);
+			g_free (dbfile);
+		}
 
 		if (db) {
 			gchar *sql;
@@ -222,7 +224,6 @@
 			g_free (sql);
 		}
 
-		g_free (dbfile);
 #endif
 
 		buf.actime = buf.modtime = mtime;


More information about the maemo-commits mailing list