serialize floating point values using locale-independent functions.

2006-09-04  Michael Natterer  <mitch@imendio.com>

	* gtk/gtkrc.c (rc_parse_token_or_compound)
	(gtk_rc_parse_assignment): serialize floating point values using
	locale-independent functions. (#346751, Frederic Crozat)
This commit is contained in:
Michael Natterer 2006-09-04 11:23:38 +00:00 committed by Michael Natterer
parent a8203d51c7
commit a4dcea2bed
2 changed files with 33 additions and 8 deletions

View File

@ -1,3 +1,9 @@
2006-09-04 Michael Natterer <mitch@imendio.com>
* gtk/gtkrc.c (rc_parse_token_or_compound)
(gtk_rc_parse_assignment): serialize floating point values using
locale-independent functions. (#346751, Frederic Crozat)
2006-09-04 Tor Lillqvist <tml@novell.com>
* gdk/win32/gdkevents-win32.c

View File

@ -2514,6 +2514,9 @@ rc_parse_token_or_compound (GScanner *scanner,
if (g_scanner_peek_next_token (scanner) == G_TOKEN_IDENTIFIER)
{
GdkColor color;
gchar rbuf[G_ASCII_DTOSTR_BUF_SIZE];
gchar gbuf[G_ASCII_DTOSTR_BUF_SIZE];
gchar bbuf[G_ASCII_DTOSTR_BUF_SIZE];
g_scanner_get_next_token (scanner);
@ -2525,10 +2528,17 @@ rc_parse_token_or_compound (GScanner *scanner,
return G_TOKEN_IDENTIFIER;
}
g_string_append_printf (gstring, " { %0.4f, %0.4f, %0.4f }",
(gdouble) color.red / 65535.0,
(gdouble) color.green / 65535.0,
(gdouble) color.blue / 65535.0);
g_string_append_printf (gstring, " { %s, %s, %s }",
g_ascii_formatd (rbuf, sizeof (rbuf),
"%0.4f",
color.red / 65535.0),
g_ascii_formatd (gbuf, sizeof (gbuf),
"%0.4f",
color.green / 65535.0),
g_ascii_formatd (bbuf, sizeof (bbuf),
"%0.4f",
color.blue / 65535.0));
break;
}
else
@ -2642,6 +2652,9 @@ gtk_rc_parse_assignment (GScanner *scanner,
if (is_color)
{
GdkColor color;
gchar rbuf[G_ASCII_DTOSTR_BUF_SIZE];
gchar gbuf[G_ASCII_DTOSTR_BUF_SIZE];
gchar bbuf[G_ASCII_DTOSTR_BUF_SIZE];
GString *gstring;
g_scanner_get_next_token (scanner);
@ -2657,10 +2670,16 @@ gtk_rc_parse_assignment (GScanner *scanner,
gstring = g_string_new (NULL);
g_string_append_printf (gstring, " { %0.4f, %0.4f, %0.4f } ",
(gdouble) color.red / 65535.0,
(gdouble) color.green / 65535.0,
(gdouble) color.blue / 65535.0);
g_string_append_printf (gstring, " { %s, %s, %s }",
g_ascii_formatd (rbuf, sizeof (rbuf),
"%0.4f",
color.red / 65535.0),
g_ascii_formatd (gbuf, sizeof (gbuf),
"%0.4f",
color.green / 65535.0),
g_ascii_formatd (bbuf, sizeof (bbuf),
"%0.4f",
color.blue / 65535.0));
g_value_init (&prop->value, G_TYPE_GSTRING);
g_value_take_boxed (&prop->value, gstring);