examples: resolve float compare warnings

Summary: Depends on D11795

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D11796
This commit is contained in:
Mike Blumenkrantz 2020-05-12 09:21:09 +02:00 committed by Xavi Artigas
parent e893d1ab7e
commit d5b119a30a
10 changed files with 21 additions and 21 deletions

View File

@ -60,7 +60,7 @@ _on_keydown(void *data,
printf("got scale %f\n", scale);
if (scale != 1.0) scale = 1.0;
if (!EINA_DBL_EQ(scale, 1.0)) scale = 1.0;
else scale = 2.0;
edje_scale_set(scale);
@ -75,8 +75,8 @@ _on_keydown(void *data,
printf("got scale %f\n", scale);
if (!scale) scale = 1.0;
else if (scale == 1.0) scale = 2.0;
if (EINA_DBL_EQ(scale, 0)) scale = 1.0;
else if (EINA_DBL_EQ(scale, 1.0)) scale = 2.0;
else scale = 0.0;
edje_object_scale_set(edje_obj, scale);

View File

@ -219,7 +219,7 @@ _on_send_double(void *data EINA_UNUSED, const Eldbus_Message *msg, Eldbus_Pendin
return;
}
if (d != expected.d)
if (!EINA_DBL_EQ(d, expected.d))
{
ERR("Double value doesn't match expected value");
return;

View File

@ -39,13 +39,13 @@ _cb_color_changed(void *data, Evas_Object *obj, void *event EINA_UNUSED)
double val = 0.0;
val = elm_spinner_value_get(obj);
if (val == 1.0)
if (EINA_DBL_EQ(val, 1.0))
elm_bg_color_set(o_bg, 255, 255, 255);
else if (val == 2.0)
else if (EINA_DBL_EQ(val, 2.0))
elm_bg_color_set(o_bg, 255, 0, 0);
else if (val == 3.0)
else if (EINA_DBL_EQ(val, 3.0))
elm_bg_color_set(o_bg, 0, 0, 255);
else if (val == 4.0)
else if (EINA_DBL_EQ(val, 4.0))
elm_bg_color_set(o_bg, 0, 255, 0);
}

View File

@ -117,7 +117,7 @@ _on_changed(void *data,
Evas_Object *label = (Evas_Object *)data;
val = elm_progressbar_value_get(obj);
if (val == 0)
if (EINA_DBL_EQ(val, 0))
{
tstart = 0;
elm_object_text_set(label, "ETA: N/A");

View File

@ -152,13 +152,13 @@ _cb_tween_changed(void *data, Evas_Object *obj, void *event EINA_UNUSED)
double val = 0.0;
val = elm_spinner_value_get(obj);
if (val == 1.0)
if (EINA_DBL_EQ(val, 1.0))
*mode = ELM_TRANSIT_TWEEN_MODE_LINEAR;
else if (val == 2.0)
else if (EINA_DBL_EQ(val, 2.0))
*mode = ELM_TRANSIT_TWEEN_MODE_SINUSOIDAL;
else if (val == 3.0)
else if (EINA_DBL_EQ(val, 3.0))
*mode = ELM_TRANSIT_TWEEN_MODE_DECELERATE;
else if (val == 4.0)
else if (EINA_DBL_EQ(val, 4.0))
*mode = ELM_TRANSIT_TWEEN_MODE_ACCELERATE;
}

View File

@ -411,7 +411,7 @@ _interpolation_keyframe(void *data EINA_UNUSED, double pos)
eina_list_nth(d.shape_list, next),
ecore_animator_pos_map(pos, ECORE_POS_MAP_SINUSOIDAL, 0.0, 0.0));
if (pos == 1.0)
if (EINA_DBL_EQ(pos, 1.0))
{
anim_index = (anim_index == 1) ? 0 : 1;
animator = ecore_animator_timeline_add(1, _interpolation_keyframe, NULL);

View File

@ -150,13 +150,13 @@ list_free:
evas_object_box_align_get(d.box, &h, &v);
if (h == 0.5)
if (EINA_DBL_EQ(h, 0.5))
h = v = 1.0;
else if (h == 1.0)
else if (EINA_DBL_EQ(h, 1.0))
h = v = -1.0;
else if (h == -1.0)
else if (EINA_DBL_EQ(h, -1.0))
h = v = 0.0;
else if (h == 0.0)
else if (EINA_DBL_EQ(h, 0.0))
h = v = 0.5;
evas_object_box_align_set(d.box, h, v);

View File

@ -199,7 +199,7 @@ view_set_ortho(float result[16], const float left, const float right,
const float bottom, const float top, const float near_,
const float far_)
{
if ((right - left) == 0.0f || (top - bottom) == 0.0f || (far_ - near_) == 0.0f)
if (EINA_FLT_EQ((right - left), 0.0f) || EINA_FLT_EQ((top - bottom), 0.0f) || EINA_FLT_EQ((far_ - near_), 0.0f))
return 0;
result[0] = 2.0f / (right - left);

View File

@ -84,7 +84,7 @@ _animator(void *data EINA_UNUSED, double pos)
batmans_vg[next],
ecore_animator_pos_map(pos, ECORE_POS_MAP_SINUSOIDAL, 0.0, 0.0));
if (pos == 1.0)
if (EINA_DBL_EQ(pos, 1.0))
{
animation_position = next;
animation = ecore_animator_timeline_add(1, _animator, NULL);

View File

@ -451,7 +451,7 @@ _interpolation_keyframe(void *data EINA_UNUSED, double pos)
eina_list_nth(d.shape_list, next),
ecore_animator_pos_map(pos, ECORE_POS_MAP_SINUSOIDAL, 0.0, 0.0));
if (pos == 1.0)
if (EINA_DBL_EQ(pos, 1.0))
{
anim_index = (anim_index == 1) ? 0 : 1;
animator = ecore_animator_timeline_add(1, _interpolation_keyframe, NULL);