commit: 28ae095b716ded6f7f6d6c74393ba0fcbe0001e5
parent fe9e201b3af26af6f0df77e2a4e1c3067cf871f4
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Sun, 24 Oct 2021 14:45:59 +0200
bin/lolcat: Fix conversion warning
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/bin/lolcat.c b/bin/lolcat.c
@@ -11,14 +11,14 @@
void
rainbow(double freq, int i)
{
- int red, green, blue;
+ double red, green, blue;
double pi = 3.14159;
red = sin(freq * i + 0) * 127 + 128;
green = sin(freq * i + 2 * pi / 3) * 127 + 128;
blue = sin(freq * i + 4 * pi / 3) * 127 + 128;
- printf("[38;2;%02d;%02d;%02dm", red, green, blue);
+ printf("[38;2;%02d;%02d;%02dm", (int)red, (int)green, (int)blue);
}
int