diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2023-10-08 13:32:21 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2023-10-08 14:00:14 -0700 |
commit | 752d9cbc0efc51bdef2ea25fba2b92974327f6a6 (patch) | |
tree | 2f01e1bd62d057003750d733f2ce10b9d14c2f3c /src | |
parent | f908dc6c1205feb66f3538096f24e2ee22947893 (diff) |
Fix -Wsign-compare warnings in xkbtext.c & xkmread.c
xkbtext.c: In function ‘XkbNKNDetailMaskText’:
xkbtext.c:588:37: warning: comparison of integer expressions of different
signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
588 | for (len = 0, i = 0, bit = 1; i < NUM_NKN; i++, bit <<= 1) {
| ^
xkbtext.c:597:37: warning: comparison of integer expressions of different
signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
597 | for (len = 0, i = 0, bit = 1; i < NUM_NKN; i++, bit <<= 1) {
| ^
xkmread.c: In function ‘XkmSkipPadding’:
xkmread.c:118:19: warning: comparison of integer expressions of different
signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare]
118 | for (i = 0; i < pad; i++) {
| ^
xkmread.c: In function ‘ReadXkmKeycodes’:
xkmread.c:254:54: warning: comparison of integer expressions of different
signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare]
254 | for (pAl = xkb->names->key_aliases, i = 0; i < nAl; i++, pAl++)
{
| ^
xkmread.c: In function ‘ReadXkmCompatMap’:
xkmread.c:452:19: warning: comparison of integer expressions of different
signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare]
452 | for (i = 0; i < num_si; i++, interp++) {
| ^
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/xkbtext.c | 2 | ||||
-rw-r--r-- | src/xkmread.c | 15 |
2 files changed, 8 insertions, 9 deletions
diff --git a/src/xkbtext.c b/src/xkbtext.c index 353c91e..95ea241 100644 --- a/src/xkbtext.c +++ b/src/xkbtext.c @@ -548,7 +548,7 @@ XkbNKNDetailMaskText(unsigned detail, unsigned format) { char *buf; const char *prefix, *suffix; - register int i; + unsigned int i; register unsigned bit; int len, plen, slen; diff --git a/src/xkmread.c b/src/xkmread.c index ea7c792..e69f236 100644 --- a/src/xkmread.c +++ b/src/xkmread.c @@ -113,9 +113,9 @@ XkmGetCARD32(FILE * file, int *pNRead) static int XkmSkipPadding(FILE * file, unsigned pad) { - register int i, nRead = 0; + int nRead = 0; - for (i = 0; i < pad; i++) { + for (unsigned int i = 0; i < pad; i++) { if (getc(file) != EOF) nRead++; } @@ -205,7 +205,7 @@ ReadXkmVirtualMods(FILE *file, XkbFileInfo *result, XkbChangesPtr changes) static int ReadXkmKeycodes(FILE *file, XkbFileInfo *result, XkbChangesPtr changes) { - register int i; + unsigned int i; unsigned minKC, maxKC, nAl; int nRead = 0; char name[100]; @@ -241,7 +241,7 @@ ReadXkmKeycodes(FILE *file, XkbFileInfo *result, XkbChangesPtr changes) xkb->names->keycodes = XkbInternAtom(xkb->dpy, name, False); } - for (pN = &xkb->names->keys[minKC], i = minKC; i <= (int) maxKC; i++, pN++) { + for (pN = &xkb->names->keys[minKC], i = minKC; i <= maxKC; i++, pN++) { if (fread(pN, 1, XkbKeyNameLength, file) != XkbKeyNameLength) { _XkbLibError(_XkbErrBadLength, "ReadXkmKeycodes", 0); return -1; @@ -418,7 +418,6 @@ ReadXkmKeyTypes(FILE *file, XkbFileInfo *result, XkbChangesPtr changes) static int ReadXkmCompatMap(FILE *file, XkbFileInfo *result, XkbChangesPtr changes) { - register int i; unsigned num_si, groups; char name[100]; XkbSymInterpretPtr interp; @@ -449,7 +448,7 @@ ReadXkmCompatMap(FILE *file, XkbFileInfo *result, XkbChangesPtr changes) compat = xkb->compat; compat->num_si = num_si; interp = compat->sym_interpret; - for (i = 0; i < num_si; i++, interp++) { + for (unsigned int i = 0; i < num_si; i++, interp++) { tmp = fread(&wire, SIZEOF(xkmSymInterpretDesc), 1, file); nRead += tmp * SIZEOF(xkmSymInterpretDesc); interp->sym = wire.sym; @@ -471,9 +470,9 @@ ReadXkmCompatMap(FILE *file, XkbFileInfo *result, XkbChangesPtr changes) changes->compat.num_si = num_si; } if (groups) { - register unsigned bit; + unsigned int bit = 1; - for (i = 0, bit = 1; i < XkbNumKbdGroups; i++, bit <<= 1) { + for (int i = 0; i < XkbNumKbdGroups; i++, bit <<= 1) { xkmModsDesc md; if (groups & bit) { |