summaryrefslogtreecommitdiff
path: root/src/examples
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2020-05-12 09:21:09 +0200
committerXavi Artigas <xavierartigas@yahoo.es>2020-05-12 16:10:02 +0200
commitd5b119a30a27eae27a9f85b5a818bd8608aa65ff (patch)
treedf55f87f77332443932c01994e6bf03f1de7de94 /src/examples
parente893d1ab7e770b2d1df75a730a3778480c079033 (diff)
downloadefl-d5b119a30a27eae27a9f85b5a818bd8608aa65ff.tar.gz
examples: resolve float compare warnings
Summary: Depends on D11795 Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11796
Diffstat (limited to 'src/examples')
-rw-r--r--src/examples/edje/edje-basic.c6
-rw-r--r--src/examples/eldbus/client.c2
-rw-r--r--src/examples/elementary/bg_example_03.c8
-rw-r--r--src/examples/elementary/progressbar_example.c2
-rw-r--r--src/examples/elementary/transit_example_03.c8
-rw-r--r--src/examples/evas/efl-canvas-vg-simple.c2
-rw-r--r--src/examples/evas/evas-box.c8
-rw-r--r--src/examples/evas/evas-gl.c2
-rw-r--r--src/examples/evas/evas-vg-batman.c2
-rw-r--r--src/examples/evas/evas-vg-simple.c2
10 files changed, 21 insertions, 21 deletions
diff --git a/src/examples/edje/edje-basic.c b/src/examples/edje/edje-basic.c
index 4d56680dcb..55df12ad05 100644
--- a/src/examples/edje/edje-basic.c
+++ b/src/examples/edje/edje-basic.c
@@ -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);
diff --git a/src/examples/eldbus/client.c b/src/examples/eldbus/client.c
index fe8391f579..9bf71f433c 100644
--- a/src/examples/eldbus/client.c
+++ b/src/examples/eldbus/client.c
@@ -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;
diff --git a/src/examples/elementary/bg_example_03.c b/src/examples/elementary/bg_example_03.c
index 5337d3426a..32ba3ed6f5 100644
--- a/src/examples/elementary/bg_example_03.c
+++ b/src/examples/elementary/bg_example_03.c
@@ -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);
}
diff --git a/src/examples/elementary/progressbar_example.c b/src/examples/elementary/progressbar_example.c
index f6d2538dc0..c33b049959 100644
--- a/src/examples/elementary/progressbar_example.c
+++ b/src/examples/elementary/progressbar_example.c
@@ -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");
diff --git a/src/examples/elementary/transit_example_03.c b/src/examples/elementary/transit_example_03.c
index a183201350..cea2d5b624 100644
--- a/src/examples/elementary/transit_example_03.c
+++ b/src/examples/elementary/transit_example_03.c
@@ -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;
}
diff --git a/src/examples/evas/efl-canvas-vg-simple.c b/src/examples/evas/efl-canvas-vg-simple.c
index 79a9645890..15d74aea86 100644
--- a/src/examples/evas/efl-canvas-vg-simple.c
+++ b/src/examples/evas/efl-canvas-vg-simple.c
@@ -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);
diff --git a/src/examples/evas/evas-box.c b/src/examples/evas/evas-box.c
index 82d5483924..0a2156e5d2 100644
--- a/src/examples/evas/evas-box.c
+++ b/src/examples/evas/evas-box.c
@@ -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);
diff --git a/src/examples/evas/evas-gl.c b/src/examples/evas/evas-gl.c
index 3694d3c9bc..0d90665647 100644
--- a/src/examples/evas/evas-gl.c
+++ b/src/examples/evas/evas-gl.c
@@ -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);
diff --git a/src/examples/evas/evas-vg-batman.c b/src/examples/evas/evas-vg-batman.c
index 72bdd6c4fe..f6576f5d63 100644
--- a/src/examples/evas/evas-vg-batman.c
+++ b/src/examples/evas/evas-vg-batman.c
@@ -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);
diff --git a/src/examples/evas/evas-vg-simple.c b/src/examples/evas/evas-vg-simple.c
index ef128d511e..f5f284bf0a 100644
--- a/src/examples/evas/evas-vg-simple.c
+++ b/src/examples/evas/evas-vg-simple.c
@@ -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);