aboutsummaryrefslogtreecommitdiffstats
path: root/thumbs.c
diff options
context:
space:
mode:
authorNRK <nrk@disroot.org>2022-07-15 22:46:23 +0200
committerNRK <nrk@disroot.org>2022-07-15 22:46:23 +0200
commitc131b1ed83da70fd739aff90ea3e8e829549ff43 (patch)
treef844587cc09b209c0edee2d3649589d62bc07215 /thumbs.c
parent5cab2fb52520e6a24012351b936ebb9162494666 (diff)
downloadnsxiv-c131b1ed83da70fd739aff90ea3e8e829549ff43.tar.zst
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 <explosion-mental@noreply.codeberg.org>
Diffstat (limited to 'thumbs.c')
-rw-r--r--thumbs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/thumbs.c b/thumbs.c
index 8341014..a0b1063 100644
--- a/thumbs.c
+++ b/thumbs.c
@@ -561,7 +561,7 @@ bool tns_zoom(tns_t *tns, int d)
oldzl = tns->zl;
tns->zl += -(d < 0) + (d > 0);
tns->zl = MAX(tns->zl, 0);
- tns->zl = MIN(tns->zl, ARRLEN(thumb_sizes)-1);
+ tns->zl = MIN(tns->zl, (int)ARRLEN(thumb_sizes)-1);
tns->bw = ((thumb_sizes[tns->zl] - 1) >> 5) + 1;
tns->bw = MIN(tns->bw, 4);