From 508ebfecb6871622ec4a6e20cbcbe594754b44e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=B6hler?= Date: Wed, 4 Apr 2007 17:04:22 +0000 Subject: [PATCH] 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. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15793 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/app-utils/file-utils.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app-utils/file-utils.c b/src/app-utils/file-utils.c index 86b5996e67..d4e8f48422 100644 --- a/src/app-utils/file-utils.c +++ b/src/app-utils/file-utils.c @@ -193,7 +193,7 @@ gnc_update_state_file_keys(const gchar *filename) 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 @@ gnc_update_state_file_keys(const gchar *filename) 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 @@ gnc_find_state_file (const gchar *url, 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 : ""); if (safe_strcmp(guid, file_guid) == 0) { DEBUG("Matched !!!"); g_free(file_guid);