From 6c6260a7c267bcabf4ddf09d71adb492d16db6c7 Mon Sep 17 00:00:00 2001 From: Petr Abdulin Date: Mon, 22 Jan 2024 23:11:50 +0700 Subject: [PATCH 1/2] Suppress MSVC compiler `possible loss of data` warning with explicit cast --- nuklear.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nuklear.h b/nuklear.h index 4abcbc1ad..25a3e14e9 100644 --- a/nuklear.h +++ b/nuklear.h @@ -7662,9 +7662,9 @@ nk_rgb_factor(struct nk_color col, const float factor) { if (factor == 1.0f) return col; - col.r *= factor; - col.g *= factor; - col.b *= factor; + col.r = (nk_byte)(col.r * factor); + col.g = (nk_byte)(col.g * factor); + col.b = (nk_byte)(col.b * factor); return col; } NK_API struct nk_color From b3b04fca160765b11e1134a6b77c040c50e23060 Mon Sep 17 00:00:00 2001 From: Petr Abdulin Date: Tue, 23 Jan 2024 09:18:21 +0700 Subject: [PATCH 2/2] Suppress MSVC compiler `possible loss of data` warning with explicit cast --- src/nuklear_color.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/nuklear_color.c b/src/nuklear_color.c index 17969f355..d73da63bf 100644 --- a/src/nuklear_color.c +++ b/src/nuklear_color.c @@ -27,9 +27,9 @@ nk_rgb_factor(struct nk_color col, const float factor) { if (factor == 1.0f) return col; - col.r *= factor; - col.g *= factor; - col.b *= factor; + col.r = (nk_byte)(col.r * factor); + col.g = (nk_byte)(col.g * factor); + col.b = (nk_byte)(col.b * factor); return col; } NK_API struct nk_color