]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Always use xisxxxx() Squid defined macros instead of ctype functions.
authorserassio <>
Fri, 6 Apr 2007 18:15:45 +0000 (18:15 +0000)
committerserassio <>
Fri, 6 Apr 2007 18:15:45 +0000 (18:15 +0000)
Also fixed some incorrect type cast.

Fore more details see this squid-dev thread:
http://www.squid-cache.org/mail-archive/squid-dev/200703/0129.html

18 files changed:
helpers/basic_auth/LDAP/squid_ldap_auth.c
helpers/external_acl/unix_group/check_group.c
helpers/negotiate_auth/mswin_sspi/libnegotiatessp.c
helpers/negotiate_auth/mswin_sspi/negotiate_auth.c
helpers/ntlm_auth/fakeauth/fakeauth_auth.c
helpers/ntlm_auth/mswin_sspi/libntlmssp.c
helpers/ntlm_auth/mswin_sspi/ntlm_auth.c
lib/util.c
src/HttpMsg.cc
src/ICAP/ChunkedCodingParser.cc
src/String.cc
src/cache_cf.cc
src/external_acl.cc
src/ftp.cc
src/helper.cc
src/http.cc
src/tests/stub_cache_cf.cc
test-suite/pconn-banger.c

index 3ae41f879a80ac28276adafdf5e76f1e1d02527d..910b387ce85d891791681f25a08ae7ccfb2d2d97 100644 (file)
@@ -320,12 +320,12 @@ validUsername(const char *user)
     const unsigned char *p = (const unsigned char *) user;
 
     /* Leading whitespace? */
-    if (isspace(p[0]))
+    if (xisspace(p[0]))
        return 0;
     while (p[0] && p[1]) {
-       if (isspace(p[0])) {
+       if (xisspace(p[0])) {
            /* More than one consequitive space? */
-           if (isspace(p[1]))
+           if (xisspace(p[1]))
                return 0;
            /* or odd space type character used? */
            if (p[0] != ' ')
@@ -334,7 +334,7 @@ validUsername(const char *user)
        p++;
     }
     /* Trailing whitespace? */
-    if (isspace(p[0]))
+    if (xisspace(p[0]))
        return 0;
     return 1;
 }
index 3e72154ad227f78b121142bc308ac3e38c34f16a..27286043d35bc84aabf203e172fb868f009a548c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: check_group.c,v 1.6 2006/05/05 12:44:26 robertc Exp $
+ * $Id: check_group.c,v 1.7 2007/04/06 12:15:45 serassio Exp $
  *
  * This is a helper for the external ACL interface for Squid Cache
  * Copyright (C) 2002 Rodrigo Albani de Campos (rodrigo@geekbunker.org)
@@ -165,7 +165,7 @@ main(int argc, char *argv[])
            }
            break;
        case '?':
-           if (isprint(optopt)) {
+           if (xisprint(optopt)) {
 
                fprintf(stderr, "Unknown option '-%c'.\n", optopt);
            } else {
index a05d1afe9e4b2db1baa0d623710101cf495ec3e8..c19a02edff0a2e87d0a3f55814367453b868adda 100755 (executable)
@@ -49,7 +49,7 @@ void hex_dump(void *data, int size)
             }
             
             c = *p;
-            if (isalnum(c) == 0) {
+            if (xisalnum(c) == 0) {
                 c = '.';
             }
 
index 1f1e2eb51fd21dbc4fb2e187bbb28138d0a2e890..bd1793e60bfe51f5831258b0da1f755132f8d5be 100755 (executable)
@@ -59,7 +59,7 @@ uc(char *string)
 {
     char *p = string, c;
     while ((c = *p)) {
-       *p = toupper(c);
+       *p = xtoupper(c);
        p++;
     }
 }
@@ -70,7 +70,7 @@ lc(char *string)
 {
     char *p = string, c;
     while ((c = *p)) {
-       *p = tolower(c);
+       *p = xtolower(c);
        p++;
     }
 }
index d0d98182750743010d3ef175d0c95351e2d22553..61a989d8a137b44db42d55e5043c99ce05f1ff22 100644 (file)
@@ -91,7 +91,7 @@ hex_dump(void *data, int size)
                    (int) (p - (unsigned char *) data));
            }
            c = *p;
-           if (isalnum(c) == 0) {
+           if (xisalnum(c) == 0) {
                c = '.';
            }
            /* store hex str (for left side) */
@@ -248,7 +248,7 @@ ntlmGetString(ntlmhdr * hdr, strhdr * str, int flags)
        d = buf;
 
        for (; l; l--) {
-           if (*sc == '\0' || !isprint((int) (unsigned char) *sc)) {
+           if (*sc == '\0' || !xisprint(*sc)) {
                fprintf(stderr, "ntlmGetString: bad ascii: %04x\n", *sc);
                return (NULL);
            }
index ec358611f7c347a3742b9ecf60ad5947eb3b6807..02c50bcf52ef0d8bc830dcb2c140e0c4f9cd609f 100755 (executable)
@@ -348,7 +348,7 @@ void hex_dump(void *data, int size)
             }
             
             c = *p;
-            if (isalnum(c) == 0) {
+            if (xisalnum(c) == 0) {
                 c = '.';
             }
 
index 3e82720e9bd6cc7ed87b6f8eca63637e9365bc22..f2e8cc00db58dca1447b2f4edc8012d79431f218 100755 (executable)
@@ -85,7 +85,7 @@ uc(char *string)
 {
     char *p = string, c;
     while ((c = *p)) {
-       *p = toupper(c);
+       *p = xtoupper(c);
        p++;
     }
 }
@@ -96,7 +96,7 @@ lc(char *string)
 {
     char *p = string, c;
     while ((c = *p)) {
-       *p = tolower(c);
+       *p = xtolower(c);
        p++;
     }
 }
index 19f05f177e7d838545eaccb2993ce582d963226c..a4b35ede210616d8301c4890065ce8b453793063 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: util.c,v 1.94 2006/08/02 22:06:35 hno Exp $
+ * $Id: util.c,v 1.95 2007/04/06 12:15:51 serassio Exp $
  *
  * DEBUG: 
  * AUTHOR: Harvest Derived
@@ -813,7 +813,7 @@ Tolower(char *q)
     char *s = q;
 
     while (*s) {
-        *s = tolower((unsigned char) *s);
+        *s = xtolower(*s);
         s++;
     }
 }
index 52f2f678d1e777f83fca7afcaf04beed3a4c075b..3cdd4baa8fb5a50586aa4b86aa94049c6717b563 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: HttpMsg.cc,v 1.40 2007/04/06 04:50:04 rousskov Exp $
+ * $Id: HttpMsg.cc,v 1.41 2007/04/06 12:15:51 serassio Exp $
  *
  * DEBUG: section 74    HTTP Message
  * AUTHOR: Alex Rousskov
@@ -490,7 +490,7 @@ HttpParserParseReqLine(HttpParser *hmsg)
        i = 0;
 
        /* Find first non-whitespace - beginning of method */
-       for (; i < hmsg->req_end && (isspace(hmsg->buf[i])); i++);
+       for (; i < hmsg->req_end && (xisspace(hmsg->buf[i])); i++);
        if (i >= hmsg->req_end) {
                retcode = 0;
                goto finish;
@@ -499,7 +499,7 @@ HttpParserParseReqLine(HttpParser *hmsg)
        hmsg->req_start = i;
 
        /* Find first whitespace - end of method */
-       for (; i < hmsg->req_end && (! isspace(hmsg->buf[i])); i++);
+       for (; i < hmsg->req_end && (! xisspace(hmsg->buf[i])); i++);
        if (i >= hmsg->req_end) {
                retcode = 0;
                goto finish;
@@ -507,7 +507,7 @@ HttpParserParseReqLine(HttpParser *hmsg)
        hmsg->m_end = i - 1;
 
        /* Find first non-whitespace - beginning of URL+Version */
-       for (; i < hmsg->req_end && (isspace(hmsg->buf[i])); i++);
+       for (; i < hmsg->req_end && (xisspace(hmsg->buf[i])); i++);
        if (i >= hmsg->req_end) {
                retcode = 0;
                goto finish;
@@ -550,7 +550,7 @@ HttpParserParseReqLine(HttpParser *hmsg)
        } else {
                /* Find the first non-whitespace after last_whitespace */
                /* XXX why <= vs < ? I do need to really re-audit all of this ..*/
-               for (i = last_whitespace; i <= hmsg->req_end && isspace(hmsg->buf[i]); i++);
+               for (i = last_whitespace; i <= hmsg->req_end && xisspace(hmsg->buf[i]); i++);
                if (i > hmsg->req_end) {
                        retcode = 0;
                        goto finish;
index 6be2a2ca4b888925f6b180ff08903e063bd8becb..06608d22275caf6d509f9e4678610b4cf3b75693 100644 (file)
@@ -79,12 +79,12 @@ void ChunkedCodingParser::parseChunkBeg()
             if (size == 0 && p && *p++ == ';') {
                 const char *e = theIn->content() + crlfBeg; // end of extension
 
-                while (p < e && isspace(*p))
+                while (p < e && xisspace(*p))
                     ++p; // skip space
 
                 sawIeof = e - p >= 4 &&
                           strncmp(p, "ieof", 4) == 0 &&
-                          isspace(p[4]);
+                          xisspace(p[4]);
             }
 
             theIn->consume(crlfEnd);
index 263b449deadfd51aab00924bbaae7b249e509fcc..d2bbbd000905cca1f480cb9334f06f229aa8c4f9 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: String.cc,v 1.22 2006/09/28 07:33:59 adrian Exp $
+ * $Id: String.cc,v 1.23 2007/04/06 12:15:51 serassio Exp $
  *
  * DEBUG: section 67    String
  * AUTHOR: Duane Wessels
@@ -336,7 +336,7 @@ strwordtok(char *buf, char **t)
     if (!p)
         goto error;
 
-    while (*p && isspace(*p))
+    while (*p && xisspace(*p))
         p++;
 
     if (!*p)
@@ -384,7 +384,7 @@ strwordtok(char *buf, char **t)
             break;
 
         default:
-            if (!quoted && isspace(*p)) {
+            if (!quoted && xisspace(*p)) {
                 p++;
                 goto done;
             }
index b601df2538029881fc01918e18108069d0543f99..b8cdc1d6af872e9bdb96fbfce2dbab79713163bf 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: cache_cf.cc,v 1.505 2007/02/25 11:32:29 hno Exp $
+ * $Id: cache_cf.cc,v 1.506 2007/04/06 12:15:51 serassio Exp $
  *
  * DEBUG: section 3     Configuration File Parsing
  * AUTHOR: Harvest Derived
@@ -255,7 +255,7 @@ parseConfigFile(const char *file_name, CacheManager & manager)
             if (file == token)
                 continue;      /* Not a valid #line directive, may be a comment */
 
-            while (*file && isspace((unsigned char) *file))
+            while (*file && xisspace((unsigned char) *file))
                 file++;
 
             if (*file) {
@@ -2289,7 +2289,7 @@ parse_eol(char *volatile *var)
     if (token == NULL)
         self_destruct();
 
-    while (*token && isspace(*token))
+    while (*token && xisspace(*token))
         token++;
 
     if (!*token)
index 45124d3c13a20579355e8c8708eb528d49a482c2..00c50246f0cadae5da0cbfa1c9a64b71c0c2e98c 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: external_acl.cc,v 1.74 2006/08/21 00:50:41 robertc Exp $
+ * $Id: external_acl.cc,v 1.75 2007/04/06 12:15:51 serassio Exp $
  *
  * DEBUG: section 82    External ACL
  * AUTHOR: Henrik Nordstrom, MARA Systems AB
@@ -297,7 +297,7 @@ parse_externalAclHelper(external_acl ** list)
                 /* Split in header and member */
                 *member++ = '\0';
 
-                if (!isalnum(*member))
+                if (!xisalnum(*member))
                     format->separator = *member++;
                 else
                     format->separator = ',';
index b18f8a0cd3dd822c952a637ab41a0ab548c313bf..7676854b3b966464b2f5c03a3525d6e962e4803d 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ftp.cc,v 1.410 2007/04/06 04:50:06 rousskov Exp $
+ * $Id: ftp.cc,v 1.411 2007/04/06 12:15:51 serassio Exp $
  *
  * DEBUG: section 9     File Transfer Protocol (FTP)
  * AUTHOR: Harvest Derived
@@ -1396,7 +1396,7 @@ FtpStateData::checkUrlpath()
 
     if ((t = request->urlpath.rpos(';')) != NULL) {
         if (strncasecmp(t + 1, "type=", 5) == 0) {
-            typecode = (char) toupper((int) *(t + 6));
+            typecode = (char) xtoupper(*(t + 6));
             request->urlpath.cutPointer(t);
         }
     }
index 066104cf402befc10a6ab50f5d390db1a74f6013..fefe816708dad7a40c815a3a53d2afcdabcd6854 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: helper.cc,v 1.78 2006/09/19 07:56:57 adrian Exp $
+ * $Id: helper.cc,v 1.79 2007/04/06 12:15:51 serassio Exp $
  *
  * DEBUG: section 84    Helper process maintenance
  * AUTHOR: Harvest Derived?
@@ -1022,7 +1022,7 @@ helperHandleRead(int fd, char *buf, size_t len, comm_err_t flag, int xerrno, voi
         if (hlp->concurrency) {
             i = strtol(msg, &msg, 10);
 
-            while (*msg && isspace(*msg))
+            while (*msg && xisspace(*msg))
                 msg++;
         }
 
index 6c7dd5073aa2faf283e5642e8661e68e4949dc18..0a357687416d9587554306e00bd0fb5ac6746eb4 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: http.cc,v 1.511 2007/04/06 04:50:06 rousskov Exp $
+ * $Id: http.cc,v 1.512 2007/04/06 12:15:51 serassio Exp $
  *
  * DEBUG: section 11    Hypertext Transfer Protocol (HTTP)
  * AUTHOR: Harvest Derived
@@ -997,7 +997,7 @@ HttpStateData::readReply (size_t len, comm_err_t flag, int xerrno)
     if (!flags.headers_parsed && flag == COMM_OK && len > 0 && fd_table[fd].uses > 1) {
         /* Skip whitespace between replies */
 
-        while (len > 0 && isspace(*buf))
+        while (len > 0 && xisspace(*buf))
             xmemmove(buf, buf + 1, len--);
 
         if (len == 0) {
index a39d46595d88d47ad6268f382dc0481e6554a672..c88bcb30251e44f74ff98baf4298d383551fb2d2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: stub_cache_cf.cc,v 1.3 2006/04/23 11:10:35 robertc Exp $
+ * $Id: stub_cache_cf.cc,v 1.4 2007/04/06 12:15:52 serassio Exp $
  *
  * DEBUG: section 3     Configuration File Parsing
  * AUTHOR: Robert Collins
@@ -65,7 +65,7 @@ parse_eol(char *volatile *var)
     if (token == NULL)
         self_destruct();
 
-    while (*token && isspace(*token))
+    while (*token && xisspace(*token))
         token++;
 
     if (!*token)
index 85fd8e3823f6a958775e554478769ec47297bc54..7e075445406f28468634198dc82bd711d905ca89 100644 (file)
@@ -283,7 +283,7 @@ get_header_int_value(const char *hdr, const char *buf, const char *end)
     for (t = buf; t < end; t += strcspn(t, crlf), t += strspn(t, crlf)) {
        if (strncasecmp(t, hdr, strlen(hdr)) == 0) {
            t += strlen(hdr);
-           while (isspace(*t))
+           while (xisspace(*t))
                t++;
            return atoi(t);
        }
@@ -299,7 +299,7 @@ get_header_string_value(const char *hdr, const char *buf, const char *end)
     for (t = buf; t < end; t += strcspn(t, crlf), t += strspn(t, crlf)) {
        if (strncasecmp(t, hdr, strlen(hdr)) == 0) {
            t += strlen(hdr);
-           while (isspace(*t))
+           while (xisspace(*t))
                t++;
            strcpy(result, "");
            strncat(result, t, strcspn(t, crlf));