From 68668ded3a92f4b04bfd387c701faea8a1964abc Mon Sep 17 00:00:00 2001 From: Steven Schubiger Date: Sun, 2 Jan 2022 16:56:41 +0100 Subject: Cast argument to unsigned char when invoking to{lower,upper}() --- colorize.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/colorize.c b/colorize.c index 88de5fb..16b2a12 100644 --- a/colorize.c +++ b/colorize.c @@ -858,7 +858,7 @@ print_help (void) const char *code = entry->code; if (code) printf ("\t\t{\033[%s#\033[0m} [%c%c]%s%*s%s\n", - code, toupper (*name), *name, name + 1, 10 - (int)strlen (name), " ", name); + code, toupper ((unsigned char)*name), *name, name + 1, 10 - (int)strlen (name), " ", name); else printf ("\t\t{-} %s%*s%s\n", name, 13 - (int)strlen (name), " ", name); } @@ -1238,7 +1238,7 @@ gather_color_names (const char *color_string, char *attr, struct color_name **co STACK_VAR (color_names[index]->orig); for (ch = color; *ch; ch++) - *ch = tolower (*ch); + *ch = tolower ((unsigned char)*ch); color_names[index]->name = xstrdup (color); STACK_VAR (color_names[index]->name); @@ -1848,7 +1848,7 @@ has_color_name (const char *str, const char *name) assert (strlen (str) > 0); assert (strlen (name) > 0); - if (!(*str == *name || *str == toupper (*name))) + if (!(*str == *name || *str == toupper ((unsigned char)*name))) return false; else if (*(name + 1) != '\0' && !((p = strstr (str + 1, name + 1)) && p == str + 1)) -- cgit v1.2.3