From da5236d57adedafd7cfcaf3b37a90f67acf18ab9 Mon Sep 17 00:00:00 2001 From: Arnaud Fontaine Date: Thu, 27 Mar 2008 11:34:19 +0000 Subject: [PATCH] Cosmetic --- common/xutil.c | 6 ++---- ewmh.c | 13 +++---------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/common/xutil.c b/common/xutil.c index 707976a2c..c070eaa37 100644 --- a/common/xutil.c +++ b/common/xutil.c @@ -52,12 +52,10 @@ xgettextprop(xcb_connection_t *conn, xcb_window_t w, xcb_atom_t atom, return false; prop_val = (char *) xcb_get_property_value(name); - if(name->type == STRING) - a_strncpy(text, name->value_len + 1, prop_val, textlen - 1); - /* TODO: XCB doesn't provide a XmbTextPropertyToTextList(), check + /* TODO: XCB doesn't provide a XmbTextPropertyToTextList(), check * whether this code is correct (locales) */ - else if(name->format == 8) + if(name->type == STRING || name->format == 8) a_strncpy(text, name->value_len + 1, prop_val, textlen - 1); text[textlen - 1] = '\0'; diff --git a/ewmh.c b/ewmh.c index ca304beed..14ed54c66 100644 --- a/ewmh.c +++ b/ewmh.c @@ -431,14 +431,15 @@ ewmh_get_window_icon(xcb_window_t w) NetWMIcon *icon; int size, i; uint32_t *data; - unsigned char *imgdata, *wdata; + unsigned char *imgdata; xcb_get_property_reply_t *r; r = xcb_get_property_reply(globalconf.connection, xcb_get_property_unchecked(globalconf.connection, false, w, net_wm_icon, CARDINAL, 0, UINT32_MAX), NULL); - if(!r || !(wdata = (unsigned char *) xcb_get_property_value(r))) + if(!r || r->type != CARDINAL || r->format != 32 || r->length < 2 || + !(data = (uint32_t *) xcb_get_property_value(r))) { if(r) p_delete(&r); @@ -446,16 +447,8 @@ ewmh_get_window_icon(xcb_window_t w) return NULL; } - if(r->type != CARDINAL || r->format != 32 || r->length < 2) - { - p_delete(&r); - return NULL; - } - icon = p_new(NetWMIcon, 1); - data = (uint32_t *) wdata; - icon->width = data[0]; icon->height = data[1]; size = icon->width * icon->height;