add '(uchar)' casts to ctype calls
This is from the pull request for the assertion failure fix. It did not mention how to reproduce the assertion failure, just added casts to a bunch of isspace/isprint/tolower calls that didn't already have such. I removed an obsolete change for win/tty/topl.c and changed the win/win32/mswproc.c code to avoid using an expression with side-effects (*colorstring++) in calls to tolower() in case someone overrides that with a macro which evaluates its argument more than once as some pre- ANSI ones used to do. Not tested, might have typos.... sys/wince/*.c still needs similar casts.
This commit is contained in:
@@ -653,7 +653,7 @@ const char *id;
|
||||
{
|
||||
struct grep_var *rv;
|
||||
|
||||
while (*id && isspace(*id))
|
||||
while (*id && isspace((uchar) *id))
|
||||
id++;
|
||||
if (!*id) {
|
||||
Fprintf(stderr, "missing identifier in line %d", grep_lineno);
|
||||
@@ -700,10 +700,10 @@ char *buf;
|
||||
int isif = 1;
|
||||
char *buf0 = buf;
|
||||
#if 1
|
||||
if (isspace(buf[0]))
|
||||
if (isspace((uchar) buf[0]))
|
||||
return &buf[-1]; /* XXX see docs above */
|
||||
#else
|
||||
while (buf[0] && isspace(buf[0]))
|
||||
while (buf[0] && isspace((uchar) buf[0]))
|
||||
buf++;
|
||||
#endif
|
||||
switch (buf[0]) {
|
||||
@@ -754,7 +754,7 @@ char *buf;
|
||||
default: {
|
||||
char str[10];
|
||||
|
||||
if (isprint(buf[0])) {
|
||||
if (isprint((uchar) buf[0])) {
|
||||
str[0] = buf[0];
|
||||
str[1] = '\0';
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user