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
This commit is contained in:
Andreas Köhler 2007-04-04 17:04:22 +00:00
parent b2bd1a6411
commit 508ebfecb6

View File

@ -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 : "<not found>");
if (safe_strcmp(guid, file_guid) == 0) {
DEBUG("Matched !!!");
g_free(file_guid);