Source-Changes-HG archive

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

[src/trunk]: src/dist/ipf More instances of casts to usngiend char for the ct...



details:   https://anonhg.NetBSD.org/src/rev/c3f1043f113c
branches:  trunk
changeset: 571203:c3f1043f113c
user:      he <he%NetBSD.org@localhost>
date:      Sat Nov 13 15:18:41 2004 +0000

description:
More instances of casts to usngiend char for the ctype functions.
Will also be sent to maintainer for inclusion in original.

diffstat:

 dist/ipf/ipsend/ipsend.c    |   4 ++--
 dist/ipf/lib/addicmp.c      |   6 +++---
 dist/ipf/lib/getportproto.c |   4 ++--
 dist/ipf/lib/hostnum.c      |   4 ++--
 dist/ipf/lib/icmpcode.c     |   4 ++--
 dist/ipf/lib/ipft_hx.c      |  11 +++++++----
 dist/ipf/lib/ipft_tx.c      |  14 ++++++++------
 dist/ipf/lib/portnum.c      |   4 ++--
 dist/ipf/lib/ports.c        |   4 ++--
 dist/ipf/lib/printbuf.c     |   4 ++--
 10 files changed, 32 insertions(+), 27 deletions(-)

diffs (244 lines):

diff -r 8116a005b625 -r c3f1043f113c dist/ipf/ipsend/ipsend.c
--- a/dist/ipf/ipsend/ipsend.c  Sat Nov 13 15:15:56 2004 +0000
+++ b/dist/ipf/ipsend/ipsend.c  Sat Nov 13 15:18:41 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ipsend.c,v 1.9 2004/03/28 09:00:56 martti Exp $        */
+/*     $NetBSD: ipsend.c,v 1.10 2004/11/13 15:18:41 he Exp $   */
 
 /*
  * ipsend.c (C) 1995-1998 Darren Reed
@@ -173,7 +173,7 @@
                u_short w[6];
        } ph;
        u_32_t temp32;
-       u_short cksum, *opts;
+       u_short *opts;
 
        ph.h.len = htons(len);
        ph.h.ttl = 0;
diff -r 8116a005b625 -r c3f1043f113c dist/ipf/lib/addicmp.c
--- a/dist/ipf/lib/addicmp.c    Sat Nov 13 15:15:56 2004 +0000
+++ b/dist/ipf/lib/addicmp.c    Sat Nov 13 15:18:41 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: addicmp.c,v 1.1.1.1 2004/03/28 08:56:17 martti Exp $   */
+/*     $NetBSD: addicmp.c,v 1.2 2004/11/13 15:18:41 he Exp $   */
 
 /*
  * Copyright (C) 1993-2001 by Darren Reed.
@@ -36,7 +36,7 @@
                return -1;
        if (!fp->fr_proto)      /* to catch lusers */
                fp->fr_proto = IPPROTO_ICMP;
-       if (isdigit(***cp)) {
+       if (isdigit((unsigned char)***cp)) {
                if (!ratoi(**cp, &i, 0, 255)) {
                        fprintf(stderr,
                                "%d: Invalid icmp-type (%s) specified\n",
@@ -70,7 +70,7 @@
        if (**cp && strcasecmp("code", **cp))
                return 0;
        (*cp)++;
-       if (isdigit(***cp)) {
+       if (isdigit((unsigned char)***cp)) {
                if (!ratoi(**cp, &i, 0, 255)) {
                        fprintf(stderr,
                                "%d: Invalid icmp code (%s) specified\n",
diff -r 8116a005b625 -r c3f1043f113c dist/ipf/lib/getportproto.c
--- a/dist/ipf/lib/getportproto.c       Sat Nov 13 15:15:56 2004 +0000
+++ b/dist/ipf/lib/getportproto.c       Sat Nov 13 15:18:41 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: getportproto.c,v 1.1.1.2 2004/07/23 05:34:34 martti Exp $      */
+/*     $NetBSD: getportproto.c,v 1.2 2004/11/13 15:18:41 he Exp $      */
 
 #include <ctype.h>
 #include "ipf.h"
@@ -10,7 +10,7 @@
        struct servent *s;
        struct protoent *p;
 
-       if (isdigit(*name) && atoi(name) > 0)
+       if (isdigit((unsigned char)*name) && atoi(name) > 0)
                return htons(atoi(name) & 65535);
 
        p = getprotobynumber(proto);
diff -r 8116a005b625 -r c3f1043f113c dist/ipf/lib/hostnum.c
--- a/dist/ipf/lib/hostnum.c    Sat Nov 13 15:15:56 2004 +0000
+++ b/dist/ipf/lib/hostnum.c    Sat Nov 13 15:18:41 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hostnum.c,v 1.1.1.1 2004/03/28 08:56:18 martti Exp $   */
+/*     $NetBSD: hostnum.c,v 1.2 2004/11/13 15:18:41 he Exp $   */
 
 /*
  * Copyright (C) 1993-2001 by Darren Reed.
@@ -37,7 +37,7 @@
                        return -1;
        }
 #endif
-       if (isdigit(*host) && inet_aton(host, &ip)) {
+       if (isdigit((unsigned char)*host) && inet_aton(host, &ip)) {
                *ipa = ip.s_addr;
                return 0;
        }
diff -r 8116a005b625 -r c3f1043f113c dist/ipf/lib/icmpcode.c
--- a/dist/ipf/lib/icmpcode.c   Sat Nov 13 15:15:56 2004 +0000
+++ b/dist/ipf/lib/icmpcode.c   Sat Nov 13 15:18:41 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: icmpcode.c,v 1.1.1.1 2004/03/28 08:56:18 martti Exp $  */
+/*     $NetBSD: icmpcode.c,v 1.2 2004/11/13 15:18:41 he Exp $  */
 
 /*
  * Copyright (C) 1993-2001 by Darren Reed.
@@ -34,7 +34,7 @@
 
        if ((s = strrchr(str, ')')))
                *s = '\0';
-       if (isdigit(*str)) {
+       if (isdigit((unsigned char)*str)) {
                if (!ratoi(str, &i, 0, 255))
                        return -1;
                else
diff -r 8116a005b625 -r c3f1043f113c dist/ipf/lib/ipft_hx.c
--- a/dist/ipf/lib/ipft_hx.c    Sat Nov 13 15:15:56 2004 +0000
+++ b/dist/ipf/lib/ipft_hx.c    Sat Nov 13 15:18:41 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ipft_hx.c,v 1.1.1.1 2004/03/28 08:56:18 martti Exp $   */
+/*     $NetBSD: ipft_hx.c,v 1.2 2004/11/13 15:18:41 he Exp $   */
 
 /*
  * Copyright (C) 1995-2001 by Darren Reed.
@@ -113,7 +113,8 @@
                                if (t < (char *)ip)
                                        putchar('\t');
                                while (t < (char *)ip) {
-                                       if (isprint(*t) && isascii(*t))
+                                       if (isprint((unsigned char)*t) &&
+                                           isascii((unsigned char)*t))
                                                putchar(*t);
                                        else
                                                putchar('.');
@@ -135,7 +136,7 @@
        char    c;
 
        while ((c = *src++)) {
-               if (isspace(c)) {
+               if (isspace((unsigned char)c)) {
                        if (state) {
                                dst++;
                                state = 0;
@@ -143,7 +144,9 @@
                        continue;
                } else if ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') ||
                           (c >= 'A' && c <= 'F')) {
-                       c = isdigit(c) ? (c - '0') : (toupper(c) - 55);
+                       c = isdigit((unsigned char)c) ? 
+                               (c - '0') : 
+                               (toupper((unsigned char)c) - 55);
                        if (state == 0) {
                                *dst = (c << 4);
                                state++;
diff -r 8116a005b625 -r c3f1043f113c dist/ipf/lib/ipft_tx.c
--- a/dist/ipf/lib/ipft_tx.c    Sat Nov 13 15:15:56 2004 +0000
+++ b/dist/ipf/lib/ipft_tx.c    Sat Nov 13 15:18:41 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ipft_tx.c,v 1.1.1.1 2004/03/28 08:56:19 martti Exp $   */
+/*     $NetBSD: ipft_tx.c,v 1.2 2004/11/13 15:18:41 he Exp $   */
 
 /*
  * Copyright (C) 1995-2001 by Darren Reed.
@@ -56,7 +56,7 @@
        *resolved = 0;
        if (!strcasecmp("any", host))
                return 0L;
-       if (isdigit(*host))
+       if (isdigit((unsigned char)*host))
                return inet_addr(host);
 
        if (gethost(host, &ipa) == -1) {
@@ -78,7 +78,7 @@
        struct  servent *sp, *sp2;
        u_short p1 = 0;
 
-       if (isdigit(*name))
+       if (isdigit((unsigned char)*name))
                return (u_short)atoi(name);
        if (!tx_proto)
                tx_proto = "tcp/udp";
@@ -202,11 +202,13 @@
                return 1;
 
        c = **cpp;
-       if (!isalpha(c) || (tolower(c) != 'o' && tolower(c) != 'i')) {
+       if (!isalpha((unsigned char)c) || 
+           (tolower((unsigned char)c) != 'o' && 
+            tolower((unsigned char)c) != 'i')) {
                fprintf(stderr, "bad direction \"%s\"\n", *cpp);
                return 1;
        }
-       *out = (tolower(c) == 'o') ? 1 : 0;
+       *out = (tolower((unsigned char)c) == 'o') ? 1 : 0;
        cpp++;
        if (!*cpp)
                return 1;
@@ -238,7 +240,7 @@
                        tx_proto = "icmp";
                }
                cpp++;
-       } else if (isdigit(**cpp) && !index(*cpp, '.')) {
+       } else if (isdigit((unsigned char)**cpp) && !index(*cpp, '.')) {
                ip->ip_p = atoi(*cpp);
                cpp++;
        } else
diff -r 8116a005b625 -r c3f1043f113c dist/ipf/lib/portnum.c
--- a/dist/ipf/lib/portnum.c    Sat Nov 13 15:15:56 2004 +0000
+++ b/dist/ipf/lib/portnum.c    Sat Nov 13 15:18:41 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: portnum.c,v 1.1.1.1 2004/03/28 08:56:20 martti Exp $   */
+/*     $NetBSD: portnum.c,v 1.2 2004/11/13 15:18:41 he Exp $   */
 
 /*
  * Copyright (C) 1993-2001 by Darren Reed.
@@ -27,7 +27,7 @@
        u_short p1 = 0;
        int i;
 
-       if (isdigit(*name)) {
+       if (isdigit((unsigned char)*name)) {
                if (ratoi(name, &i, 0, USHRT_MAX)) {
                        *port = (u_short)i;
                        return 1;
diff -r 8116a005b625 -r c3f1043f113c dist/ipf/lib/ports.c
--- a/dist/ipf/lib/ports.c      Sat Nov 13 15:15:56 2004 +0000
+++ b/dist/ipf/lib/ports.c      Sat Nov 13 15:18:41 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ports.c,v 1.1.1.1 2004/03/28 08:56:20 martti Exp $     */
+/*     $NetBSD: ports.c,v 1.2 2004/11/13 15:18:41 he Exp $     */
 
 /*
  * Copyright (C) 1993-2001 by Darren Reed.
@@ -30,7 +30,7 @@
                return 0;
        if (!strcasecmp(**seg, "port") && *(*seg + 1) && *(*seg + 2)) {
                (*seg)++;
-               if (isalnum(***seg) && *(*seg + 2)) {
+               if (isalnum((unsigned char)***seg) && *(*seg + 2)) {
                        if (portnum(**seg, proto, pp, linenum) == 0)
                                return -1;
                        (*seg)++;
diff -r 8116a005b625 -r c3f1043f113c dist/ipf/lib/printbuf.c
--- a/dist/ipf/lib/printbuf.c   Sat Nov 13 15:15:56 2004 +0000
+++ b/dist/ipf/lib/printbuf.c   Sat Nov 13 15:18:41 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: printbuf.c,v 1.1.1.1 2004/03/28 08:56:20 martti Exp $  */
+/*     $NetBSD: printbuf.c,v 1.2 2004/11/13 15:18:41 he Exp $  */
 
 /*
  * Copyright (C) 1993-2001 by Darren Reed.
@@ -22,7 +22,7 @@
 
        for (s = buf, i = len; i; i--) {
                c = *s++;
-               if (isprint(c))
+               if (isprint((unsigned char)c))
                        putchar(c);
                else
                        printf("\\%03o", c);



Home | Main Index | Thread Index | Old Index