[gegl] gegl: use locale-independent decimal point for chain serializer



commit 2cdd86c848eb44be0728a604490e9ed474f89bc2
Author: Øyvind Kolås <pippin gimp org>
Date:   Mon Aug 14 16:51:38 2017 +0200

    gegl: use locale-independent decimal point for chain serializer

 gegl/gegl-serialize.c         |   14 ++++++++++----
 tests/simple/test-serialize.c |    4 ++--
 2 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/gegl/gegl-serialize.c b/gegl/gegl-serialize.c
index b046459..fa25b04 100644
--- a/gegl/gegl-serialize.c
+++ b/gegl/gegl-serialize.c
@@ -63,16 +63,22 @@ static void each_knot (const GeglPathItem *path_node,
                        gpointer user_data)
 {
   GString *str = user_data;
-
-  g_string_append_printf (str, " %f=%f ", path_node->point[0].x, path_node->point[0].y);
+  gchar fstr[G_ASCII_DTOSTR_BUF_SIZE];
+  g_ascii_dtostr (fstr, sizeof(fstr), path_node->point[0].x);
+  g_string_append_printf (str, " %s=", fstr);
+  g_ascii_dtostr (fstr, sizeof(fstr), path_node->point[0].y);
+  g_string_append_printf (str, "%s ", fstr);
 }
 
 static void each_knot_rel (const GeglPathItem *path_node,
                            gpointer user_data)
 {
   GString *str = user_data;
-
-  g_string_append_printf (str, " %f=%frel ", path_node->point[0].x, path_node->point[0].y);
+  gchar fstr[G_ASCII_DTOSTR_BUF_SIZE];
+  g_ascii_dtostr (fstr, sizeof(fstr), path_node->point[0].x);
+  g_string_append_printf (str, " %s=", fstr);
+  g_ascii_dtostr (fstr, sizeof(fstr), path_node->point[0].y);
+  g_string_append_printf (str, "%srel ", fstr);
 }
 
 void
diff --git a/tests/simple/test-serialize.c b/tests/simple/test-serialize.c
index 0965426..7f371b7 100644
--- a/tests/simple/test-serialize.c
+++ b/tests/simple/test-serialize.c
@@ -39,9 +39,9 @@ TestCase tests[] = {
 
 
     {"threshold value={ 0=0.1 2=0.33 }",
-     "gegl:threshold value={  0.000000=0.100000  2.000000=0.330000  } ",
+     "gegl:threshold value={  0=0.10000000149011612  2=0.33000001311302185  } ",
      ""},
-  
+
     {"invert a=b",
      "gegl:invert-linear",
      "gegl:invert has no a property."},


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