Merge pull request #2115 from psychon/small_fixes_codacy

Small fixes for codacy
This commit is contained in:
Daniel Hahler 2017-11-18 01:49:12 +01:00 committed by GitHub
commit f4ad2e7517
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 4 deletions

View File

@ -158,7 +158,6 @@ scan(xcb_query_tree_cookie_t tree_c)
xcb_get_window_attributes_reply_t *attr_r; xcb_get_window_attributes_reply_t *attr_r;
xcb_get_geometry_reply_t *geom_r; xcb_get_geometry_reply_t *geom_r;
xcb_get_property_cookie_t prop_cookie; xcb_get_property_cookie_t prop_cookie;
long state;
tree_r = xcb_query_tree_reply(globalconf.connection, tree_r = xcb_query_tree_reply(globalconf.connection,
tree_c, tree_c,
@ -197,7 +196,7 @@ scan(xcb_query_tree_cookie_t tree_c)
NULL); NULL);
geom_r = xcb_get_geometry_reply(globalconf.connection, geom_wins[i], NULL); geom_r = xcb_get_geometry_reply(globalconf.connection, geom_wins[i], NULL);
state = xwindow_get_state_reply(state_wins[i]); long state = xwindow_get_state_reply(state_wins[i]);
if(!geom_r || !attr_r || attr_r->override_redirect if(!geom_r || !attr_r || attr_r->override_redirect
|| attr_r->map_state == XCB_MAP_STATE_UNMAPPED || attr_r->map_state == XCB_MAP_STATE_UNMAPPED

View File

@ -81,7 +81,10 @@ buffer_addvf(buffer_t *buf, const char *fmt, va_list args)
len = vsnprintf(buf->s + buf->len, buf->size - buf->len, fmt, args); len = vsnprintf(buf->s + buf->len, buf->size - buf->len, fmt, args);
if (unlikely(len < 0)) if (unlikely(len < 0))
{
va_end(ap);
return; return;
}
if (len >= buf->size - buf->len) if (len >= buf->size - buf->len)
{ {
buffer_ensure(buf, len); buffer_ensure(buf, len);
@ -89,6 +92,7 @@ buffer_addvf(buffer_t *buf, const char *fmt, va_list args)
} }
buf->len += len; buf->len += len;
buf->s[buf->len] = '\0'; buf->s[buf->len] = '\0';
va_end(ap);
} }
void void

View File

@ -864,7 +864,7 @@ event_handle_randr_output_change_notify(xcb_randr_notify_event_t *ev)
xcb_randr_output_t output = ev->u.oc.output; xcb_randr_output_t output = ev->u.oc.output;
uint8_t connection = ev->u.oc.connection; uint8_t connection = ev->u.oc.connection;
const char *connection_str = NULL; const char *connection_str = NULL;
xcb_randr_get_output_info_reply_t *info = NULL; xcb_randr_get_output_info_reply_t *info;
lua_State *L = globalconf_get_lua_State(); lua_State *L = globalconf_get_lua_State();
/* The following explicitly uses XCB_CURRENT_TIME since we want to know /* The following explicitly uses XCB_CURRENT_TIME since we want to know

View File

@ -356,7 +356,6 @@ window_set_xproperty(lua_State *L, xcb_window_t window, int prop_idx, int value_
{ {
xproperty_t *prop = luaA_find_xproperty(L, prop_idx); xproperty_t *prop = luaA_find_xproperty(L, prop_idx);
xcb_atom_t type; xcb_atom_t type;
uint8_t format;
size_t len; size_t len;
uint32_t number; uint32_t number;
const void *data; const void *data;
@ -365,6 +364,7 @@ window_set_xproperty(lua_State *L, xcb_window_t window, int prop_idx, int value_
{ {
xcb_delete_property(globalconf.connection, window, prop->atom); xcb_delete_property(globalconf.connection, window, prop->atom);
} else { } else {
uint8_t format;
if(prop->type == PROP_STRING) if(prop->type == PROP_STRING)
{ {
data = luaL_checklstring(L, value_idx, &len); data = luaL_checklstring(L, value_idx, &len);