[Gnucash-changes] r13055 - gnucash/trunk - Do the Locale-two-step
to fix graphs in non-C-locales. Bug#328773.
Joshua Sled
jsled at cvs.gnucash.org
Mon Jan 30 22:34:26 EST 2006
Author: jsled
Date: 2006-01-30 22:34:26 -0500 (Mon, 30 Jan 2006)
New Revision: 13055
Trac: http://svn.gnucash.org/trac/changeset/13055
Modified:
gnucash/trunk/ChangeLog
gnucash/trunk/src/gnome-utils/gnc-html-graph-gog.c
Log:
Do the Locale-two-step to fix graphs in non-C-locales. Bug#328773.
Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog 2006-01-30 21:01:05 UTC (rev 13054)
+++ gnucash/trunk/ChangeLog 2006-01-31 03:34:26 UTC (rev 13055)
@@ -1,3 +1,9 @@
+2006-01-30 Joshua Sled <jsled at asynchronous.org>
+
+ * src/gnome-utils/gnc-html-graph-gog.c (read_doubles): Explicitly
+ enter the C locale before calling sscanf on doubles string-ified
+ by guile. Bug#328773.
+
2006-01-30 Derek Atkins <derek at ihtfp.com>
* src/business/business-core/gncInvoice.c:
Modified: gnucash/trunk/src/gnome-utils/gnc-html-graph-gog.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-html-graph-gog.c 2006-01-30 21:01:05 UTC (rev 13054)
+++ gnucash/trunk/src/gnome-utils/gnc-html-graph-gog.c 2006-01-31 03:34:26 UTC (rev 13055)
@@ -28,6 +28,7 @@
#include <gtkhtml/gtkhtml-embedded.h>
#include <string.h>
+#include "gnc-ui-util.h"
#include "gnc-html-graph-gog.h"
#include "gnc-html.h"
#include "gnc-engine.h"
@@ -98,10 +99,17 @@
int accum = 0;
double * retval = g_new0(double, nvalues);
- for (n=0; n<nvalues; n++) {
- sscanf(string + accum, "%le%n", &retval[n], &choffset);
- accum += choffset;
+ // guile is going to (puts ...) the elements of the double array
+ // together. In non-POSIX locales, tthat will be in a format that
+ // the locale-specific sscanf will not be able to parse.
+ gnc_push_locale("C");
+ {
+ for (n=0; n<nvalues; n++) {
+ sscanf(string + accum, "%le%n", &retval[n], &choffset);
+ accum += choffset;
+ }
}
+ gnc_pop_locale();
return retval;
}
@@ -318,6 +326,7 @@
sscanf( datasizeStr, "%d", &datasize );
data = read_doubles( dataStr, datasize );
labels = read_strings( labelsStr, datasize );
+ _debug_print_array(labels, datasize);
colors = read_strings( colorStr, datasize );
}
More information about the gnucash-changes
mailing list