[gtk+/gtk-2-24] gtkrc.c: Use g_ascii_dtostr for formatting floats



commit c4b2d3a144a148f8f9087f9d616b68a991440072
Author: Colin Walters <walters verbum org>
Date:   Wed Apr 27 17:10:34 2011 -0400

    gtkrc.c: Use g_ascii_dtostr for formatting floats
    
    We should be locale-independent.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=647908

 gtk/gtkrc.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkrc.c b/gtk/gtkrc.c
index 6eefa34..82a6470 100644
--- a/gtk/gtkrc.c
+++ b/gtk/gtkrc.c
@@ -2520,7 +2520,14 @@ rc_parse_token_or_compound (GScanner   *scanner,
       g_string_append_printf (gstring, " 0x%lx", scanner->value.v_int);
       break;
     case G_TOKEN_FLOAT:
-      g_string_append_printf (gstring, " %f", scanner->value.v_float);
+      {
+	gchar    fbuf[G_ASCII_DTOSTR_BUF_SIZE];
+	g_ascii_formatd (fbuf,
+			 sizeof (fbuf),
+			 "%f",
+			 scanner->value.v_float);
+	g_string_append_printf (gstring, " %s", (char*)fbuf);
+      }
       break;
     case G_TOKEN_STRING:
       string = g_strescape (scanner->value.v_string, NULL);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]