From 752d9cbc0efc51bdef2ea25fba2b92974327f6a6 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 8 Oct 2023 13:32:21 -0700 Subject: Fix -Wsign-compare warnings in xkbtext.c & xkmread.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/xkmread.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/xkmread.c') 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) { -- cgit v1.2.3