From: Gwanglim Lee Date: Tue, 14 Jun 2016 12:45:17 +0000 (+0900) Subject: fixed the problems detected by static analyzer. X-Git-Tag: submit/tizen/20160615.013934~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eafb8fa0074fa32dfd3eea0c7542d38f1ffce117;p=platform%2Fupstream%2Fenlightenment.git fixed the problems detected by static analyzer. Change-Id: I7f2172e19174285146e11e0929a770df2b4eda95 --- diff --git a/src/bin/e_client.c b/src/bin/e_client.c index 45ff6874f6..c4dc09e7fb 100644 --- a/src/bin/e_client.c +++ b/src/bin/e_client.c @@ -3615,7 +3615,6 @@ e_client_mouse_wheel(E_Client *ec, Evas_Point *output, E_Binding_Event_Wheel *ev E_API void e_client_mouse_down(E_Client *ec, int button, Evas_Point *output, E_Binding_Event_Mouse_Button *ev) { - Eina_Bool did_act = EINA_FALSE; E_Client *pfocus; int player; @@ -3641,8 +3640,6 @@ e_client_mouse_down(E_Client *ec, int button, Evas_Point *output, E_Binding_Even ec->mouse.current.my = output->y; pfocus = e_client_focused_get(); player = ec->layer; - if ((!did_act) || (((pfocus == e_client_focused_get()) || (ec == e_client_focused_get())) && (ec->layer >= player))) - e_focus_event_mouse_down(ec); if ((button >= 1) && (button <= 3)) { ec->mouse.last_down[button - 1].mx = output->x; diff --git a/src/bin/e_comp_screen.c b/src/bin/e_comp_screen.c index d183c4b15a..6911a66d90 100644 --- a/src/bin/e_comp_screen.c +++ b/src/bin/e_comp_screen.c @@ -419,11 +419,11 @@ e_comp_screen_apply(void) } } -static void +static Eina_Bool _drm_read_pixels(E_Comp_Wl_Output *output, void *pixels) { Ecore_Drm_Device *dev; - Ecore_Drm_Fb *fb; + Ecore_Drm_Fb *fb = NULL; const Eina_List *drm_devs, *l; int i = 0, bstride; unsigned char *s, *d = pixels; @@ -436,7 +436,7 @@ _drm_read_pixels(E_Comp_Wl_Output *output, void *pixels) if (fb) break; } - if (!fb) return; + EINA_SAFETY_ON_NULL_RETURN_VAL(fb, EINA_FALSE); bstride = output->w * sizeof(int); @@ -447,6 +447,8 @@ _drm_read_pixels(E_Comp_Wl_Output *output, void *pixels) memcpy(d, s, (output->w * sizeof(int))); d += bstride; } + + return EINA_TRUE; } E_API void diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c index 6814d01b0a..8a208b5e19 100644 --- a/src/bin/e_comp_wl.c +++ b/src/bin/e_comp_wl.c @@ -3685,16 +3685,21 @@ _e_comp_wl_screenshooter_cb_shoot(struct wl_client *client EINA_UNUSED, struct w struct wl_shm_buffer *shm_buffer; int stride; void *pixels = NULL, *d; + Eina_Bool res; output = wl_resource_get_user_data(output_resource); buffer = e_comp_wl_buffer_get(buffer_resource, NULL); + if (!output) return; + if (!buffer) { wl_resource_post_no_memory(resource); return; } + EINA_SAFETY_ON_NULL_RETURN(e_comp_wl->screenshooter.read_pixels); + if ((buffer->w < output->w) || (buffer->h < output->h)) { ERR("Buffer size less than output"); @@ -3712,8 +3717,12 @@ _e_comp_wl_screenshooter_cb_shoot(struct wl_client *client EINA_UNUSED, struct w return; } - if (e_comp_wl->screenshooter.read_pixels) - e_comp_wl->screenshooter.read_pixels(output, pixels); + res = e_comp_wl->screenshooter.read_pixels(output, pixels); + if (!res) + { + free(pixels); + return; + } shm_buffer = wl_shm_buffer_get(buffer->resource); if (!shm_buffer) diff --git a/src/bin/e_comp_wl.h b/src/bin/e_comp_wl.h index cedc67ef36..400d33ca31 100644 --- a/src/bin/e_comp_wl.h +++ b/src/bin/e_comp_wl.h @@ -327,7 +327,7 @@ struct _E_Comp_Wl_Data { struct wl_global *global; struct wl_client *client; - void (*read_pixels)(E_Comp_Wl_Output *output, void *pixels); + Eina_Bool (*read_pixels)(E_Comp_Wl_Output *output, void *pixels); } screenshooter; Eina_List *outputs; diff --git a/src/bin/e_desk.c b/src/bin/e_desk.c index 0fb449ac23..eab16a8c81 100644 --- a/src/bin/e_desk.c +++ b/src/bin/e_desk.c @@ -292,6 +292,8 @@ e_desk_deskshow(E_Zone *zone) E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE); desk = e_desk_current_get(zone); + EINA_SAFETY_ON_NULL_RETURN(desk); + if (desk->deskshow_toggle) { /* uniconify raises windows and changes stacking order diff --git a/src/bin/e_dpms.c b/src/bin/e_dpms.c index c7b5b2c8ec..18dd44bbed 100644 --- a/src/bin/e_dpms.c +++ b/src/bin/e_dpms.c @@ -21,16 +21,8 @@ static int _e_dpms_enabled = EINA_FALSE; E_API void e_dpms_update(void) { - unsigned int standby = 0, suspend = 0, off = 0; - int enabled; - - enabled = 0; - if (_e_dpms_enabled != enabled) _e_dpms_enabled = enabled; - if (!enabled) return; - - if (_e_dpms_timeout_standby != standby) _e_dpms_timeout_standby = standby; - if (_e_dpms_timeout_suspend != suspend) _e_dpms_timeout_suspend = suspend; - if (_e_dpms_timeout_off != off) _e_dpms_timeout_off = off; + /* do nothing */ + ; } E_API void diff --git a/src/bin/e_icon.c b/src/bin/e_icon.c index 7f6a67fe7d..30b51597ed 100644 --- a/src/bin/e_icon.c +++ b/src/bin/e_icon.c @@ -425,8 +425,6 @@ E_API Eina_Bool e_icon_fdo_icon_set(Evas_Object *obj, const char *icon) { E_Smart_Data *sd; - const char *path = NULL; - int len; if (!icon) return EINA_FALSE; if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERR(0); @@ -446,36 +444,7 @@ e_icon_fdo_icon_set(Evas_Object *obj, const char *icon) eina_stringshare_replace(&sd->fdo, icon); if (!sd->fdo) return EINA_FALSE; - //path = efreet_icon_path_find(e_config->icon_theme, sd->fdo, sd->size); - //if (!path) - // { - // if (e_util_strcmp(e_config->icon_theme, "hicolor")) - // path = efreet_icon_path_find("hicolor", sd->fdo, sd->size); - if (!path) return EINA_FALSE; - // } - - len = strlen(icon); - if ((len > 4) && (!strcasecmp(icon + len - 4, ".edj"))) - return e_icon_file_edje_set(obj, path, "icon"); - - /* smart code here */ - _e_icon_obj_prepare(obj, sd); - sd->loading = 0; - if (sd->size != 0) - evas_object_image_load_size_set(sd->obj, sd->size, sd->size); - if (sd->preload) evas_object_hide(sd->obj); - evas_object_image_file_set(sd->obj, path, NULL); - if (evas_object_image_load_error_get(sd->obj) != EVAS_LOAD_ERROR_NONE) - return EINA_FALSE; - if (sd->preload) - { - sd->loading = 1; - evas_object_image_preload(sd->obj, 0); - } - else if (evas_object_visible_get(obj)) - evas_object_show(sd->obj); - _e_icon_smart_reconfigure(sd); - return EINA_TRUE; + return EINA_FALSE; } E_API void @@ -908,27 +877,10 @@ static Eina_Bool _e_icon_fdo_reload(void *data) { E_Smart_Data *sd = data; - const char *path = NULL; sd->fdo_reload_timer = NULL; sd->size = MAX(sd->w, sd->h); - //path = efreet_icon_path_find(e_config->icon_theme, sd->fdo, sd->size); - //if (!path) - // { - // if (e_util_strcmp(e_config->icon_theme, "hicolor")) - // path = efreet_icon_path_find("hicolor", sd->fdo, sd->size); - if (!path) return EINA_FALSE; - // } - - /* smart code here */ - evas_object_image_load_size_set(sd->obj, sd->size, sd->size); - evas_object_image_file_set(sd->obj, path, NULL); - if (sd->preload) - { - sd->loading = 1; - evas_object_image_preload(sd->obj, 0); - } return EINA_FALSE; } diff --git a/src/bin/e_utils.c b/src/bin/e_utils.c index a227203e45..7cb4ac753e 100644 --- a/src/bin/e_utils.c +++ b/src/bin/e_utils.c @@ -455,32 +455,11 @@ e_util_icon_add(const char *path, Evas *evas) return _e_util_icon_add(path, evas, 64); } -#if 0 -E_API Evas_Object * -e_util_desktop_icon_add(Efreet_Desktop *desktop, unsigned int size, Evas *evas) -{ - if ((!desktop) || (!desktop->icon)) return NULL; - return e_util_icon_theme_icon_add(desktop->icon, size, evas); -} -#endif - E_API Evas_Object * e_util_icon_theme_icon_add(const char *icon_name, unsigned int size, Evas *evas) { if (!icon_name) return NULL; if (icon_name[0] == '/') return _e_util_icon_add(icon_name, evas, size); - else - { - Evas_Object *obj; - const char *path = NULL; - - //path = efreet_icon_path_find(e_config->icon_theme, icon_name, size); - if (path) - { - obj = _e_util_icon_add(path, evas, size); - return obj; - } - } return NULL; } diff --git a/src/bin/e_zone.c b/src/bin/e_zone.c index 7ccd05bc9b..ed9d399e32 100644 --- a/src/bin/e_zone.c +++ b/src/bin/e_zone.c @@ -685,8 +685,6 @@ e_zone_desk_linear_flip_by(E_Zone *zone, (zone->desk_y_current * zone->desk_x_count) + dx; if (((dx < 0) || (dx >= zone->desk_x_count * zone->desk_y_count))) return; dx = dx % (zone->desk_x_count * zone->desk_y_count); - while (dx < 0) - dx += (zone->desk_x_count * zone->desk_y_count); e_zone_desk_linear_flip_to(zone, dx); }