From c1416a03fd42423ac11e1160735c1e0200b1e499 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jir=CC=8Ci=CC=81=20Techet?= Date: Tue, 29 Mar 2016 15:11:42 +0200 Subject: [PATCH] scope: Fix validate_number() The brackets are apparently wrong - the check that should happen is strcmp(text, "2147483648") < 0 but instead the whole expression (s - text == 10 && strcmp(text, "2147483648")) is compared if it's less than zero. Noticed by LLVM: utils.c:654:50: warning: comparison of constant 0 with boolean expression is always false [-Wtautological-constant-out-of-range-compare] (s - text == 10 && strcmp(text, "2147483648")) < 0) ? text : NULL; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~ --- scope/src/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scope/src/utils.c b/scope/src/utils.c index 053a5b043..4b59dee3a 100644 --- a/scope/src/utils.c +++ b/scope/src/utils.c @@ -651,7 +651,7 @@ static gchar *validate_number(gchar *text) for (s = text; isdigit(*s); s++); *s = '\0'; return *text && (s - text < 10 || - (s - text == 10 && strcmp(text, "2147483648")) < 0) ? text : NULL; + (s - text == 10 && strcmp(text, "2147483648") < 0)) ? text : NULL; } gchar *validate_column(gchar *text, gboolean string)