mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
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:
parent
b2bd1a6411
commit
508ebfecb6
@ -193,7 +193,7 @@ gnc_update_state_file_keys(const gchar *filename)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
lines = g_strsplit(contents, "\n", -1);
|
lines = g_strsplit_set(contents, "\r\n", -1);
|
||||||
g_free(contents);
|
g_free(contents);
|
||||||
|
|
||||||
/* Strip spaces from non-comment lines, and rewrite the new text
|
/* 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++])
|
for (j = 0, part = parts[j++]; part; part = parts[j++])
|
||||||
part[0] = g_ascii_toupper(part[0]);
|
part[0] = g_ascii_toupper(part[0]);
|
||||||
newkey = g_strjoinv("", parts);
|
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_free(newkey);
|
||||||
g_strfreev(parts);
|
g_strfreev(parts);
|
||||||
g_strfreev(kv);
|
g_strfreev(kv);
|
||||||
@ -286,7 +286,7 @@ gnc_find_state_file (const gchar *url,
|
|||||||
file_guid = g_key_file_get_string(key_file,
|
file_guid = g_key_file_get_string(key_file,
|
||||||
STATE_FILE_TOP, STATE_FILE_BOOK_GUID,
|
STATE_FILE_TOP, STATE_FILE_BOOK_GUID,
|
||||||
NULL);
|
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) {
|
if (safe_strcmp(guid, file_guid) == 0) {
|
||||||
DEBUG("Matched !!!");
|
DEBUG("Matched !!!");
|
||||||
g_free(file_guid);
|
g_free(file_guid);
|
||||||
|
Loading…
Reference in New Issue
Block a user