From 5de9613c3807944087df7fa890e7a72bf6a3cec5 Mon Sep 17 00:00:00 2001 From: Mario Bodemann Date: Sat, 27 Jul 2024 21:23:08 +0200 Subject: [PATCH] fix: initialized the uninitialized while building all demos I found that several colors are uninitialized, and where throwing an error when building. I could have added the flag for dismissing that warning, but I felt more explicit is better. --- examples/cosmic_unicorn/cosmic_lava_lamp.cpp | 6 +++--- examples/galactic_unicorn/lava_lamp.cpp | 6 +++--- examples/stellar_unicorn/stellar_lava_lamp.cpp | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/cosmic_unicorn/cosmic_lava_lamp.cpp b/examples/cosmic_unicorn/cosmic_lava_lamp.cpp index e05fb7644..ca5b777b0 100644 --- a/examples/cosmic_unicorn/cosmic_lava_lamp.cpp +++ b/examples/cosmic_unicorn/cosmic_lava_lamp.cpp @@ -106,11 +106,11 @@ int main() { // calculate dark, medium, and bright shades for rendering the // lava - uint8_t dark_r, dark_g, dark_b; + uint8_t dark_r = 0, dark_g = 0, dark_b = 0; from_hsv(hue, 1.0f, 0.3f, dark_r, dark_g, dark_b); - uint8_t mid_r, mid_g, mid_b; + uint8_t mid_r = 0, mid_g = 0, mid_b = 0; from_hsv(hue, 1.0f, 0.6f, mid_r, mid_g, mid_b); - uint8_t bright_r, bright_g, bright_b; + uint8_t bright_r = 0, bright_g = 0, bright_b = 0; from_hsv(hue, 1.0f, 1.0f, bright_r, bright_g, bright_b); // clear the canvas diff --git a/examples/galactic_unicorn/lava_lamp.cpp b/examples/galactic_unicorn/lava_lamp.cpp index 7499b9216..1c84c94cf 100644 --- a/examples/galactic_unicorn/lava_lamp.cpp +++ b/examples/galactic_unicorn/lava_lamp.cpp @@ -107,11 +107,11 @@ int main() { // calculate dark, medium, and bright shades for rendering the // lava - uint8_t dark_r, dark_g, dark_b; + uint8_t dark_r = 0, dark_g = 0, dark_b = 0; from_hsv(hue, 1.0f, 0.3f, dark_r, dark_g, dark_b); - uint8_t mid_r, mid_g, mid_b; + uint8_t mid_r = 0, mid_g = 0, mid_b = 0; from_hsv(hue, 1.0f, 0.6f, mid_r, mid_g, mid_b); - uint8_t bright_r, bright_g, bright_b; + uint8_t bright_r = 0, bright_g = 0, bright_b = 0; from_hsv(hue, 1.0f, 1.0f, bright_r, bright_g, bright_b); // clear the canvas diff --git a/examples/stellar_unicorn/stellar_lava_lamp.cpp b/examples/stellar_unicorn/stellar_lava_lamp.cpp index 97217b8d8..1458e7fcd 100644 --- a/examples/stellar_unicorn/stellar_lava_lamp.cpp +++ b/examples/stellar_unicorn/stellar_lava_lamp.cpp @@ -106,11 +106,11 @@ int main() { // calculate dark, medium, and bright shades for rendering the // lava - uint8_t dark_r, dark_g, dark_b; + uint8_t dark_r = 0, dark_g = 0, dark_b = 0; from_hsv(hue, 1.0f, 0.3f, dark_r, dark_g, dark_b); - uint8_t mid_r, mid_g, mid_b; + uint8_t mid_r = 0, mid_g = 0, mid_b = 0; from_hsv(hue, 1.0f, 0.6f, mid_r, mid_g, mid_b); - uint8_t bright_r, bright_g, bright_b; + uint8_t bright_r = 0, bright_g = 0, bright_b = 0; from_hsv(hue, 1.0f, 1.0f, bright_r, bright_g, bright_b); // clear the canvas