(submit/fix-char-signedness) xkb: xkbtext: fix char signess mismatch

On NetBSD gives warning:

In file included from /usr/include/ctype.h:100,
                 from ../xkb/xkbtext.c:32:
../xkb/xkbtext.c: In function ‘XkbAtomText’:
../xkb/xkbtext.c:94:44: warning: array subscript has type ‘char’ [-Wchar-subscripts]
   94 |             if ((tmp == rtrn) && (!isalpha(*tmp)))
      |                                            ^
../xkb/xkbtext.c:96:31: warning: array subscript has type ‘char’ [-Wchar-subscripts]
   96 |             else if (!isalnum(*tmp))
      |                               ^
../xkb/xkbtext.c: In function ‘XkbIMWhichStateMaskText’:
../xkb/xkbtext.c:470:43: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  470 |                 buf[len + 9] = toupper(buf[len + 9]);
      |                                           ^
../xkb/xkbtext.c: In function ‘XkbControlsMaskText’:
../xkb/xkbtext.c:532:43: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  532 |                 buf[len + 3] = toupper(buf[len + 3]);
      |                                           ^
../xkb/xkbtext.c: In function ‘XkbStringText’:
../xkb/xkbtext.c:563:22: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  563 |         if (!isprint(*in)) {
      |                      ^
../xkb/xkbtext.c:584:21: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  584 |         if (isprint(*in))
      |                     ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-04-02 17:30:54 +02:00
parent 0e054c32e3
commit b5ebbb2e3f

View File

@ -90,9 +90,9 @@ XkbAtomText(Atom atm, unsigned format)
}
if (format == XkbCFile) {
for (tmp = rtrn; *tmp != '\0'; tmp++) {
if ((tmp == rtrn) && (!isalpha(*tmp)))
if ((tmp == rtrn) && (!isalpha((unsigned char)*tmp)))
*tmp = '_';
else if (!isalnum(*tmp))
else if (!isalnum((unsigned char)*tmp))
*tmp = '_';
}
}
@ -466,7 +466,7 @@ XkbIMWhichStateMaskText(unsigned use_which, unsigned format)
if (len != 0)
buf[len++] = '|';
sprintf(&buf[len], "XkbIM_Use%s", imWhichNames[i]);
buf[len + 9] = toupper(buf[len + 9]);
buf[len + 9] = toupper((unsigned char)buf[len + 9]);
}
else {
if (len != 0)
@ -528,7 +528,7 @@ XkbControlsMaskText(unsigned ctrls, unsigned format)
if (len != 0)
buf[len++] = '|';
sprintf(&buf[len], "Xkb%sMask", ctrlNames[i]);
buf[len + 3] = toupper(buf[len + 3]);
buf[len + 3] = toupper((unsigned char)buf[len + 3]);
}
else {
if (len != 0)
@ -559,7 +559,7 @@ XkbStringText(char *str, unsigned format)
else if (format == XkbXKMFile)
return str;
for (ok = TRUE, len = 0, in = str; *in != '\0'; in++, len++) {
if (!isprint(*in)) {
if (!isprint((unsigned char)*in)) {
ok = FALSE;
switch (*in) {
case '\n':
@ -580,7 +580,7 @@ XkbStringText(char *str, unsigned format)
return str;
buf = tbGetBuffer(len + 1);
for (in = str, out = buf; *in != '\0'; in++) {
if (isprint(*in))
if (isprint((unsigned char)*in))
*out++ = *in;
else {
*out++ = '\\';