aboutsummaryrefslogtreecommitdiffstats
path: root/image.c
diff options
context:
space:
mode:
authorNRK <nrk@disroot.org>2022-06-17 18:16:37 +0200
committerGitea <gitea@fake.local>2022-06-25 08:27:01 +0200
commit5c3a796e55a2de822692810d0ac77c6589b0f10e (patch)
tree8206a8778e30860b74cc9f3d496d9235f8c1c6ec /image.c
parent4cf17d23492a4673a2c6addfa82e61c2117be003 (diff)
downloadnsxiv-5c3a796e55a2de822692810d0ac77c6589b0f10e.tar.zst
[ci]: slience some clang-tidy warnings
the warnings on r_readdir(), img_load_gif() and strcpy seems to be false positives. the warning about fmt being unused is valid, but not worth fixing with additional #ifdef guards. use `assert` to silence the false positive cases when possible, otherwise use a NOLINT comment with an explanation.
Diffstat (limited to 'image.c')
-rw-r--r--image.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/image.c b/image.c
index 2f469b1..bcefa54 100644
--- a/image.c
+++ b/image.c
@@ -21,6 +21,7 @@
#define INCLUDE_IMAGE_CONFIG
#include "config.h"
+#include <assert.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
@@ -262,6 +263,7 @@ static bool img_load_gif(img_t *img, const fileinfo_t *file)
*ptr = bgpixel;
}
} else {
+ assert(cmap != NULL);
r = cmap->Colors[rows[i-y][j-x]].Red;
g = cmap->Colors[rows[i-y][j-x]].Green;
b = cmap->Colors[rows[i-y][j-x]].Blue;
@@ -447,7 +449,7 @@ bool img_load(img_t *img, const fileinfo_t *file)
exif_auto_orientate(file);
#endif
- if ((fmt = imlib_image_format()) != NULL) {
+ if ((fmt = imlib_image_format()) != NULL) { /* NOLINT: fmt might be unused, not worth fixing */
#if HAVE_LIBGIF
if (STREQ(fmt, "gif"))
img_load_gif(img, file);