From 032ee5e1a3338ce4d9712f1962fcbe8547a12342 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Thu, 5 Nov 2009 15:51:35 +0100 Subject: [PATCH] Some cleanups pointed out by clang --- obt/parse.c | 2 +- openbox/client.c | 2 +- openbox/debug.c | 2 +- openbox/focus_cycle_popup.c | 7 ------- openbox/openbox.c | 2 +- openbox/prompt.c | 2 +- openbox/resist.c | 4 ---- openbox/screen.c | 28 +++++++++++++--------------- 8 files changed, 18 insertions(+), 31 deletions(-) diff --git a/obt/parse.c b/obt/parse.c index d181b679..a792188f 100644 --- a/obt/parse.c +++ b/obt/parse.c @@ -99,7 +99,7 @@ void obt_parse_register(ObtParseInst *i, const gchar *tag, { struct Callback *c; - if ((c = g_hash_table_lookup(i->callbacks, tag))) { + if (g_hash_table_lookup(i->callbacks, tag)) { g_error("Tag '%s' already registered", tag); return; } diff --git a/openbox/client.c b/openbox/client.c index 6f13d9fe..42d8c6e1 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -2379,7 +2379,7 @@ ObClient *client_search_focus_tree_full(ObClient *self) for (it = self->parents; it; it = g_slist_next(it)) { ObClient *c = it->data; - if ((c = client_search_focus_tree_full(it->data))) return c; + if ((c = client_search_focus_tree_full(c))) return c; } return NULL; diff --git a/openbox/debug.c b/openbox/debug.c index db18784c..c1180c33 100644 --- a/openbox/debug.c +++ b/openbox/debug.c @@ -161,7 +161,7 @@ static inline void log_argv(ObDebugType type, g_free(a); } - g_debug(message); + g_debug("%s", message); g_free(message); } diff --git a/openbox/focus_cycle_popup.c b/openbox/focus_cycle_popup.c index c7921fa9..3ac51b93 100644 --- a/openbox/focus_cycle_popup.c +++ b/openbox/focus_cycle_popup.c @@ -326,7 +326,6 @@ static void popup_render(ObFocusCyclePopup *p, const ObClient *c) gint l, t, r, b; gint x, y, w, h; Rect *screen_area = NULL; - gint rgbax, rgbay, rgbaw, rgbah; gint i; GList *it; const ObFocusCyclePopupTarget *newtarget; @@ -480,12 +479,6 @@ static void popup_render(ObFocusCyclePopup *p, const ObClient *c) y = screen_area->y + (screen_area->height - (h + ob_rr_theme->obwidth * 2)) / 2; - /* get the dimensions of the target hilite texture */ - rgbax = ml; - rgbay = mt; - rgbaw = w - ml - mr; - rgbah = h - mt - mb; - if (!p->mapped) { /* position the background but don't draw it */ XMoveResizeWindow(obt_display, p->bg, x, y, w, h); diff --git a/openbox/openbox.c b/openbox/openbox.c index 9b331834..8dc60ec6 100644 --- a/openbox/openbox.c +++ b/openbox/openbox.c @@ -667,7 +667,7 @@ static Cursor load_cursor(const gchar *name, guint fontval) void ob_exit_with_error(const gchar *msg) { - g_message(msg); + g_message("%s", msg); session_shutdown(TRUE); exit(EXIT_FAILURE); } diff --git a/openbox/prompt.c b/openbox/prompt.c index 720bb310..f2ddfd33 100644 --- a/openbox/prompt.c +++ b/openbox/prompt.c @@ -95,7 +95,7 @@ void prompt_startup(gboolean reconfig) prompt_a_button->texture[0].data.text.color = c_button; prompt_a_focus->texture[0].data.text.color = c_focus; prompt_a_press->texture[0].data.text.color = c_press; - prompt_a_pfocus->texture[0].data.text.color = c_press; + prompt_a_pfocus->texture[0].data.text.color = c_pfocus; prompt_a_focus->texture[1].data.lineart.color = c_focus; prompt_a_focus->texture[2].data.lineart.color = c_focus; diff --git a/openbox/resist.c b/openbox/resist.c index 87c397a8..9f622a01 100644 --- a/openbox/resist.c +++ b/openbox/resist.c @@ -351,7 +351,6 @@ void resist_size_monitors(ObClient *c, gint resist, gint *w, gint *h, Rect *area, *parea; gint al, at, ar, ab; /* screen boundaries */ gint pl, pt, pr, pb; /* physical screen boundaries */ - gint incw, inch; guint i; Rect desired_area; @@ -362,9 +361,6 @@ void resist_size_monitors(ObClient *c, gint resist, gint *w, gint *h, t = RECT_TOP(c->frame->area); b = RECT_BOTTOM(c->frame->area); - incw = c->size_inc.width; - inch = c->size_inc.height; - RECT_SET(desired_area, c->area.x, c->area.y, *w, *h); for (i = 0; i < screen_num_monitors; ++i) { diff --git a/openbox/screen.c b/openbox/screen.c index 3402d20c..68b23a51 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -511,7 +511,6 @@ void screen_resize(void) void screen_set_num_desktops(guint num) { - guint old; gulong *viewport; GList *it, *stacking_copy; @@ -519,7 +518,6 @@ void screen_set_num_desktops(guint num) if (screen_num_desktops == num) return; - old = screen_num_desktops; screen_num_desktops = num; OBT_PROP_SET32(obt_root(ob_screen), NET_NUMBER_OF_DESKTOPS, CARDINAL, num); @@ -1590,7 +1588,7 @@ Rect* screen_area(guint desktop, guint head, Rect *search) { Rect *a; GSList *it; - gint l, r, t, b, al, ar, at, ab; + gint l, r, t, b; guint i, d; gboolean us = search != NULL; /* user provided search */ @@ -1616,30 +1614,30 @@ Rect* screen_area(guint desktop, guint head, Rect *search) /* only include monitors which the search area lines up with */ if (RECT_INTERSECTS_RECT(monitor_area[screen_num_monitors], *search)) { - al = l = RECT_RIGHT(monitor_area[screen_num_monitors]); - at = t = RECT_BOTTOM(monitor_area[screen_num_monitors]); - ar = r = RECT_LEFT(monitor_area[screen_num_monitors]); - ab = b = RECT_TOP(monitor_area[screen_num_monitors]); + l = RECT_RIGHT(monitor_area[screen_num_monitors]); + t = RECT_BOTTOM(monitor_area[screen_num_monitors]); + r = RECT_LEFT(monitor_area[screen_num_monitors]); + b = RECT_TOP(monitor_area[screen_num_monitors]); for (i = 0; i < screen_num_monitors; ++i) { /* add the monitor if applicable */ if (RANGES_INTERSECT(search->x, search->width, monitor_area[i].x, monitor_area[i].width)) { - at = t = MIN(t, RECT_TOP(monitor_area[i])); - ab = b = MAX(b, RECT_BOTTOM(monitor_area[i])); + t = MIN(t, RECT_TOP(monitor_area[i])); + b = MAX(b, RECT_BOTTOM(monitor_area[i])); } if (RANGES_INTERSECT(search->y, search->height, monitor_area[i].y, monitor_area[i].height)) { - al = l = MIN(l, RECT_LEFT(monitor_area[i])); - ar = r = MAX(r, RECT_RIGHT(monitor_area[i])); + l = MIN(l, RECT_LEFT(monitor_area[i])); + r = MAX(r, RECT_RIGHT(monitor_area[i])); } } } else { - al = l = RECT_LEFT(monitor_area[screen_num_monitors]); - at = t = RECT_TOP(monitor_area[screen_num_monitors]); - ar = r = RECT_RIGHT(monitor_area[screen_num_monitors]); - ab = b = RECT_BOTTOM(monitor_area[screen_num_monitors]); + l = RECT_LEFT(monitor_area[screen_num_monitors]); + t = RECT_TOP(monitor_area[screen_num_monitors]); + r = RECT_RIGHT(monitor_area[screen_num_monitors]); + b = RECT_BOTTOM(monitor_area[screen_num_monitors]); } for (d = 0; d < screen_num_desktops; ++d) { -- 2.34.1