]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Clean up use of isXXX ctype functions to always call on unsigned char
authorhno <>
Sun, 7 Nov 2004 20:55:20 +0000 (20:55 +0000)
committerhno <>
Sun, 7 Nov 2004 20:55:20 +0000 (20:55 +0000)
include/config.h
lib/GNUregex.c
snmplib/mib.c
snmplib/parse.c
src/access_log.cc
src/test_cache_digest.cc

index bf91ebbec6ded45356ab7c1a85e6756e6300dea1..e1742c5bd534fa4c10da549e8933e517996a0bc0 100644 (file)
@@ -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
index 04649438247eb8ee8ee3264954cad8bd6bc15948..ea2a68e269ab3232d2b96e4a1822075e09e8138a 100644 (file)
@@ -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
index 0e07d96c3604ddd8f6571f3c632476ef9ab81458..feef8efdfa4139d8b009a09cc271fe5d574413b3 100644 (file)
@@ -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';
        }
index 863b213fed23278115d7eea3dea5da25e08856ad..9aae79dba374cd9715ce97cfcaafd94f8e09b173 100644 (file)
@@ -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 {
index 931153a1d618909ee4227c70df4554bc2a1702e3..a1ba4b7cd0e7497b51f3e887c6a99fc027baeb30 100644 (file)
@@ -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 == '.')
index 1cb66584fa04386e34486d22256a24ed780f7749..8fd0e4c3fb5c5b605d92b84f7e2f497fe18cd5e0 100644 (file)
@@ -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';