Luncher/Pager Gadget: Fix coverity issues.

This commit is contained in:
Stephen okra Houston 2016-11-02 09:34:10 -05:00
parent 2a0b4dfbc4
commit ef8d86d7f3
3 changed files with 18 additions and 17 deletions

View File

@ -271,6 +271,7 @@ static Evas_Object *
_bar_icon_menu_item_new(Icon *ic, Evas_Object *popup, Evas_Object *parent, const char *name, const char *icon) _bar_icon_menu_item_new(Icon *ic, Evas_Object *popup, Evas_Object *parent, const char *name, const char *icon)
{ {
const char *path = NULL, *k = NULL; const char *path = NULL, *k = NULL;
char buf[4096];
int len = 0; int len = 0;
Evas_Object *layout, *label, *img; Evas_Object *layout, *label, *img;
@ -312,7 +313,6 @@ _bar_icon_menu_item_new(Icon *ic, Evas_Object *popup, Evas_Object *parent, const
} }
if (!path) if (!path)
{ {
char buf[4096];
snprintf(buf, sizeof(buf), "e/icons/%s", icon); snprintf(buf, sizeof(buf), "e/icons/%s", icon);
if (eina_list_count(e_theme_collection_items_find("base/theme/icons", buf))) if (eina_list_count(e_theme_collection_items_find("base/theme/icons", buf)))
{ {
@ -743,7 +743,9 @@ _bar_icon_preview_show(void *data)
ic->mouse_in_timer = NULL; ic->mouse_in_timer = NULL;
if (ic->drag.dnd) if (ic->drag.dnd)
return EINA_FALSE; return EINA_FALSE;
if (!ic->inst && !ic->inst->o_icon_con) if (!ic->inst)
return EINA_FALSE;
if (!ic->inst->o_icon_con)
return EINA_FALSE; return EINA_FALSE;
orient = e_gadget_site_orient_get(e_gadget_site_get(ic->inst->o_main)); orient = e_gadget_site_orient_get(e_gadget_site_get(ic->inst->o_main));
@ -893,6 +895,7 @@ static Icon *
_bar_icon_add(Instance *inst, Efreet_Desktop *desktop, E_Client *non_desktop_client) _bar_icon_add(Instance *inst, Efreet_Desktop *desktop, E_Client *non_desktop_client)
{ {
const char *path = NULL, *k = NULL; const char *path = NULL, *k = NULL;
char buf[4096];
int len = 0; int len = 0;
Icon *ic; Icon *ic;
const Eina_List *l; const Eina_List *l;
@ -943,7 +946,6 @@ _bar_icon_add(Instance *inst, Efreet_Desktop *desktop, E_Client *non_desktop_cli
} }
if (!path) if (!path)
{ {
char buf[4096];
snprintf(buf, sizeof(buf), "e/icons/%s", desktop->icon); snprintf(buf, sizeof(buf), "e/icons/%s", desktop->icon);
if (eina_list_count(e_theme_collection_items_find("base/theme/icons", buf))) if (eina_list_count(e_theme_collection_items_find("base/theme/icons", buf)))
{ {
@ -1079,10 +1081,10 @@ _bar_cb_client_remove(void *data EINA_UNUSED, int type EINA_UNUSED, E_Event_Clie
{ {
if (ic->starting) elm_layout_signal_emit(ic->o_layout, "e,state,started", "e"); if (ic->starting) elm_layout_signal_emit(ic->o_layout, "e,state,started", "e");
ic->starting = EINA_FALSE; ic->starting = EINA_FALSE;
if (ev->ec->exe_inst)
ic->execs = eina_list_remove(ic->execs, ev->ec->exe_inst);
if (ev->ec) if (ev->ec)
ic->clients = eina_list_remove(ic->clients, ev->ec); ic->clients = eina_list_remove(ic->clients, ev->ec);
if (ev->ec->exe_inst)
ic->execs = eina_list_remove(ic->execs, ev->ec->exe_inst);
if (!eina_list_count(ic->execs) && !eina_list_count(ic->clients)) if (!eina_list_count(ic->execs) && !eina_list_count(ic->clients))
{ {
elm_layout_signal_emit(ic->o_layout, "e,state,off", "e"); elm_layout_signal_emit(ic->o_layout, "e,state,off", "e");
@ -1176,8 +1178,7 @@ _bar_cb_exec_client_prop(void *data EINA_UNUSED, int type EINA_UNUSED, E_Event_C
Icon *ic = NULL; Icon *ic = NULL;
char buf[4096]; char buf[4096];
if (ev->ec) ic = _bar_icon_match(inst, ev->ec);
ic = _bar_icon_match(inst, ev->ec);
if (skip && !ic) continue; if (skip && !ic) continue;
if (!skip) if (!skip)
@ -1362,7 +1363,6 @@ _bar_fill(Instance *inst)
if (!ec->netwm.state.skip_taskbar) if (!ec->netwm.state.skip_taskbar)
{ {
skip = EINA_FALSE; skip = EINA_FALSE;
break;
} }
if (skip) continue; if (skip) continue;
ic = _bar_icon_match(inst, ec); ic = _bar_icon_match(inst, ec);
@ -1406,11 +1406,12 @@ _bar_resize_job(void *data)
Instance *inst = data; Instance *inst = data;
Eina_List *l; Eina_List *l;
Icon *ic; Icon *ic;
E_Gadget_Site_Orient orient = e_gadget_site_orient_get(e_gadget_site_get(inst->o_main)); E_Gadget_Site_Orient orient;
Evas_Coord x, y, w, h, size; Evas_Coord x, y, w, h, size;
if (inst) if (inst)
{ {
orient = e_gadget_site_orient_get(e_gadget_site_get(inst->o_main));
elm_layout_sizing_eval(inst->o_main); elm_layout_sizing_eval(inst->o_main);
evas_object_geometry_get(inst->o_main, &x, &y, &w, &h); evas_object_geometry_get(inst->o_main, &x, &y, &w, &h);
switch (orient) switch (orient)

View File

@ -19,7 +19,7 @@ _config_source_changed(void *data, Evas_Object *obj EINA_UNUSED, void *event_inf
return; return;
if (inst->cfg->dir) eina_stringshare_del(inst->cfg->dir); if (inst->cfg->dir) eina_stringshare_del(inst->cfg->dir);
inst->cfg->dir = NULL; inst->cfg->dir = NULL;
if (dir) inst->cfg->dir = eina_stringshare_ref(dir); inst->cfg->dir = eina_stringshare_ref(dir);
bar_reorder(inst); bar_reorder(inst);
} }
@ -176,6 +176,7 @@ static void
_icon_theme_file_set(Evas_Object *img, const char *icon) _icon_theme_file_set(Evas_Object *img, const char *icon)
{ {
const char *path = NULL, *k = NULL; const char *path = NULL, *k = NULL;
char buf[4096];
int len = 0; int len = 0;
if (!icon) if (!icon)
@ -195,7 +196,6 @@ _icon_theme_file_set(Evas_Object *img, const char *icon)
} }
if (!path) if (!path)
{ {
char buf[4096];
snprintf(buf, sizeof(buf), "e/icons/%s", icon); snprintf(buf, sizeof(buf), "e/icons/%s", icon);
if (eina_list_count(e_theme_collection_items_find("base/theme/icons", buf))) if (eina_list_count(e_theme_collection_items_find("base/theme/icons", buf)))
{ {

View File

@ -178,9 +178,9 @@ _pager_gadget_anchor_change_cb(void *data, Evas_Object *obj, void *event_info EI
{ {
Instance *inst = data; Instance *inst = data;
_pager_orient(inst, e_gadget_site_orient_get(obj));
if (inst->pager && inst->o_pager) if (inst->pager && inst->o_pager)
{ {
_pager_orient(inst, e_gadget_site_orient_get(obj));
_pager_empty(inst->pager); _pager_empty(inst->pager);
_pager_fill(inst->pager); _pager_fill(inst->pager);
} }
@ -194,10 +194,10 @@ _pager_gadget_created_cb(void *data, Evas_Object *obj, void *event_info EINA_UNU
Eina_List *l; Eina_List *l;
Pager_Desk *pd; Pager_Desk *pd;
e_gadget_configure_cb_set(inst->o_pager, _pager_gadget_configure);
_pager_orient(inst, e_gadget_site_orient_get(obj));
if (inst->pager && inst->o_pager) if (inst->pager && inst->o_pager)
{ {
e_gadget_configure_cb_set(inst->o_pager, _pager_gadget_configure);
_pager_orient(inst, e_gadget_site_orient_get(obj));
_pager_empty(inst->pager); _pager_empty(inst->pager);
_pager_fill(inst->pager); _pager_fill(inst->pager);
@ -1280,7 +1280,7 @@ _pager_drop_cb_drop(void *data, const char *type, void *event_info)
{ {
E_Event_Dnd_Drop *ev; E_Event_Dnd_Drop *ev;
Eina_List *l; Eina_List *l;
Pager_Desk *pd; Pager_Desk *pd, *pdd;
Pager_Desk *pd2 = NULL; Pager_Desk *pd2 = NULL;
E_Client *ec = NULL; E_Client *ec = NULL;
int dx = 0, dy = 0; int dx = 0, dy = 0;
@ -1356,9 +1356,9 @@ _pager_drop_cb_drop(void *data, const char *type, void *event_info)
if (fullscreen) e_client_fullscreen(ec, fs); if (fullscreen) e_client_fullscreen(ec, fs);
} }
} }
EINA_LIST_FOREACH(pd->pager->desks, l, pd) EINA_LIST_FOREACH(pd->pager->desks, l, pdd)
{ {
edje_object_signal_emit(pd->o_desk, "e,action,drag,out", "e"); edje_object_signal_emit(pdd->o_desk, "e,action,drag,out", "e");
} }
} }