From ff3456b04e1b42fd77e0db061bf7a563108b5868 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Thu, 18 Aug 2022 19:02:35 -0700 Subject: Resolve -Wsign-compare warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit XRecord.c: In function ‘XRecordFreeState’: XRecord.c:515:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(i=0; inclients; i++) { ^ XRecord.c: In function ‘parse_reply_call_callback’: XRecord.c:752:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (current_index + 4 > rep->length << 2) ^ XRecord.c:759:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (current_index + 1 > rep->length << 2) ^ XRecord.c:763:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (current_index + 8 > rep->length << 2) ^ XRecord.c:777:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (current_index + 4 > rep->length << 2) ^ XRecord.c:785:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (current_index + 4 > rep->length << 2) ^ XRecord.c:792:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (current_index + 4 > rep->length<<2) ^ XRecord.c:797:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (current_index + 8 > rep->length << 2) ^ XRecord.c:810:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (current_index + 8 > rep->length << 2) ^ XRecord.c:818:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (current_index + 4 > rep->length << 2) ^ XRecord.c:824:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] } else if (current_index < rep->length << 2) ^ XRecord.c:830:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (current_index < rep->length << 2) ^ XRecord.c:859:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] } while (current_indexlength<<2); ^ Signed-off-by: Alan Coopersmith --- src/XRecord.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/XRecord.c b/src/XRecord.c index fefd842..00f4480 100644 --- a/src/XRecord.c +++ b/src/XRecord.c @@ -510,9 +510,7 @@ XRecordGetContext(Display *dpy, XRecordContext context, void XRecordFreeState(XRecordState *state) { - int i; - - for(i=0; inclients; i++) { + for (unsigned long i = 0; i < state->nclients; i++) { if (state->client_info[i]->ranges) { if (state->client_info[i]->ranges[0]) Xfree(state->client_info[i]->ranges[0]); @@ -727,7 +725,7 @@ parse_reply_call_callback( XRecordInterceptProc callback, XPointer closure) { - int current_index; + unsigned int current_index; int datum_bytes = 0; XRecordInterceptData *data; -- cgit v1.2.1