From caf50bcb93013cb0875ba101ffa0d4e7e74dcfb3 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Mon, 3 Jun 2019 00:22:20 +0000 Subject: [PATCH] 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. (cherry picked from commit ae2ef1472c69ad61ed8d19d932da4ca04c2a13ef) --- 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 70369410bf..887af19200 100644 --- a/gtk/gtkscale.c +++ b/gtk/gtkscale.c @@ -1544,7 +1544,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 e4ddfaecb6..e673bd3a03 100644 --- a/gtk/gtkspinbutton.c +++ b/gtk/gtkspinbutton.c @@ -1101,7 +1101,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; }