From 97a6bf07012f5a55d16f28c3bb3d039a09f8d700 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 22 Mar 2017 21:58:37 +0100 Subject: Fix passing plain char into ctype.h is* functions Change-Id: I4de56462e1fe5bba3035fec691feda91be88b434 --- soltools/cpp/_unix.c | 2 +- soltools/mkdepend/cppsetup.c | 2 +- soltools/mkdepend/ifparser.c | 14 +++++++------- soltools/mkdepend/parse.c | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) (limited to 'soltools') diff --git a/soltools/cpp/_unix.c b/soltools/cpp/_unix.c index 1010e3084eb6..274ee5acaf3a 100644 --- a/soltools/cpp/_unix.c +++ b/soltools/cpp/_unix.c @@ -149,7 +149,7 @@ void case 'w': dp = &optarg[n + 1]; n += (int)strlen(dp); - while (isspace(*dp)) dp++; + while (isspace((unsigned char)*dp)) dp++; for (i = NINCLUDE - 1; i >= 0; i--) { diff --git a/soltools/mkdepend/cppsetup.c b/soltools/mkdepend/cppsetup.c index 708e75dc099e..750142af9ddf 100644 --- a/soltools/mkdepend/cppsetup.c +++ b/soltools/mkdepend/cppsetup.c @@ -174,7 +174,7 @@ my_eval_defined (IfParser *ip, const char *var, size_t len) return 0; } -#define isvarfirstletter(ccc) (isalpha(ccc) || (ccc) == '_') +#define isvarfirstletter(ccc) (isalpha((unsigned char)(ccc)) || (ccc) == '_') static int my_eval_variable (IfParser *ip, const char *var, size_t len) diff --git a/soltools/mkdepend/ifparser.c b/soltools/mkdepend/ifparser.c index 274a72a7fce8..8777e795f18e 100644 --- a/soltools/mkdepend/ifparser.c +++ b/soltools/mkdepend/ifparser.c @@ -69,8 +69,8 @@ #define DO(val) if (!(val)) return NULL #define CALLFUNC(ggg,fff) (*((ggg)->funcs.fff)) -#define SKIPSPACE(ccc) while (isspace(*ccc)) ccc++ -#define isvarfirstletter(ccc) (isalpha(ccc) || (ccc) == '_') +#define SKIPSPACE(ccc) while (isspace((unsigned char)*ccc)) ccc++ +#define isvarfirstletter(ccc) (isalpha((unsigned char)(ccc)) || (ccc) == '_') static const char * @@ -83,7 +83,7 @@ parse_variable (IfParser *g, const char *cp, const char **varp) *varp = cp; /* EMPTY */ - for (cp++; isalnum(*cp) || *cp == '_'; cp++) ; + for (cp++; isalnum((unsigned char)*cp) || *cp == '_'; cp++) ; return cp; } @@ -93,7 +93,7 @@ parse_number (IfParser *g, const char *cp, int *valp) { SKIPSPACE (cp); - if (!isdigit(*cp)) + if (!isdigit((unsigned char)*cp)) return CALLFUNC(g, handle_error) (g, cp, "number"); #ifdef _WIN32 @@ -104,7 +104,7 @@ parse_number (IfParser *g, const char *cp, int *valp) #else *valp = atoi (cp); /* EMPTY */ - for (cp++; isdigit(*cp); cp++) ; + for (cp++; isdigit((unsigned char)*cp); cp++) ; #endif return cp; } @@ -155,7 +155,7 @@ parse_value (IfParser *g, const char *cp, int *valp) return cp + 1; case 'd': - if (strncmp (cp, "defined", 7) == 0 && !isalnum(cp[7])) { + if (strncmp (cp, "defined", 7) == 0 && !isalnum((unsigned char)cp[7])) { int paren = 0; size_t len; @@ -176,7 +176,7 @@ parse_value (IfParser *g, const char *cp, int *valp) /* fall out */ } - if (isdigit(*cp)) { + if (isdigit((unsigned char)*cp)) { DO (cp = parse_number (g, cp, valp)); } else if (!isvarfirstletter(*cp)) return CALLFUNC(g, handle_error) (g, cp, "variable or number"); diff --git a/soltools/mkdepend/parse.c b/soltools/mkdepend/parse.c index 250a6a66a702..41ae113e9ff0 100644 --- a/soltools/mkdepend/parse.c +++ b/soltools/mkdepend/parse.c @@ -293,7 +293,7 @@ int deftype (char *line, struct filepointer *filep, struct inclist *file_red, st /* * separate the name of a single symbol. */ - while (isalnum(*p) || *p == '_') + while (isalnum((unsigned char)*p) || *p == '_') *line++ = *p++; *line = '\0'; break; @@ -385,7 +385,7 @@ void define( char *def, struct symhash **symbols ) /* Separate symbol name and its value */ val = def; - while (isalnum(*val) || *val == '_') + while (isalnum((unsigned char)*val) || *val == '_') val++; if (*val) *val++ = '\0'; -- cgit