From: Matthew Fernandez Date: Thu, 28 Jul 2022 02:21:45 +0000 (-0700) Subject: gvpr canontoken: use char instead of unsigned char, introduce casts X-Git-Tag: 5.0.1~25^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=69b6ae12768133d7259db1266e0109a42e627fcb;p=graphviz gvpr canontoken: use char instead of unsigned char, introduce casts It is not clear to me why this code was using unsigned char when it can do the same thing with less typing and fewer compiler warnings using char. This also introduces casts to squash warnings from some of the more pedantic compiler implementations. See 6c29170f9f29466374fbc6e8e62a1b6916c6bc59 for details. --- diff --git a/lib/gvpr/actions.c b/lib/gvpr/actions.c index 2f8d70d6c..63ebc4187 100644 --- a/lib/gvpr/actions.c +++ b/lib/gvpr/actions.c @@ -922,27 +922,27 @@ static int colorcmpf(const void *p0, const void *p1) static char *canontoken(char *str) { - static unsigned char *canon; + static char *canon; static size_t allocated; - unsigned char c, *p, *q; + char c, *p, *q; size_t len; - p = (unsigned char *) str; + p = str; len = strlen(str); if (len >= allocated) { allocated = len + 1 + 10; - canon = newof(canon, unsigned char, allocated, 0); + canon = newof(canon, char, allocated, 0); if (!canon) return NULL; } q = canon; while ((c = *p++)) { - if (isupper(c)) - c = tolower(c); + if (isupper((int)c)) + c = (char)tolower((int)c); *q++ = c; } *q = '\0'; - return (char*)canon; + return canon; } /* fullColor: