Fix compiler warnings (-Wfloat-equal)

This commit is contained in:
M. Liebmann
2014-02-21 00:00:51 +01:00
parent c4bff391a5
commit 3f0400a23e
2 changed files with 7 additions and 3 deletions

View File

@@ -35,7 +35,11 @@
#include <gui/color.h>
#include <stdio.h>
#include <math.h>
#ifndef FLT_EPSILON
#define FLT_EPSILON 1E-5
#endif
int convertSetupColor2RGB(const unsigned char r, const unsigned char g, const unsigned char b)
{
@@ -145,7 +149,7 @@ void Hsv2Rgb(HsvColor *hsv, RgbColor *rgb)
float f_H = hsv->h;
float f_S = hsv->s;
float f_V = hsv->v;
if (f_S == 0) {
if (fabsf(f_S) < FLT_EPSILON) {
rgb->r = (uint8_t)(f_V * 255);
rgb->g = (uint8_t)(f_V * 255);
rgb->b = (uint8_t)(f_V * 255);
@@ -204,7 +208,7 @@ void Rgb2Hsv(RgbColor *rgb, HsvColor *hsv)
float f_H = 0;
float f_S = 0;
if (delta == 0) { //gray
if (fabsf(delta) < FLT_EPSILON) { //gray
f_S = 0;
f_H = 0;
} else {

View File

@@ -667,7 +667,7 @@ bool CLuaMenuChangeObserver::changeNotify(lua_State *L, const std::string &luaAc
lua_pcall(L, 2 /* two args */, 1 /* one result */, 0);
double res = lua_isnumber(L, -1) ? lua_tonumber(L, -1) : 0;
lua_pop(L, 2);
return ((res == menu_return::RETURN_REPAINT) || (res == menu_return::RETURN_EXIT_REPAINT));
return (((int)res == menu_return::RETURN_REPAINT) || ((int)res == menu_return::RETURN_EXIT_REPAINT));
}
void CLuaInstance::MenuRegister(lua_State *L)