summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Gayot <olivier.gayot@sigexec.com>2018-06-12 09:41:44 +0200
committerOlivier Gayot <olivier.gayot@sigexec.com>2018-06-20 14:20:17 +0200
commit598b76cc5332e196518a9ec6d722ebaeb3781a9c (patch)
treeae79380434e291215c6e85295f5a369cd0ece0e3
parentca8c3e73372babbf1aaa47db55a9360739ca37c5 (diff)
Make sure the arguments passed to printf/die(...) match the format
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
-rw-r--r--i3status.c4
-rw-r--r--include/i3status.h3
-rw-r--r--src/print_volume.c2
3 files changed, 5 insertions, 4 deletions
diff --git a/i3status.c b/i3status.c
index 6461d6b..316159c 100644
--- a/i3status.c
+++ b/i3status.c
@@ -106,7 +106,7 @@ static bool path_exists(const char *path) {
static void *scalloc(size_t size) {
void *result = calloc(size, 1);
- exit_if_null(result, "Error: out of memory (calloc(%zd))\n", size);
+ exit_if_null(result, "Error: out of memory (calloc(%zu))\n", size);
return result;
}
@@ -142,7 +142,7 @@ static int parse_min_width(cfg_t *context, cfg_opt_t *option, const char *value,
long num = strtol(value, &end, 10);
if (num < 0)
- die("Invalid min_width attribute found in section %s, line %d: %d\n"
+ die("Invalid min_width attribute found in section %s, line %d: %ld\n"
"Expected positive integer or string\n",
context->name, context->line, num);
else if (num == LONG_MIN || num == LONG_MAX || (end && *end != '\0'))
diff --git a/include/i3status.h b/include/i3status.h
index fe9206e..7bedfed 100644
--- a/include/i3status.h
+++ b/include/i3status.h
@@ -186,7 +186,8 @@ char *sstrdup(const char *str);
/* src/general.c */
char *skip_character(char *input, char character, int amount);
-void die(const char *fmt, ...);
+
+void die(const char *fmt, ...) __attribute__((format(printf, 1, 2), noreturn));
bool slurp(const char *filename, char *destination, int size);
/* src/output.c */
diff --git a/src/print_volume.c b/src/print_volume.c
index be6a1d7..e28a132 100644
--- a/src/print_volume.c
+++ b/src/print_volume.c
@@ -151,7 +151,7 @@ void print_volume(yajl_gen json_gen, char *buffer, const char *fmt, const char *
snd_mixer_selem_id_set_index(sid, mixer_idx);
snd_mixer_selem_id_set_name(sid, mixer);
if (!(elem = snd_mixer_find_selem(m, sid))) {
- fprintf(stderr, "i3status: ALSA: Cannot find mixer %s (index %i)\n",
+ fprintf(stderr, "i3status: ALSA: Cannot find mixer %s (index %u)\n",
snd_mixer_selem_id_get_name(sid), snd_mixer_selem_id_get_index(sid));
snd_mixer_close(m);
snd_mixer_selem_id_free(sid);