Commit 7d84c563 authored by Carlos Garnacho's avatar Carlos Garnacho

libtracker-data: Use g_ascii_dtostr/strtod to transform doubles

Using locale dependent variants is a very very bad idea. Use the
locale-independent glib API.
parent 59db5202
......@@ -1659,7 +1659,7 @@ string_to_gvalue (const gchar *value,
break;
case TRACKER_PROPERTY_TYPE_DOUBLE:
g_value_init (gvalue, G_TYPE_DOUBLE);
g_value_set_double (gvalue, atof (value));
g_value_set_double (gvalue, g_ascii_strtod (value, NULL));
break;
case TRACKER_PROPERTY_TYPE_DATE:
g_value_init (gvalue, G_TYPE_INT64);
......@@ -1700,7 +1700,9 @@ gvalue_to_string (TrackerPropertyType type,
retval = g_value_get_int64 (gvalue) == 0 ? g_strdup ("false") : g_strdup ("true");
break;
case TRACKER_PROPERTY_TYPE_DOUBLE:
retval = g_strdup_printf ("%f", g_value_get_double (gvalue));
retval = g_new0 (char, G_ASCII_DTOSTR_BUF_SIZE);
g_ascii_dtostr (retval, G_ASCII_DTOSTR_BUF_SIZE,
g_value_get_double (gvalue));
break;
case TRACKER_PROPERTY_TYPE_DATE:
datet = g_value_get_int64 (gvalue);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment