aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/build.yml6
-rw-r--r--commands.c27
-rw-r--r--commands.h2
-rw-r--r--main.c25
-rw-r--r--nsxiv.h33
-rw-r--r--thumbs.c6
-rw-r--r--window.c2
7 files changed, 53 insertions, 48 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index c527de1..69fcaea 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -27,9 +27,10 @@ jobs:
CFLAGS="-std=c99 -Wall -pedantic"
# extra flags
CFLAGS+=" -O3 -flto"
- CFLAGS+=" -Werror -Wextra -Wshadow -Wvla -Wpointer-arith -Wstrict-prototypes"
+ CFLAGS+=" -Werror -Wextra -Wshadow -Wvla -Wpointer-arith"
CFLAGS+=" -Wundef -Wstrict-overflow=4 -Wwrite-strings -Wunreachable-code"
CFLAGS+=" -Wbad-function-cast -Wdeclaration-after-statement"
+ CFLAGS+=" -Wmissing-prototypes -Wstrict-prototypes"
# silence
CFLAGS+=" -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers"
echo "### GCC BUILD ###" && make clean && make -s CC=gcc CFLAGS="$CFLAGS" LDFLAGS="$CFLAGS" OPT_DEP_DEFAULT=1
@@ -55,9 +56,10 @@ jobs:
CFLAGS="-std=c99 -Wall -pedantic"
# extra flags
CFLAGS+=" -O3 -flto"
- CFLAGS+=" -Werror -Wextra -Wshadow -Wvla -Wpointer-arith -Wstrict-prototypes"
+ CFLAGS+=" -Werror -Wextra -Wshadow -Wvla -Wpointer-arith"
CFLAGS+=" -Wundef -Wstrict-overflow=4 -Wwrite-strings -Wunreachable-code"
CFLAGS+=" -Wbad-function-cast -Wdeclaration-after-statement"
+ CFLAGS+=" -Wmissing-prototypes -Wstrict-prototypes"
# silence
CFLAGS+=" -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers"
echo "### GCC BUILD ###" && make clean && make -s CC=gcc CFLAGS="$CFLAGS" LDFLAGS="$CFLAGS" OPT_DEP_DEFAULT=0
diff --git a/commands.c b/commands.c
index 111d1e9..9ee83ec 100644
--- a/commands.c
+++ b/commands.c
@@ -24,34 +24,11 @@
#include <unistd.h>
#include <sys/wait.h>
-void remove_file(int, bool);
-void load_image(int);
-bool mark_image(int, bool);
-void close_info(void);
-void open_info(void);
-int nav_button(void);
-void redraw(void);
-void reset_cursor(void);
-void animate(void);
-void slideshow(void);
-void set_timeout(timeout_f, int, bool);
-void reset_timeout(timeout_f);
-void handle_key_handler(bool);
-
-extern appmode_t mode;
+#include "commands.h"
+
extern img_t img;
extern tns_t tns;
extern win_t win;
-extern const XButtonEvent *xbutton_ev;
-
-extern fileinfo_t *files;
-extern int filecnt, fileidx;
-extern int alternate;
-extern int markcnt;
-extern int markidx;
-
-extern int prefix;
-extern bool extprefix;
bool cg_quit(arg_t status)
{
diff --git a/commands.h b/commands.h
index b78157d..74e2638 100644
--- a/commands.h
+++ b/commands.h
@@ -44,6 +44,7 @@ bool ct_scroll(arg_t);
bool ct_drag_mark_image(arg_t);
bool ct_select(arg_t);
+#ifdef _MAPPINGS_CONFIG
/* global */
#define g_change_gamma { cg_change_gamma, MODE_ALL }
#define g_first { cg_first, MODE_ALL }
@@ -88,4 +89,5 @@ bool ct_select(arg_t);
#define t_drag_mark_image { ct_drag_mark_image, MODE_THUMB }
#define t_select { ct_select, MODE_THUMB }
+#endif /* _MAPPINGS_CONFIG */
#endif /* COMMANDS_H */
diff --git a/main.c b/main.c
index 29bb1ec..976bd5f 100644
--- a/main.c
+++ b/main.c
@@ -18,8 +18,8 @@
*/
#include "nsxiv.h"
-#include "commands.h"
#define _MAPPINGS_CONFIG
+#include "commands.h"
#include "config.h"
#include <stdlib.h>
@@ -45,18 +45,18 @@ typedef struct {
timeout_f handler;
} timeout_t;
-/* timeout handler functions: */
-void redraw(void);
-void reset_cursor(void);
-void animate(void);
-void slideshow(void);
-void clear_resize(void);
+typedef struct {
+ int err;
+ char *cmd;
+} extcmd_t;
-appmode_t mode;
+/* these are not declared in nsxiv.h, as it causes too many -Wshadow warnings */
arl_t arl;
img_t img;
tns_t tns;
win_t win;
+
+appmode_t mode;
const XButtonEvent *xbutton_ev;
fileinfo_t *files;
@@ -70,11 +70,6 @@ static bool extprefix;
static bool resized = false;
-typedef struct {
- int err;
- char *cmd;
-} extcmd_t;
-
static struct {
extcmd_t f, ft;
int fd;
@@ -527,7 +522,7 @@ void clear_resize(void)
resized = false;
}
-Bool is_input_ev(Display *dpy, XEvent *ev, XPointer arg)
+static Bool is_input_ev(Display *dpy, XEvent *ev, XPointer arg)
{
return ev->type == ButtonPress || ev->type == KeyPress;
}
@@ -822,7 +817,7 @@ static int fncmp(const void *a, const void *b)
return strcoll(((fileinfo_t*) a)->name, ((fileinfo_t*) b)->name);
}
-void sigchld(int sig)
+static void sigchld(int sig)
{
while (waitpid(-1, NULL, WNOHANG) > 0);
}
diff --git a/nsxiv.h b/nsxiv.h
index 67c2185..f9f5600 100644
--- a/nsxiv.h
+++ b/nsxiv.h
@@ -232,6 +232,10 @@ void img_toggle_antialias(img_t*);
bool img_change_gamma(img_t*, int);
bool img_frame_navigate(img_t*, int);
bool img_frame_animate(img_t*);
+Imlib_Image img_open(const fileinfo_t*);
+#if HAVE_LIBEXIF
+void exif_auto_orientate(const fileinfo_t*);
+#endif
/* options.c */
@@ -449,4 +453,33 @@ void win_set_title(win_t*, bool);
void win_set_cursor(win_t*, cursor_t);
void win_cursor_pos(win_t*, int*, int*);
+/* main.c */
+
+/* timeout handler functions: */
+void redraw(void);
+void reset_cursor(void);
+void animate(void);
+void slideshow(void);
+void clear_resize(void);
+
+void remove_file(int, bool);
+void set_timeout(timeout_f, int, bool);
+void reset_timeout(timeout_f);
+size_t get_win_title(unsigned char*, int, bool);
+void close_info(void);
+void open_info(void);
+void load_image(int);
+bool mark_image(int, bool);
+int nav_button(void);
+void handle_key_handler(bool);
+
+extern appmode_t mode;
+extern const XButtonEvent *xbutton_ev;
+extern fileinfo_t *files;
+extern int filecnt, fileidx;
+extern int alternate;
+extern int markcnt;
+extern int markidx;
+extern int prefix;
+
#endif /* NSXIV_H */
diff --git a/thumbs.c b/thumbs.c
index b4c2de3..52820d4 100644
--- a/thumbs.c
+++ b/thumbs.c
@@ -31,9 +31,7 @@
#if HAVE_LIBEXIF
#include <libexif/exif-data.h>
-void exif_auto_orientate(const fileinfo_t*);
#endif
-Imlib_Image img_open(const fileinfo_t*);
static char *cache_dir;
@@ -143,7 +141,7 @@ void tns_clean_cache(void)
r_closedir(&dir);
}
-void tns_init(tns_t *tns, fileinfo_t *files, const int *cnt, int *sel, win_t *win)
+void tns_init(tns_t *tns, fileinfo_t *tns_files, const int *cnt, int *sel, win_t *win)
{
int len;
const char *homedir, *dsuffix = "";
@@ -152,7 +150,7 @@ void tns_init(tns_t *tns, fileinfo_t *files, const int *cnt, int *sel, win_t *wi
tns->thumbs = ecalloc(*cnt, sizeof(thumb_t));
else
tns->thumbs = NULL;
- tns->files = files;
+ tns->files = tns_files;
tns->cnt = cnt;
tns->initnext = tns->loadnext = 0;
tns->first = tns->end = tns->r_first = tns->r_end = 0;
diff --git a/window.c b/window.c
index 57245e9..69c7b66 100644
--- a/window.c
+++ b/window.c
@@ -30,8 +30,6 @@
#include <X11/Xatom.h>
#include <X11/Xresource.h>
-extern size_t get_win_title(unsigned char *, int, bool);
-
#if HAVE_LIBFONTS
#include "utf8.h"
static XftFont *font;