From bab5c5fac0fba6b6e0735e8bd9dfecb7bd474700 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Fri, 12 Mar 2010 16:26:16 +0000 Subject: 2010-03-12 Joel Sherrill * ftpd/ftpd.c, httpd/asp.c, httpd/ejparse.c, httpd/emfdb.c, httpd/misc.c, httpd/um.c, httpd/webs.c, httpd/websuemf.c, libfs/src/dosfs/msdos_dir.c, libfs/src/dosfs/msdos_format.c, libfs/src/dosfs/msdos_misc.c, libfs/src/nfsclient/src/nfs.c, libmisc/capture/capture-cli.c, libmisc/monitor/mon-network.c, libmisc/shell/hexdump-odsyntax.c, libmisc/shell/main_ifconfig.c, libmisc/shell/shell.c, libmisc/shell/shell_makeargs.c, libmisc/uuid/parse.c, libnetworking/libc/gethostbydns.c, libnetworking/libc/gethostbyht.c, libnetworking/libc/gethostnamadr.c, libnetworking/libc/getnetnamadr.c, libnetworking/libc/inet_addr.c, libnetworking/libc/inet_network.c, libnetworking/libc/res_debug.c, libnetworking/libc/res_init.c, libnetworking/libc/res_query.c, libnetworking/rtems/rtems_mii_ioctl.c, score/src/objectgetnameasstring.c: Readdress use of ctype methods per recommendation from D.J. Delorie on the newlib mailing list. We should pass an unsigned char into these methods. --- cpukit/libnetworking/libc/gethostbydns.c | 8 ++--- cpukit/libnetworking/libc/gethostbyht.c | 8 ++--- cpukit/libnetworking/libc/gethostnamadr.c | 2 +- cpukit/libnetworking/libc/getnetnamadr.c | 2 +- cpukit/libnetworking/libc/inet_addr.c | 10 +++--- cpukit/libnetworking/libc/inet_network.c | 8 ++--- cpukit/libnetworking/libc/res_debug.c | 52 ++++++++++++++-------------- cpukit/libnetworking/libc/res_init.c | 4 +-- cpukit/libnetworking/libc/res_query.c | 6 ++-- cpukit/libnetworking/rtems/rtems_mii_ioctl.c | 4 +-- 10 files changed, 52 insertions(+), 52 deletions(-) (limited to 'cpukit/libnetworking') diff --git a/cpukit/libnetworking/libc/gethostbydns.c b/cpukit/libnetworking/libc/gethostbydns.c index 07d6f2042b..28c31713a0 100644 --- a/cpukit/libnetworking/libc/gethostbydns.c +++ b/cpukit/libnetworking/libc/gethostbydns.c @@ -516,7 +516,7 @@ _gethostbydnsname( * disallow names consisting only of digits/dots, unless * they end in a dot. */ - if (isdigit((int)name[0])) + if (isdigit((unsigned char)name[0])) for (cp = name;; ++cp) { if (!*cp) { if (*--cp == '.') @@ -545,10 +545,10 @@ _gethostbydnsname( h_errno = NETDB_SUCCESS; return (&host); } - if (!isdigit((int)*cp) && *cp != '.') + if (!isdigit((unsigned char)*cp) && *cp != '.') break; } - if ((isxdigit((int)name[0]) && strchr(name, ':') != NULL) || + if ((isxdigit((unsigned char)name[0]) && strchr(name, ':') != NULL) || name[0] == ':') for (cp = name;; ++cp) { if (!*cp) { @@ -576,7 +576,7 @@ _gethostbydnsname( h_errno = NETDB_SUCCESS; return (&host); } - if (!isxdigit((int)*cp) && *cp != ':' && *cp != '.') + if (!isxdigit((unsigned char)*cp) && *cp != ':' && *cp != '.') break; } diff --git a/cpukit/libnetworking/libc/gethostbyht.c b/cpukit/libnetworking/libc/gethostbyht.c index e20414ca45..915adfc62c 100644 --- a/cpukit/libnetworking/libc/gethostbyht.c +++ b/cpukit/libnetworking/libc/gethostbyht.c @@ -252,7 +252,7 @@ again: if (*cur=='#' || *cur=='\n') goto parseerror; /* first, the ip number */ pe->h_name=cur; - while (cur=last) return 0; if (*cur=='\n') goto parseerror; { @@ -278,9 +278,9 @@ again: ++cur; /* now the aliases */ for (aliasidx=0;aliasidx<9;++aliasidx) { - while (curh_aliases[aliasidx]=cur; - while (curh_aliases[aliasidx]; int len=cur-from; @@ -291,7 +291,7 @@ again: *dest=0; ++dest; } if (*cur=='\n') { ++cur; ++aliasidx; break; } - if (cur>=last || !isblank((int)*cur)) break; + if (cur>=last || !isblank((unsigned char)*cur)) break; cur++; } pe->h_aliases[aliasidx]=0; diff --git a/cpukit/libnetworking/libc/gethostnamadr.c b/cpukit/libnetworking/libc/gethostnamadr.c index 2513fbf2b2..6fb3157299 100644 --- a/cpukit/libnetworking/libc/gethostnamadr.c +++ b/cpukit/libnetworking/libc/gethostnamadr.c @@ -102,7 +102,7 @@ init_services(void) if (cp == NULL) continue; do { - if (isalpha((int)cp[0])) { + if (isalpha((unsigned char)cp[0])) { service_order[cc] = get_service_name(cp); if(service_order[cc] != SERVICE_NONE) cc++; diff --git a/cpukit/libnetworking/libc/getnetnamadr.c b/cpukit/libnetworking/libc/getnetnamadr.c index 0ce9341f1f..736444fc14 100644 --- a/cpukit/libnetworking/libc/getnetnamadr.c +++ b/cpukit/libnetworking/libc/getnetnamadr.c @@ -101,7 +101,7 @@ init_services(void) if (cp == NULL) continue; do { - if (isalpha((int)cp[0])) { + if (isalpha((unsigned char)cp[0])) { service_order[cc] = get_service_name(cp); if(service_order[cc] != SERVICE_NONE) cc++; diff --git a/cpukit/libnetworking/libc/inet_addr.c b/cpukit/libnetworking/libc/inet_addr.c index 1d86052c18..9820e25ce2 100644 --- a/cpukit/libnetworking/libc/inet_addr.c +++ b/cpukit/libnetworking/libc/inet_addr.c @@ -102,7 +102,7 @@ inet_aton( * Values are specified as for C: * 0x=hex, 0=octal, isdigit=decimal. */ - if (!isdigit((int)c)) + if (!isdigit((unsigned char)c)) return (0); val = 0; base = 10; if (c == '0') { @@ -113,12 +113,12 @@ inet_aton( base = 8; } for (;;) { - if (isascii((int)c) && isdigit((int)c)) { + if (isascii((unsigned char)c) && isdigit((unsigned char)c)) { val = (val * base) + (c - '0'); c = *++cp; - } else if (base == 16 && isascii((int)c) && isxdigit((int)c)) { + } else if (base == 16 && isascii((unsigned char)c) && isxdigit((unsigned char)c)) { val = (val << 4) | - (c + 10 - (islower((int)c) ? 'a' : 'A')); + (c + 10 - (islower((unsigned char)c) ? 'a' : 'A')); c = *++cp; } else break; @@ -140,7 +140,7 @@ inet_aton( /* * Check for trailing characters. */ - if (c != '\0' && (!isascii((int)c) || !isspace((int)c))) + if (c != '\0' && (!isascii((unsigned char)c) || !isspace((unsigned char)c))) return (0); /* * Concoct the address according to diff --git a/cpukit/libnetworking/libc/inet_network.c b/cpukit/libnetworking/libc/inet_network.c index 1efbf19ca3..ffeaa900a1 100644 --- a/cpukit/libnetworking/libc/inet_network.c +++ b/cpukit/libnetworking/libc/inet_network.c @@ -62,13 +62,13 @@ again: if (*cp == 'x' || *cp == 'X') base = 16, cp++; while ((c = *cp) != 0) { - if (isdigit((int)c)) { + if (isdigit((unsigned char)c)) { val = (val * base) + (c - '0'); cp++; continue; } - if (base == 16 && isxdigit((int)c)) { - val = (val << 4) + (c + 10 - (islower((int)c) ? 'a' : 'A')); + if (base == 16 && isxdigit((unsigned char)c)) { + val = (val << 4) + (c + 10 - (islower((unsigned char)c) ? 'a' : 'A')); cp++; continue; } @@ -80,7 +80,7 @@ again: *pp++ = val, cp++; goto again; } - if (*cp && !isspace((int)*cp)) + if (*cp && !isspace((unsigned char)*cp)) return (INADDR_NONE); *pp++ = val; n = pp - parts; diff --git a/cpukit/libnetworking/libc/res_debug.c b/cpukit/libnetworking/libc/res_debug.c index f7a36abf25..c4792e3e72 100644 --- a/cpukit/libnetworking/libc/res_debug.c +++ b/cpukit/libnetworking/libc/res_debug.c @@ -579,14 +579,14 @@ precsize_aton( cp = *strptr; - while (isdigit((int)*cp)) + while (isdigit((unsigned char)*cp)) mval = mval * 10 + (*cp++ - '0'); if (*cp == '.') { /* centimeters */ cp++; - if (isdigit((int)*cp)) { + if (isdigit((unsigned char)*cp)) { cmval = (*cp++ - '0') * 10; - if (isdigit((int)*cp)) { + if (isdigit((unsigned char)*cp)) { cmval += (*cp++ - '0'); } } @@ -620,44 +620,44 @@ latlon2ul( cp = *latlonstrptr; - while (isdigit((int)*cp)) + while (isdigit((unsigned char)*cp)) deg = deg * 10 + (*cp++ - '0'); - while (isspace((int)*cp)) + while (isspace((unsigned char)*cp)) cp++; - if (!(isdigit((int)*cp))) + if (!(isdigit((unsigned char)*cp))) goto fndhemi; - while (isdigit((int)*cp)) + while (isdigit((unsigned char)*cp)) min = min * 10 + (*cp++ - '0'); - while (isspace((int)*cp)) + while (isspace((unsigned char)*cp)) cp++; - if (!(isdigit((int)*cp))) + if (!(isdigit((unsigned char)*cp))) goto fndhemi; - while (isdigit((int)*cp)) + while (isdigit((unsigned char)*cp)) secs = secs * 10 + (*cp++ - '0'); if (*cp == '.') { /* decimal seconds */ cp++; - if (isdigit((int)*cp)) { + if (isdigit((unsigned char)*cp)) { secsfrac = (*cp++ - '0') * 100; - if (isdigit((int)*cp)) { + if (isdigit((unsigned char)*cp)) { secsfrac += (*cp++ - '0') * 10; - if (isdigit((int)*cp)) { + if (isdigit((unsigned char)*cp)) { secsfrac += (*cp++ - '0'); } } } } - while (!isspace((int)*cp)) /* if any trailing garbage */ + while (!isspace((unsigned char)*cp)) /* if any trailing garbage */ cp++; - while (isspace((int)*cp)) + while (isspace((unsigned char)*cp)) cp++; fndhemi: @@ -695,10 +695,10 @@ latlon2ul( cp++; /* skip the hemisphere */ - while (!isspace((int)*cp)) /* if any trailing garbage */ + while (!isspace((unsigned char)*cp)) /* if any trailing garbage */ cp++; - while (isspace((int)*cp)) /* move to next field */ + while (isspace((unsigned char)*cp)) /* move to next field */ cp++; *latlonstrptr = cp; @@ -756,14 +756,14 @@ loc_aton( if (*cp == '+') cp++; - while (isdigit((int)*cp)) + while (isdigit((unsigned char)*cp)) altmeters = altmeters * 10 + (*cp++ - '0'); if (*cp == '.') { /* decimal meters */ cp++; - if (isdigit((int)*cp)) { + if (isdigit((unsigned char)*cp)) { altfrac = (*cp++ - '0') * 10; - if (isdigit((int)*cp)) { + if (isdigit((unsigned char)*cp)) { altfrac += (*cp++ - '0'); } } @@ -771,10 +771,10 @@ loc_aton( alt = (10000000 + (altsign * (altmeters * 100 + altfrac))); - while (!isspace((int)*cp) && (cp < maxcp)) /* if trailing garbage or m */ + while (!isspace((unsigned char)*cp) && (cp < maxcp)) /* if trailing garbage or m */ cp++; - while (isspace((int)*cp) && (cp < maxcp)) + while (isspace((unsigned char)*cp) && (cp < maxcp)) cp++; if (cp >= maxcp) @@ -782,10 +782,10 @@ loc_aton( siz = precsize_aton(&cp); - while (!isspace((int)*cp) && (cp < maxcp)) /* if trailing garbage or m */ + while (!isspace((unsigned char)*cp) && (cp < maxcp)) /* if trailing garbage or m */ cp++; - while (isspace((int)*cp) && (cp < maxcp)) + while (isspace((unsigned char)*cp) && (cp < maxcp)) cp++; if (cp >= maxcp) @@ -793,10 +793,10 @@ loc_aton( hp = precsize_aton(&cp); - while (!isspace((int)*cp) && (cp < maxcp)) /* if trailing garbage or m */ + while (!isspace((unsigned char)*cp) && (cp < maxcp)) /* if trailing garbage or m */ cp++; - while (isspace((int)*cp) && (cp < maxcp)) + while (isspace((unsigned char)*cp) && (cp < maxcp)) cp++; if (cp >= maxcp) diff --git a/cpukit/libnetworking/libc/res_init.c b/cpukit/libnetworking/libc/res_init.c index 564c230311..9af80e3727 100644 --- a/cpukit/libnetworking/libc/res_init.c +++ b/cpukit/libnetworking/libc/res_init.c @@ -340,7 +340,7 @@ res_init(void) break; net = cp; while (*cp && !ISSORTMASK(*cp) && *cp != ';' && - isascii((int)*cp) && !isspace((int)*cp)) + isascii((unsigned char)*cp) && !isspace((unsigned char)*cp)) cp++; n = *cp; *cp = 0; @@ -350,7 +350,7 @@ res_init(void) *cp++ = n; net = cp; while (*cp && *cp != ';' && - isascii((int)*cp) && !isspace((int)*cp)) + isascii((unsigned char)*cp) && !isspace((unsigned char)*cp)) cp++; n = *cp; *cp = 0; diff --git a/cpukit/libnetworking/libc/res_query.c b/cpukit/libnetworking/libc/res_query.c index f53327511b..00a0c30041 100644 --- a/cpukit/libnetworking/libc/res_query.c +++ b/cpukit/libnetworking/libc/res_query.c @@ -384,17 +384,17 @@ hostalias(const char *name) setbuf(fp, NULL); buf[sizeof(buf) - 1] = '\0'; while (fgets(buf, sizeof(buf), fp)) { - for (cp1 = buf; *cp1 && !isspace((int)*cp1); ++cp1) + for (cp1 = buf; *cp1 && !isspace((unsigned char)*cp1); ++cp1) ; if (!*cp1) break; *cp1 = '\0'; if (!strcasecmp(buf, name)) { - while (isspace((int)*++cp1)) + while (isspace((unsigned char)*++cp1)) ; if (!*cp1) break; - for (cp2 = cp1 + 1; *cp2 && !isspace((int)*cp2); ++cp2) + for (cp2 = cp1 + 1; *cp2 && !isspace((unsigned char)*cp2); ++cp2) ; abuf[sizeof(abuf) - 1] = *cp2 = '\0'; strncpy(abuf, cp1, sizeof(abuf) - 1); diff --git a/cpukit/libnetworking/rtems/rtems_mii_ioctl.c b/cpukit/libnetworking/rtems/rtems_mii_ioctl.c index b2b8b4d35f..93e9a0d580 100644 --- a/cpukit/libnetworking/rtems/rtems_mii_ioctl.c +++ b/cpukit/libnetworking/rtems/rtems_mii_ioctl.c @@ -158,9 +158,9 @@ rtems_str2ifmedia (const char *str, int phy) return 0; if (!strncmp (chpt, "ase", 3)) chpt += 3; - if (toupper ((int)*chpt++) != 'T') + if (toupper ((unsigned char)*chpt++) != 'T') return 0; - if (IFM_100_TX == sub && toupper ((int)*chpt++) != 'X') + if (IFM_100_TX == sub && toupper ((unsigned char)*chpt++) != 'X') return 0; } } -- cgit v1.2.3