From 3b99837b78dc1499fee223a71ca7e225d4b261a9 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Tue, 2 Apr 2024 17:17:13 +0200 Subject: [PATCH] xfree86: parser: scan: fix char signess mismatch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On NetBSD gives warning: In file included from /usr/include/ctype.h:100, from ../hw/xfree86/parser/scan.c:58: ../hw/xfree86/parser/scan.c: In function ‘xf86getToken’: ../hw/xfree86/parser/scan.c:343:50: warning: array subscript has type ‘char’ [-Wchar-subscripts] 343 | else if ((c == ',') && !isalpha(configBuf[configPos])) { | ^ ../hw/xfree86/parser/scan.c:346:50: warning: array subscript has type ‘char’ [-Wchar-subscripts] 346 | else if ((c == '-') && !isalpha(configBuf[configPos])) { | ^ ../hw/xfree86/parser/scan.c: In function ‘xf86nameCompare’: ../hw/xfree86/parser/scan.c:1031:19: warning: array subscript has type ‘char’ [-Wchar-subscripts] 1031 | c1 = (isupper(*s1) ? tolower(*s1) : *s1); | ^ ../hw/xfree86/parser/scan.c:1031:34: warning: array subscript has type ‘char’ [-Wchar-subscripts] 1031 | c1 = (isupper(*s1) ? tolower(*s1) : *s1); | ^ ../hw/xfree86/parser/scan.c:1032:19: warning: array subscript has type ‘char’ [-Wchar-subscripts] 1032 | c2 = (isupper(*s2) ? tolower(*s2) : *s2); | ^ ../hw/xfree86/parser/scan.c:1032:34: warning: array subscript has type ‘char’ [-Wchar-subscripts] 1032 | c2 = (isupper(*s2) ? tolower(*s2) : *s2); | ^ ../hw/xfree86/parser/scan.c:1042:23: warning: array subscript has type ‘char’ [-Wchar-subscripts] 1042 | c1 = (isupper(*s1) ? tolower(*s1) : *s1); | ^ ../hw/xfree86/parser/scan.c:1042:38: warning: array subscript has type ‘char’ [-Wchar-subscripts] 1042 | c1 = (isupper(*s1) ? tolower(*s1) : *s1); | ^ ../hw/xfree86/parser/scan.c:1043:23: warning: array subscript has type ‘char’ [-Wchar-subscripts] 1043 | c2 = (isupper(*s2) ? tolower(*s2) : *s2); | ^ ../hw/xfree86/parser/scan.c:1043:38: warning: array subscript has type ‘char’ [-Wchar-subscripts] 1043 | c2 = (isupper(*s2) ? tolower(*s2) : *s2); | ^ Signed-off-by: Enrico Weigelt, metux IT consult Part-of: --- hw/xfree86/parser/scan.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c index f4645f9d9..bf5a8d13b 100644 --- a/hw/xfree86/parser/scan.c +++ b/hw/xfree86/parser/scan.c @@ -340,10 +340,10 @@ xf86getToken(const xf86ConfigSymTabRec * tab) } /* GJA -- handle '-' and ',' * Be careful: "-hsync" is a keyword. */ - else if ((c == ',') && !isalpha(configBuf[configPos])) { + else if ((c == ',') && !isalpha((unsigned char)configBuf[configPos])) { return COMMA; } - else if ((c == '-') && !isalpha(configBuf[configPos])) { + else if ((c == '-') && !isalpha((unsigned char)configBuf[configPos])) { return DASH; } @@ -1034,8 +1034,8 @@ xf86nameCompare(const char *s1, const char *s2) s1++; while (*s2 == '_' || *s2 == ' ' || *s2 == '\t') s2++; - c1 = (isupper(*s1) ? tolower(*s1) : *s1); - c2 = (isupper(*s2) ? tolower(*s2) : *s2); + c1 = (isupper((unsigned char)*s1) ? tolower((unsigned char)*s1) : *s1); + c2 = (isupper((unsigned char)*s2) ? tolower((unsigned char)*s2) : *s2); while (c1 == c2) { if (c1 == '\0') return 0; @@ -1045,8 +1045,8 @@ xf86nameCompare(const char *s1, const char *s2) s1++; while (*s2 == '_' || *s2 == ' ' || *s2 == '\t') s2++; - c1 = (isupper(*s1) ? tolower(*s1) : *s1); - c2 = (isupper(*s2) ? tolower(*s2) : *s2); + c1 = (isupper((unsigned char)*s1) ? tolower((unsigned char)*s1) : *s1); + c2 = (isupper((unsigned char)*s2) ? tolower((unsigned char)*s2) : *s2); } return c1 - c2; }