[goffice] Fix axis limits serialization. [#640438]
- From: Jean Bréfort <jbrefort src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] Fix axis limits serialization. [#640438]
- Date: Tue, 25 Jan 2011 16:03:36 +0000 (UTC)
commit ea97882f64c523b788e41ffc481519b3dbe9cd18
Author: Jean Brefort <jean brefort normalesup org>
Date: Tue Jan 25 17:06:26 2011 +0100
Fix axis limits serialization. [#640438]
ChangeLog | 6 ++++++
NEWS | 1 +
goffice/data/go-data-simple.c | 18 +++++++++++-------
3 files changed, 18 insertions(+), 7 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 1fcf7b1..9e9aa8f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-01-25 Jean Brefort <jean brefort normalesup org>
+ * goffice/data/go-data-simple.c (render_val),
+ (go_data_scalar_val_serialize), (go_data_scalar_val_unserialize),
+ (go_data_vector_val_unserialize), (go_data_matrix_val_unserialize):
+ use g_ascii_dtostr and g_ascii_strtod when serializing. [#640438]
+
2011-01-23 Andreas J. Guelzow <aguelzow pyrshep ca>
* goffice/utils/formats.c (_go_format_currencies): delete EEK (Estonia
diff --git a/NEWS b/NEWS
index e40362f..782bb7a 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ Jean:
* Fixed memory leaks found by cppcheck analysis.
* Fixed drop lines in line plots. [#638738]
* Invalidate canvas items after reordering to force a redraw? [#639840]
+ * Fix axis limits serialization. [#640438]
--------------------------------------------------------------------------
goffice 0.8.12:
diff --git a/goffice/data/go-data-simple.c b/goffice/data/go-data-simple.c
index 5ebd0f2..2f9252c 100644
--- a/goffice/data/go-data-simple.c
+++ b/goffice/data/go-data-simple.c
@@ -37,8 +37,11 @@ render_val (double val, GOFormat const *fmt)
{
if (fmt)
return go_format_value (fmt, val);
- else
- return g_strdup_printf ("%g", val);
+ else {
+ char buf[G_ASCII_DTOSTR_BUF_SIZE];
+ g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE, val);
+ return g_strdup (buf);
+ }
}
@@ -84,8 +87,9 @@ go_data_scalar_val_eq (GOData const *a, GOData const *b)
static char *
go_data_scalar_val_serialize (GOData const *dat, gpointer user)
{
- /* FIXME: shouldn't use _get_str. */
- return g_strdup (go_data_scalar_get_str (GO_DATA_SCALAR (dat)));
+ GODataScalarVal *sval = (GODataScalarVal *)dat;
+ GOFormat const *fmt = NULL;
+ return render_val (sval->val, fmt);
}
static gboolean
@@ -95,7 +99,7 @@ go_data_scalar_val_unserialize (GOData *dat, char const *str, gpointer user)
double tmp;
char *end;
errno = 0; /* strto(ld) sets errno, but does not clear it. */
- tmp = strtod (str, &end);
+ tmp = g_ascii_strtod (str, &end);
if (end == str || *end != '\0' || errno == ERANGE)
return FALSE;
@@ -412,7 +416,7 @@ go_data_vector_val_unserialize (GOData *dat, char const *str, gpointer user)
vec->n = 0;
vec->notify = (GDestroyNotify) g_free;
while (1) {
- val = g_strtod (end, &end);
+ val = g_ascii_strtod (end, &end);
g_array_append_val (values, val);
if (*end) {
if (!sep) {
@@ -933,7 +937,7 @@ go_data_matrix_val_unserialize (GOData *dat, char const *str, gpointer user)
mat->size.columns = 0;
mat->notify = g_free;
while (1) {
- val = g_strtod (end, &end);
+ val = g_ascii_strtod (end, &end);
g_array_append_val (values, val);
if (*end) {
if (*end == col_sep)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]