[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.
pull/319/head
NRK 2 years ago committed by Gitea
parent 4cf17d2349
commit 5c3a796e55

@ -79,7 +79,7 @@ void arl_setup(arl_t *arl, const char *filepath)
if (base != NULL) {
arl->filename[++base - filepath] = '\0';
add_watch(arl->fd, &arl->wd_dir, arl->filename, IN_CREATE | IN_MOVED_TO);
strcpy(arl->filename, base);
strcpy(arl->filename, base); /* NOLINT: basename will always be shorter than fullpath */
}
}

@ -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);

@ -19,6 +19,7 @@
#include "nsxiv.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
@ -178,6 +179,7 @@ char* r_readdir(r_dir_t *rdir, bool skip_dotfiles)
if (rdir->recursive && rdir->stlen > 0) {
/* open next subdirectory */
assert(rdir->dir != NULL);
closedir(rdir->dir);
if (rdir->d != 0)
free(rdir->name);

Loading…
Cancel
Save