Add unsigned char cast to ctype macros arg

This commit is contained in:
Andrey A. Chernov 1999-11-04 04:30:44 +00:00
parent 93548d79ba
commit 9ea99d349b
5 changed files with 39 additions and 37 deletions

View File

@ -206,7 +206,7 @@ b64_pton(src, target, targsize)
tarindex = 0;
while ((ch = *src++) != '\0') {
if (isspace(ch)) /* Skip whitespace anywhere. */
if (isspace((unsigned char)ch)) /* Skip whitespace anywhere. */
continue;
if (ch == Pad64)
@ -276,7 +276,7 @@ b64_pton(src, target, targsize)
case 2: /* Valid, means one byte of info */
/* Skip any number of spaces. */
for ((void)NULL; ch != '\0'; ch = *src++)
if (!isspace(ch))
if (!isspace((unsigned char)ch))
break;
/* Make sure there is another trailing = sign. */
if (ch != Pad64)
@ -291,7 +291,7 @@ b64_pton(src, target, targsize)
* whitespace after it?
*/
for ((void)NULL; ch != '\0'; ch = *src++)
if (!isspace(ch))
if (!isspace((unsigned char)ch))
return (-1);
/*

View File

@ -140,7 +140,7 @@ inet_aton(cp, addr)
break;
default:
if (isspace(*c)) {
if (isspace((unsigned char)*c)) {
gotend = 1;
break;
} else

View File

@ -29,6 +29,8 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#if defined(LIBC_SCCS) && !defined(lint)
@ -60,13 +62,13 @@ again:
if (*cp == 'x' || *cp == 'X')
base = 16, cp++;
while ((c = *cp) != 0) {
if (isdigit(c)) {
if (isdigit((unsigned char)c)) {
val = (val * base) + (c - '0');
cp++;
continue;
}
if (base == 16 && isxdigit(c)) {
val = (val << 4) + (c + 10 - (islower(c) ? 'a' : 'A'));
if (base == 16 && isxdigit((unsigned char)c)) {
val = (val << 4) + (c + 10 - (islower((unsigned char)c) ? 'a' : 'A'));
cp++;
continue;
}
@ -78,7 +80,7 @@ again:
*pp++ = val, cp++;
goto again;
}
if (*cp && !isspace(*cp))
if (*cp && !isspace((unsigned char)*cp))
return (INADDR_NONE);
*pp++ = val;
n = pp - parts;

View File

@ -577,14 +577,14 @@ precsize_aton(strptr)
cp = *strptr;
while (isdigit(*cp))
while (isdigit((unsigned char)*cp))
mval = mval * 10 + (*cp++ - '0');
if (*cp == '.') { /* centimeters */
cp++;
if (isdigit(*cp)) {
if (isdigit((unsigned char)*cp)) {
cmval = (*cp++ - '0') * 10;
if (isdigit(*cp)) {
if (isdigit((unsigned char)*cp)) {
cmval += (*cp++ - '0');
}
}
@ -618,44 +618,44 @@ latlon2ul(latlonstrptr,which)
cp = *latlonstrptr;
while (isdigit(*cp))
while (isdigit((unsigned char)*cp))
deg = deg * 10 + (*cp++ - '0');
while (isspace(*cp))
while (isspace((unsigned char)*cp))
cp++;
if (!(isdigit(*cp)))
if (!(isdigit((unsigned char)*cp)))
goto fndhemi;
while (isdigit(*cp))
while (isdigit((unsigned char)*cp))
min = min * 10 + (*cp++ - '0');
while (isspace(*cp))
while (isspace((unsigned char)*cp))
cp++;
if (!(isdigit(*cp)))
if (!(isdigit((unsigned char)*cp)))
goto fndhemi;
while (isdigit(*cp))
while (isdigit((unsigned char)*cp))
secs = secs * 10 + (*cp++ - '0');
if (*cp == '.') { /* decimal seconds */
cp++;
if (isdigit(*cp)) {
if (isdigit((unsigned char)*cp)) {
secsfrac = (*cp++ - '0') * 100;
if (isdigit(*cp)) {
if (isdigit((unsigned char)*cp)) {
secsfrac += (*cp++ - '0') * 10;
if (isdigit(*cp)) {
if (isdigit((unsigned char)*cp)) {
secsfrac += (*cp++ - '0');
}
}
}
}
while (!isspace(*cp)) /* if any trailing garbage */
while (!isspace((unsigned char)*cp)) /* if any trailing garbage */
cp++;
while (isspace(*cp))
while (isspace((unsigned char)*cp))
cp++;
fndhemi:
@ -693,10 +693,10 @@ latlon2ul(latlonstrptr,which)
cp++; /* skip the hemisphere */
while (!isspace(*cp)) /* if any trailing garbage */
while (!isspace((unsigned char)*cp)) /* if any trailing garbage */
cp++;
while (isspace(*cp)) /* move to next field */
while (isspace((unsigned char)*cp)) /* move to next field */
cp++;
*latlonstrptr = cp;
@ -754,14 +754,14 @@ loc_aton(ascii, binary)
if (*cp == '+')
cp++;
while (isdigit(*cp))
while (isdigit((unsigned char)*cp))
altmeters = altmeters * 10 + (*cp++ - '0');
if (*cp == '.') { /* decimal meters */
cp++;
if (isdigit(*cp)) {
if (isdigit((unsigned char)*cp)) {
altfrac = (*cp++ - '0') * 10;
if (isdigit(*cp)) {
if (isdigit((unsigned char)*cp)) {
altfrac += (*cp++ - '0');
}
}
@ -769,10 +769,10 @@ loc_aton(ascii, binary)
alt = (10000000 + (altsign * (altmeters * 100 + altfrac)));
while (!isspace(*cp) && (cp < maxcp)) /* if trailing garbage or m */
while (!isspace((unsigned char)*cp) && (cp < maxcp)) /* if trailing garbage or m */
cp++;
while (isspace(*cp) && (cp < maxcp))
while (isspace((unsigned char)*cp) && (cp < maxcp))
cp++;
if (cp >= maxcp)
@ -780,10 +780,10 @@ loc_aton(ascii, binary)
siz = precsize_aton(&cp);
while (!isspace(*cp) && (cp < maxcp)) /* if trailing garbage or m */
while (!isspace((unsigned char)*cp) && (cp < maxcp)) /* if trailing garbage or m */
cp++;
while (isspace(*cp) && (cp < maxcp))
while (isspace((unsigned char)*cp) && (cp < maxcp))
cp++;
if (cp >= maxcp)
@ -791,10 +791,10 @@ loc_aton(ascii, binary)
hp = precsize_aton(&cp);
while (!isspace(*cp) && (cp < maxcp)) /* if trailing garbage or m */
while (!isspace((unsigned char)*cp) && (cp < maxcp)) /* if trailing garbage or m */
cp++;
while (isspace(*cp) && (cp < maxcp))
while (isspace((unsigned char)*cp) && (cp < maxcp))
cp++;
if (cp >= maxcp)

View File

@ -387,17 +387,17 @@ hostalias(name)
setbuf(fp, NULL);
buf[sizeof(buf) - 1] = '\0';
while (fgets(buf, sizeof(buf), fp)) {
for (cp1 = buf; *cp1 && !isspace(*cp1); ++cp1)
for (cp1 = buf; *cp1 && !isspace((unsigned char)*cp1); ++cp1)
;
if (!*cp1)
break;
*cp1 = '\0';
if (!strcasecmp(buf, name)) {
while (isspace(*++cp1))
while (isspace((unsigned char)*++cp1))
;
if (!*cp1)
break;
for (cp2 = cp1 + 1; *cp2 && !isspace(*cp2); ++cp2)
for (cp2 = cp1 + 1; *cp2 && !isspace((unsigned char)*cp2); ++cp2)
;
abuf[sizeof(abuf) - 1] = *cp2 = '\0';
strncpy(abuf, cp1, sizeof(abuf) - 1);