From c131b1ed83da70fd739aff90ea3e8e829549ff43 Mon Sep 17 00:00:00 2001 From: NRK Date: Fri, 15 Jul 2022 22:46:23 +0200 Subject: fix: -Wsign-compare warnings (#336) mixing signed and unsigned types in comparison can end up having unintended results. for example: if (-1 < 1U) printf("true\n"); else printf("false\n"); previously we silenced these warnings, instead just fix them properly via necessary casting, and in cases where the value cannot be negative (e.g width/height members) make them unsigned. Reviewed-on: https://codeberg.org/nsxiv/nsxiv/pulls/336 Reviewed-by: explosion-mental --- nsxiv.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'nsxiv.h') diff --git a/nsxiv.h b/nsxiv.h index 7d81fff..4f903e9 100644 --- a/nsxiv.h +++ b/nsxiv.h @@ -162,9 +162,9 @@ typedef struct { typedef struct { img_frame_t *frames; - int cap; - int cnt; - int sel; + unsigned int cap; + unsigned int cnt; + unsigned int sel; bool animate; unsigned int framedelay; int length; @@ -403,8 +403,8 @@ struct win { unsigned int bw; struct { - int w; - int h; + unsigned int w; + unsigned int h; Pixmap pm; } buf; -- cgit v1.2.3-54-g00ecf