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)
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,
60 60
61 printf("got scale %f\n", scale); 61 printf("got scale %f\n", scale);
62 62
63 if (scale != 1.0) scale = 1.0; 63 if (!EINA_DBL_EQ(scale, 1.0)) scale = 1.0;
64 else scale = 2.0; 64 else scale = 2.0;
65 65
66 edje_scale_set(scale); 66 edje_scale_set(scale);
@@ -75,8 +75,8 @@ _on_keydown(void *data,
75 75
76 printf("got scale %f\n", scale); 76 printf("got scale %f\n", scale);
77 77
78 if (!scale) scale = 1.0; 78 if (EINA_DBL_EQ(scale, 0)) scale = 1.0;
79 else if (scale == 1.0) scale = 2.0; 79 else if (EINA_DBL_EQ(scale, 1.0)) scale = 2.0;
80 else scale = 0.0; 80 else scale = 0.0;
81 81
82 edje_object_scale_set(edje_obj, scale); 82 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
219 return; 219 return;
220 } 220 }
221 221
222 if (d != expected.d) 222 if (!EINA_DBL_EQ(d, expected.d))
223 { 223 {
224 ERR("Double value doesn't match expected value"); 224 ERR("Double value doesn't match expected value");
225 return; 225 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)
39 double val = 0.0; 39 double val = 0.0;
40 40
41 val = elm_spinner_value_get(obj); 41 val = elm_spinner_value_get(obj);
42 if (val == 1.0) 42 if (EINA_DBL_EQ(val, 1.0))
43 elm_bg_color_set(o_bg, 255, 255, 255); 43 elm_bg_color_set(o_bg, 255, 255, 255);
44 else if (val == 2.0) 44 else if (EINA_DBL_EQ(val, 2.0))
45 elm_bg_color_set(o_bg, 255, 0, 0); 45 elm_bg_color_set(o_bg, 255, 0, 0);
46 else if (val == 3.0) 46 else if (EINA_DBL_EQ(val, 3.0))
47 elm_bg_color_set(o_bg, 0, 0, 255); 47 elm_bg_color_set(o_bg, 0, 0, 255);
48 else if (val == 4.0) 48 else if (EINA_DBL_EQ(val, 4.0))
49 elm_bg_color_set(o_bg, 0, 255, 0); 49 elm_bg_color_set(o_bg, 0, 255, 0);
50} 50}
51 51
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,
117 Evas_Object *label = (Evas_Object *)data; 117 Evas_Object *label = (Evas_Object *)data;
118 118
119 val = elm_progressbar_value_get(obj); 119 val = elm_progressbar_value_get(obj);
120 if (val == 0) 120 if (EINA_DBL_EQ(val, 0))
121 { 121 {
122 tstart = 0; 122 tstart = 0;
123 elm_object_text_set(label, "ETA: N/A"); 123 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)
152 double val = 0.0; 152 double val = 0.0;
153 153
154 val = elm_spinner_value_get(obj); 154 val = elm_spinner_value_get(obj);
155 if (val == 1.0) 155 if (EINA_DBL_EQ(val, 1.0))
156 *mode = ELM_TRANSIT_TWEEN_MODE_LINEAR; 156 *mode = ELM_TRANSIT_TWEEN_MODE_LINEAR;
157 else if (val == 2.0) 157 else if (EINA_DBL_EQ(val, 2.0))
158 *mode = ELM_TRANSIT_TWEEN_MODE_SINUSOIDAL; 158 *mode = ELM_TRANSIT_TWEEN_MODE_SINUSOIDAL;
159 else if (val == 3.0) 159 else if (EINA_DBL_EQ(val, 3.0))
160 *mode = ELM_TRANSIT_TWEEN_MODE_DECELERATE; 160 *mode = ELM_TRANSIT_TWEEN_MODE_DECELERATE;
161 else if (val == 4.0) 161 else if (EINA_DBL_EQ(val, 4.0))
162 *mode = ELM_TRANSIT_TWEEN_MODE_ACCELERATE; 162 *mode = ELM_TRANSIT_TWEEN_MODE_ACCELERATE;
163} 163}
164 164
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)
411 eina_list_nth(d.shape_list, next), 411 eina_list_nth(d.shape_list, next),
412 ecore_animator_pos_map(pos, ECORE_POS_MAP_SINUSOIDAL, 0.0, 0.0)); 412 ecore_animator_pos_map(pos, ECORE_POS_MAP_SINUSOIDAL, 0.0, 0.0));
413 413
414 if (pos == 1.0) 414 if (EINA_DBL_EQ(pos, 1.0))
415 { 415 {
416 anim_index = (anim_index == 1) ? 0 : 1; 416 anim_index = (anim_index == 1) ? 0 : 1;
417 animator = ecore_animator_timeline_add(1, _interpolation_keyframe, NULL); 417 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:
150 150
151 evas_object_box_align_get(d.box, &h, &v); 151 evas_object_box_align_get(d.box, &h, &v);
152 152
153 if (h == 0.5) 153 if (EINA_DBL_EQ(h, 0.5))
154 h = v = 1.0; 154 h = v = 1.0;
155 else if (h == 1.0) 155 else if (EINA_DBL_EQ(h, 1.0))
156 h = v = -1.0; 156 h = v = -1.0;
157 else if (h == -1.0) 157 else if (EINA_DBL_EQ(h, -1.0))
158 h = v = 0.0; 158 h = v = 0.0;
159 else if (h == 0.0) 159 else if (EINA_DBL_EQ(h, 0.0))
160 h = v = 0.5; 160 h = v = 0.5;
161 161
162 evas_object_box_align_set(d.box, h, v); 162 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,
199 const float bottom, const float top, const float near_, 199 const float bottom, const float top, const float near_,
200 const float far_) 200 const float far_)
201{ 201{
202 if ((right - left) == 0.0f || (top - bottom) == 0.0f || (far_ - near_) == 0.0f) 202 if (EINA_FLT_EQ((right - left), 0.0f) || EINA_FLT_EQ((top - bottom), 0.0f) || EINA_FLT_EQ((far_ - near_), 0.0f))
203 return 0; 203 return 0;
204 204
205 result[0] = 2.0f / (right - left); 205 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)
84 batmans_vg[next], 84 batmans_vg[next],
85 ecore_animator_pos_map(pos, ECORE_POS_MAP_SINUSOIDAL, 0.0, 0.0)); 85 ecore_animator_pos_map(pos, ECORE_POS_MAP_SINUSOIDAL, 0.0, 0.0));
86 86
87 if (pos == 1.0) 87 if (EINA_DBL_EQ(pos, 1.0))
88 { 88 {
89 animation_position = next; 89 animation_position = next;
90 animation = ecore_animator_timeline_add(1, _animator, NULL); 90 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)
451 eina_list_nth(d.shape_list, next), 451 eina_list_nth(d.shape_list, next),
452 ecore_animator_pos_map(pos, ECORE_POS_MAP_SINUSOIDAL, 0.0, 0.0)); 452 ecore_animator_pos_map(pos, ECORE_POS_MAP_SINUSOIDAL, 0.0, 0.0));
453 453
454 if (pos == 1.0) 454 if (EINA_DBL_EQ(pos, 1.0))
455 { 455 {
456 anim_index = (anim_index == 1) ? 0 : 1; 456 anim_index = (anim_index == 1) ? 0 : 1;
457 animator = ecore_animator_timeline_add(1, _interpolation_keyframe, NULL); 457 animator = ecore_animator_timeline_add(1, _interpolation_keyframe, NULL);