From: serassio <> Date: Fri, 6 Apr 2007 18:15:45 +0000 (+0000) Subject: Always use xisxxxx() Squid defined macros instead of ctype functions. X-Git-Tag: SQUID_3_0_PRE6~129 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e4755e29c7519bedb8c5eac1407af9acc80e8ce3;p=thirdparty%2Fsquid.git Always use xisxxxx() Squid defined macros instead of ctype functions. 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 --- diff --git a/helpers/basic_auth/LDAP/squid_ldap_auth.c b/helpers/basic_auth/LDAP/squid_ldap_auth.c index 3ae41f879a..910b387ce8 100644 --- a/helpers/basic_auth/LDAP/squid_ldap_auth.c +++ b/helpers/basic_auth/LDAP/squid_ldap_auth.c @@ -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; } diff --git a/helpers/external_acl/unix_group/check_group.c b/helpers/external_acl/unix_group/check_group.c index 3e72154ad2..27286043d3 100644 --- a/helpers/external_acl/unix_group/check_group.c +++ b/helpers/external_acl/unix_group/check_group.c @@ -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 { diff --git a/helpers/negotiate_auth/mswin_sspi/libnegotiatessp.c b/helpers/negotiate_auth/mswin_sspi/libnegotiatessp.c index a05d1afe9e..c19a02edff 100755 --- a/helpers/negotiate_auth/mswin_sspi/libnegotiatessp.c +++ b/helpers/negotiate_auth/mswin_sspi/libnegotiatessp.c @@ -49,7 +49,7 @@ void hex_dump(void *data, int size) } c = *p; - if (isalnum(c) == 0) { + if (xisalnum(c) == 0) { c = '.'; } diff --git a/helpers/negotiate_auth/mswin_sspi/negotiate_auth.c b/helpers/negotiate_auth/mswin_sspi/negotiate_auth.c index 1f1e2eb51f..bd1793e60b 100755 --- a/helpers/negotiate_auth/mswin_sspi/negotiate_auth.c +++ b/helpers/negotiate_auth/mswin_sspi/negotiate_auth.c @@ -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++; } } diff --git a/helpers/ntlm_auth/fakeauth/fakeauth_auth.c b/helpers/ntlm_auth/fakeauth/fakeauth_auth.c index d0d9818275..61a989d8a1 100644 --- a/helpers/ntlm_auth/fakeauth/fakeauth_auth.c +++ b/helpers/ntlm_auth/fakeauth/fakeauth_auth.c @@ -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); } diff --git a/helpers/ntlm_auth/mswin_sspi/libntlmssp.c b/helpers/ntlm_auth/mswin_sspi/libntlmssp.c index ec358611f7..02c50bcf52 100755 --- a/helpers/ntlm_auth/mswin_sspi/libntlmssp.c +++ b/helpers/ntlm_auth/mswin_sspi/libntlmssp.c @@ -348,7 +348,7 @@ void hex_dump(void *data, int size) } c = *p; - if (isalnum(c) == 0) { + if (xisalnum(c) == 0) { c = '.'; } diff --git a/helpers/ntlm_auth/mswin_sspi/ntlm_auth.c b/helpers/ntlm_auth/mswin_sspi/ntlm_auth.c index 3e82720e9b..f2e8cc00db 100755 --- a/helpers/ntlm_auth/mswin_sspi/ntlm_auth.c +++ b/helpers/ntlm_auth/mswin_sspi/ntlm_auth.c @@ -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++; } } diff --git a/lib/util.c b/lib/util.c index 19f05f177e..a4b35ede21 100644 --- a/lib/util.c +++ b/lib/util.c @@ -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++; } } diff --git a/src/HttpMsg.cc b/src/HttpMsg.cc index 52f2f678d1..3cdd4baa8f 100644 --- a/src/HttpMsg.cc +++ b/src/HttpMsg.cc @@ -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; diff --git a/src/ICAP/ChunkedCodingParser.cc b/src/ICAP/ChunkedCodingParser.cc index 6be2a2ca4b..06608d2227 100644 --- a/src/ICAP/ChunkedCodingParser.cc +++ b/src/ICAP/ChunkedCodingParser.cc @@ -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); diff --git a/src/String.cc b/src/String.cc index 263b449dea..d2bbbd0009 100644 --- a/src/String.cc +++ b/src/String.cc @@ -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; } diff --git a/src/cache_cf.cc b/src/cache_cf.cc index b601df2538..b8cdc1d6af 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -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) diff --git a/src/external_acl.cc b/src/external_acl.cc index 45124d3c13..00c50246f0 100644 --- a/src/external_acl.cc +++ b/src/external_acl.cc @@ -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 = ','; diff --git a/src/ftp.cc b/src/ftp.cc index b18f8a0cd3..7676854b3b 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -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); } } diff --git a/src/helper.cc b/src/helper.cc index 066104cf40..fefe816708 100644 --- a/src/helper.cc +++ b/src/helper.cc @@ -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++; } diff --git a/src/http.cc b/src/http.cc index 6c7dd5073a..0a35768741 100644 --- a/src/http.cc +++ b/src/http.cc @@ -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) { diff --git a/src/tests/stub_cache_cf.cc b/src/tests/stub_cache_cf.cc index a39d46595d..c88bcb3025 100644 --- a/src/tests/stub_cache_cf.cc +++ b/src/tests/stub_cache_cf.cc @@ -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) diff --git a/test-suite/pconn-banger.c b/test-suite/pconn-banger.c index 85fd8e3823..7e07544540 100644 --- a/test-suite/pconn-banger.c +++ b/test-suite/pconn-banger.c @@ -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));