Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings #357

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile.am
Expand Up @@ -20,3 +20,4 @@ i3blocks_SOURCES = \
sys.c \
sys.h \
term.h
i3blocks_CFLAGS = -Wall -Wextra -Werror $(AM_CFLAGS)
10 changes: 7 additions & 3 deletions block.c
Expand Up @@ -60,6 +60,8 @@ static int block_setenv(const char *name, const char *value, void *data)
{
int err;

(void)data;

if (!value)
value = "";

Expand Down Expand Up @@ -182,7 +184,6 @@ static int block_send_json(struct block *block)
static int block_send(struct block *block)
{
const char *button = block_get(block, "button");
int err;

if (!button) {
block_error(block, "no click data to send");
Expand Down Expand Up @@ -217,6 +218,8 @@ void block_touch(struct block *block)
unsigned long now;
int err;

(void)block;

err = sys_gettime(&now);
if (err) {
block_error(block, "failed to touch block");
Expand All @@ -236,6 +239,8 @@ static int block_child_sig(struct block *block)
sigset_t set;
int err;

(void)block;

/* It'd be safe to assume that all signals are unblocked by default */
err = sys_sigfillset(&set);
if (err)
Expand Down Expand Up @@ -482,7 +487,6 @@ int block_reap(struct block *block)
static int i3blocks_setup(struct block *block)
{
const char *value;
int err;

value = map_get(block->config, "command");
if (value && *value != '\0')
Expand Down Expand Up @@ -584,7 +588,7 @@ void block_printf(struct block *block, int lvl, const char *fmt, ...)
va_list ap;
int err;

if (lvl > log_level)
if (lvl > (int)log_level)
return;

va_start(ap, fmt);
Expand Down
2 changes: 1 addition & 1 deletion block.h
Expand Up @@ -50,7 +50,7 @@ struct block {
/* Shortcuts */
const char *command;
int interval;
unsigned signal;
int signal;
unsigned format;

/* Runtime info */
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
@@ -1,6 +1,6 @@
AC_INIT([i3blocks], 1.4)
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE(foreign)
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_PROG_CC
AC_CONFIG_HEADERS([i3blocks-config.h])
AC_CONFIG_FILES([
Expand Down
2 changes: 2 additions & 0 deletions ini.c
Expand Up @@ -47,6 +47,8 @@ static int ini_property(struct ini *ini, char *key, char *value)

static int ini_parse_line(char *line, size_t num, void *data)
{
(void)num;

/* comment or empty line? */
if (*line == '\0' || *line == '#')
return 0;
Expand Down
4 changes: 3 additions & 1 deletion json.c
Expand Up @@ -347,6 +347,8 @@ static int json_line_cb(char *line, size_t num, void *data)
size_t len;
int err;

(void)num;

for (;;) {
/* Only support inline flattened structures at the moment */
while (*line == '[' || *line == ']' || *line == ',' ||
Expand Down Expand Up @@ -452,7 +454,7 @@ int json_escape(const char *str, char *buf, size_t size)
}

/* Ensure the result was not truncated */
if (len < 0 || len >= size)
if (len < 0 || (size_t)len >= size)
return -ENOSPC;

size -= len;
Expand Down
2 changes: 1 addition & 1 deletion log.h
Expand Up @@ -40,7 +40,7 @@ static inline void log_printf(int lvl, const char *fmt, ...)
{
va_list ap;

if (lvl <= LOG_ERROR || lvl <= log_level) {
if (lvl <= LOG_ERROR || lvl <= (int)log_level) {
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
Expand Down