Add (unsigned char) cast to ctype functions

This commit is contained in:
dsl 2004-10-29 19:46:27 +00:00
parent 404e35b651
commit 26207dda78
5 changed files with 25 additions and 25 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: parse.y,v 1.3 2004/06/23 04:38:43 itojun Exp $ */
/* $NetBSD: parse.y,v 1.4 2004/10/29 19:46:27 dsl Exp $ */
/* $OpenBSD: parse.y,v 1.449 2004/03/20 23:20:20 david Exp $ */
/*
@ -386,7 +386,7 @@ typedef struct {
#define DYNIF_MULTIADDR(addr) ((addr).type == PF_ADDR_DYNIFTL && \
(!((addr).iflags & PFI_AFLAG_NOALIAS) || \
!isdigit((addr).v.ifname[strlen((addr).v.ifname)-1])))
!isdigit((unsigned char)(addr).v.ifname[strlen((addr).v.ifname)-1])))
%}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pfctl_osfp.c,v 1.2 2004/06/22 15:16:30 itojun Exp $ */
/* $NetBSD: pfctl_osfp.c,v 1.3 2004/10/29 19:46:27 dsl Exp $ */
/* $OpenBSD: pfctl_osfp.c,v 1.8 2004/02/27 10:42:00 henning Exp $ */
/*
@ -133,9 +133,9 @@ pfctl_file_fingerprints(int dev, int opts, const char *fp_filename)
break;
}
/* Chop off whitespace */
while (len > 0 && isspace(line[len - 1]))
while (len > 0 && isspace((unsigned char)line[len - 1]))
len--;
while (len > 0 && isspace(line[0])) {
while (len > 0 && isspace((unsigned char)line[0])) {
len--;
line++;
}
@ -516,7 +516,7 @@ found:
if (index(version_name, ' '))
strlcat(buf, " ", len);
else if (index(version_name, '.') &&
isdigit(*subtype_name))
isdigit((unsigned char)*subtype_name))
strlcat(buf, ".", len);
else
strlcat(buf, " ", len);
@ -550,30 +550,30 @@ add_fingerprint(int dev, int opts, struct pf_osfp_ioctl *fp)
#define EXPAND(field) do { \
int _dot = -1, _start = -1, _end = -1, _i = 0; \
/* pick major version out of #.# */ \
if (isdigit(fp->field[_i]) && fp->field[_i+1] == '.') { \
if (isdigit((unsigned char)fp->field[_i]) && fp->field[_i+1] == '.') { \
_dot = fp->field[_i] - '0'; \
_i += 2; \
} \
if (isdigit(fp->field[_i])) \
if (isdigit((unsigned char)fp->field[_i])) \
_start = fp->field[_i++] - '0'; \
else \
break; \
if (isdigit(fp->field[_i])) \
if (isdigit((unsigned char)fp->field[_i])) \
_start = (_start * 10) + fp->field[_i++] - '0'; \
if (fp->field[_i++] != '-') \
break; \
if (isdigit(fp->field[_i]) && fp->field[_i+1] == '.' && \
if (isdigit((unsigned char)fp->field[_i]) && fp->field[_i+1] == '.' && \
fp->field[_i] - '0' == _dot) \
_i += 2; \
else if (_dot != -1) \
break; \
if (isdigit(fp->field[_i])) \
if (isdigit((unsigned char)fp->field[_i])) \
_end = fp->field[_i++] - '0'; \
else \
break; \
if (isdigit(fp->field[_i])) \
if (isdigit((unsigned char)fp->field[_i])) \
_end = (_end * 10) + fp->field[_i++] - '0'; \
if (isdigit(fp->field[_i])) \
if (isdigit((unsigned char)fp->field[_i])) \
_end = (_end * 10) + fp->field[_i++] - '0'; \
if (fp->field[_i] != '\0') \
break; \
@ -904,7 +904,7 @@ get_tcpopts(const char *filename, int lineno, const char *tcpopts,
return (0);
for (i = 0; tcpopts[i] && *optcnt < PF_OSFP_MAX_OPTS;) {
switch ((opt = toupper(tcpopts[i++]))) {
switch ((opt = toupper((unsigned char)tcpopts[i++]))) {
case 'N': /* FALLTHROUGH */
case 'S':
*packed = (*packed << PF_OSFP_TCPOPT_BITS) |
@ -940,7 +940,7 @@ get_tcpopts(const char *filename, int lineno, const char *tcpopts,
i++;
}
do {
if (!isdigit(tcpopts[i])) {
if (!isdigit((unsigned char)tcpopts[i])) {
fprintf(stderr, "%s:%d unknown "
"character '%c' in %c TCP opt\n",
filename, lineno, tcpopts[i], opt);
@ -981,7 +981,7 @@ get_field(char **line, size_t *len, int *fieldlen)
size_t plen = *len;
while (plen && isspace(*ptr)) {
while (plen && isspace((unsigned char)*ptr)) {
plen--;
ptr++;
}
@ -996,7 +996,7 @@ get_field(char **line, size_t *len, int *fieldlen)
} else {
*len = 0;
}
while (*fieldlen && isspace(ret[*fieldlen - 1]))
while (*fieldlen && isspace((unsigned char)ret[*fieldlen - 1]))
(*fieldlen)--;
return (ret);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pfctl_parser.c,v 1.3 2004/06/24 11:05:10 hannken Exp $ */
/* $NetBSD: pfctl_parser.c,v 1.4 2004/10/29 19:46:27 dsl Exp $ */
/* $OpenBSD: pfctl_parser.c,v 1.194.2.1 2004/05/05 04:00:50 brad Exp $ */
/*
@ -1169,7 +1169,7 @@ ifa_exists(const char *ifa_name, int group_ok)
char *p, buf[IFNAMSIZ];
int group;
group = !isdigit(ifa_name[strlen(ifa_name) - 1]);
group = !isdigit((unsigned char)ifa_name[strlen(ifa_name) - 1]);
if (group && !group_ok)
return (NULL);
if (iftab == NULL)
@ -1182,7 +1182,7 @@ ifa_exists(const char *ifa_name, int group_ok)
if (!group) {
/* look for clonable and/or dynamic interface */
strlcpy(buf, ifa_name, sizeof(buf));
for (p = buf + strlen(buf) - 1; p > buf && isdigit(*p); p--)
for (p = buf + strlen(buf) - 1; p > buf && isdigit((unsigned char)*p); p--)
*p = '\0';
for (n = iftab; n != NULL; n = n->next)
if (n->af == AF_LINK &&

View File

@ -1,4 +1,4 @@
/* $NetBSD: pfctl_radix.c,v 1.2 2004/06/22 15:16:30 itojun Exp $ */
/* $NetBSD: pfctl_radix.c,v 1.3 2004/10/29 19:46:27 dsl Exp $ */
/* $OpenBSD: pfctl_radix.c,v 1.24 2004/02/10 18:29:30 henning Exp $ */
/*
@ -632,7 +632,7 @@ pfr_next_token(char buf[BUF_SIZE], FILE *fp)
for (;;) {
/* skip spaces */
while (isspace(next_ch) && !feof(fp))
while (isspace((unsigned char)next_ch) && !feof(fp))
next_ch = fgetc(fp);
/* remove from '#' until end of line */
if (next_ch == '#')
@ -652,7 +652,7 @@ pfr_next_token(char buf[BUF_SIZE], FILE *fp)
if (i < BUF_SIZE)
buf[i++] = next_ch;
next_ch = fgetc(fp);
} while (!feof(fp) && !isspace(next_ch));
} while (!feof(fp) && !isspace((unsigned char)next_ch));
if (i >= BUF_SIZE) {
errno = EINVAL;
return (-1);

View File

@ -1,4 +1,4 @@
/* $NetBSD: pfctl_table.c,v 1.2 2004/06/22 15:16:30 itojun Exp $ */
/* $NetBSD: pfctl_table.c,v 1.3 2004/10/29 19:46:27 dsl Exp $ */
/* $OpenBSD: pfctl_table.c,v 1.59 2004/03/15 15:25:44 dhartmei Exp $ */
/*
@ -549,7 +549,7 @@ pfctl_show_ifaces(const char *filter, int opts)
struct pfi_if *p;
int i = 0, f = PFI_FLAG_GROUP|PFI_FLAG_INSTANCE;
if (filter != NULL && *filter && !isdigit(filter[strlen(filter)-1]))
if (filter != NULL && *filter && !isdigit((unsigned char)filter[strlen(filter)-1]))
f &= ~PFI_FLAG_INSTANCE;
bzero(&b, sizeof(b));
b.pfrb_type = PFRB_IFACES;