[gegl] Bug 774708 - All pixels data is lost on transforms.



commit 4bea1130c1485fe82dd3beafaa50174a5eb78a2f
Author: Jehan <jehan girinstud io>
Date:   Mon Nov 21 15:42:14 2016 +0100

    Bug 774708 - All pixels data is lost on transforms.
    
    gegl_matrix3_parse_string() has been updated in b7f2d85 to use the
    non-locale dependant function g_ascii_strtod(), but the opposite
    gegl_matrix3_to_string() was still creating locale-dependant double
    strings (with g_string_append_printf()) which was completely breaking
    matrix string descriptions.

 gegl/gegl-matrix.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/gegl/gegl-matrix.c b/gegl/gegl-matrix.c
index 036df9f..b4a1e52 100644
--- a/gegl/gegl-matrix.c
+++ b/gegl/gegl-matrix.c
@@ -274,6 +274,7 @@ gegl_matrix3_parse_string (GeglMatrix3  *matrix,
 gchar *gegl_matrix3_to_string (GeglMatrix3 *matrix)
 {
   gchar *res;
+  gchar  dstring[G_ASCII_DTOSTR_BUF_SIZE];
   GString *str = g_string_new ("matrix(");
   gint i, j;
   gint a=0;
@@ -284,7 +285,12 @@ gchar *gegl_matrix3_to_string (GeglMatrix3 *matrix)
         if (a!=0)
           g_string_append (str, ",");
         a=1;
-        g_string_append_printf (str, "%f", matrix->coeff[j][i]);
+        /* Do not use g_string_append_printf () or any other printf
+         * function because they are locale dependent.
+         */
+        g_ascii_dtostr (dstring, sizeof (dstring),
+                        matrix->coeff[j][i]);
+        g_string_append (str, dstring);
       }
   g_string_append (str, ")");
   res = str->str;


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