]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Never pass a `char' to a ctype function. I had relied on gcc -Wall
authorSimon Tatham <anakin@pobox.com>
Tue, 11 Mar 2003 09:30:31 +0000 (09:30 +0000)
committerSimon Tatham <anakin@pobox.com>
Tue, 11 Mar 2003 09:30:31 +0000 (09:30 +0000)
letting me know about instances of this, but it turns out that my
ctype.h explicitly casts input values to `int' to evade the
`subscript has type char' warning, so it had been carefully not
letting me know! Found them all by compiling with a doctored
ctype.h, and hopefully fixed them all too.

[originally from svn r2927]

ldisc.c
proxy.c
rlogin.c
unix/uxstore.c

diff --git a/ldisc.c b/ldisc.c
index d569f11239e517151e4113547eba594ea6736dbe..91af0aca462fb15ffdf59532c9d7b278936c97de 100644 (file)
--- a/ldisc.c
+++ b/ldisc.c
@@ -164,8 +164,8 @@ void ldisc_send(void *handle, char *buf, int len, int interactive)
                        bsb(ldisc, plen(ldisc, ldisc->buf[ldisc->buflen - 1]));
                    ldisc->buflen--;
                    if (ldisc->buflen > 0 &&
-                       isspace(ldisc->buf[ldisc->buflen - 1]) &&
-                       !isspace(ldisc->buf[ldisc->buflen]))
+                       isspace((unsigned char)ldisc->buf[ldisc->buflen-1]) &&
+                       !isspace((unsigned char)ldisc->buf[ldisc->buflen]))
                        break;
                }
                break;
diff --git a/proxy.c b/proxy.c
index 0a61741e339a107ed953dcee5a75367f3b1d88fe..f3342495e0bd75732d4f58bbe3eab3dfc4ba5840 100644 (file)
--- a/proxy.c
+++ b/proxy.c
@@ -281,7 +281,7 @@ static int proxy_for_destination (SockAddr addr, char *hostname, int port,
 
     while (exclude_list[s]) {
        while (exclude_list[s] &&
-              (isspace(exclude_list[s]) ||
+              (isspace((unsigned char)exclude_list[s]) ||
                exclude_list[s] == ',')) s++;
 
        if (!exclude_list[s]) break;
@@ -289,7 +289,7 @@ static int proxy_for_destination (SockAddr addr, char *hostname, int port,
        e = s;
 
        while (exclude_list[e] &&
-              (isalnum(exclude_list[e]) ||
+              (isalnum((unsigned char)exclude_list[e]) ||
                exclude_list[e] == '-' ||
                exclude_list[e] == '.' ||
                exclude_list[e] == '*')) e++;
@@ -325,7 +325,7 @@ static int proxy_for_destination (SockAddr addr, char *hostname, int port,
 
        /* Make sure we really have reached the next comma or end-of-string */
        while (exclude_list[s] &&
-              !isspace(exclude_list[s]) &&
+              !isspace((unsigned char)exclude_list[s]) &&
               exclude_list[s] != ',') s++;
     }
 
index 89a2bfe1a73d79261c76894bed86bb55fa7b4195..7b13a789c94f5f6a86823307ee1120ff6eda3cb9 100644 (file)
--- a/rlogin.c
+++ b/rlogin.c
@@ -169,7 +169,7 @@ static char *rlogin_init(void *frontend_handle, void **backend_handle,
        sk_write(rlogin->s, cfg->termtype,
                 strlen(cfg->termtype));
        sk_write(rlogin->s, "/", 1);
-       for (p = cfg->termspeed; isdigit(*p); p++) continue;
+       for (p = cfg->termspeed; isdigit((unsigned char)*p); p++) continue;
        sk_write(rlogin->s, cfg->termspeed, p - cfg->termspeed);
        rlogin->bufsize = sk_write(rlogin->s, &z, 1);
     }
index 6035113bf4fc02d3c22d770b1bdcb5bb10e39c99..5da6ed6adcfc6844dcfeef0944b269842dcb17ef 100644 (file)
@@ -80,7 +80,7 @@ void provide_xrm_string(char *string)
     memcpy(key, p, q-p);
     key[q-p-1] = '\0';
     xrms->key = key;
-    while (*q && isspace(*q))
+    while (*q && isspace((unsigned char)*q))
        q++;
     xrms->value = dupstr(q);