Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Commit

Permalink
Never pass a `char' to a ctype function. I had relied on gcc -Wall
Browse files Browse the repository at this point in the history
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]
  • Loading branch information
sgtatham committed Mar 11, 2003
1 parent 43fe7d3 commit 73203bc
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions ldisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions proxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,15 +281,15 @@ 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;

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++;
Expand Down Expand Up @@ -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++;
}

Expand Down
2 changes: 1 addition & 1 deletion rlogin.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion unix/uxstore.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 73203bc

Please sign in to comment.