r15793 - gnucash/trunk/src/app-utils - Fix state file issues on Windows.

Andreas Köhler andi5 at cvs.gnucash.org
Wed Apr 4 13:04:23 EDT 2007


Author: andi5
Date: 2007-04-04 13:04:22 -0400 (Wed, 04 Apr 2007)
New Revision: 15793
Trac: http://svn.gnucash.org/trac/changeset/15793

Modified:
   gnucash/trunk/src/app-utils/file-utils.c
Log:
Fix state file issues on Windows.

Handle two NULL parameters to %s in printfs.  In
gnc_update_state_file_keys, also use \r for splitting the contents into
lines.


Modified: gnucash/trunk/src/app-utils/file-utils.c
===================================================================
--- gnucash/trunk/src/app-utils/file-utils.c	2007-04-04 15:41:48 UTC (rev 15792)
+++ gnucash/trunk/src/app-utils/file-utils.c	2007-04-04 17:04:22 UTC (rev 15793)
@@ -193,7 +193,7 @@
     return FALSE;
   }
 
-  lines = g_strsplit(contents, "\n", -1);
+  lines = g_strsplit_set(contents, "\r\n", -1);
   g_free(contents);
 
   /* Strip spaces from non-comment lines, and rewrite the new text
@@ -208,7 +208,7 @@
       for (j = 0, part = parts[j++]; part; part = parts[j++])
 	part[0] = g_ascii_toupper(part[0]);
       newkey = g_strjoinv("", parts);
-      g_sprintf(line, "%s=%s", newkey, kv[1]);
+      g_sprintf(line, "%s=%s", newkey, kv[1] ? kv[1] : "");
       g_free(newkey);
       g_strfreev(parts);
       g_strfreev(kv);
@@ -286,7 +286,7 @@
     file_guid = g_key_file_get_string(key_file,
 				      STATE_FILE_TOP, STATE_FILE_BOOK_GUID,
 				      NULL);
-    DEBUG("File GUID is %s", file_guid);
+    DEBUG("File GUID is %s", file_guid ? file_guid : "<not found>");
     if (safe_strcmp(guid, file_guid) == 0) {
       DEBUG("Matched !!!");
       g_free(file_guid);



More information about the gnucash-changes mailing list