diff options
author | Eliseo Martínez <eliseomarmol@gmail.com> | 2015-04-11 19:27:13 +0200 |
---|---|---|
committer | Eliseo Martínez <eliseomarmol@gmail.com> | 2015-04-11 22:34:57 +0200 |
commit | 95d6f4416e32139deb12e176a685474195fe8488 (patch) | |
tree | efff6573a29f33ae62b77111cc4e59338ecc2357 /src | |
parent | 9a363ca7a3174d8e278dee29bb8984909eeda693 (diff) | |
download | rneovim-95d6f4416e32139deb12e176a685474195fe8488.tar.gz rneovim-95d6f4416e32139deb12e176a685474195fe8488.tar.bz2 rneovim-95d6f4416e32139deb12e176a685474195fe8488.zip |
coverity/{13738,13739,68853,13717,13720,13716,68854,13718,13721}: FP.
All these issues are false positives that result from coverity's
inability to properly follow arithmetic implications in expressions
using some macros. Redefining macros another way to make arithmetic
implications clearer fixes the issues.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/macros.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/macros.h b/src/nvim/macros.h index 93812683d6..e14e998e7a 100644 --- a/src/nvim/macros.h +++ b/src/nvim/macros.h @@ -59,12 +59,12 @@ /* Use our own isdigit() replacement, because on MS-Windows isdigit() returns * non-zero for superscript 1. Also avoids that isdigit() crashes for numbers * below 0 and above 255. */ -#define VIM_ISDIGIT(c) ((unsigned)(c) - '0' < 10) +#define VIM_ISDIGIT(c) ((unsigned)(c) >= '0' && (unsigned)(c) <= '9') /* Like isalpha() but reject non-ASCII characters. Can't be used with a * special key (negative value). */ -# define ASCII_ISLOWER(c) ((unsigned)(c) - 'a' < 26) -# define ASCII_ISUPPER(c) ((unsigned)(c) - 'A' < 26) +# define ASCII_ISLOWER(c) ((unsigned)(c) >= 'a' && (unsigned)(c) <= 'z') +# define ASCII_ISUPPER(c) ((unsigned)(c) >= 'A' && (unsigned)(c) <= 'Z') # define ASCII_ISALPHA(c) (ASCII_ISUPPER(c) || ASCII_ISLOWER(c)) # define ASCII_ISALNUM(c) (ASCII_ISALPHA(c) || VIM_ISDIGIT(c)) |