[geany/geany-plugins] c1416a: scope: Fix validate_number()

Jiří Techet git-noreply at xxxxx
Thu Jun 23 15:19:23 UTC 2016


Branch:      refs/heads/master
Author:      Jiří Techet <techet at gmail.com>
Committer:   Jiří Techet <techet at gmail.com>
Date:        Tue, 29 Mar 2016 13:11:42 UTC
Commit:      c1416a03fd42423ac11e1160735c1e0200b1e499
             https://github.com/geany/geany-plugins/commit/c1416a03fd42423ac11e1160735c1e0200b1e499

Log Message:
-----------
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;
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~


Modified Paths:
--------------
    scope/src/utils.c

Modified: scope/src/utils.c
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -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)



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Plugins-Commits mailing list