From 5e903329af51c8898e8f3b13945267cbd49c0998 Mon Sep 17 00:00:00 2001 From: Ray Date: Tue, 4 Dec 2018 00:42:47 +0100 Subject: [PATCH] Some minor tweaks --- src/raygui.h | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/raygui.h b/src/raygui.h index cd8234b..b5b92fa 100644 --- a/src/raygui.h +++ b/src/raygui.h @@ -379,7 +379,6 @@ RAYGUIDEF void UnloadGuiStyle(GuiStyle style); // Unload style #if defined(RAYGUI_IMPLEMENTATION) #include // Required for: FILE, fopen(), fclose(), fprintf(), feof(), fscanf(), vsprintf() -#include // Required for: NAN #include // Required for: strlen() on GuiTextBox() #if defined(RAYGUI_STANDALONE) @@ -2978,14 +2977,16 @@ RAYGUIDEF void GuiUpdateStyleComplete(void) // NOTE: Color data should be passed normalized static Vector3 ConvertRGBtoHSV(Vector3 rgb) { - Vector3 hsv; - float min, max, delta; + Vector3 hsv = { 0.0f }; + float min = 0.0f; + float max = 0.0f; + float delta = 0.0f; - min = rgb.x < rgb.y ? rgb.x : rgb.y; - min = min < rgb.z ? min : rgb.z; + min = (rgb.x < rgb.y) ? rgb.x : rgb.y; + min = (min < rgb.z) ? min : rgb.z; - max = rgb.x > rgb.y ? rgb.x : rgb.y; - max = max > rgb.z ? max : rgb.z; + max = (rgb.x > rgb.y) ? rgb.x : rgb.y; + max = (max > rgb.z) ? max : rgb.z; hsv.z = max; // Value delta = max - min; @@ -3006,7 +3007,7 @@ static Vector3 ConvertRGBtoHSV(Vector3 rgb) { // NOTE: If max is 0, then r = g = b = 0, s = 0, h is undefined hsv.y = 0.0f; - hsv.x = NAN; // Undefined + hsv.x = 0.0f; // Undefined, maybe NAN? return hsv; } @@ -3029,9 +3030,9 @@ static Vector3 ConvertRGBtoHSV(Vector3 rgb) // NOTE: Color data should be passed normalized static Vector3 ConvertHSVtoRGB(Vector3 hsv) { - Vector3 rgb; - float hh, p, q, t, ff; - long i; + Vector3 rgb = { 0.0f }; + float hh = 0.0f, p = 0.0f, q = 0.0f, t = 0.0f, ff = 0.0f; + long i = 0; // NOTE: Comparing float values could not work properly if (hsv.y <= 0.0f)