JpegFile.Description malformed



I updated my checkout today and found that I could no longer import
photos. A SqliteSyntaxException resulted for each photo. Gonzalo noted
the same error earlier today, so I did some digging.

The problem is ultimately that JpegFile.Description returns a strange
string consisting of many literal 0/NULLs. When this string is included
in the SQL command created by PhotoStore.Create and then marshaled in
SqliteCommand.ExecuteReader, the native string is truncated early
because of the 0s in JpegFile.Description.

Attached is more/less a hack patch to satisfy some late night importing.
This probably wouldn't hurt to have as a check in PhotoStore.Create, but
does not address the real issue.

Cheers,
Aaron

Index: src/PhotoStore.cs
===================================================================
RCS file: /cvs/gnome/f-spot/src/PhotoStore.cs,v
retrieving revision 1.90
diff -u -r1.90 PhotoStore.cs
--- src/PhotoStore.cs	21 Feb 2006 08:58:26 -0000	1.90
+++ src/PhotoStore.cs	6 Mar 2006 07:29:25 -0000
@@ -703,7 +703,7 @@
 	{
 		FSpot.ImageFile img = FSpot.ImageFile.Create (origPath);
 		long unix_time = DbUtils.UnixTimeFromDateTime (img.Date);
-		string description = img.Description != null ? img.Description : "";
+		string description = img.Description != null && img.Description[0] != 0 ? img.Description : "";
 		SqliteCommand command = new SqliteCommand ();
 		command.Connection = Connection;
 


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