xfree86: parser: scan: fix char signess mismatch

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 <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1455>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-04-02 17:17:13 +02:00 committed by Povilas Kanapickas
parent 7830b007e4
commit 3b99837b78

View File

@ -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;
}