From: hno <> Date: Sun, 7 Nov 2004 20:55:20 +0000 (+0000) Subject: Clean up use of isXXX ctype functions to always call on unsigned char X-Git-Tag: SQUID_3_0_PRE4~997 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ec451a0f9661f47b475f7a1f8d978a22a34badfb;p=thirdparty%2Fsquid.git Clean up use of isXXX ctype functions to always call on unsigned char --- diff --git a/include/config.h b/include/config.h index bf91ebbec6..e1742c5bd5 100644 --- a/include/config.h +++ b/include/config.h @@ -1,5 +1,5 @@ /* - * $Id: config.h,v 1.9 2003/04/24 06:35:03 hno Exp $ + * $Id: config.h,v 1.10 2004/11/07 13:55:20 hno Exp $ * * AUTHOR: Duane Wessels * @@ -327,6 +327,12 @@ typedef long mtyp_t; #define xisascii(x) isascii((unsigned char)x) #define xislower(x) islower((unsigned char)x) #define xisalpha(x) isalpha((unsigned char)x) +#define xisprint(x) isprint((unsigned char)x) +#define xisalnum(x) isalnum((unsigned char)x) +#define xiscntrl(x) iscntrl((unsigned char)x) +#define xispunct(x) ispunct((unsigned char)x) +#define xisupper(x) isupper((unsigned char)x) +#define xisxdigit(x) isxdigit((unsigned char)x) #if HAVE_RANDOM #define squid_random random diff --git a/lib/GNUregex.c b/lib/GNUregex.c index 0464943824..ea2a68e269 100644 --- a/lib/GNUregex.c +++ b/lib/GNUregex.c @@ -1,5 +1,5 @@ /* - * $Id: GNUregex.c,v 1.16 2003/08/03 22:53:47 hno Exp $ + * $Id: GNUregex.c,v 1.17 2004/11/07 13:55:20 hno Exp $ */ /* Extended regular expression matching and search library, @@ -146,26 +146,26 @@ static int re_match_2 #endif #ifdef isblank -#define ISBLANK(c) (isascii (c) && isblank (c)) +#define ISBLANK(c) (isascii ((unsigned char)c) && isblank ((unsigned char)c)) #else #define ISBLANK(c) ((c) == ' ' || (c) == '\t') #endif #ifdef isgraph -#define ISGRAPH(c) (isascii (c) && isgraph (c)) +#define ISGRAPH(c) (isascii ((unsigned char)c) && isgraph ((unsigned char)c)) #else -#define ISGRAPH(c) (isascii (c) && isprint (c) && !isspace (c)) +#define ISGRAPH(c) (isascii ((unsigned char)c) && isprint ((unsigned char)c) && !isspace ((unsigned char)c)) #endif -#define ISPRINT(c) (isascii (c) && isprint (c)) -#define ISDIGIT(c) (isascii (c) && isdigit (c)) -#define ISALNUM(c) (isascii (c) && isalnum (c)) -#define ISALPHA(c) (isascii (c) && isalpha (c)) -#define ISCNTRL(c) (isascii (c) && iscntrl (c)) -#define ISLOWER(c) (isascii (c) && islower (c)) -#define ISPUNCT(c) (isascii (c) && ispunct (c)) -#define ISSPACE(c) (isascii (c) && isspace (c)) -#define ISUPPER(c) (isascii (c) && isupper (c)) -#define ISXDIGIT(c) (isascii (c) && isxdigit (c)) +#define ISPRINT(c) (isascii ((unsigned char)c) && isprint ((unsigned char)c)) +#define ISDIGIT(c) (isascii ((unsigned char)c) && isdigit ((unsigned char)c)) +#define ISALNUM(c) (isascii ((unsigned char)c) && isalnum ((unsigned char)c)) +#define ISALPHA(c) (isascii ((unsigned char)c) && isalpha ((unsigned char)c)) +#define ISCNTRL(c) (isascii ((unsigned char)c) && iscntrl ((unsigned char)c)) +#define ISLOWER(c) (isascii ((unsigned char)c) && islower ((unsigned char)c)) +#define ISPUNCT(c) (isascii ((unsigned char)c) && ispunct ((unsigned char)c)) +#define ISSPACE(c) (isascii ((unsigned char)c) && isspace ((unsigned char)c)) +#define ISUPPER(c) (isascii ((unsigned char)c) && isupper ((unsigned char)c)) +#define ISXDIGIT(c) (isascii ((unsigned char)c) && isxdigit ((unsigned char)c)) #ifndef NULL #define NULL 0 diff --git a/snmplib/mib.c b/snmplib/mib.c index 0e07d96c36..feef8efdfa 100644 --- a/snmplib/mib.c +++ b/snmplib/mib.c @@ -127,11 +127,11 @@ lc_cmp(const char *s1, const char *s2) char c1, c2; while (*s1 && *s2) { - if (isupper(*s1)) + if (xisupper(*s1)) c1 = tolower(*s1); else c1 = *s1; - if (isupper(*s2)) + if (xisupper(*s2)) c2 = tolower(*s2); else c2 = *s2; @@ -163,11 +163,11 @@ parse_subtree(struct snmp_mib_tree *subtree, char *input, oid *output, int *out_ (*input == '.')) return (0); - if (isdigit(*input)) { + if (xisdigit(*input)) { /* * Read the number, then try to find it in the subtree. */ - while (isdigit(*input)) { + while (xisdigit(*input)) { subid *= 10; subid += *input++ - '0'; } diff --git a/snmplib/parse.c b/snmplib/parse.c index 863b213fed..9aae79dba3 100644 --- a/snmplib/parse.c +++ b/snmplib/parse.c @@ -488,9 +488,9 @@ get_token(register FILE *fp, register char *token) register struct tok *tp; *cp = 0; - ch = last; + ch = (unsigned char)last; /* skip all white space */ - while (isspace(ch) && ch != -1) { + while (xisspace(ch) && ch != -1) { ch = getc(fp); if (ch == '\n') Line++; @@ -506,10 +506,10 @@ get_token(register FILE *fp, register char *token) do { if (ch == '\n') Line++; - if (isspace(ch) || ch == '(' || ch == ')' || + if (xisspace(ch) || ch == '(' || ch == ')' || ch == '{' || ch == '}' || ch == ',' || ch == '"') { - if (!isspace(ch) && *token == 0) { + if (!xisspace(ch) && *token == 0) { hash += ch; *cp++ = ch; last = ' '; @@ -540,7 +540,7 @@ get_token(register FILE *fp, register char *token) return get_token(fp, token); } for (cp = token; *cp; cp++) - if (!isdigit(*cp)) + if (!xisdigit(*cp)) return LABEL; return NUMBER; } else { diff --git a/src/access_log.cc b/src/access_log.cc index 931153a1d6..a1ba4b7cd0 100644 --- a/src/access_log.cc +++ b/src/access_log.cc @@ -1,6 +1,6 @@ /* - * $Id: access_log.cc,v 1.97 2004/10/18 12:12:54 hno Exp $ + * $Id: access_log.cc,v 1.98 2004/11/07 13:55:21 hno Exp $ * * DEBUG: section 46 Access Log * AUTHOR: Duane Wessels @@ -941,7 +941,7 @@ accessLogGetNewLogFormatToken(logformat_token * lt, char *def, char *last) cur++; } - if (isdigit(*cur)) + if (xisdigit(*cur)) lt->width = strtol(cur, &cur, 10); if (*cur == '.') diff --git a/src/test_cache_digest.cc b/src/test_cache_digest.cc index 1cb66584fa..8fd0e4c3fb 100644 --- a/src/test_cache_digest.cc +++ b/src/test_cache_digest.cc @@ -1,6 +1,6 @@ /* - * $Id: test_cache_digest.cc,v 1.30 2003/02/21 22:50:12 robertc Exp $ + * $Id: test_cache_digest.cc,v 1.31 2004/11/07 13:55:21 hno Exp $ * * AUTHOR: Alex Rousskov * @@ -460,7 +460,7 @@ accessLogReader(FileIterator * fi) method = url; - while (!isdigit(*method)) { + while (!xisdigit(*method)) { if (*method == ' ') *method = '\0';