[gtk/gtk-3-24] gtk: fix weed_out_neg_zero() in spinbutton and scale



commit ae2ef1472c69ad61ed8d19d932da4ca04c2a13ef
Author: Michael Natterer <mitch gimp org>
Date:   Mon Jun 3 02:22:20 2019 +0200

    gtk: fix weed_out_neg_zero() in spinbutton and scale
    
    It was not copying the terminating \0 in the string, breaking output
    in spinbutton (didn't try scale). Fixes #3452.

 gtk/gtkscale.c      | 2 +-
 gtk/gtkspinbutton.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkscale.c b/gtk/gtkscale.c
index 18bb7f8cc3..ea30a8c081 100644
--- a/gtk/gtkscale.c
+++ b/gtk/gtkscale.c
@@ -1951,7 +1951,7 @@ weed_out_neg_zero (gchar *str,
       gchar neg_zero[8];
       g_snprintf (neg_zero, 8, "%0.*f", digits, -0.0);
       if (strcmp (neg_zero, str) == 0)
-        memmove (str, str + 1, strlen (str) - 1);
+        memmove (str, str + 1, strlen (str));
     }
   return str;
 }
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index ec9102157b..9498aad33d 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -1129,7 +1129,7 @@ weed_out_neg_zero (gchar *str,
       gchar neg_zero[8];
       g_snprintf (neg_zero, 8, "%0.*f", digits, -0.0);
       if (strcmp (neg_zero, str) == 0)
-        memmove (str, str + 1, strlen (str) - 1);
+        memmove (str, str + 1, strlen (str));
     }
   return str;
 }


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