fixed the problems detected by static analyzer 11/68411/5 accepted/tizen/common/20160505.140315 accepted/tizen/ivi/20160504.115207 accepted/tizen/mobile/20160504.114928 accepted/tizen/tv/20160504.114728 accepted/tizen/wearable/20160504.115025 submit/tizen/20160504.062133
authorGwanglim Lee <gl77.lee@samsung.com>
Wed, 4 May 2016 05:34:19 +0000 (14:34 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Wed, 4 May 2016 06:06:52 +0000 (15:06 +0900)
Change-Id: Ib343b6b39c6d9c98c8d4cea7a76ab40ff015d75e

src/bin/e_actions.c
src/bin/e_client.c
src/bin/e_comp.h
src/bin/e_comp_hwc.c
src/bin/e_comp_wl.c
src/bin/e_hints.c

index 2881328129612fa74126f644f92a201e8cc9a939..42a2ed1727497cdda45a1e0f398c69ea7c908bd3 100644 (file)
@@ -2426,7 +2426,7 @@ e_action_predef_name_del(const char *act_grp, const char *act_name)
 
    EINA_LIST_FOREACH(actg->acts, l, actd)
      {
-        if (!strcmp(actd->act_name, act_name))
+        if ((actd->act_name) && (!strcmp(actd->act_name, act_name)))
           {
              actg->acts = eina_list_remove(actg->acts, actd);
 
index 2f8d9b42fbfafde4be6d600de94c9fdc1a738907..0a4bf0bf967194ffa54a9ff66e2f1687af0852dc 100644 (file)
@@ -29,7 +29,7 @@ E_API int E_EVENT_CLIENT_VISIBILITY_CHANGE = -1;
 E_API int E_EVENT_CLIENT_BUFFER_CHANGE = -1;
 #endif
 
-static Eina_Hash *clients_hash[2] = {NULL}; // pixmap->client
+static Eina_Hash *clients_hash[E_PIXMAP_TYPE_MAX] = {NULL}; // pixmap->client
 
 static unsigned int focus_track_frozen = 0;
 
@@ -826,6 +826,7 @@ static void
 _e_client_del(E_Client *ec)
 {
    E_Client *child;
+   E_Pixmap_Type type;
 
    ec->changed = 0;
    focus_stack = eina_list_remove(focus_stack, ec);
@@ -894,7 +895,9 @@ _e_client_del(E_Client *ec)
    EINA_LIST_FREE(ec->group, child)
      child->leader = NULL;
 
-   eina_hash_del_by_key(clients_hash[e_pixmap_type_get(ec->pixmap)], &ec->pixmap);
+   type = e_pixmap_type_get(ec->pixmap);
+   if (type < E_PIXMAP_TYPE_MAX)
+     eina_hash_del_by_key(clients_hash[type], &ec->pixmap);
    e_comp->clients = eina_list_remove(e_comp->clients, ec);
    e_comp_object_render_update_del(ec->frame);
    e_comp_post_update_purge(ec);
@@ -3049,8 +3052,18 @@ e_client_idler_before(void)
 {
    const Eina_List *l;
    E_Client *ec;
+   Eina_Bool exist_clients_hash = EINA_FALSE;
+   int pix_id;
 
-   if ((!eina_hash_population(clients_hash[0])) && (!eina_hash_population(clients_hash[1]))) return;
+   for (pix_id = 0; pix_id < E_PIXMAP_TYPE_MAX; pix_id++)
+     {
+        if (eina_hash_population(clients_hash[pix_id]))
+          {
+             exist_clients_hash = EINA_TRUE;
+             break;
+          }
+     }
+   if (!exist_clients_hash) return;
 
    TRACE_DS_BEGIN(CLIENT:IDLE BEFORE);
 
@@ -3156,8 +3169,9 @@ e_client_idler_before(void)
 EINTERN Eina_Bool
 e_client_init(void)
 {
-   clients_hash[0] = eina_hash_pointer_new(NULL);
-   clients_hash[1] = eina_hash_pointer_new(NULL);
+   int pix_id;
+   for (pix_id = 0; pix_id < E_PIXMAP_TYPE_MAX; pix_id++)
+     clients_hash[pix_id] = eina_hash_pointer_new(NULL);
 
    E_LIST_HANDLER_APPEND(handlers, E_EVENT_POINTER_WARP, _e_client_cb_pointer_warp, NULL);
    E_LIST_HANDLER_APPEND(handlers, E_EVENT_CONFIG_MODE_CHANGED, _e_client_cb_config_mode, NULL);
@@ -3195,8 +3209,9 @@ e_client_init(void)
 EINTERN void
 e_client_shutdown(void)
 {
-   E_FREE_FUNC(clients_hash[0], eina_hash_free);
-   E_FREE_FUNC(clients_hash[1], eina_hash_free);
+   int pix_id;
+   for (pix_id = 0; pix_id < E_PIXMAP_TYPE_MAX; pix_id++)
+     E_FREE_FUNC(clients_hash[pix_id], eina_hash_free);
 
    E_FREE_LIST(handlers, ecore_event_handler_del);
 
@@ -3226,8 +3241,11 @@ E_API E_Client *
 e_client_new(E_Pixmap *cp, int first_map, int internal)
 {
    E_Client *ec;
+   E_Pixmap_Type type;
 
-   if (eina_hash_find(clients_hash[e_pixmap_type_get(cp)], &cp)) return NULL;
+   type = e_pixmap_type_get(cp);
+   if (type >= E_PIXMAP_TYPE_MAX) return NULL;
+   if (eina_hash_find(clients_hash[type], &cp)) return NULL;
 
    ec = E_OBJECT_ALLOC(E_Client, E_CLIENT_TYPE, _e_client_free);
    if (!ec) return NULL;
index 076c65f9d941356a5ce12ce80ff2de2b2dfba280..207999ccfb6e171f74734413902f73222a42cd4b 100644 (file)
@@ -133,9 +133,7 @@ struct _E_Comp
 
    Eina_Stringshare *name;
    struct {
-      Ecore_Window win;
       Evas_Object *obj;
-      //Eina_Inlist *objs; /* E_Comp_Object; NOT to be exposed; seems pointless? */
       Eina_Inlist *clients; /* E_Client, bottom to top */
       unsigned int clients_count;
    } layers[E_LAYER_COUNT];
index 59a31f0fba15ef3b7867791ac98564e2de951ee1..74b0b744776aa5cbc282ec92f952882b17ce1ba0 100755 (executable)
@@ -1110,7 +1110,8 @@ _e_comp_hwc_output_commit(E_Comp_Hwc_Output *hwc_output, E_Comp_Hwc_Layer *hwc_l
                 hwc_layer->info.dst_pos.w, hwc_layer->info.dst_pos.h, data);
          else
            ELOGF("HWC", "Commit  Layer(%p)     wl_buffer(%p) tsurface(%p) (%dx%d,[%d,%d,%d,%d]=>[%d,%d,%d,%d]) data(%p) wl_buffer_ref(%p)",
-                 ec->pixmap, ec, hwc_layer, _get_wl_buffer(ec), tsurface,
+                 ec ? ec->pixmap : NULL, ec,
+                 hwc_layer, _get_wl_buffer(ec), tsurface,
                  hwc_layer->info.src_config.size.h, hwc_layer->info.src_config.size.h,
                  hwc_layer->info.src_config.pos.x, hwc_layer->info.src_config.pos.y,
                  hwc_layer->info.src_config.pos.w, hwc_layer->info.src_config.pos.h,
index 4398f51edc297a6712872887e2e171c75040329b..03545a6544d5b76bec80f382b71df43d2ba50af7 100644 (file)
@@ -2238,7 +2238,7 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state)
              EINA_LIST_FREE(state->damages, dmg)
                {
                   Eina_Rectangle temp = {0,};
-                  if (ec->comp_data && ec->comp_data->sub.data &&
+                  if (ec->comp_data->sub.data &&
                       (ec->comp_data->scaler.buffer_viewport.surface.width != -1 ||
                        ec->comp_data->scaler.buffer_viewport.buffer.src_width != wl_fixed_from_int(-1)))
                     {
@@ -3991,7 +3991,6 @@ _e_comp_wl_gl_init(void *data EINA_UNUSED)
    e_comp_wl->wl.glapi = glapi;
    e_comp_wl->wl.glsfc = sfc;
    e_comp_wl->wl.glctx = ctx;
-   e_comp_wl->wl.glcfg = cfg;
 
    /* for native surface */
    e_comp->gl = 1;
index 94f6ac662130e89ea09d176420321c0524b34026..b55c7966e04dc950083c542b7901903acbf2f403 100644 (file)
@@ -296,19 +296,19 @@ e_hints_aux_hint_add_with_pixmap(E_Pixmap *cp, int32_t id, const char *name, con
    if (!found)
      {
         hint = E_NEW(E_Comp_Wl_Aux_Hint, 1);
+        EINA_SAFETY_ON_NULL_RETURN_VAL(hint, EINA_FALSE);
+
         memset(hint, 0, sizeof(E_Comp_Wl_Aux_Hint));
-        if (hint)
-          {
-             hint->id = id;
-             hint->hint = eina_stringshare_add(name);
-             hint->val = eina_stringshare_add(val);
-             hint->changed = EINA_TRUE;
-             hint->deleted = EINA_FALSE;
-             cdata->aux_hint.hints = eina_list_append(cdata->aux_hint.hints, hint);
-             cdata->aux_hint.changed = 1;
-             ELOGF("COMP", "AUX_HINT |Add [%d:%s:%s]", cp, e_pixmap_client_get(cp),
-                   id, hint->hint, hint->val);
-          }
+
+        hint->id = id;
+        hint->hint = eina_stringshare_add(name);
+        hint->val = eina_stringshare_add(val);
+        hint->changed = EINA_TRUE;
+        hint->deleted = EINA_FALSE;
+        cdata->aux_hint.hints = eina_list_append(cdata->aux_hint.hints, hint);
+        cdata->aux_hint.changed = 1;
+        ELOGF("COMP", "AUX_HINT |Add [%d:%s:%s]", cp, e_pixmap_client_get(cp),
+              id, hint->hint, hint->val);
      }
 
    if (!found)