wmfs compile with -W -Wall -Wextra (TODO: fix types !!)

This commit is contained in:
Philippe Pepiot 2010-11-17 02:27:15 +01:00
parent b6c557a8ee
commit c2664e8e85
18 changed files with 127 additions and 58 deletions

View File

@ -32,6 +32,7 @@ src/wmfs.c
# flags # flags
CFLAGS+= -DXDG_CONFIG_DIR=\"${XDG_CONFIG_DIR}\" CFLAGS+= -DXDG_CONFIG_DIR=\"${XDG_CONFIG_DIR}\"
CFLAGS+= -DWMFS_VERSION=\"${VERSION}\" CFLAGS+= -DWMFS_VERSION=\"${VERSION}\"
CFLAGS+= -W -Wall -Wextra -ansi
OBJS= ${SRCS:.c=.o} OBJS= ${SRCS:.c=.o}

View File

@ -293,7 +293,7 @@ barwin_refresh_color(BarWindow *bw)
if(bw->stipple) if(bw->stipple)
{ {
XSetForeground(dpy, gc_stipple, ((bw->stipple_color != -1) ? bw->stipple_color : getcolor(bw->fg))); XSetForeground(dpy, gc_stipple, ((bw->stipple_color != (uint)-1) ? (long)bw->stipple_color : getcolor(bw->fg)));
XFillRectangle(dpy, bw->dr, gc_stipple, 3, 2, bw->geo.width - 6, bw->geo.height - 4); XFillRectangle(dpy, bw->dr, gc_stipple, 3, 2, bw->geo.width - 6, bw->geo.height - 4);
} }

View File

@ -181,6 +181,7 @@ void
uicb_client_prev(uicb_t cmd) uicb_client_prev(uicb_t cmd)
{ {
Client *c; Client *c;
(void)cmd;
if((c = client_get_prev())) if((c = client_get_prev()))
{ {
@ -198,6 +199,7 @@ void
uicb_client_next(uicb_t cmd) uicb_client_next(uicb_t cmd)
{ {
Client *c; Client *c;
(void)cmd;
if((c = client_get_next())) if((c = client_get_next()))
{ {
@ -215,6 +217,7 @@ void
uicb_client_swap_next(uicb_t cmd) uicb_client_swap_next(uicb_t cmd)
{ {
Client *c; Client *c;
(void)cmd;
if((c = client_get_next())) if((c = client_get_next()))
{ {
@ -232,6 +235,7 @@ void
uicb_client_swap_prev(uicb_t cmd) uicb_client_swap_prev(uicb_t cmd)
{ {
Client *c; Client *c;
(void)cmd;
if((c = client_get_prev())) if((c = client_get_prev()))
{ {
@ -249,6 +253,7 @@ void
uicb_client_focus_right(uicb_t cmd) uicb_client_focus_right(uicb_t cmd)
{ {
Client *c; Client *c;
(void)cmd;
if((c = client_get_next_with_direction(Right))) if((c = client_get_next_with_direction(Right)))
{ {
@ -267,6 +272,7 @@ void
uicb_client_focus_left(uicb_t cmd) uicb_client_focus_left(uicb_t cmd)
{ {
Client *c; Client *c;
(void)cmd;
if((c = client_get_next_with_direction(Left))) if((c = client_get_next_with_direction(Left)))
{ {
@ -284,6 +290,7 @@ void
uicb_client_focus_top(uicb_t cmd) uicb_client_focus_top(uicb_t cmd)
{ {
Client *c; Client *c;
(void)cmd;
if((c = client_get_next_with_direction(Top))) if((c = client_get_next_with_direction(Top)))
{ {
@ -301,6 +308,7 @@ void
uicb_client_focus_bottom(uicb_t cmd) uicb_client_focus_bottom(uicb_t cmd)
{ {
Client *c; Client *c;
(void)cmd;
if((c = client_get_next_with_direction(Bottom))) if((c = client_get_next_with_direction(Bottom)))
{ {
@ -317,7 +325,9 @@ uicb_client_focus_bottom(uicb_t cmd)
void void
client_above(Client *c) client_above(Client *c)
{ {
XRectangle geo = { 0 }; XRectangle geo;
memset(&geo, 0, sizeof(geo));
if(c->flags & AboveFlag) if(c->flags & AboveFlag)
return; return;
@ -373,7 +383,7 @@ client_focus(Client *c)
/* Set focusontag option */ /* Set focusontag option */
for(cc = clients; cc; cc = cc->next) for(cc = clients; cc; cc = cc->next)
if(cc->focusontag == c->tag) if(cc->focusontag == (int)c->tag)
cc->focusontag = -1; cc->focusontag = -1;
c->focusontag = seltag[selscreen]; c->focusontag = seltag[selscreen];
@ -559,7 +569,7 @@ client_hide(Client *c)
Bool Bool
ishide(Client *c, int screen) ishide(Client *c, int screen)
{ {
if(((c->tag == seltag[screen] || c->tag == MAXTAG + 1) && c->screen == screen) if(((c->tag == (uint)seltag[screen] || c->tag == MAXTAG + 1) && c->screen == screen)
|| tags[screen][seltag[screen]].tagad & TagFlag(c->tag)) || tags[screen][seltag[screen]].tagad & TagFlag(c->tag))
return False; return False;
@ -614,6 +624,7 @@ client_kill(Client *c)
void void
uicb_client_kill(uicb_t cmd) uicb_client_kill(uicb_t cmd)
{ {
(void)cmd;
CHECK(sel); CHECK(sel);
client_kill(sel); client_kill(sel);
@ -990,13 +1001,15 @@ client_swap(Client *c1, Client *c2)
void void
client_set_rules(Client *c) client_set_rules(Client *c)
{ {
XClassHint xch = { 0 }; XClassHint xch;
int i, j, k, f; int i, j, k, f;
Atom rf; Atom rf;
ulong n, il; ulong n, il;
uchar *data = NULL; uchar *data = NULL;
char wwrole[256] = { 0 }; char wwrole[256] = { 0 };
memset(&xch, 0, sizeof(xch));
if(conf.ignore_next_client_rules) if(conf.ignore_next_client_rules)
{ {
conf.ignore_next_client_rules = False; conf.ignore_next_client_rules = False;
@ -1040,7 +1053,7 @@ client_set_rules(Client *c)
c->screen = i; c->screen = i;
c->tag = j; c->tag = j;
if(c->tag != seltag[selscreen]) if(c->tag != (uint)seltag[selscreen])
{ {
tags[c->screen][c->tag].request_update = True; tags[c->screen][c->tag].request_update = True;
client_focus(NULL); client_focus(NULL);
@ -1074,7 +1087,7 @@ client_set_rules(Client *c)
c->flags |= MaxFlag; c->flags |= MaxFlag;
} }
if(c->tag != seltag[selscreen]) if(c->tag != (uint)seltag[selscreen])
{ {
tags[c->screen][c->tag].request_update = True; tags[c->screen][c->tag].request_update = True;
client_focus(NULL); client_focus(NULL);
@ -1131,6 +1144,7 @@ client_raise(Client *c)
void void
uicb_client_raise(uicb_t cmd) uicb_client_raise(uicb_t cmd)
{ {
(void)cmd;
CHECK(sel); CHECK(sel);
client_raise(sel); client_raise(sel);
@ -1167,7 +1181,7 @@ client_focus_next(Client *c)
&& c_next->screen != c->screen; && c_next->screen != c->screen;
c_next = c_next->next); c_next = c_next->next);
if(c_next && c_next->tag == seltag[selscreen] if(c_next && c_next->tag == (uint)seltag[selscreen]
&& c_next->screen == selscreen) && c_next->screen == selscreen)
client_focus(c_next); client_focus(c_next);
@ -1204,7 +1218,7 @@ client_unmanage(Client *c)
/* Arrange */ /* Arrange */
for(i = 0; i < screen_count() && !b; ++i) for(i = 0; i < screen_count() && !b; ++i)
if(c->tag == seltag[i] || tags[i][seltag[i]].tagad & TagFlag(c->tag)) if(c->tag == (uint)seltag[i] || tags[i][seltag[i]].tagad & TagFlag(c->tag))
b = True; b = True;
if(b) if(b)
@ -1299,6 +1313,7 @@ client_set_screen(Client *c, int s)
void void
uicb_client_screen_next(uicb_t cmd) uicb_client_screen_next(uicb_t cmd)
{ {
(void)cmd;
CHECK(sel); CHECK(sel);
client_set_screen(sel, (sel->screen + 1 > screen_count() - 1) ? 0 : sel->screen + 1); client_set_screen(sel, (sel->screen + 1 > screen_count() - 1) ? 0 : sel->screen + 1);
@ -1312,6 +1327,7 @@ uicb_client_screen_next(uicb_t cmd)
void void
uicb_client_screen_prev(uicb_t cmd) uicb_client_screen_prev(uicb_t cmd)
{ {
(void)cmd;
CHECK(sel); CHECK(sel);
client_set_screen(sel, (sel->screen - 1 < 0) ? screen_count() - 1 : sel->screen - 1); client_set_screen(sel, (sel->screen - 1 < 0) ? screen_count() - 1 : sel->screen - 1);
@ -1384,6 +1400,7 @@ uicb_client_resize(uicb_t cmd)
void void
uicb_ignore_next_client_rules(uicb_t cmd) uicb_ignore_next_client_rules(uicb_t cmd)
{ {
(void)cmd;
conf.ignore_next_client_rules = !conf.ignore_next_client_rules; conf.ignore_next_client_rules = !conf.ignore_next_client_rules;
return; return;
@ -1465,7 +1482,7 @@ uicb_client_select(uicb_t cmd)
if(clist_index[i].client->screen != selscreen) if(clist_index[i].client->screen != selscreen)
screen_set_sel(clist_index[i].client->screen); screen_set_sel(clist_index[i].client->screen);
if(clist_index[i].client->tag != seltag[clist_index[i].client->screen]) if(clist_index[i].client->tag != (uint)seltag[clist_index[i].client->screen])
tag_set(clist_index[i].client->tag); tag_set(clist_index[i].client->tag);
client_focus(clist_index[i].client); client_focus(clist_index[i].client);
@ -1487,6 +1504,7 @@ uicb_client_select(uicb_t cmd)
Bool Bool
uicb_checkclist(uicb_t cmd) uicb_checkclist(uicb_t cmd)
{ {
(void)cmd;
return True; return True;
} }
@ -1496,6 +1514,7 @@ uicb_checkclist(uicb_t cmd)
void void
uicb_client_ignore_tag(uicb_t cmd) uicb_client_ignore_tag(uicb_t cmd)
{ {
(void)cmd;
CHECK(sel); CHECK(sel);
screen_get_sel(); screen_get_sel();

View File

@ -725,7 +725,8 @@ conf_launcher_section(void)
void void
conf_keybind_section(void) conf_keybind_section(void)
{ {
int i, j; int i;
size_t j;
struct conf_sec *sec, **ks; struct conf_sec *sec, **ks;
struct opt_type *opt; struct opt_type *opt;

View File

@ -51,6 +51,7 @@ draw_image_ofset_text(Drawable d, int x, int y, char* fg, int pad, char *str, in
{ {
XftColor xftcolor; XftColor xftcolor;
XftDraw *xftd; XftDraw *xftd;
(void)pad;
if(!str) if(!str)
return; return;
@ -130,7 +131,7 @@ draw_rectangle(Drawable dr, int x, int y, uint w, uint h, uint color)
void void
draw_graph(Drawable dr, int x, int y, uint w, uint h, uint color, char *data) draw_graph(Drawable dr, int x, int y, uint w, uint h, uint color, char *data)
{ {
int i; uint i;
XSetForeground(dpy, gc, color); XSetForeground(dpy, gc, color);

View File

@ -236,7 +236,7 @@ clientmessageevent(XClientMessageEvent *ev)
/* Manage _NET_WM_DESKTOP */ /* Manage _NET_WM_DESKTOP */
if(mess_t == net_wm_desktop) if(mess_t == net_wm_desktop)
if((c = client_gb_win(ev->window)) && ev->data.l[0] != 0xFFFFFFFF) if((c = client_gb_win(ev->window)) && ev->data.l[0] != (long)0xFFFFFFFF)
tag_transfert(c, ev->data.l[0]); tag_transfert(c, ev->data.l[0]);
/* Manage _WMFS_STATUSTEXT_x */ /* Manage _WMFS_STATUSTEXT_x */
@ -446,7 +446,7 @@ focusin(XFocusChangeEvent *ev)
void void
grabkeys(void) grabkeys(void)
{ {
uint i; int i;
KeyCode code; KeyCode code;
XUngrabKey(dpy, AnyKey, AnyModifier, ROOT); XUngrabKey(dpy, AnyKey, AnyModifier, ROOT);
@ -468,7 +468,7 @@ grabkeys(void)
void void
keypress(XKeyPressedEvent *ev) keypress(XKeyPressedEvent *ev)
{ {
uint i; int i;
KeySym keysym; KeySym keysym;
keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
@ -607,6 +607,7 @@ propertynotify(XPropertyEvent *ev)
void void
reparentnotify(XReparentEvent *ev) reparentnotify(XReparentEvent *ev)
{ {
(void)ev;
return; return;
} }

View File

@ -357,7 +357,7 @@ void
ewmh_manage_net_wm_state(long data_l[], Client *c) ewmh_manage_net_wm_state(long data_l[], Client *c)
{ {
/* Manage _NET_WM_STATE_FULLSCREEN */ /* Manage _NET_WM_STATE_FULLSCREEN */
if(data_l[1] == net_atom[net_wm_state_fullscreen]) if(data_l[1] == (long)net_atom[net_wm_state_fullscreen])
{ {
if(data_l[0] == _NET_WM_STATE_ADD && !(c->flags & FSSFlag)) if(data_l[0] == _NET_WM_STATE_ADD && !(c->flags & FSSFlag))
{ {
@ -392,14 +392,14 @@ ewmh_manage_net_wm_state(long data_l[], Client *c)
} }
} }
/* Manage _NET_WM_STATE_STICKY */ /* Manage _NET_WM_STATE_STICKY */
else if(data_l[1] == net_atom[net_wm_state_sticky]) else if(data_l[1] == (long)net_atom[net_wm_state_sticky])
{ {
/* == client_ignore_tag */ /* == client_ignore_tag */
c->tag = MAXTAG + 1; c->tag = MAXTAG + 1;
arrange(c->screen, True); arrange(c->screen, True);
} }
/* Manage _NET_WM_STATE_DEMANDS_ATTENTION */ /* Manage _NET_WM_STATE_DEMANDS_ATTENTION */
else if(data_l[1] == net_atom[net_wm_state_demands_attention]) else if(data_l[1] == (long)net_atom[net_wm_state_demands_attention])
{ {
if(data_l[0] == _NET_WM_STATE_ADD) if(data_l[0] == _NET_WM_STATE_ADD)
client_focus(c); client_focus(c);
@ -419,8 +419,8 @@ void
ewmh_manage_window_type(Client *c) ewmh_manage_window_type(Client *c)
{ {
Atom *atom, rf; Atom *atom, rf;
int i, f; int f;
ulong n, il; ulong n, il, i;
uchar *data = NULL; uchar *data = NULL;
long ldata[5] = { 0 }; long ldata[5] = { 0 };

View File

@ -95,7 +95,7 @@ infobar_init(void)
/* Create layout switch barwindow */ /* Create layout switch barwindow */
infobar[sc].layout_button = barwin_create(infobar[sc].bar->win, infobar[sc].layout_button = barwin_create(infobar[sc].bar->win,
((conf.layout_placement) ? 0 : (j + PAD / 2)), 0, ((conf.layout_placement) ? 0 : (j + PAD / 2)), 0,
((conf.layout_button_width > 0) ? conf.layout_button_width : (textw(tags[sc][seltag[sc]].layout.symbol) + PAD)), ((conf.layout_button_width > 0) ? (uint)conf.layout_button_width : (textw(tags[sc][seltag[sc]].layout.symbol) + PAD)),
infobar[sc].geo.height, infobar[sc].geo.height,
conf.colors.layout_bg, conf.colors.layout_fg, conf.colors.layout_bg, conf.colors.layout_fg,
False, False, conf.border.layout); False, False, conf.border.layout);
@ -159,7 +159,7 @@ infobar_draw_layout(int sc)
if(!conf.layout_placement) if(!conf.layout_placement)
barwin_move(infobar[sc].layout_button, infobar[sc].tags_board->geo.width + PAD / 2, 0); barwin_move(infobar[sc].layout_button, infobar[sc].tags_board->geo.width + PAD / 2, 0);
barwin_resize(infobar[sc].layout_button, ((conf.layout_button_width > 0) ? conf.layout_button_width : (textw(tags[sc][seltag[sc]].layout.symbol) + PAD)), infobar[sc].geo.height); barwin_resize(infobar[sc].layout_button, ((conf.layout_button_width > 0) ? (uint)conf.layout_button_width : (textw(tags[sc][seltag[sc]].layout.symbol) + PAD)), infobar[sc].geo.height);
barwin_refresh_color(infobar[sc].layout_button); barwin_refresh_color(infobar[sc].layout_button);
if(tags[sc][seltag[sc]].layout.symbol) if(tags[sc][seltag[sc]].layout.symbol)
@ -193,7 +193,7 @@ infobar_draw_selbar(int sc)
str = emalloc(conf.selbar.maxlength + 4, sizeof(char)); str = emalloc(conf.selbar.maxlength + 4, sizeof(char));
strncpy(str, sel->title, conf.selbar.maxlength); strncpy(str, sel->title, conf.selbar.maxlength);
if(strlen(sel->title) > conf.selbar.maxlength) if(strlen(sel->title) > (size_t)conf.selbar.maxlength)
strcat(str, "..."); strcat(str, "...");
} }
@ -225,7 +225,7 @@ infobar_draw_taglist(int sc)
Bool is_occupied[MAXTAG + 1]; Bool is_occupied[MAXTAG + 1];
if(conf.layout_placement) if(conf.layout_placement)
barwin_move(infobar[sc].tags_board, ((conf.layout_button_width > 0) ? conf.layout_button_width : (textw(tags[sc][seltag[sc]].layout.symbol) + PAD)) + PAD / 2, 0); barwin_move(infobar[sc].tags_board, ((conf.layout_button_width > 0) ? (uint)conf.layout_button_width : (textw(tags[sc][seltag[sc]].layout.symbol) + PAD)) + PAD / 2, 0);
for(i = 0; i < MAXTAG; i++) for(i = 0; i < MAXTAG; i++)
is_occupied[i] = False; is_occupied[i] = False;
@ -393,6 +393,7 @@ infobar_set_position(int pos)
void void
uicb_infobar_togglepos(uicb_t cmd) uicb_infobar_togglepos(uicb_t cmd)
{ {
(void)cmd;
screen_get_sel(); screen_get_sel();
infobar_set_position((tags[selscreen][seltag[selscreen]].barpos infobar_set_position((tags[selscreen][seltag[selscreen]].barpos
@ -410,6 +411,7 @@ void
uicb_toggle_tagautohide(uicb_t cmd) uicb_toggle_tagautohide(uicb_t cmd)
{ {
int i, x; int i, x;
(void)cmd;
screen_get_sel(); screen_get_sel();
conf.tagautohide = !conf.tagautohide; conf.tagautohide = !conf.tagautohide;

View File

@ -108,14 +108,14 @@ launcher_execute(Launcher *launcher)
case XK_Up: case XK_Up:
if(launcher->nhisto) if(launcher->nhisto)
{ {
if(histpos >= launcher->nhisto) if(histpos >= (int)launcher->nhisto)
histpos = 0; histpos = 0;
strncpy(buf, launcher->histo[launcher->nhisto - ++histpos], sizeof(buf)); strncpy(buf, launcher->histo[launcher->nhisto - ++histpos], sizeof(buf));
pos = strlen(buf); pos = strlen(buf);
} }
break; break;
case XK_Down: case XK_Down:
if(launcher->nhisto && histpos > 0 && histpos < launcher->nhisto) if(launcher->nhisto && histpos > 0 && histpos < (int)launcher->nhisto)
{ {
strncpy(buf, launcher->histo[launcher->nhisto - --histpos], sizeof(buf)); strncpy(buf, launcher->histo[launcher->nhisto - --histpos], sizeof(buf));
pos = strlen(buf); pos = strlen(buf);

View File

@ -65,6 +65,7 @@ void
freelayout(int screen) freelayout(int screen)
{ {
Client *c; Client *c;
(void)screen;
for(c = clients; c; c = c->next) for(c = clients; c; c = c->next)
if(!ishide(c, selscreen) if(!ishide(c, selscreen)
@ -92,7 +93,7 @@ layoutswitch(Bool b)
screen_get_sel(); screen_get_sel();
if(tags[selscreen][seltag[selscreen]].layout.func == freelayout) if(tags[selscreen][seltag[selscreen]].layout.func == freelayout)
for(c = clients; c && (c->tag != seltag[selscreen] && c->screen != selscreen); c = c->next) for(c = clients; c && (c->tag != (uint)seltag[selscreen] && c->screen != selscreen); c = c->next)
{ {
c->ogeo = c->geo; c->ogeo = c->geo;
c->free_geo = c->geo; c->free_geo = c->geo;
@ -124,6 +125,7 @@ layoutswitch(Bool b)
void void
uicb_layout_next(uicb_t cmd) uicb_layout_next(uicb_t cmd)
{ {
(void)cmd;
layoutswitch(True); layoutswitch(True);
return; return;
@ -135,6 +137,7 @@ uicb_layout_next(uicb_t cmd)
void void
uicb_layout_prev(uicb_t cmd) uicb_layout_prev(uicb_t cmd)
{ {
(void)cmd;
layoutswitch(False); layoutswitch(False);
return; return;
@ -321,15 +324,15 @@ multi_tile(int screen, Position type)
if(type == Top || type == Bottom) if(type == Top || type == Bottom)
{ {
if(type == Top) if(type == Top)
mastergeo.y = (n <= nmaster) ? sg.y : sg.y + (sg.height - mwfact) - BORDH; mastergeo.y = (n <= nmaster) ? (uint)sg.y : sg.y + (sg.height - mwfact) - BORDH;
mastergeo.width = (sg.width / nmaster) - (BORDH * 4); mastergeo.width = (sg.width / nmaster) - (BORDH * 4);
mastergeo.height = (n <= nmaster) ? sg.height - BORDH : mwfact; mastergeo.height = (n <= nmaster) ? (uint)(sg.height - BORDH) : mwfact;
} }
else else
{ {
if(type == Left) if(type == Left)
mastergeo.x = (n <= nmaster) ? sg.x : (sg.x + sg.width) - mwfact - (BORDH * 2); mastergeo.x = (n <= nmaster) ? (uint)sg.x : (sg.x + sg.width) - mwfact - (BORDH * 2);
mastergeo.width = (n <= nmaster) ? sg.width - (BORDH * 2) : mwfact; mastergeo.width = (n <= nmaster) ? (uint)(sg.width - (BORDH * 2)) : mwfact;
mastergeo.height = (sg.height / nmaster) - BORDH; mastergeo.height = (sg.height / nmaster) - BORDH;
} }
@ -434,12 +437,15 @@ mirror(int screen, Bool horizontal)
XRectangle sg = sgeo[screen]; XRectangle sg = sgeo[screen];
XRectangle mastergeo = {sg.x, sg.y, sg.width, sg.height}; XRectangle mastergeo = {sg.x, sg.y, sg.width, sg.height};
XRectangle cgeo = {sg.x, sg.y , sg.width, sg.height}; XRectangle cgeo = {sg.x, sg.y , sg.width, sg.height};
XRectangle nextg[2] = { {0} }; XRectangle nextg[2];
uint i, n, tilesize = 0, mwfact; uint i, n, tilesize = 0, mwfact;
uint nmaster = tags[screen][seltag[screen]].nmaster; uint nmaster = tags[screen][seltag[screen]].nmaster;
int pa, imp; int pa, imp;
Bool isp = 0; Bool isp = 0;
memset(&nextg[0], 0, sizeof(nextg[0]));
memset(&nextg[1], 0, sizeof(nextg[2]));
for(n = 0, c = tiled_client(screen, clients); c; c = tiled_client(screen, c->next), ++n); for(n = 0, c = tiled_client(screen, clients); c; c = tiled_client(screen, c->next), ++n);
CHECK(n); CHECK(n);
@ -687,6 +693,7 @@ grid_vertical(int screen)
void void
uicb_tile_switch(uicb_t cmd) uicb_tile_switch(uicb_t cmd)
{ {
(void)cmd;
layout_set_client_master (sel); layout_set_client_master (sel);
return; return;
} }
@ -697,6 +704,8 @@ uicb_tile_switch(uicb_t cmd)
void void
uicb_togglefree(uicb_t cmd) uicb_togglefree(uicb_t cmd)
{ {
(void)cmd;
if(!sel || sel->screen != screen_get_sel() || (sel->flags & FSSFlag)) if(!sel || sel->screen != screen_get_sel() || (sel->flags & FSSFlag))
return; return;
@ -728,6 +737,8 @@ uicb_togglefree(uicb_t cmd)
void void
uicb_togglemax(uicb_t cmd) uicb_togglemax(uicb_t cmd)
{ {
(void)cmd;
if(!sel || ishide(sel, selscreen) if(!sel || ishide(sel, selscreen)
|| (sel->flags & HintFlag)|| (sel->flags & FSSFlag)) || (sel->flags & HintFlag)|| (sel->flags & FSSFlag))
return; return;
@ -759,6 +770,7 @@ void
uicb_toggle_resizehint(uicb_t cmd) uicb_toggle_resizehint(uicb_t cmd)
{ {
screen_get_sel(); screen_get_sel();
(void)cmd;
tags[selscreen][seltag[selscreen]].resizehint = !tags[selscreen][seltag[selscreen]].resizehint; tags[selscreen][seltag[selscreen]].resizehint = !tags[selscreen][seltag[selscreen]].resizehint;
@ -774,6 +786,7 @@ void
uicb_toggle_abovefc(uicb_t cmd) uicb_toggle_abovefc(uicb_t cmd)
{ {
Client *c; Client *c;
(void)cmd;
screen_get_sel(); screen_get_sel();
@ -782,7 +795,7 @@ uicb_toggle_abovefc(uicb_t cmd)
for(c = clients; c; c = c->next) for(c = clients; c; c = c->next)
if(c->flags & AboveFlag if(c->flags & AboveFlag
&& c->screen == selscreen && c->screen == selscreen
&& c->tag == seltag[selscreen]) && c->tag == (uint)seltag[selscreen])
{ {
c->flags &= ~AboveFlag; c->flags &= ~AboveFlag;
break; break;
@ -802,7 +815,7 @@ uicb_toggle_abovefc(uicb_t cmd)
void void
uicb_set_layout(uicb_t cmd) uicb_set_layout(uicb_t cmd)
{ {
int i, j, n; size_t i, j, n;
screen_get_sel(); screen_get_sel();
@ -850,6 +863,8 @@ layout_set_client_master(Client *c)
Bool Bool
uicb_checkmax(uicb_t cmd) uicb_checkmax(uicb_t cmd)
{ {
(void)cmd;
if(!sel) if(!sel)
return False; return False;
@ -865,6 +880,8 @@ uicb_checkmax(uicb_t cmd)
Bool Bool
uicb_checkfree(uicb_t cmd) uicb_checkfree(uicb_t cmd)
{ {
(void)cmd;
if(!sel) if(!sel)
return False; return False;

View File

@ -354,6 +354,8 @@ menu_clear(Menu *menu)
Bool Bool
menu_get_checkstring_needed(MenuItem *mi, int nitem) menu_get_checkstring_needed(MenuItem *mi, int nitem)
{ {
(void)mi;
(void)nitem;
return True; return True;
} }

View File

@ -319,7 +319,7 @@ mouse_resize(Client *c)
void void
mouse_grabbuttons(Client *c, Bool focused) mouse_grabbuttons(Client *c, Bool focused)
{ {
int i; size_t i;
uint but[] = {Button1, Button2, Button3, Button4, Button5}; uint but[] = {Button1, Button2, Button3, Button4, Button5};
XUngrabButton(dpy, AnyButton, AnyModifier, c->win); XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
@ -348,6 +348,7 @@ mouse_grabbuttons(Client *c, Bool focused)
void void
uicb_mouse_move(uicb_t cmd) uicb_mouse_move(uicb_t cmd)
{ {
(void)cmd;
CHECK(sel); CHECK(sel);
mouse_move(sel); mouse_move(sel);
@ -361,6 +362,7 @@ uicb_mouse_move(uicb_t cmd)
void void
uicb_mouse_resize(uicb_t cmd) uicb_mouse_resize(uicb_t cmd)
{ {
(void)cmd;
CHECK(sel); CHECK(sel);
mouse_resize(sel); mouse_resize(sel);

View File

@ -237,6 +237,7 @@ uicb_screen_select(uicb_t cmd)
void void
uicb_screen_next(uicb_t cmd) uicb_screen_next(uicb_t cmd)
{ {
(void)cmd;
screen_get_sel(); screen_get_sel();
selscreen = (selscreen + 1 > screen_count() - 1) ? 0 : selscreen + 1; selscreen = (selscreen + 1 > screen_count() - 1) ? 0 : selscreen + 1;
@ -252,6 +253,7 @@ uicb_screen_next(uicb_t cmd)
void void
uicb_screen_prev(uicb_t cmd) uicb_screen_prev(uicb_t cmd)
{ {
(void)cmd;
screen_get_sel(); screen_get_sel();
selscreen = (selscreen - 1 < 0) ? screen_count() - 1 : selscreen - 1; selscreen = (selscreen - 1 < 0) ? screen_count() - 1 : selscreen - 1;
@ -267,6 +269,7 @@ uicb_screen_prev(uicb_t cmd)
void void
uicb_screen_prev_sel(uicb_t cmd) uicb_screen_prev_sel(uicb_t cmd)
{ {
(void)cmd;
screen_get_sel(); screen_get_sel();
screen_set_sel(prevselscreen); screen_set_sel(prevselscreen);

View File

@ -44,7 +44,7 @@ statustext_rectangle(StatusRec *r, char *str)
char as; char as;
int n, i, j, k; int n, i, j, k;
for(i = j = n = 0; i < strlen(str); ++i, ++j) for(i = j = n = 0; i < (int)strlen(str); ++i, ++j)
if(sscanf(&str[i], "\\b[%d;%d;%d;%d;#%x]%c", &r[n].x, &r[n].y, &r[n].w, &r[n].h, &r[n].color, &as) == 6 if(sscanf(&str[i], "\\b[%d;%d;%d;%d;#%x]%c", &r[n].x, &r[n].y, &r[n].w, &r[n].h, &r[n].color, &as) == 6
&& as == '\\') && as == '\\')
for(++n, ++i, --j; str[i] != as || str[i - 1] != ']'; ++i); for(++n, ++i, --j; str[i] != as || str[i - 1] != ']'; ++i);
@ -68,7 +68,7 @@ statustext_graph(StatusGraph *g, char *str)
char as, c, *p; char as, c, *p;
int n, i, j, k, m, w; int n, i, j, k, m, w;
for(i = j = n = 0; i < strlen(str); ++i, ++j) for(i = j = n = 0; i < (int)strlen(str); ++i, ++j)
if(sscanf(&str[i], "\\g[%d;%d;%d;%d;#%x;%512[^]]]%c", if(sscanf(&str[i], "\\g[%d;%d;%d;%d;#%x;%512[^]]]%c",
&g[n].x, &g[n].y, &g[n].w, &g[n].h, &g[n].color, g[n].data, &as) == 7 &g[n].x, &g[n].y, &g[n].w, &g[n].h, &g[n].color, g[n].data, &as) == 7
&& as == '\\') && as == '\\')
@ -84,7 +84,7 @@ statustext_graph(StatusGraph *g, char *str)
/* height limits */ /* height limits */
if(c < 0) if(c < 0)
c = 0; c = 0;
if(c > g[n].h) if(c > (char)g[n].h)
c = g[n].h; c = g[n].h;
g[n].data[m] = c; g[n].data[m] = c;
p = strtok(NULL, ";"); p = strtok(NULL, ";");
@ -118,7 +118,7 @@ statustext_text(StatusText *s, char *str)
char as; char as;
int n, i, j, k; int n, i, j, k;
for(i = j = n = 0; i < strlen(str); ++i, ++j) for(i = j = n = 0; i < (int)strlen(str); ++i, ++j)
if(sscanf(&str[i], "\\s[%d;%d;%7[^;];%512[^]]]%c", &s[n].x, &s[n].y, s[n].color, s[n].text, &as) == 5 if(sscanf(&str[i], "\\s[%d;%d;%7[^;];%512[^]]]%c", &s[n].x, &s[n].y, s[n].color, s[n].text, &as) == 5
&& as == '\\') && as == '\\')
for(++n, ++i, --j; str[i] != as || str[i - 1] != ']'; ++i); for(++n, ++i, --j; str[i] != as || str[i - 1] != ']'; ++i);
@ -146,7 +146,7 @@ statustext_normal(int sc, char *str)
if(sc == conf.systray.screen) if(sc == conf.systray.screen)
sw = systray_get_width(); sw = systray_get_width();
for(i = j = n = 0; i < strlen(str); ++i, ++j) for(i = j = n = 0; i < (int)strlen(str); ++i, ++j)
if(str[i] == '\\' && str[i + 1] == '#' && str[i + 8] == '\\') if(str[i] == '\\' && str[i + 1] == '#' && str[i + 8] == '\\')
{ {
++n; ++n;
@ -164,7 +164,7 @@ statustext_normal(int sc, char *str)
{ {
strcpy(buf, strwc); strcpy(buf, strwc);
for(i = k = 0; i < strlen(str); ++i, ++k) for(i = k = 0; i < (int)strlen(str); ++i, ++k)
if(str[i] == '\\' && str[i + 1] == '#' && str[i + 8] == '\\') if(str[i] == '\\' && str[i + 1] == '#' && str[i + 8] == '\\')
{ {
/* Store current color in col[] */ /* Store current color in col[] */

View File

@ -114,7 +114,7 @@ tag_set(int tag)
/* No focusontag option found on any client, try to find the first of the tag */ /* No focusontag option found on any client, try to find the first of the tag */
if(!c) if(!c)
for(c = clients; c; c = c->next) for(c = clients; c; c = c->next)
if(c->tag == seltag[selscreen] && c->screen == selscreen) if(c->tag == (uint)seltag[selscreen] && c->screen == selscreen)
break; break;
client_focus((c) ? c : NULL); client_focus((c) ? c : NULL);
@ -175,6 +175,7 @@ uicb_tag(uicb_t cmd)
void void
uicb_tag_next(uicb_t cmd) uicb_tag_next(uicb_t cmd)
{ {
(void)cmd;
screen_get_sel(); screen_get_sel();
tag_set(seltag[selscreen] + 1); tag_set(seltag[selscreen] + 1);
@ -188,6 +189,7 @@ uicb_tag_next(uicb_t cmd)
void void
uicb_tag_prev(uicb_t cmd) uicb_tag_prev(uicb_t cmd)
{ {
(void)cmd;
screen_get_sel(); screen_get_sel();
tag_set(seltag[selscreen] - 1); tag_set(seltag[selscreen] - 1);
@ -204,6 +206,7 @@ uicb_tag_next_visible(uicb_t cmd)
int i, tag; int i, tag;
Client *c; Client *c;
Bool is_occupied[MAXTAG]; Bool is_occupied[MAXTAG];
(void)cmd;
screen_get_sel(); screen_get_sel();
@ -247,6 +250,7 @@ uicb_tag_prev_visible(uicb_t cmd)
int i, tag; int i, tag;
Client *c; Client *c;
Bool is_occupied[MAXTAG]; Bool is_occupied[MAXTAG];
(void)cmd;
screen_get_sel(); screen_get_sel();
@ -301,6 +305,7 @@ uicb_tagtransfert(uicb_t cmd)
void void
uicb_tag_prev_sel(uicb_t cmd) uicb_tag_prev_sel(uicb_t cmd)
{ {
(void)cmd;
screen_get_sel(); screen_get_sel();
tag_set(prevseltag[selscreen]); tag_set(prevseltag[selscreen]);
@ -316,6 +321,7 @@ uicb_tagtransfert_next(uicb_t cmd)
{ {
CHECK(sel); CHECK(sel);
int tag = seltag[selscreen] + 1; int tag = seltag[selscreen] + 1;
(void)cmd;
if(tag > conf.ntag[selscreen]) if(tag > conf.ntag[selscreen])
{ {
@ -336,6 +342,7 @@ uicb_tagtransfert_prev(uicb_t cmd)
{ {
CHECK(sel); CHECK(sel);
int tag = seltag[selscreen] - 1; int tag = seltag[selscreen] - 1;
(void)cmd;
if(tag <= 0) if(tag <= 0)
{ {
@ -357,6 +364,8 @@ uicb_tag_urgent(uicb_t cmd)
Client *c; Client *c;
Bool b = False; Bool b = False;
(void)cmd;
/* Check if there is a urgent client */ /* Check if there is a urgent client */
for(c = clients; c; c = c->next) for(c = clients; c; c = c->next)
if(c->flags & UrgentFlag) if(c->flags & UrgentFlag)
@ -428,9 +437,9 @@ tag_swap(int s, int t1, int t2)
for(c = clients; c; c = c->next) for(c = clients; c; c = c->next)
{ {
if(c->screen == s && c->tag == t1) if(c->screen == s && c->tag == (uint)t1)
c->tag = t2; c->tag = t2;
else if(c->screen == s && c->tag == t2) else if(c->screen == s && c->tag == (uint)t2)
c->tag = t1; c->tag = t1;
} }
@ -459,6 +468,7 @@ uicb_tag_swap(uicb_t cmd)
void void
uicb_tag_swap_next(uicb_t cmd) uicb_tag_swap_next(uicb_t cmd)
{ {
(void)cmd;
screen_get_sel(); screen_get_sel();
tag_swap(selscreen, seltag[selscreen], seltag[selscreen] + 1); tag_swap(selscreen, seltag[selscreen], seltag[selscreen] + 1);
@ -472,6 +482,7 @@ uicb_tag_swap_next(uicb_t cmd)
void void
uicb_tag_swap_previous(uicb_t cmd) uicb_tag_swap_previous(uicb_t cmd)
{ {
(void)cmd;
screen_get_sel(); screen_get_sel();
tag_swap(selscreen, seltag[selscreen], seltag[selscreen] - 1); tag_swap(selscreen, seltag[selscreen], seltag[selscreen] - 1);
@ -546,15 +557,17 @@ uicb_tag_new(uicb_t cmd)
void void
tag_delete(int s, int tag) tag_delete(int s, int tag)
{ {
Tag t = { 0 }; Tag t;
Client *c; Client *c;
int i; size_t i;
memset(&t, 0, sizeof(t));
if(tag < 0 || tag > conf.ntag[s] || conf.ntag[s] == 1) if(tag < 0 || tag > conf.ntag[s] || conf.ntag[s] == 1)
return; return;
for(c = clients; c; c = c->next) for(c = clients; c; c = c->next)
if(c->screen == s && c->tag == tag) if(c->screen == s && c->tag == (uint)tag)
{ {
warnx("Client(s) present in this tag, can't delete it"); warnx("Client(s) present in this tag, can't delete it");
@ -566,7 +579,7 @@ tag_delete(int s, int tag)
tags[s][tag] = t; tags[s][tag] = t;
infobar[s].tags[tag] = NULL; infobar[s].tags[tag] = NULL;
for(i = tag; i < conf.ntag[s] + 1; ++i) for(i = tag; i < (size_t)conf.ntag[s] + 1; ++i)
{ {
/* Set clients tag because of shift */ /* Set clients tag because of shift */
for(c = clients; c; c = c->next) for(c = clients; c; c = c->next)

View File

@ -209,7 +209,8 @@ spawn(const char *format, ...)
char cmd[512]; char cmd[512];
va_list ap; va_list ap;
pid_t pid, ret; pid_t pid, ret;
int p[2], len; int p[2];
size_t len;
va_start(ap, format); va_start(ap, format);
len = vsnprintf(cmd, sizeof(cmd), format, ap); len = vsnprintf(cmd, sizeof(cmd), format, ap);
@ -307,7 +308,7 @@ parse_image_block(ImageAttr *im, char *str)
char as; char as;
int n, i, j, k; int n, i, j, k;
for(i = j = n = 0; i < strlen(str); ++i, ++j) for(i = j = n = 0; i < (int)strlen(str); ++i, ++j)
if(sscanf(&str[i], "\\i[%d;%d;%d;%d;%512[^]]]%c", &im[n].x, &im[n].y, &im[n].w, &im[n].h, im[n].name, &as) == 6 if(sscanf(&str[i], "\\i[%d;%d;%d;%d;%512[^]]]%c", &im[n].x, &im[n].y, &im[n].w, &im[n].h, im[n].name, &as) == 6
&& as == '\\') && as == '\\')
for(++n, ++i, --j; str[i] != as || str[i - 1] != ']'; ++i); for(++n, ++i, --j; str[i] != as || str[i - 1] != ']'; ++i);

View File

@ -65,7 +65,7 @@ vicmd_to_uicb vicmd[] =
void void
viwmfs_help(void) viwmfs_help(void)
{ {
int i; size_t i;
char s[20]; char s[20];
printf("ViWMFS commands list:\n"); printf("ViWMFS commands list:\n");
@ -85,7 +85,7 @@ viwmfs_help(void)
void void
viwmfs(int argc, char **argv) viwmfs(int argc, char **argv)
{ {
int i; size_t i;
char *cmd, str[256] = { 0 }; char *cmd, str[256] = { 0 };
Bool e; Bool e;
@ -94,7 +94,7 @@ viwmfs(int argc, char **argv)
if(argc > 3) if(argc > 3)
{ {
for(i = 2; i < argc; ++i) for(i = 2; i < (size_t)argc; ++i)
{ {
strcat(str, argv[i]); strcat(str, argv[i]);

View File

@ -68,6 +68,8 @@ errorhandler(Display *d, XErrorEvent *event)
int int
errorhandlerdummy(Display *d, XErrorEvent *event) errorhandlerdummy(Display *d, XErrorEvent *event)
{ {
(void)d;
(void)event;
return 0; return 0;
} }
@ -77,7 +79,7 @@ void
quit(void) quit(void)
{ {
Client *c; Client *c;
int i; size_t i, len;
/* Set the silent error handler */ /* Set the silent error handler */
XSetErrorHandler(errorhandlerdummy); XSetErrorHandler(errorhandlerdummy);
@ -111,7 +113,8 @@ quit(void)
if(conf.menu) if(conf.menu)
{ {
for(i = 0; i < LEN(conf.menu); ++i) len = LEN(conf.menu);
for(i = 0; i < len; ++i)
IFREE(conf.menu[i].item); IFREE(conf.menu[i].item);
IFREE(conf.menu); IFREE(conf.menu);
} }
@ -192,6 +195,7 @@ mainloop(void)
void void
uicb_quit(uicb_t cmd) uicb_quit(uicb_t cmd)
{ {
(void)cmd;
exiting = True; exiting = True;
return; return;
@ -203,11 +207,11 @@ uicb_quit(uicb_t cmd)
void void
scan(void) scan(void)
{ {
uint i, n; uint n;
XWindowAttributes wa; XWindowAttributes wa;
Window usl, usl2, *w = NULL; Window usl, usl2, *w = NULL;
Atom rt; Atom rt;
int s, rf, tag = -1, screen = -1, free = -1; int s, rf, tag = -1, screen = -1, free = -1, i;
ulong ir, il; ulong ir, il;
uchar *ret; uchar *ret;
Client *c; Client *c;
@ -258,7 +262,7 @@ scan(void)
/* Set update layout request */ /* Set update layout request */
for(c = clients; c; c = c->next) for(c = clients; c; c = c->next)
{ {
if(c->tag > conf.ntag[c->screen]) if(c->tag > (uint)conf.ntag[c->screen])
c->tag = conf.ntag[c->screen]; c->tag = conf.ntag[c->screen];
tags[c->screen][c->tag].request_update = True; tags[c->screen][c->tag].request_update = True;
} }
@ -277,6 +281,7 @@ scan(void)
void void
uicb_reload(uicb_t cmd) uicb_reload(uicb_t cmd)
{ {
(void)cmd;
quit(); quit();
for(; argv_global[0] && argv_global[0] == ' '; ++argv_global); for(; argv_global[0] && argv_global[0] == ' '; ++argv_global);
@ -398,6 +403,7 @@ update_status(void)
void void
signal_handle(int sig) signal_handle(int sig)
{ {
(void)sig;
exiting = True; exiting = True;
quit(); quit();
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);