r23508 - gnucash/branches/2.4/src/app-utils - [23501]Bug 627575 - Stylesheet names with non-alphanumeric characters and saved-reports -- addendum
Geert Janssens
gjanssens at code.gnucash.org
Sat Dec 7 11:10:00 EST 2013
Author: gjanssens
Date: 2013-12-07 11:10:00 -0500 (Sat, 07 Dec 2013)
New Revision: 23508
Trac: http://svn.gnucash.org/trac/changeset/23508
Modified:
gnucash/branches/2.4/src/app-utils/guile-util.c
Log:
[23501]Bug 627575 - Stylesheet names with non-alphanumeric characters and saved-reports -- addendum
Work around a bug in guile 1.8. It escapes spaces in symbols
when printed to a string, but can't convert that string
back properly in a symbol
Modified: gnucash/branches/2.4/src/app-utils/guile-util.c
===================================================================
--- gnucash/branches/2.4/src/app-utils/guile-util.c 2013-12-07 16:09:33 UTC (rev 23507)
+++ gnucash/branches/2.4/src/app-utils/guile-util.c 2013-12-07 16:10:00 UTC (rev 23508)
@@ -1164,12 +1164,33 @@
splits = g_strsplit(raw_text, "\n", -1);
for (i = j = 0; splits[i]; i++)
{
+ gchar *haystack, *needle;
if ((splits[i][0] == ';') || (splits[i][0] == '\0'))
{
g_free(splits[i]);
continue;
}
- splits[j++] = g_strstrip(splits[i]);
+
+ /* Work around a bug in guile 1.8 that escapes spaces
+ * in a symbol printed on a string port. We don't
+ * want this, because this string can't be properly
+ * converted back into a symbol later on. */
+
+ haystack = splits [i];
+ needle = g_strstr_len (haystack, -1, "\\ ");
+ while (needle)
+ {
+ gchar *new_haystack = NULL;
+ gsize prefix_size = needle - haystack;
+ gchar *prefix = g_strndup (haystack, prefix_size);
+ needle++;
+ new_haystack = g_strconcat (prefix, needle, NULL);
+ g_free (prefix);
+ g_free (haystack);
+ haystack = new_haystack;
+ needle = g_strstr_len (haystack, -1, "\\ ");
+ }
+ splits[j++] = haystack;
}
splits[j] = NULL;
More information about the gnucash-changes
mailing list