[Rawstudio-commit] r3829 - trunk/librawstudio

Klaus Post klauspost at gmail.com
Tue Feb 22 22:28:32 CET 2011


Author: post
Date: 2011-02-22 22:28:32 +0100 (Tue, 22 Feb 2011)
New Revision: 3829

Modified:
   trunk/librawstudio/rs-library.c
Log:
Fix a few warnings of unused variables by doing more error checking.

Modified: trunk/librawstudio/rs-library.c
===================================================================
--- trunk/librawstudio/rs-library.c	2011-02-22 21:26:32 UTC (rev 3828)
+++ trunk/librawstudio/rs-library.c	2011-02-22 21:28:32 UTC (rev 3829)
@@ -720,6 +720,7 @@
 	sqlite3_prepare_v2(db, "create temp table filter (photo integer)", -1, &stmt, NULL);
 	rc = sqlite3_step(stmt);
 	sqlite3_finalize(stmt);
+	library_sqlite_error(db, rc);
        
 	for (n = 0; n < num_tags; n++)
 	{
@@ -736,12 +737,14 @@
 	sqlite3_prepare_v2(db, "create temp table result (photo integer, count integer)", -1, &stmt, NULL);
 	rc = sqlite3_step(stmt);
 	sqlite3_finalize(stmt);
+	library_sqlite_error(db, rc);
 
 	g_mutex_lock(library->id_lock);
 	sqlite3_prepare_v2(db, "insert into result select photo, count(photo) from filter group by photo;", -1, &stmt, NULL);
 	rc = sqlite3_step(stmt);
 	sqlite3_finalize(stmt);
 	g_mutex_unlock(library->id_lock);
+	library_sqlite_error(db, rc);
 
 	sqlite3_prepare_v2(db, "select library.filename from library,result where library.id = result.photo and result.count = ?1 order by library.filename;", -1, &stmt, NULL);
         rc = sqlite3_bind_int(stmt, 1, num_tags);
@@ -757,16 +760,19 @@
 		}
 	}				       
 	sqlite3_finalize(stmt);
+	library_sqlite_error(db, rc);
 
 	/* Empty filter */
 	sqlite3_prepare_v2(db, "delete from filter;", -1, &stmt, NULL);
 	rc = sqlite3_step(stmt);
 	sqlite3_finalize(stmt);
+	library_sqlite_error(db, rc);
 
 	/* Empty result */
 	sqlite3_prepare_v2(db, "delete from result;", -1, &stmt, NULL);
 	rc = sqlite3_step(stmt);
 	sqlite3_finalize(stmt);
+	library_sqlite_error(db, rc);
 
 	g_debug("Search in library took %.03f seconds", g_timer_elapsed(gt, NULL));
 	g_timer_destroy(gt);
@@ -916,6 +922,7 @@
 	while (sqlite3_step(stmt) == SQLITE_ROW)
 		tags = g_list_append(tags, g_strdup((gchar *) sqlite3_column_text(stmt, 0)));
 	sqlite3_finalize(stmt);
+	library_sqlite_error(db, rc);
 
 	return tags;
 }
@@ -939,6 +946,7 @@
 	while (sqlite3_step(stmt) == SQLITE_ROW)
 		tags = g_list_append(tags, g_strdup((gchar *) sqlite3_column_text(stmt, 0)));
 	sqlite3_finalize(stmt);
+	library_sqlite_error(db, rc);
 
 	g_free(like);
 
@@ -1075,7 +1083,7 @@
 	xmlDocPtr doc;
 	xmlNodePtr cur, cur2;
 	xmlChar *val;
-	gint version;
+	gint version = 0;
 
 	gchar *filename, *identifier, *tagname;
 	gint autotag, photoid, tagid;
@@ -1091,6 +1099,14 @@
 		val = xmlGetProp(cur, BAD_CAST "version");
 		if (val)
 			version = atoi((gchar *) val);
+		if (version > LIBRARY_VERSION)
+		{
+			xmlFree(val);
+			g_free(dotdir);
+			g_free(xmlfile);
+			xmlFreeDoc(doc);
+			return;
+		}
 	}
 
 	cur = cur->xmlChildrenNode;




More information about the Rawstudio-commit mailing list