Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/tr Pass -Wpointer-sign.



details:   https://anonhg.NetBSD.org/src/rev/eb6d77b307cc
branches:  trunk
changeset: 789201:eb6d77b307cc
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sun Aug 11 01:00:13 2013 +0000

description:
Pass -Wpointer-sign.

diffstat:

 usr.bin/tr/Makefile |   6 +-----
 usr.bin/tr/str.c    |  18 +++++++++---------
 2 files changed, 10 insertions(+), 14 deletions(-)

diffs (97 lines):

diff -r cfd3331c5c71 -r eb6d77b307cc usr.bin/tr/Makefile
--- a/usr.bin/tr/Makefile       Sun Aug 11 00:52:17 2013 +0000
+++ b/usr.bin/tr/Makefile       Sun Aug 11 01:00:13 2013 +0000
@@ -1,11 +1,7 @@
-#      $NetBSD: Makefile,v 1.8 2012/08/10 12:10:28 joerg Exp $
+#      $NetBSD: Makefile,v 1.9 2013/08/11 01:00:13 dholland Exp $
 #      @(#)Makefile    8.1 (Berkeley) 6/6/93
 
 PROG=  tr
 SRCS=  str.c tr.c
 
-.for f in str tr
-COPTS.${f}.c+=  -Wno-pointer-sign
-.endfor
-
 .include <bsd.prog.mk>
diff -r cfd3331c5c71 -r eb6d77b307cc usr.bin/tr/str.c
--- a/usr.bin/tr/str.c  Sun Aug 11 00:52:17 2013 +0000
+++ b/usr.bin/tr/str.c  Sun Aug 11 01:00:13 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: str.c,v 1.24 2013/08/11 00:52:17 dholland Exp $        */
+/*     $NetBSD: str.c,v 1.25 2013/08/11 01:00:13 dholland Exp $        */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)str.c      8.2 (Berkeley) 4/28/95";
 #endif
-__RCSID("$NetBSD: str.c,v 1.24 2013/08/11 00:52:17 dholland Exp $");
+__RCSID("$NetBSD: str.c,v 1.25 2013/08/11 01:00:13 dholland Exp $");
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -57,7 +57,7 @@
        int      lastch;                /* last character */
        int     equiv[2];               /* equivalence set */
        int     *set;                   /* set of characters */
-       unsigned const char *str;       /* user's string */
+       const char *str;                /* user's string */
 };
 
 static int     backslash(STR *);
@@ -112,7 +112,7 @@
                *ret = s->lastch;
                return 1;
        case NORMAL:
-               switch (ch = *s->str) {
+               switch (ch = (unsigned char)*s->str) {
                case '\0':
                        s->state = EOS;
                        *ret = s->lastch;
@@ -261,7 +261,7 @@
                if (*s->str != '=')
                        errx(1, "misplaced equivalence equals sign");
        } else {
-               s->equiv[0] = s->str[0];
+               s->equiv[0] = (unsigned char)s->str[0];
                if (s->str[1] != '=')
                        errx(1, "misplaced equivalence equals sign");
        }
@@ -278,7 +278,7 @@
        const char *savestart;
 
        savestart = s->str++;
-       stopval = *s->str == '\\' ? backslash(s) : *s->str++;
+       stopval = *s->str == '\\' ? backslash(s) : (unsigned char)*s->str++;
        if (stopval < (u_char)s->lastch) {
                s->str = savestart;
                return 0;
@@ -300,7 +300,7 @@
        if (*s->str == '\\')
                s->lastch = backslash(s);
        else
-               s->lastch = *s->str++;
+               s->lastch = (unsigned char)*s->str++;
        if (*s->str != '*')
                errx(1, "misplaced sequence asterisk");
 
@@ -313,7 +313,7 @@
                ++s->str;
                break;
        default:
-               if (isdigit(*s->str)) {
+               if (isdigit((unsigned char)*s->str)) {
                        s->cnt = strtol(s->str, &ep, 0);
                        if (*ep == ']') {
                                s->str = ep + 1;
@@ -337,7 +337,7 @@
        int ch, cnt, val;
 
        for (cnt = val = 0;;) {
-               ch = *++s->str;
+               ch = (unsigned char)*++s->str;
                if (!isascii(ch) || !isdigit(ch))
                        break;
                val = val * 8 + ch - '0';



Home | Main Index | Thread Index | Old Index