Add (unsigned char) casts to tolower/toupper and iscntrl calls.

Fixes PR 27593
This commit is contained in:
dsl 2004-10-28 20:15:36 +00:00
parent 2bdbaab58f
commit 7f5b5f6c04
4 changed files with 21 additions and 20 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: c_ksh.c,v 1.11 2004/07/07 19:20:09 mycroft Exp $ */
/* $NetBSD: c_ksh.c,v 1.12 2004/10/28 20:15:36 dsl Exp $ */
/*
* built-in Korn commands: c_*
@ -6,7 +6,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: c_ksh.c,v 1.11 2004/07/07 19:20:09 mycroft Exp $");
__RCSID("$NetBSD: c_ksh.c,v 1.12 2004/10/28 20:15:36 dsl Exp $");
#endif
#include "sh.h"
@ -1196,7 +1196,8 @@ c_kill(wp)
int i, n, rv, sig;
/* assume old style options if -digits or -UPPERCASE */
if ((p = wp[1]) && *p == '-' && (digit(p[1]) || isupper(p[1]))) {
if ((p = wp[1]) && *p == '-'
&& (digit(p[1]) || isupper((unsigned char)p[1]))) {
if (!(t = gettrap(p + 1, TRUE))) {
bi_errorf("bad signal `%s'", p + 1);
return 1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: emacs.c,v 1.25 2004/07/07 19:46:57 mycroft Exp $ */
/* $NetBSD: emacs.c,v 1.26 2004/10/28 20:15:37 dsl Exp $ */
/*
* Emacs-like command line editing and history
@ -10,7 +10,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: emacs.c,v 1.25 2004/07/07 19:46:57 mycroft Exp $");
__RCSID("$NetBSD: emacs.c,v 1.26 2004/10/28 20:15:37 dsl Exp $");
#endif
@ -741,7 +741,7 @@ x_size(c)
{
if (c=='\t')
return 4; /* Kludge, tabs are always four spaces. */
if (iscntrl(c)) /* control char */
if (iscntrl((unsigned char)c)) /* control char */
return 2;
return 1;
}
@ -764,7 +764,7 @@ x_zotc(c)
if (c == '\t') {
/* Kludge, tabs are always four spaces. */
x_e_puts(" ");
} else if (iscntrl(c)) {
} else if (iscntrl((unsigned char)c)) {
x_e_putc('^');
x_e_putc(UNCTRL(c));
} else
@ -1390,7 +1390,7 @@ x_mapout(c)
*p++ = '0';
} else
#endif /* OS2 */
if (iscntrl(c)) {
if (iscntrl((unsigned char)c)) {
*p++ = '^';
*p++ = UNCTRL(c);
} else
@ -2155,10 +2155,10 @@ x_fold_case(c)
if (cp != xep) {
if (c == 'L') { /* lowercase */
if (isupper((unsigned char)*cp))
*cp = tolower(*cp);
*cp = tolower((unsigned char)*cp);
} else { /* uppercase, capitialize */
if (islower((unsigned char)*cp))
*cp = toupper(*cp);
*cp = toupper((unsigned char)*cp);
}
cp++;
}
@ -2168,10 +2168,10 @@ x_fold_case(c)
while (cp != xep && !is_mfs((unsigned char)*cp)) {
if (c == 'U') { /* uppercase */
if (islower((unsigned char)*cp))
*cp = toupper(*cp);
*cp = toupper((unsigned char)*cp);
} else { /* lowercase, capitialize */
if (isupper((unsigned char)*cp))
*cp = tolower(*cp);
*cp = tolower((unsigned char)*cp);
}
cp++;
}

View File

@ -1,9 +1,9 @@
/* $NetBSD: var.c,v 1.9 2004/07/07 19:20:09 mycroft Exp $ */
/* $NetBSD: var.c,v 1.10 2004/10/28 20:15:37 dsl Exp $ */
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: var.c,v 1.9 2004/07/07 19:20:09 mycroft Exp $");
__RCSID("$NetBSD: var.c,v 1.10 2004/10/28 20:15:37 dsl Exp $");
#endif
@ -557,11 +557,11 @@ formatstr(vp, s)
if (vp->flag & UCASEV_AL) {
for (q = p; *q; q++)
if (islower((unsigned char)*q))
*q = toupper(*q);
*q = toupper((unsigned char)*q);
} else if (vp->flag & LCASEV) {
for (q = p; *q; q++)
if (isupper((unsigned char)*q))
*q = tolower(*q);
*q = tolower((unsigned char)*q);
}
return p;

View File

@ -1,4 +1,4 @@
/* $NetBSD: vi.c,v 1.8 2004/07/07 19:20:09 mycroft Exp $ */
/* $NetBSD: vi.c,v 1.9 2004/10/28 20:15:37 dsl Exp $ */
/*
* vi command editing
@ -9,7 +9,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: vi.c,v 1.8 2004/07/07 19:20:09 mycroft Exp $");
__RCSID("$NetBSD: vi.c,v 1.9 2004/10/28 20:15:37 dsl Exp $");
#endif
#include "config.h"
@ -1123,10 +1123,10 @@ vi_cmd(argcnt, cmd)
p = &es->cbuf[es->cursor];
if (islower((unsigned char)*p)) {
modified = 1; hnum = hlast;
*p = toupper(*p);
*p = toupper((unsigned char)*p);
} else if (isupper((unsigned char)*p)) {
modified = 1; hnum = hlast;
*p = tolower(*p);
*p = tolower((unsigned char)*p);
}
if (es->cursor < es->linelen - 1)
es->cursor++;