Make bar compile with -Wall and no warning

This commit is contained in:
LemonBoy 2015-02-14 00:20:46 +01:00
parent d8443785a8
commit 2778c81699
2 changed files with 9 additions and 4 deletions

View File

@ -1,5 +1,5 @@
CC ?= gcc CC ?= gcc
CFLAGS = -std=c99 -Os CFLAGS = -Wall -std=c99 -Os
LDFLAGS = -lxcb -lxcb-xinerama -lxcb-randr LDFLAGS = -lxcb -lxcb-xinerama -lxcb-randr
CFDEBUG = -g3 -pedantic -Wall -Wunused-parameter -Wlong-long\ CFDEBUG = -g3 -pedantic -Wall -Wunused-parameter -Wlong-long\
-Wsign-conversion -Wconversion -Wimplicit-function-declaration -Wsign-conversion -Wconversion -Wimplicit-function-declaration

11
bar.c
View File

@ -118,7 +118,12 @@ fill_gradient (xcb_drawable_t d, int x, int y, int width, int height, rgba_t sta
unsigned int bb = i * stop.b + (1. - i) * start.b; unsigned int bb = i * stop.b + (1. - i) * start.b;
// The alpha is ignored here // The alpha is ignored here
rgba_t step = { rr, gg, bb, 0xff }; rgba_t step = {
.r = rr,
.g = gg,
.b = bb,
.a = 0xff
};
xcb_change_gc(c, gc[GC_DRAW], XCB_GC_FOREGROUND, (const uint32_t []){ step.v }); xcb_change_gc(c, gc[GC_DRAW], XCB_GC_FOREGROUND, (const uint32_t []){ step.v });
xcb_poly_fill_rectangle(c, d, gc[GC_DRAW], 1, xcb_poly_fill_rectangle(c, d, gc[GC_DRAW], 1,
@ -224,7 +229,7 @@ rgba_t
parse_color (const char *str, char **end, const rgba_t def) parse_color (const char *str, char **end, const rgba_t def)
{ {
xcb_alloc_named_color_reply_t *nc_reply; xcb_alloc_named_color_reply_t *nc_reply;
size_t string_len; int string_len;
rgba_t ret; rgba_t ret;
if (!str) if (!str)
@ -1028,7 +1033,7 @@ parse_font_list (char *str)
end = tok + strlen(tok) - 1; end = tok + strlen(tok) - 1;
while (end > tok && isspace(*end) || iscntrl(*end)) while ((end > tok && isspace(*end)) || iscntrl(*end))
end--; end--;
*(end + 1) = '\0'; *(end + 1) = '\0';