mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 16:01:20 +02:00
Fix compiler warnings (-Wfloat-equal)
This commit is contained in:
@@ -35,7 +35,11 @@
|
|||||||
|
|
||||||
#include <gui/color.h>
|
#include <gui/color.h>
|
||||||
#include <stdio.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)
|
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_H = hsv->h;
|
||||||
float f_S = hsv->s;
|
float f_S = hsv->s;
|
||||||
float f_V = hsv->v;
|
float f_V = hsv->v;
|
||||||
if (f_S == 0) {
|
if (fabsf(f_S) < FLT_EPSILON) {
|
||||||
rgb->r = (uint8_t)(f_V * 255);
|
rgb->r = (uint8_t)(f_V * 255);
|
||||||
rgb->g = (uint8_t)(f_V * 255);
|
rgb->g = (uint8_t)(f_V * 255);
|
||||||
rgb->b = (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_H = 0;
|
||||||
float f_S = 0;
|
float f_S = 0;
|
||||||
|
|
||||||
if (delta == 0) { //gray
|
if (fabsf(delta) < FLT_EPSILON) { //gray
|
||||||
f_S = 0;
|
f_S = 0;
|
||||||
f_H = 0;
|
f_H = 0;
|
||||||
} else {
|
} else {
|
||||||
|
@@ -667,7 +667,7 @@ bool CLuaMenuChangeObserver::changeNotify(lua_State *L, const std::string &luaAc
|
|||||||
lua_pcall(L, 2 /* two args */, 1 /* one result */, 0);
|
lua_pcall(L, 2 /* two args */, 1 /* one result */, 0);
|
||||||
double res = lua_isnumber(L, -1) ? lua_tonumber(L, -1) : 0;
|
double res = lua_isnumber(L, -1) ? lua_tonumber(L, -1) : 0;
|
||||||
lua_pop(L, 2);
|
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)
|
void CLuaInstance::MenuRegister(lua_State *L)
|
||||||
|
Reference in New Issue
Block a user