From 03d0f1d2dc75e59a0079c1be53d78a2a431c1dc1 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Wed, 28 Dec 2016 19:40:24 +0900 Subject: [PATCH] e - fix float warnings cmp where they actually may cause issues --- src/bin/e_bindings.c | 2 +- src/modules/conf_randr/e_int_config_randr2.c | 2 +- src/modules/geolocation/e_mod_main.c | 12 ++++++------ src/modules/tiling/e_mod_tiling.c | 2 +- src/modules/tiling/window_tree.c | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/bin/e_bindings.c b/src/bin/e_bindings.c index 53817831b..6ec62cb54 100644 --- a/src/bin/e_bindings.c +++ b/src/bin/e_bindings.c @@ -809,7 +809,7 @@ e_bindings_edge_get(const char *action, E_Zone_Edge edge, int click) EINA_LIST_FOREACH(edge_bindings, l, binding) { if ((binding->edge == edge) && - ((click && (binding->delay == -1.0 * click)) + ((click && EINA_DBL_CMP(binding->delay, -1.0 * click)) || (!click && (binding->delay >= 0.0))) && (binding->action) && (action) && (!strcmp(action, binding->action))) diff --git a/src/modules/conf_randr/e_int_config_randr2.c b/src/modules/conf_randr/e_int_config_randr2.c index d02abb165..404fd6fb2 100644 --- a/src/modules/conf_randr/e_int_config_randr2.c +++ b/src/modules/conf_randr/e_int_config_randr2.c @@ -378,7 +378,7 @@ _basic_screen_info_fill(E_Config_Dialog_Data *cfdata, E_Config_Randr2_Screen *cs cfdata->freelist = eina_list_append(cfdata->freelist, mode_cbdata); /* printf("mode add %p %p %p\n", mode_cbdata, cfdata->modes_obj, it); */ if ((cs->mode_w == m->w) && (cs->mode_h == m->h) && - (cs->mode_refresh == m->refresh)) + (fabs(cs->mode_refresh - m->refresh) < 0.01 )) it_sel = it; } } diff --git a/src/modules/geolocation/e_mod_main.c b/src/modules/geolocation/e_mod_main.c index e0561af53..6ec785c2b 100644 --- a/src/modules/geolocation/e_mod_main.c +++ b/src/modules/geolocation/e_mod_main.c @@ -80,21 +80,21 @@ popup_update(Instance *inst) snprintf(buf, sizeof(buf), _("Longitude: %f"), inst->longitude); e_widget_label_text_set(inst->popup_longitude, buf); - if (inst->altitude != -DBL_MAX) + if (inst->altitude <= -DBL_MAX) snprintf(buf, sizeof(buf), _("Altitude: %f"), inst->altitude); else snprintf(buf, sizeof(buf), _("Altitude: N/A")); e_widget_label_text_set(inst->popup_altitude, buf); - if (inst->speed != -1.0) + if (inst->speed <= -1.0) snprintf(buf, sizeof(buf), _("Speed: %f"), inst->speed); else snprintf(buf, sizeof(buf), _("Speed: N/A")); e_widget_label_text_set(inst->popup_speed, buf); - if (inst->heading != -1.0) + if (inst->heading <= -1.0) snprintf(buf, sizeof(buf), _("Heading: %f"), inst->heading); else snprintf(buf, sizeof(buf), _("Heading: N/A")); @@ -146,7 +146,7 @@ popup_new(Instance *inst) inst->popup_longitude = e_widget_label_add(evas, buf); e_widget_list_object_append(list, inst->popup_longitude, 1, 1, 0.5); - if (inst->altitude != -DBL_MAX) + if (inst->altitude <= -DBL_MAX) snprintf(buf, sizeof(buf), _("Altitude: %f"), inst->altitude); else snprintf(buf, sizeof(buf), _("Altitude: N/A")); @@ -154,7 +154,7 @@ popup_new(Instance *inst) inst->popup_altitude = e_widget_label_add(evas, buf); e_widget_list_object_append(list, inst->popup_altitude, 1, 1, 0.5); - if (inst->speed != -1.0) + if (inst->speed <= -1.0) snprintf(buf, sizeof(buf), _("Speed: %f"), inst->speed); else snprintf(buf, sizeof(buf), _("Speed: N/A")); @@ -162,7 +162,7 @@ popup_new(Instance *inst) inst->popup_speed = e_widget_label_add(evas, buf); e_widget_list_object_append(list, inst->popup_speed, 1, 1, 0.5); - if (inst->heading != -1.0) + if (inst->heading <= -1.0) snprintf(buf, sizeof(buf), _("Heading: %f"), inst->heading); else snprintf(buf, sizeof(buf), _("Heading: N/A")); diff --git a/src/modules/tiling/e_mod_tiling.c b/src/modules/tiling/e_mod_tiling.c index e95070f8c..9f4161f89 100644 --- a/src/modules/tiling/e_mod_tiling.c +++ b/src/modules/tiling/e_mod_tiling.c @@ -997,7 +997,7 @@ _move_or_resize(E_Client *ec) default: break; } - if ((w_diff != 1.0) || (h_diff != 1.0)) + if ((!EINA_DBL_CMP(w_diff, 1.0)) || (!EINA_DBL_CMP(h_diff, 1.0))) { if (!tiling_window_tree_node_resize(item, w_dir, w_diff, h_dir, h_diff)) diff --git a/src/modules/tiling/window_tree.c b/src/modules/tiling/window_tree.c index 00d26e736..c6b951751 100644 --- a/src/modules/tiling/window_tree.c +++ b/src/modules/tiling/window_tree.c @@ -457,7 +457,7 @@ tiling_window_tree_node_resize(Window_Tree *node, int w_dir, double w_diff, h_parent = parent; } - if ((h_diff != 1.0) && h_parent) + if ((!EINA_DBL_CMP(h_diff, 1.0)) && h_parent) { Window_Tree *tmp_node = (h_parent == parent) ? node : parent; @@ -466,7 +466,7 @@ tiling_window_tree_node_resize(Window_Tree *node, int w_dir, double w_diff, h_diff, h_dir); } - if ((w_diff != 1.0) && w_parent) + if ((!EINA_DBL_CMP(w_diff, 1.0)) && w_parent) { Window_Tree *tmp_node = (w_parent == parent) ? node : parent;