[goffice] Use locale independent markup. [#608047]
- From: Jean Bréfort <jbrefort src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [goffice] Use locale independent markup. [#608047]
- Date: Tue, 26 Jan 2010 15:44:46 +0000 (UTC)
commit d775abd66f5a0332d0c0194fbad7c22c4787bd23
Author: Jean Brefort <jean brefort normalesup org>
Date: Tue Jan 26 16:46:12 2010 +0100
Use locale independent markup. [#608047]
ChangeLog | 5 +++++
NEWS | 1 +
goffice/utils/go-format.c | 17 +++++++++++------
3 files changed, 17 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b658f60..68bf545 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-01-26 Jean Brefort <jean brefort normalesup org>
+
+ * goffice/utils/go-format.c (cb_attrs_as_string),
+ (go_format_parse_markup): use locale independent markup. [#608047]
+
2010-01-25 Jean Brefort <jean brefort normalesup org>
* goffice/canvas/goc-graph.c (goc_graph_do_tooltip): do not crash when
diff --git a/NEWS b/NEWS
index 4e596e0..330c786 100644
--- a/NEWS
+++ b/NEWS
@@ -25,6 +25,7 @@ goffice 0.7.17:
Jean:
* Fixed a canvas performance issue. [#603813]
* Update property page when style changes after reordering. [#604229]
+ * Use locale independent markup. [#608047]
Jody:
* Fix context sensitive help support on win32.
diff --git a/goffice/utils/go-format.c b/goffice/utils/go-format.c
index c7a9dc6..17fac1c 100644
--- a/goffice/utils/go-format.c
+++ b/goffice/utils/go-format.c
@@ -4153,6 +4153,7 @@ static gboolean
cb_attrs_as_string (PangoAttribute *a, GString *accum)
{
PangoColor const *c;
+ char buf[16];
if (a->start_index >= a->end_index)
return FALSE;
@@ -4171,8 +4172,10 @@ cb_attrs_as_string (PangoAttribute *a, GString *accum)
((PangoAttrInt *)a)->value);
break;
case PANGO_ATTR_SCALE:
- g_string_append_printf (accum, "[scale=%.2f",
- ((PangoAttrFloat *)a)->value);
+ g_string_append (accum, "[scale=");
+ g_ascii_formatd (buf, sizeof (buf), "%.2f",
+ ((PangoAttrFloat *)a)->value);
+ g_string_append (accum, buf);
break;
case PANGO_ATTR_STYLE :
g_string_append_printf (accum, "[italic=%d",
@@ -4181,8 +4184,10 @@ cb_attrs_as_string (PangoAttribute *a, GString *accum)
case PANGO_ATTR_WEIGHT :
/* We are scaling the weight so that earlier versions that used only 0/1 */
/* can still read the new formats and we can read the old ones. */
- g_string_append_printf (accum, "[bold=%.3f",
- (((PangoAttrInt *)a)->value - 399.)/300.);
+ g_string_append (accum, "[bold=");
+ g_ascii_formatd (buf, sizeof (buf), "%.3f",
+ (((PangoAttrInt *)a)->value - 399.)/300.);
+ g_string_append (accum, buf);
break;
case PANGO_ATTR_STRIKETHROUGH :
g_string_append_printf (accum, "[strikethrough=%d",
@@ -4259,7 +4264,7 @@ go_format_parse_markup (char *str)
if (0 == strncmp (str, "size", 4))
a = pango_attr_size_new (atoi (val));
else if (0 == strncmp (str, "bold", 4))
- a = pango_attr_weight_new ((int)(atof (val) * 300. + 399.));
+ a = pango_attr_weight_new ((int)(g_ascii_strtod (val, NULL) * 300. + 399.));
else if (0 == strncmp (str, "rise", 4))
a = pango_attr_rise_new (atoi (val));
break;
@@ -4269,7 +4274,7 @@ go_format_parse_markup (char *str)
3 == sscanf (val, "%02xx%02xx%02x", &r, &g, &b))
a = pango_attr_foreground_new ((r << 8) | r, (g << 8) | g, (b << 8) | b);
else if (0 == strncmp (str, "scale", 5))
- a = pango_attr_scale_new (atof (val));
+ a = pango_attr_scale_new (g_ascii_strtod (val, NULL));
break;
case 6:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]