serialize doubles and floats using the locale independent

2002-04-15  Sven Neumann  <sven@gimp.org>

        * app/config/gimpconfig-serialize.c: serialize doubles and floats
        using the locale independent g_ascii_formatd().
This commit is contained in:
Sven Neumann 2002-04-15 09:40:08 +00:00 committed by Sven Neumann
parent 2a8bab17de
commit 21fb2943b5
3 changed files with 37 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2002-04-15 Sven Neumann <sven@gimp.org>
* app/config/gimpconfig-serialize.c: serialize doubles and floats
using the locale independent g_ascii_formatd().
2002-04-14 Michael Natterer <mitch@gimp.org> 2002-04-14 Michael Natterer <mitch@gimp.org>
* app/core/gimpunits.c: serialize the unit factor with * app/core/gimpunits.c: serialize the unit factor with

View File

@ -245,6 +245,22 @@ gimp_config_serialize_value (const GValue *value,
return TRUE; return TRUE;
} }
if (G_VALUE_HOLDS_DOUBLE (value) || G_VALUE_HOLDS_FLOAT (value))
{
gdouble v_double;
gchar buf[G_ASCII_DTOSTR_BUF_SIZE];
if (G_VALUE_HOLDS_DOUBLE (value))
v_double = g_value_get_double (value);
else
v_double = (gdouble) g_value_get_float (value);
g_ascii_formatd (buf, sizeof (buf), "%f", v_double);
g_string_append_c (str, ' ');
g_string_append (str, buf);
return TRUE;
}
if (g_value_type_transformable (G_VALUE_TYPE (value), G_TYPE_STRING)) if (g_value_type_transformable (G_VALUE_TYPE (value), G_TYPE_STRING))
{ {
GValue tmp_value = { 0, }; GValue tmp_value = { 0, };

View File

@ -245,6 +245,22 @@ gimp_config_serialize_value (const GValue *value,
return TRUE; return TRUE;
} }
if (G_VALUE_HOLDS_DOUBLE (value) || G_VALUE_HOLDS_FLOAT (value))
{
gdouble v_double;
gchar buf[G_ASCII_DTOSTR_BUF_SIZE];
if (G_VALUE_HOLDS_DOUBLE (value))
v_double = g_value_get_double (value);
else
v_double = (gdouble) g_value_get_float (value);
g_ascii_formatd (buf, sizeof (buf), "%f", v_double);
g_string_append_c (str, ' ');
g_string_append (str, buf);
return TRUE;
}
if (g_value_type_transformable (G_VALUE_TYPE (value), G_TYPE_STRING)) if (g_value_type_transformable (G_VALUE_TYPE (value), G_TYPE_STRING))
{ {
GValue tmp_value = { 0, }; GValue tmp_value = { 0, };