fixed the problems detected by static analyzer. 51/74551/1
authorGwanglim Lee <gl77.lee@samsung.com>
Tue, 14 Jun 2016 12:45:17 +0000 (21:45 +0900)
committerGwanglim Lee <gl77.lee@samsung.com>
Tue, 14 Jun 2016 12:45:17 +0000 (21:45 +0900)
Change-Id: I7f2172e19174285146e11e0929a770df2b4eda95

src/bin/e_client.c
src/bin/e_comp_screen.c
src/bin/e_comp_wl.c
src/bin/e_comp_wl.h
src/bin/e_desk.c
src/bin/e_dpms.c
src/bin/e_icon.c
src/bin/e_utils.c
src/bin/e_zone.c

index 45ff6874f64e03657e2efc1c7a3fb5f4a07d02bd..c4dc09e7fbc8567e245dc7a6479e48b9b9a99ce7 100644 (file)
@@ -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;
index d183c4b15ac2ff3a3f9512f65e920e3e0201e9b1..6911a66d905e03625334a7b9851d6bad3d906a26 100644 (file)
@@ -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
index 6814d01b0ae9218b932ba5f608ab280d63e7d0e5..8a208b5e19a9ddcd67d6b34851b021f4cdd84872 100644 (file)
@@ -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)
index cedc67ef36cce9485f0fa0b40b9c4e92fb311868..400d33ca3174a2d6a68dd5c4adeb4a1f3fa6bea8 100644 (file)
@@ -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;
index 0fb449ac234ff964712f09df2941eee87913fad3..eab16a8c819a3404063a4653e0c5698f2b8db825 100644 (file)
@@ -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
index c7b5b2c8ec71776b913f1d2a4e6cfdc216c74a03..18dd44bbed38551242747be2a9d3f4bd472191f6 100644 (file)
@@ -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
index 7f6a67fe7d9c5c1a2f7e79a98063f1680c2fb47c..30b51597edd29b973f5f31719cfc95bf33b7611e 100644 (file)
@@ -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;
 }
 
index a227203e45c40e8b9b22b13eb2f7a22f0af239ea..7cb4ac753e1eb5fb4ccb745dcfbaca064a8df3da 100644 (file)
@@ -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;
 }
 
index 7ccd05bc9bac2f339672cae9efd9b743e3a3fc53..ed9d399e322fa3fe0ec8a7a0abc8d3d95aa3da69 100644 (file)
@@ -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);
 }