summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1997-10-23 02:03:43 +0000
committerache <ache@FreeBSD.org>1997-10-23 02:03:43 +0000
commit436deeda1a243078fb9907dfb57558f6d481936d (patch)
tree5cb2a43d1de737532a8761c9b05aef6b70be3ab3 /contrib
parent94286bf50951c81435f65927e7b8ef8554ab5877 (diff)
downloadFreeBSD-src-436deeda1a243078fb9907dfb57558f6d481936d.zip
FreeBSD-src-436deeda1a243078fb9907dfb57558f6d481936d.tar.gz
Add more (unsigned char) casts to ctype macros
Fix casetable usage in the same manner too
Diffstat (limited to 'contrib')
-rw-r--r--contrib/awk/builtin.c4
-rw-r--r--contrib/awk/dfa.c16
-rw-r--r--contrib/awk/eval.c6
-rw-r--r--contrib/awk/field.c6
-rw-r--r--contrib/awk/io.c14
-rw-r--r--contrib/awk/main.c4
-rw-r--r--contrib/awk/node.c6
7 files changed, 28 insertions, 28 deletions
diff --git a/contrib/awk/builtin.c b/contrib/awk/builtin.c
index dc2c1d3..32bde1c 100644
--- a/contrib/awk/builtin.c
+++ b/contrib/awk/builtin.c
@@ -231,7 +231,7 @@ NODE *tree;
while (l1 > 0) {
if (l2 > l1)
break;
- if (casetable[(int)*p1] == casetable[(int)*p2]
+ if (casetable[(unsigned char)*p1] == casetable[(unsigned char)*p2]
&& (l2 == 1 || strncasecmp(p1, p2, l2) == 0)) {
ret = 1 + s1->stlen - l1;
break;
@@ -2038,7 +2038,7 @@ size_t len;
}
} else if (*str == '0') {
for (; len > 0; len--) {
- if (! isdigit(*str) || *str == '8' || *str == '9')
+ if (! isdigit((unsigned char)*str) || *str == '8' || *str == '9')
goto done;
retval = (retval * 8) + (*str - '0');
str++;
diff --git a/contrib/awk/dfa.c b/contrib/awk/dfa.c
index 88e8e3e..72ef552 100644
--- a/contrib/awk/dfa.c
+++ b/contrib/awk/dfa.c
@@ -736,9 +736,9 @@ lex()
setbit(c3, ccl);
if (case_fold)
if (ISUPPER(c3))
- setbit(tolower(c3), ccl);
+ setbit(tolower((unsigned char)c3), ccl);
else if (ISLOWER(c3))
- setbit(toupper(c3), ccl);
+ setbit(toupper((unsigned char)c3), ccl);
}
}
#else
@@ -747,9 +747,9 @@ lex()
setbit(c, ccl);
if (case_fold)
if (ISUPPER(c))
- setbit(tolower(c), ccl);
+ setbit(tolower((unsigned char)c), ccl);
else if (ISLOWER(c))
- setbit(toupper(c), ccl);
+ setbit(toupper((unsigned char)c), ccl);
++c;
}
#endif
@@ -773,10 +773,10 @@ lex()
{
zeroset(ccl);
setbit(c, ccl);
- if (isupper(c))
- setbit(tolower(c), ccl);
+ if (isupper((unsigned char)c))
+ setbit(tolower((unsigned char)c), ccl);
else
- setbit(toupper(c), ccl);
+ setbit(toupper((unsigned char)c), ccl);
return lasttok = CSET + charclass_index(ccl);
}
return c;
@@ -2047,7 +2047,7 @@ dfacomp(s, len, d, searchflag)
case_fold = 0;
for (i = 0; i < len; ++i)
if (ISUPPER(s[i]))
- lcopy[i] = tolower(s[i]);
+ lcopy[i] = tolower((unsigned char)s[i]);
else
lcopy[i] = s[i];
diff --git a/contrib/awk/eval.c b/contrib/awk/eval.c
index aa2e881..6ba00f6a 100644
--- a/contrib/awk/eval.c
+++ b/contrib/awk/eval.c
@@ -1652,13 +1652,13 @@ NODE *n;
return 0;
while (*p && strchr(" +-#", *p) != NULL) /* flags */
p++;
- while (*p && isdigit(*p)) /* width - %*.*g is NOT allowed */
+ while (*p && isdigit((unsigned char)*p)) /* width - %*.*g is NOT allowed */
p++;
- if (*p == '\0' || (*p != '.' && ! isdigit(*p)))
+ if (*p == '\0' || (*p != '.' && ! isdigit((unsigned char)*p)))
return 0;
if (*p == '.')
p++;
- while (*p && isdigit(*p)) /* precision */
+ while (*p && isdigit((unsigned char)*p)) /* precision */
p++;
if (*p == '\0' || strchr("efgEG", *p) == NULL)
return 0;
diff --git a/contrib/awk/field.c b/contrib/awk/field.c
index 31c9628..81ee121 100644
--- a/contrib/awk/field.c
+++ b/contrib/awk/field.c
@@ -550,9 +550,9 @@ NODE *n;
else
fschar = fs->stptr[0];
- onecase = (IGNORECASE && isalpha(fschar));
+ onecase = (IGNORECASE && isalpha((unsigned char)fschar));
if (onecase)
- fschar = casetable[(int) fschar];
+ fschar = casetable[(unsigned char) fschar];
/* before doing anything save the char at *end */
sav = *end;
@@ -562,7 +562,7 @@ NODE *n;
for (; nf < up_to;) {
field = scan;
if (onecase) {
- while (casetable[(int) *scan] != fschar)
+ while (casetable[(unsigned char) *scan] != fschar)
scan++;
} else {
while (*scan != fschar)
diff --git a/contrib/awk/io.c b/contrib/awk/io.c
index 74d9a8d..5db2796 100644
--- a/contrib/awk/io.c
+++ b/contrib/awk/io.c
@@ -1540,9 +1540,9 @@ int *errcode; /* pointer to error variable */
else
rs = (char) grRS;
- onecase = (IGNORECASE && isalpha(rs));
+ onecase = (IGNORECASE && isalpha((unsigned char)rs));
if (onecase)
- rs = casetable[rs];
+ rs = casetable[(unsigned char)rs];
/* set up sentinel */
if (iop->buf) {
@@ -1703,7 +1703,7 @@ int *errcode; /* pointer to error variable */
}
/* search for RS, #2, RS = <single char> */
if (onecase) {
- while (casetable[(int) *bp++] != rs)
+ while (casetable[(unsigned char) *bp++] != rs)
continue;
} else {
while (*bp++ != rs)
@@ -1732,7 +1732,7 @@ int *errcode; /* pointer to error variable */
bstart = iop->off = bp;
bp--;
- if (onecase ? casetable[(int) *bp] != rs : *bp != rs) {
+ if (onecase ? casetable[(unsigned char) *bp] != rs : *bp != rs) {
bp++;
bstart = bp;
}
@@ -1816,9 +1816,9 @@ int *errcode; /* pointer to error variable */
else
rs = (char) grRS;
- onecase = (IGNORECASE && isalpha(rs));
+ onecase = (IGNORECASE && isalpha((unsigned char)rs));
if (onecase)
- rs = casetable[rs];
+ rs = casetable[(unsigned char)rs];
/* if RS = "", skip leading newlines at the front of the file */
if (grRS == FALSE && iop->off == iop->buf) {
@@ -1891,7 +1891,7 @@ int *errcode; /* pointer to error variable */
*/
/* search for RS, #2, RS = <single char> */
if (onecase) {
- while (bp < end && casetable[*bp++] != rs)
+ while (bp < end && casetable[(unsigned char)*bp++] != rs)
continue;
} else {
while (bp < end && *bp++ != rs)
diff --git a/contrib/awk/main.c b/contrib/awk/main.c
index 92445de..35fb119 100644
--- a/contrib/awk/main.c
+++ b/contrib/awk/main.c
@@ -644,11 +644,11 @@ char *arg;
*cp++ = '\0';
/* first check that the variable name has valid syntax */
badvar = FALSE;
- if (! isalpha(arg[0]) && arg[0] != '_')
+ if (! isalpha((unsigned char)arg[0]) && arg[0] != '_')
badvar = TRUE;
else
for (cp2 = arg+1; *cp2; cp2++)
- if (! isalnum(*cp2) && *cp2 != '_') {
+ if (! isalnum((unsigned char)*cp2) && *cp2 != '_') {
badvar = TRUE;
break;
}
diff --git a/contrib/awk/node.c b/contrib/awk/node.c
index 6f10b9f..98df143 100644
--- a/contrib/awk/node.c
+++ b/contrib/awk/node.c
@@ -61,9 +61,9 @@ register NODE *n;
return 0.0;
cpend = cp + n->stlen;
- while (cp < cpend && isspace(*cp))
+ while (cp < cpend && isspace((unsigned char)*cp))
cp++;
- if (cp == cpend || isalpha(*cp))
+ if (cp == cpend || isalpha((unsigned char)*cp))
return 0.0;
if (n->flags & MAYBE_NUM) {
@@ -489,7 +489,7 @@ char **string_ptr;
}
if (do_posix)
return ('x');
- if (! isxdigit((*string_ptr)[0])) {
+ if (! isxdigit((unsigned char)(*string_ptr)[0])) {
warning("no hex digits in \\x escape sequence");
return ('x');
}
OpenPOWER on IntegriCloud