From 9ded258538048c1f43dc85086860c61c35922e09 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Thu, 28 Nov 2013 18:24:56 +0000 Subject: unsigned char for ctype ok krw okan --- usr.bin/rpcgen/rpc_cout.c | 4 ++-- usr.bin/rpcgen/rpc_main.c | 6 +++--- usr.bin/rpcgen/rpc_scan.c | 27 +++++++++++++++------------ 3 files changed, 20 insertions(+), 17 deletions(-) (limited to 'usr.bin/rpcgen') diff --git a/usr.bin/rpcgen/rpc_cout.c b/usr.bin/rpcgen/rpc_cout.c index 11b24c54448..ae13b1165c9 100644 --- a/usr.bin/rpcgen/rpc_cout.c +++ b/usr.bin/rpcgen/rpc_cout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rpc_cout.c,v 1.23 2013/10/27 18:31:24 guenther Exp $ */ +/* $OpenBSD: rpc_cout.c,v 1.24 2013/11/28 18:24:54 deraadt Exp $ */ /* $NetBSD: rpc_cout.c,v 1.6 1996/10/01 04:13:53 cgd Exp $ */ /* @@ -739,7 +739,7 @@ upcase(str) hptr = ptr; while (*str != '\0') - *ptr++ = toupper(*str++); + *ptr++ = toupper((unsigned char)*str++); *ptr = '\0'; return (hptr); diff --git a/usr.bin/rpcgen/rpc_main.c b/usr.bin/rpcgen/rpc_main.c index 122acfa70e0..ac76a8fab6e 100644 --- a/usr.bin/rpcgen/rpc_main.c +++ b/usr.bin/rpcgen/rpc_main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rpc_main.c,v 1.26 2013/10/27 18:31:24 guenther Exp $ */ +/* $OpenBSD: rpc_main.c,v 1.27 2013/11/28 18:24:54 deraadt Exp $ */ /* $NetBSD: rpc_main.c,v 1.9 1996/02/19 11:12:43 pk Exp $ */ /* @@ -445,8 +445,8 @@ generate_guard(char *pathname) /* convert to upper case */ tmp = guard; while (*tmp) { - if (islower(*tmp)) - *tmp = toupper(*tmp); + if (islower((unsigned char)*tmp)) + *tmp = toupper((unsigned char)*tmp); tmp++; } diff --git a/usr.bin/rpcgen/rpc_scan.c b/usr.bin/rpcgen/rpc_scan.c index ca8977f7253..d2e3f742417 100644 --- a/usr.bin/rpcgen/rpc_scan.c +++ b/usr.bin/rpcgen/rpc_scan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rpc_scan.c,v 1.16 2012/12/05 23:20:26 deraadt Exp $ */ +/* $OpenBSD: rpc_scan.c,v 1.17 2013/11/28 18:24:54 deraadt Exp $ */ /* $NetBSD: rpc_scan.c,v 1.4 1995/06/11 21:50:02 pk Exp $ */ /* @@ -181,8 +181,8 @@ get_token(tokp) } } where = curline; - } else if (isspace(*where)) { - while (isspace(*where)) { + } else if (isspace((unsigned char)*where)) { + while (isspace((unsigned char)*where)) { where++; /* eat */ } } else if (commenting) { @@ -283,10 +283,10 @@ get_token(tokp) break; default: - if (!(isalpha(*where) || *where == '_')) { + if (!(isalpha((unsigned char)*where) || *where == '_')) { char buf[100], chs[20]; - if (isprint(*where)) { + if (isprint((unsigned char)*where)) { snprintf(chs, sizeof chs, "%c", *where); } else { snprintf(chs, sizeof chs, "%d", *where); @@ -375,11 +375,11 @@ findconst(str, val) p++; do { p++; - } while (isxdigit(*p)); + } while (isxdigit((unsigned char)*p)); } else { do { p++; - } while (isdigit(*p)); + } while (isdigit((unsigned char)*p)); } size = p - *str; *val = alloc(size + 1); @@ -428,7 +428,8 @@ findkind(mark, tokp) for (s = symbols; s->kind != TOK_EOF; s++) { len = strlen(s->str); if (strncmp(str, s->str, len) == 0) { - if (!isalnum(str[len]) && str[len] != '_') { + if (!isalnum((unsigned char)str[len]) && + str[len] != '_') { tokp->kind = s->kind; tokp->str = s->str; *mark = str + len; @@ -437,7 +438,9 @@ findkind(mark, tokp) } } tokp->kind = TOK_IDENT; - for (len = 0; isalnum(str[len]) || str[len] == '_'; len++); + for (len = 0; isalnum((unsigned char)str[len]) || str[len] == '_'; + len++) + ; tokp->str = alloc(len + 1); if (tokp->str == NULL) error("alloc failed"); @@ -478,14 +481,14 @@ docppline(line, lineno, fname) char *p; line++; - while (isspace(*line)) { + while (isspace((unsigned char)*line)) { line++; } num = atoi(line); - while (isdigit(*line)) { + while (isdigit((unsigned char)*line)) { line++; } - while (isspace(*line)) { + while (isspace((unsigned char)*line)) { line++; } if (*line != '"') { -- cgit v1.2.3