Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src cast isblank(3)'s argument to unsigned char.



details:   https://anonhg.NetBSD.org/src/rev/1cf908eea3e3
branches:  trunk
changeset: 754803:1cf908eea3e3
user:      tnozaki <tnozaki%NetBSD.org@localhost>
date:      Thu May 13 17:52:11 2010 +0000

description:
cast isblank(3)'s argument to unsigned char.

diffstat:

 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(-)

diffs (truncated from 440 to 300 lines):

diff -r fe641b09d2e8 -r 1cf908eea3e3 dist/nvi/common/options.c
--- a/dist/nvi/common/options.c Thu May 13 17:48:50 2010 +0000
+++ b/dist/nvi/common/options.c Thu May 13 17:52:11 2010 +0000
@@ -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 @@
                        }
                        (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 -r fe641b09d2e8 -r 1cf908eea3e3 dist/nvi/ex/ex_cscope.c
--- a/dist/nvi/ex/ex_cscope.c   Thu May 13 17:48:50 2010 +0000
+++ b/dist/nvi/ex/ex_cscope.c   Thu May 13 17:52:11 2010 +0000
@@ -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 @@
                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 @@
        }
 
        /* Skip <blank> 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 -r fe641b09d2e8 -r 1cf908eea3e3 dist/nvi/ex/ex_tag.c
--- a/dist/nvi/ex/ex_tag.c      Thu May 13 17:48:50 2010 +0000
+++ b/dist/nvi/ex/ex_tag.c      Thu May 13 17:52:11 2010 +0000
@@ -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 @@
 
        /* 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 -r fe641b09d2e8 -r 1cf908eea3e3 dist/nvi/ex/ex_usage.c
--- a/dist/nvi/ex/ex_usage.c    Thu May 13 17:48:50 2010 +0000
+++ b/dist/nvi/ex/ex_usage.c    Thu May 13 17:52:11 2010 +0000
@@ -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 @@
                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 -r fe641b09d2e8 -r 1cf908eea3e3 dist/nvi/vi/vs_msg.c
--- a/dist/nvi/vi/vs_msg.c      Thu May 13 17:48:50 2010 +0000
+++ b/dist/nvi/vi/vs_msg.c      Thu May 13 17:52:11 2010 +0000
@@ -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 @@
        }
        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 -r fe641b09d2e8 -r 1cf908eea3e3 games/factor/factor.c
--- a/games/factor/factor.c     Thu May 13 17:48:50 2010 +0000
+++ b/games/factor/factor.c     Thu May 13 17:52:11 2010 +0000
@@ -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 @@
 #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 @@
                                        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 -r fe641b09d2e8 -r 1cf908eea3e3 games/number/number.c
--- a/games/number/number.c     Thu May 13 17:48:50 2010 +0000
+++ b/games/number/number.c     Thu May 13 17:52:11 2010 +0000
@@ -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 @@
 #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 @@
        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 -r fe641b09d2e8 -r 1cf908eea3e3 games/primes/primes.c
--- a/games/primes/primes.c     Thu May 13 17:48:50 2010 +0000
+++ b/games/primes/primes.c     Thu May 13 17:52:11 2010 +0000
@@ -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 @@
 #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 @@
                                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 -r fe641b09d2e8 -r 1cf908eea3e3 lib/libform/internals.c
--- a/lib/libform/internals.c   Thu May 13 17:48:50 2010 +0000
+++ b/lib/libform/internals.c   Thu May 13 17:52:11 2010 +0000
@@ -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 <sys/cdefs.h>
-__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 <limits.h>
 #include <ctype.h>
@@ -619,9 +619,9 @@
                                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 @@
                                 * 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 @@
                           * 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 @@
                           * 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 @@
 
        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 @@
 
        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 @@
        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 @@
                                } 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 @@
                                } while (row->length == 0);
                        }
                }
-       } while (isblank(row->string[start]));
+       } while (isblank((unsigned char)row->string[start]));
 
        *rowp = row;



Home | Main Index | Thread Index | Old Index