[gimp] libgimpwidgets: in GimpNumberPairEntry, fix parsing
- From: N/A <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimpwidgets: in GimpNumberPairEntry, fix parsing
- Date: Tue, 27 Feb 2018 08:58:11 +0000 (UTC)
commit 8d2381f6e737b31f7f1721837b5fb9677279db86
Author: Ell <ell_se yahoo com>
Date: Tue Feb 27 03:46:46 2018 -0500
libgimpwidgets: in GimpNumberPairEntry, fix parsing
... to classify strings beginning with a non-digit character as
INVALID, rather than CLEAR.
libgimpwidgets/gimpnumberpairentry.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/libgimpwidgets/gimpnumberpairentry.c b/libgimpwidgets/gimpnumberpairentry.c
index 99f5d70..04ffe0f 100644
--- a/libgimpwidgets/gimpnumberpairentry.c
+++ b/libgimpwidgets/gimpnumberpairentry.c
@@ -1016,11 +1016,19 @@ gimp_number_pair_entry_parse_text (GimpNumberPairEntry *entry,
gboolean simplify = FALSE;
gchar *end;
+ /* skip over whitespace */
+ while (g_unichar_isspace (g_utf8_get_char (text)))
+ text = g_utf8_next_char (text);
+
+ /* check if clear */
+ if (! *text)
+ return PARSE_CLEAR;
+
/* try to parse a number */
new_left_number = strtod (text, &end);
if (end == text)
- return PARSE_CLEAR;
+ return PARSE_INVALID;
else
text = end;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]