ges-xml-formatter: use g_ascii_dtostr() instead of messing with setlocale()
authorTim-Philipp Müller <tim@centricular.net>
Sun, 1 Sep 2013 23:19:30 +0000 (00:19 +0100)
committerTim-Philipp Müller <tim@centricular.net>
Sun, 1 Sep 2013 23:19:30 +0000 (00:19 +0100)
Libraries shouldn't use setlocale().

ges/ges-xml-formatter.c

index 9551254..3b8ee09 100644 (file)
@@ -825,9 +825,7 @@ _save_keyframes (GString * str, GESTrackElement * trackelement, gint index)
       if (GST_IS_INTERPOLATION_CONTROL_SOURCE (source)) {
         GList *timed_values, *tmp;
         GstInterpolationMode mode;
-        gchar *oldlocale = setlocale (LC_NUMERIC, NULL);
 
-        oldlocale = g_strdup (oldlocale);
         append_escaped (str,
             g_markup_printf_escaped
             ("            <binding type='direct' source_type='interpolation' property='%s'",
@@ -839,16 +837,15 @@ _save_keyframes (GString * str, GESTrackElement * trackelement, gint index)
         timed_values =
             gst_timed_value_control_source_get_all
             (GST_TIMED_VALUE_CONTROL_SOURCE (source));
-        setlocale (LC_NUMERIC, "C");
         for (tmp = timed_values; tmp; tmp = tmp->next) {
+          gchar strbuf[G_ASCII_DTOSTR_BUF_SIZE];
           GstTimedValue *value;
 
           value = (GstTimedValue *) tmp->data;
           append_escaped (str, g_markup_printf_escaped (" %" G_GUINT64_FORMAT
-                  ":%f ", value->timestamp, value->value));
+                  ":%s ", value->timestamp, g_ascii_dtostr (strbuf,
+                      G_ASCII_DTOSTR_BUF_SIZE, value->value)));
         }
-        setlocale (LC_NUMERIC, oldlocale);
-        g_free (oldlocale);
         append_escaped (str, g_markup_printf_escaped ("'/>\n"));
       } else
         GST_DEBUG ("control source not in [interpolation]");