Revert "edje: fix float comparison warning in edje_cc."

This reverts commit 9730eb1f47.

This introduces new issues, such as:
Warning: naviframe.edc:451: couldn't find an exact match in
 part 'elements_clip' when looking for 'hidden' 0.000000. Falling
 back to nearest one 'hidden' 0.000000.

Because some comparison was not done properly, and changed
float != 0 to float == 0.

Get it right if you insist on "fixing" those floating point
comparisons.
This commit is contained in:
Jean-Philippe Andre 2016-12-22 14:08:51 +09:00
parent bceb263910
commit 176b0c8d03
2 changed files with 10 additions and 16 deletions

View File

@ -3676,7 +3676,7 @@ st_collections_base_scale(void)
check_min_arg_count(1);
edje_file->base_scale = FROM_DOUBLE(parse_float_range(0, 0.0, 999999999.0));
if (EQ(edje_file->base_scale, ZERO))
if (edje_file->base_scale == ZERO)
{
ERR("The base_scale is 0.0. The value should be bigger than 0.0.");
exit(-1);
@ -8180,7 +8180,7 @@ st_collections_group_parts_part_description_inherit(void)
exit(-1);
}
if (!strcmp (parent_name, "default") && EINA_DBL_CMP(parent_val, 0.0))
if (!strcmp (parent_name, "default") && parent_val == 0.0)
parent = ep->default_desc;
else
{
@ -8212,8 +8212,8 @@ st_collections_group_parts_part_description_inherit(void)
}
}
if (EINA_DBL_CMP(min_dst, 0.0))
{
if (min_dst)
{
WRN("%s:%i: couldn't find an exact match in part '%s' when looking for '%s' %lf. Falling back to nearest one '%s' %lf.",
file_in, line - 1, ep->name, parent_name, parent_val, parent ? parent->state.name : NULL, parent ? parent->state.value : 0);
}
@ -8472,12 +8472,8 @@ _part_description_state_update(Edje_Part_Description_Common *ed)
Edje_Part *ep = current_part;
if (ed == ep->default_desc) return;
if ((ep->default_desc->state.name &&
!strcmp(ed->state.name, ep->default_desc->state.name) &&
EQ(ed->state.value, ep->default_desc->state.value)) ||
(!ep->default_desc->state.name &&
!strcmp(ed->state.name, "default") &&
EQ(ed->state.value, ep->default_desc->state.value)))
if ((ep->default_desc->state.name && !strcmp(ed->state.name, ep->default_desc->state.name) && ed->state.value == ep->default_desc->state.value) ||
(!ep->default_desc->state.name && !strcmp(ed->state.name, "default") && ed->state.value == ep->default_desc->state.value))
{
if (ep->type == EDJE_PART_TYPE_IMAGE)
_edje_part_description_image_remove((Edje_Part_Description_Image*) ed);
@ -8493,8 +8489,7 @@ _part_description_state_update(Edje_Part_Description_Common *ed)
unsigned int i;
for (i = 0; i < ep->other.desc_count - 1; ++i)
{
if (!strcmp(ed->state.name, ep->other.desc[i]->state.name) &&
EQ(ed->state.value, ep->other.desc[i]->state.value))
if (!strcmp(ed->state.name, ep->other.desc[i]->state.name) && ed->state.value == ep->other.desc[i]->state.value)
{
if (ep->type == EDJE_PART_TYPE_IMAGE)
_edje_part_description_image_remove((Edje_Part_Description_Image*) ed);
@ -8549,8 +8544,7 @@ st_collections_group_parts_part_description_state(void)
val = parse_float_range(1, 0.0, 1.0);
/* if only default desc exists and current desc is not default, commence paddling */
if ((!ep->other.desc_count) &&
(!EINA_DBL_CMP(val, 0) || (!eina_streq(s, "default"))))
if ((!ep->other.desc_count) && (val || (!eina_streq(s, "default"))))
{
ERR("parse error %s:%i. invalid state name: '%s'. \"default\" state must always be first.",
file_in, line - 1, s);

View File

@ -1891,7 +1891,7 @@ _calcf(char op, double a, double b)
a -= b;
return a;
case '/':
if (NEQ(b, 0)) a /= b;
if (b != 0) a /= b;
else
ERR("%s:%i divide by zero", file_in, line - 1);
return a;
@ -1899,7 +1899,7 @@ _calcf(char op, double a, double b)
a *= b;
return a;
case '%':
if (NEQ(b, 0)) a = (double)((int)a % (int)b);
if (0 != b) a = (double)((int)a % (int)b);
else
ERR("%s:%i modula by zero", file_in, line - 1);
return a;