forked from enlightenment/efl
efl: fix some warnings in examples
Summary: - Check return vaule of fread() - Uninitialized var (seriously!) - Weird struct assignment Still one warning remains, pending evaluation of T7166. Fixes T6718 Test Plan: Those 3 warnings have disappeared and the related example still works as expected. Reviewers: zmike Reviewed By: zmike Subscribers: cedric, #committers Tags: #efl Maniphest Tasks: T6718 Differential Revision: https://phab.enlightenment.org/D6631
This commit is contained in:
parent
d9515f002a
commit
b4d3c92b6c
|
@ -31,7 +31,10 @@ main(void)
|
|||
|
||||
if ((buffer = malloc(size)))
|
||||
{
|
||||
fread(buffer, 1, size, file);
|
||||
if (fread(buffer, 1, size, file) != size)
|
||||
{
|
||||
EINA_LOG_ERR("Can't read chat.xml");
|
||||
}
|
||||
|
||||
array = eina_array_new(10);
|
||||
eina_simple_xml_parse(buffer, size, EINA_TRUE,
|
||||
|
|
|
@ -72,7 +72,7 @@ EAPI_MAIN int
|
|||
elm_main(int argc, char **argv)
|
||||
{
|
||||
Efl_Ui_Layout_Factory *factory;
|
||||
Evas_Object *win, *li, *bx;
|
||||
Evas_Object *win, *li;
|
||||
Eo *model;
|
||||
|
||||
win = elm_win_util_standard_add("viewlist", "Viewlist");
|
||||
|
@ -90,7 +90,6 @@ elm_main(int argc, char **argv)
|
|||
li = efl_add(EFL_UI_VIEW_LIST_CLASS, win);
|
||||
efl_ui_view_list_layout_factory_set(li, factory);
|
||||
efl_ui_view_model_set(li, model);
|
||||
elm_box_pack_end(bx, li);
|
||||
|
||||
efl_event_callback_add(li, EFL_UI_VIEW_LIST_EVENT_ITEM_REALIZED, _realized_cb, NULL);
|
||||
// efl_event_callback_add(li, EFL_UI_VIEW_LIST_EVENT_ITEM_UNREALIZED, _unrealized_cb, NULL);
|
||||
|
|
|
@ -71,8 +71,9 @@ _anim_cb(void *data)
|
|||
App_Data *ad = data;
|
||||
Evas_Object *o;
|
||||
Eina_Rect rect;
|
||||
int r, g, b, a, f, h, w;
|
||||
int r, g, b, a, f;
|
||||
int win_w, win_h, mx, my;
|
||||
Eina_Size2D size;
|
||||
|
||||
f = ad->frame;
|
||||
r = ad->colors[ad->colors_index].r;
|
||||
|
@ -90,13 +91,13 @@ _anim_cb(void *data)
|
|||
|
||||
|
||||
o = evas_object_name_find(ad->canvas, "obj2");
|
||||
h = efl_gfx_entity_size_get(o).h;
|
||||
size = efl_gfx_entity_size_get(o);
|
||||
efl_gfx_map_reset(o);
|
||||
efl_gfx_map_smooth_set(o, ad->smooth);
|
||||
efl_gfx_map_alpha_set(o, ad->alpha);
|
||||
efl_gfx_map_color_set(o, -1, r, g, b, a);
|
||||
efl_gfx_map_translate(o, 0, 0, 100);
|
||||
efl_gfx_map_rotate_3d(o, f * 6, f * 6, f * 6, NULL, 1./3., 10. / h, 0);
|
||||
efl_gfx_map_rotate_3d(o, f * 6, f * 6, f * 6, NULL, 1./3., 10. / size.h, 0);
|
||||
if (ad->apply_lighting)
|
||||
{
|
||||
efl_gfx_map_lightning_3d(o, ad->canvas, 0.5, 0.5, -100.,
|
||||
|
@ -105,13 +106,13 @@ _anim_cb(void *data)
|
|||
|
||||
|
||||
o = evas_object_name_find(ad->canvas, "obj3");
|
||||
EINA_SIZE2D(w, h) = efl_gfx_entity_size_get(o);
|
||||
size = efl_gfx_entity_size_get(o);
|
||||
efl_gfx_map_reset(o);
|
||||
efl_gfx_map_smooth_set(o, ad->smooth);
|
||||
efl_gfx_map_alpha_set(o, ad->alpha);
|
||||
efl_gfx_map_color_set(o, -1, r, g, b, a);
|
||||
efl_gfx_map_translate(o, 0, h/2, -20);
|
||||
efl_gfx_map_rotate_3d(o, 20, f * 6, 0, NULL, 0.5, 0.5, w / 2);
|
||||
efl_gfx_map_translate(o, 0, size.h/2, -20);
|
||||
efl_gfx_map_rotate_3d(o, 20, f * 6, 0, NULL, 0.5, 0.5, size.w / 2);
|
||||
if (ad->apply_perspective)
|
||||
efl_gfx_map_perspective_3d(o, NULL, 0.5, 0.5, 0, 256);
|
||||
if (ad->apply_lighting)
|
||||
|
|
Loading…
Reference in New Issue