From 50eb6aaddeb56ef4dcab01008b866533d8f2e7cf Mon Sep 17 00:00:00 2001 From: tnozaki Date: Thu, 13 May 2010 17:52:11 +0000 Subject: [PATCH] cast isblank(3)'s argument to unsigned char. --- dist/nvi/common/options.c | 4 ++-- dist/nvi/ex/ex_cscope.c | 8 ++++---- dist/nvi/ex/ex_tag.c | 4 ++-- dist/nvi/ex/ex_usage.c | 4 ++-- dist/nvi/vi/vs_msg.c | 8 ++++---- games/factor/factor.c | 6 +++--- games/number/number.c | 6 +++--- games/primes/primes.c | 6 +++--- lib/libform/internals.c | 43 +++++++++++++++++++++------------------ lib/libform/type_enum.c | 6 +++--- sbin/ldconfig/ldconfig.c | 8 ++++---- usr.sbin/syslogd/tls.c | 6 +++--- 12 files changed, 56 insertions(+), 53 deletions(-) diff --git a/dist/nvi/common/options.c b/dist/nvi/common/options.c index c84b9fb9cf68..5778de9ba145 100644 --- a/dist/nvi/common/options.c +++ b/dist/nvi/common/options.c @@ -1,4 +1,4 @@ -/* $NetBSD: options.c,v 1.7 2009/11/14 23:31:37 christos Exp $ */ +/* $NetBSD: options.c,v 1.8 2010/05/13 17:52:11 tnozaki Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -1036,7 +1036,7 @@ opts_save(SCR *sp, FILE *fp) } (void)putc('=', fp); for (np = O_STR(sp, cnt); (nch = *np) != '\0'; ++np) { - if (isblank(nch) || nch == '\\') + if (isblank((unsigned char)nch) || nch == '\\') (void)putc('\\', fp); (void)putc(nch, fp); } diff --git a/dist/nvi/ex/ex_cscope.c b/dist/nvi/ex/ex_cscope.c index cd3f93f4f2b4..0b2f34545718 100644 --- a/dist/nvi/ex/ex_cscope.c +++ b/dist/nvi/ex/ex_cscope.c @@ -1,4 +1,4 @@ -/* $NetBSD: ex_cscope.c,v 1.5 2009/11/24 13:12:01 tnozaki Exp $ */ +/* $NetBSD: ex_cscope.c,v 1.6 2010/05/13 17:52:11 tnozaki Exp $ */ /*- * Copyright (c) 1994, 1996 @@ -606,8 +606,8 @@ create_cs_cmd(SCR *sp, const char *pattern, size_t *searchp) goto usage; /* Skip leading blanks, check for command character. */ - for (; isblank(pattern[0]); ++pattern); - if (pattern[0] == '\0' || !isblank(pattern[1])) + for (; isblank((unsigned char)pattern[0]); ++pattern); + if (pattern[0] == '\0' || !isblank((unsigned char)pattern[1])) goto usage; for (*searchp = 0, p = CSCOPE_QUERIES; *p != '\0' && *p != pattern[0]; ++*searchp, ++p); @@ -619,7 +619,7 @@ create_cs_cmd(SCR *sp, const char *pattern, size_t *searchp) } /* Skip characters to the pattern. */ - for (p = pattern + 1; *p != '\0' && isblank(*p); ++p); + for (p = pattern + 1; *p != '\0' && isblank((unsigned char)*p); ++p); if (*p == '\0') { usage: (void)csc_help(sp, "find"); return (NULL); diff --git a/dist/nvi/ex/ex_tag.c b/dist/nvi/ex/ex_tag.c index cad2a821aa1a..d4845b3a686e 100644 --- a/dist/nvi/ex/ex_tag.c +++ b/dist/nvi/ex/ex_tag.c @@ -1,4 +1,4 @@ -/* $NetBSD: ex_tag.c,v 1.7 2009/11/24 13:12:01 tnozaki Exp $ */ +/* $NetBSD: ex_tag.c,v 1.8 2010/05/13 17:52:11 tnozaki Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -899,7 +899,7 @@ ex_tagf_alloc(SCR *sp, const char *str) /* Create new queue. */ for (p = t = str;; ++p) { - if (*p == '\0' || isblank(*p)) { + if (*p == '\0' || isblank((unsigned char)*p)) { if ((len = p - t) > 1) { MALLOC_RET(sp, tfp, TAGF *, sizeof(TAGF)); MALLOC(sp, tfp->name, char *, len + 1); diff --git a/dist/nvi/ex/ex_usage.c b/dist/nvi/ex/ex_usage.c index 7db363303409..0bc73a0fa456 100644 --- a/dist/nvi/ex/ex_usage.c +++ b/dist/nvi/ex/ex_usage.c @@ -1,4 +1,4 @@ -/* $NetBSD: ex_usage.c,v 1.4 2009/12/23 12:44:22 mlelstv Exp $ */ +/* $NetBSD: ex_usage.c,v 1.5 2010/05/13 17:52:11 tnozaki Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -178,7 +178,7 @@ nokey: (void)ex_printf(sp, else (void)ex_printf(sp, " Key:%s%s\nUsage: %s\n", - isblank(*kp->help) ? "" : " ", kp->help, kp->usage); + isblank((unsigned char)*kp->help) ? "" : " ", kp->help, kp->usage); break; case 0: for (key = 0; key <= MAXVIKEY && !INTERRUPTED(sp); ++key) { diff --git a/dist/nvi/vi/vs_msg.c b/dist/nvi/vi/vs_msg.c index 928271a38b99..dce2191da2ee 100644 --- a/dist/nvi/vi/vs_msg.c +++ b/dist/nvi/vi/vs_msg.c @@ -1,4 +1,4 @@ -/* $NetBSD: vs_msg.c,v 1.3 2009/11/14 23:40:11 christos Exp $ */ +/* $NetBSD: vs_msg.c,v 1.4 2010/05/13 17:52:11 tnozaki Exp $ */ /*- * Copyright (c) 1993, 1994 @@ -355,16 +355,16 @@ vs_msg(SCR *sp, mtype_t mtype, char *line, size_t len) } vip->mtype = mtype; for (s = line;; s = t) { - for (; len > 0 && isblank(*s); --len, ++s); + for (; len > 0 && isblank((unsigned char)*s); --len, ++s); if (len == 0) break; if (len + vip->lcontinue > maxcols) { for (e = s + (maxcols - vip->lcontinue); - e > s && !isblank(*e); --e); + e > s && !isblank((unsigned char)*e); --e); if (e == s) e = t = s + (maxcols - vip->lcontinue); else - for (t = e; isblank(e[-1]); --e); + for (t = e; isblank((unsigned char)e[-1]); --e); } else e = t = s + len; diff --git a/games/factor/factor.c b/games/factor/factor.c index d383f555357a..cc6c8b98ef0d 100644 --- a/games/factor/factor.c +++ b/games/factor/factor.c @@ -1,4 +1,4 @@ -/* $NetBSD: factor.c,v 1.22 2010/04/28 18:04:31 drochner Exp $ */ +/* $NetBSD: factor.c,v 1.23 2010/05/13 17:52:11 tnozaki Exp $ */ /* * Copyright (c) 1989, 1993 @@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\ #if 0 static char sccsid[] = "@(#)factor.c 8.4 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: factor.c,v 1.22 2010/04/28 18:04:31 drochner Exp $"); +__RCSID("$NetBSD: factor.c,v 1.23 2010/05/13 17:52:11 tnozaki Exp $"); #endif #endif /* not lint */ @@ -164,7 +164,7 @@ main(int argc, char *argv[]) err(1, "stdin"); exit (0); } - for (p = buf; isblank(*p); ++p); + for (p = buf; isblank((unsigned char)*p); ++p); if (*p == '\n' || *p == '\0') continue; if (*p == '-') diff --git a/games/number/number.c b/games/number/number.c index 60331f358d06..3d28455c7801 100644 --- a/games/number/number.c +++ b/games/number/number.c @@ -1,4 +1,4 @@ -/* $NetBSD: number.c,v 1.13 2009/08/12 08:12:20 dholland Exp $ */ +/* $NetBSD: number.c,v 1.14 2010/05/13 17:52:11 tnozaki Exp $ */ /* * Copyright (c) 1988, 1993, 1994 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1993, 1994\ #if 0 static char sccsid[] = "@(#)number.c 8.3 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: number.c,v 1.13 2009/08/12 08:12:20 dholland Exp $"); +__RCSID("$NetBSD: number.c,v 1.14 2010/05/13 17:52:11 tnozaki Exp $"); #endif #endif /* not lint */ @@ -134,7 +134,7 @@ convert(line) flen = 0; fraction = NULL; for (p = line; *p != '\0' && *p != '\n'; ++p) { - if (isblank(*p)) { + if (isblank((unsigned char)*p)) { if (p == line) { ++line; continue; diff --git a/games/primes/primes.c b/games/primes/primes.c index 60b6590498fa..c8c6ea586ae6 100644 --- a/games/primes/primes.c +++ b/games/primes/primes.c @@ -1,4 +1,4 @@ -/* $NetBSD: primes.c,v 1.17 2009/08/12 08:25:27 dholland Exp $ */ +/* $NetBSD: primes.c,v 1.18 2010/05/13 17:52:12 tnozaki Exp $ */ /* * Copyright (c) 1989, 1993 @@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\ #if 0 static char sccsid[] = "@(#)primes.c 8.5 (Berkeley) 5/10/95"; #else -__RCSID("$NetBSD: primes.c,v 1.17 2009/08/12 08:25:27 dholland Exp $"); +__RCSID("$NetBSD: primes.c,v 1.18 2010/05/13 17:52:12 tnozaki Exp $"); #endif #endif /* not lint */ @@ -199,7 +199,7 @@ read_num_buf(void) err(1, "stdin"); exit(0); } - for (p = buf; isblank(*p); ++p); + for (p = buf; isblank((unsigned char)*p); ++p); if (*p == '\n' || *p == '\0') continue; if (*p == '-') diff --git a/lib/libform/internals.c b/lib/libform/internals.c index 35dd2de68fc2..ae8a31b3fad2 100644 --- a/lib/libform/internals.c +++ b/lib/libform/internals.c @@ -1,4 +1,4 @@ -/* $NetBSD: internals.c,v 1.33 2010/02/03 15:34:43 roy Exp $ */ +/* $NetBSD: internals.c,v 1.34 2010/05/13 17:52:12 tnozaki Exp $ */ /*- * Copyright (c) 1998-1999 Brett Lymn @@ -30,7 +30,7 @@ */ #include -__RCSID("$NetBSD: internals.c,v 1.33 2010/02/03 15:34:43 roy Exp $"); +__RCSID("$NetBSD: internals.c,v 1.34 2010/05/13 17:52:12 tnozaki Exp $"); #include #include @@ -619,9 +619,9 @@ _formi_wrap_field(FIELD *field, _FORMI_FIELD_LINES *loc) pos = tab_fit_len(row, field->cols); } - if ((!isblank(row->string[pos])) && + if ((!isblank((unsigned char)row->string[pos])) && ((field->opts & O_WRAP) == O_WRAP)) { - if (!isblank(row->string[pos - 1])) + if (!isblank((unsigned char)row->string[pos - 1])) pos = find_sow((unsigned int) pos, &row); /* @@ -630,7 +630,7 @@ _formi_wrap_field(FIELD *field, _FORMI_FIELD_LINES *loc) * should not autoskip (if that is enabled) */ if ((pos == 0) - || (!isblank(row->string[pos - 1]))) { + || (!isblank((unsigned char)row->string[pos - 1]))) { wrap_err = E_NO_ROOM; goto restore_and_exit; } @@ -640,7 +640,7 @@ _formi_wrap_field(FIELD *field, _FORMI_FIELD_LINES *loc) * a trailing blank, don't wrap the blank. */ if ((row->next == NULL) && (pos == row->length - 1) && - (isblank(row->string[pos])) && + (isblank((unsigned char)row->string[pos])) && row->expanded <= field->cols) continue; @@ -650,7 +650,7 @@ _formi_wrap_field(FIELD *field, _FORMI_FIELD_LINES *loc) * move forward one char so the blank * is on the line boundary. */ - if ((isblank(row->string[pos])) && + if ((isblank((unsigned char)row->string[pos])) && (pos != row->length - 1)) pos++; @@ -1073,7 +1073,7 @@ _formi_skip_blanks(char *string, unsigned int start) i = start; - while ((string[i] != '\0') && isblank(string[i])) + while ((string[i] != '\0') && isblank((unsigned char)string[i])) i++; return i; @@ -1097,7 +1097,7 @@ field_skip_blanks(unsigned int start, _FORMI_FIELD_LINES **rowp) do { i = _formi_skip_blanks(&row->string[i], i); - if (!isblank(row->string[i])) { + if (!isblank((unsigned char)row->string[i])) { last = row; row = row->next; /* @@ -1191,7 +1191,7 @@ find_eow(FIELD *cur, unsigned int offset, bool do_join, do { /* first skip any non-whitespace */ while ((row->string[start] != '\0') - && !isblank(row->string[start])) + && !isblank((unsigned char)row->string[start])) start++; /* see if we hit the end of the string */ @@ -1215,12 +1215,12 @@ find_eow(FIELD *cur, unsigned int offset, bool do_join, } while (row->length == 0); } } - } while (!isblank(row->string[start])); + } while (!isblank((unsigned char)row->string[start])); do { /* otherwise skip the whitespace.... */ while ((row->string[start] != '\0') - && isblank(row->string[start])) + && isblank((unsigned char)row->string[start])) start++; if (row->string[start] == '\0') { @@ -1243,7 +1243,7 @@ find_eow(FIELD *cur, unsigned int offset, bool do_join, } while (row->length == 0); } } - } while (isblank(row->string[start])); + } while (isblank((unsigned char)row->string[start])); *rowp = row; return start; @@ -1266,11 +1266,13 @@ find_sow(unsigned int offset, _FORMI_FIELD_LINES **rowp) do { if (start > 0) { - if (isblank(str[start]) || isblank(str[start - 1])) { - if (isblank(str[start - 1])) + if (isblank((unsigned char)str[start]) || + isblank((unsigned char)str[start - 1])) { + if (isblank((unsigned char)str[start - 1])) start--; /* skip the whitespace.... */ - while ((start >= 0) && isblank(str[start])) + while ((start >= 0) && + isblank((unsigned char)str[start])) start--; } } @@ -1292,7 +1294,7 @@ find_sow(unsigned int offset, _FORMI_FIELD_LINES **rowp) } } while (row->length == 0); } - } while (isblank(row->string[start])); + } while (isblank((unsigned char)row->string[start])); /* see if we hit the start of the string */ if (start < 0) { @@ -1302,7 +1304,7 @@ find_sow(unsigned int offset, _FORMI_FIELD_LINES **rowp) /* now skip any non-whitespace */ do { - while ((start >= 0) && !isblank(str[start])) + while ((start >= 0) && !isblank((unsigned char)str[start])) start--; @@ -1322,7 +1324,7 @@ find_sow(unsigned int offset, _FORMI_FIELD_LINES **rowp) } } while (row->length == 0); } - } while (!isblank(str[start])); + } while (!isblank((unsigned char)str[start])); if (start > 0) { start++; /* last loop has us pointing at a space, adjust */ @@ -2846,7 +2848,8 @@ _formi_manipulate_field(FORM *form, int c) * a word. */ if ((start > 0) - && !(isblank(str[start - 1]) && !isblank(str[start]))) + && !(isblank((unsigned char)str[start - 1]) && + !isblank((unsigned char)str[start]))) start = find_sow(start, &row); str = row->string; /* XXXX hmmmm what if start and end on diff rows? XXXX */ diff --git a/lib/libform/type_enum.c b/lib/libform/type_enum.c index 837c29b0903b..1f1b5139ad9d 100644 --- a/lib/libform/type_enum.c +++ b/lib/libform/type_enum.c @@ -1,4 +1,4 @@ -/* $NetBSD: type_enum.c,v 1.10 2004/11/24 11:57:09 blymn Exp $ */ +/* $NetBSD: type_enum.c,v 1.11 2010/05/13 17:52:12 tnozaki Exp $ */ /*- * Copyright (c) 1998-1999 Brett Lymn @@ -30,7 +30,7 @@ */ #include -__RCSID("$NetBSD: type_enum.c,v 1.10 2004/11/24 11:57:09 blymn Exp $"); +__RCSID("$NetBSD: type_enum.c,v 1.11 2010/05/13 17:52:12 tnozaki Exp $"); #include #include @@ -71,7 +71,7 @@ trim_blanks(char *field) else return 0; - while ((i > 0) && isblank(field[i])) + while ((i > 0) && isblank((unsigned char)field[i])) i--; return i; diff --git a/sbin/ldconfig/ldconfig.c b/sbin/ldconfig/ldconfig.c index 6242420af530..a103ea9e4154 100644 --- a/sbin/ldconfig/ldconfig.c +++ b/sbin/ldconfig/ldconfig.c @@ -1,4 +1,4 @@ -/* $NetBSD: ldconfig.c,v 1.46 2009/08/16 18:01:49 martin Exp $ */ +/* $NetBSD: ldconfig.c,v 1.47 2010/05/13 17:52:12 tnozaki Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: ldconfig.c,v 1.46 2009/08/16 18:01:49 martin Exp $"); +__RCSID("$NetBSD: ldconfig.c,v 1.47 2010/05/13 17:52:12 tnozaki Exp $"); #endif @@ -198,10 +198,10 @@ do_conf(void) line[len] = '\0'; } - while (isblank(*line)) { line++; len--; } + while (isblank((unsigned char)*line)) { line++; len--; } if ((c = strchr(line, '#')) == NULL) c = line + len; - while (--c >= line && isblank(*c)) continue; + while (--c >= line && isblank((unsigned char)*c)) continue; if (c >= line) { *++c = '\0'; rval |= dodir(line, 0, 1); diff --git a/usr.sbin/syslogd/tls.c b/usr.sbin/syslogd/tls.c index 5dfbbb70edfe..9ba9d30f0851 100644 --- a/usr.sbin/syslogd/tls.c +++ b/usr.sbin/syslogd/tls.c @@ -1,4 +1,4 @@ -/* $NetBSD: tls.c,v 1.4 2009/01/18 10:35:26 lukem Exp $ */ +/* $NetBSD: tls.c,v 1.5 2010/05/13 17:52:12 tnozaki Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -45,7 +45,7 @@ */ #include -__RCSID("$NetBSD: tls.c,v 1.4 2009/01/18 10:35:26 lukem Exp $"); +__RCSID("$NetBSD: tls.c,v 1.5 2010/05/13 17:52:12 tnozaki Exp $"); #ifndef DISABLE_TLS #include "syslogd.h" @@ -1194,7 +1194,7 @@ parse_tls_destination(const char *p, struct filed *f, size_t linenum) logerror("unknown keyword %s " "in config line %zu", p, linenum); } - while (*p == ',' || isblank(*p)) + while (*p == ',' || isblank((unsigned char)*p)) p++; if (*p == '\0') { logerror("unterminated ("