Fix some warning related to the parameter datatype change in gtk_hsv_to_rgb gtk4

Thu, 10 Feb 2022 22:02:53 -0600

author
Gary Kramlich <grim@reaperworld.com>
date
Thu, 10 Feb 2022 22:02:53 -0600
branch
gtk4
changeset 41522
e87f6a720a98
parent 41521
72cc2e4e12f5
child 41523
2ca542ed08e2

Fix some warning related to the parameter datatype change in gtk_hsv_to_rgb

Testing Done:
Compiled and verified that `pidgincolor.c` compiled cleanly with no warnings (aside from our intentional warning) and no errors.

Reviewed at https://reviews.imfreedom.org/r/1298/

pidgin/pidgincolor.c file | annotate | diff | comparison | revisions
--- a/pidgin/pidgincolor.c	Thu Feb 10 21:06:57 2022 -0600
+++ b/pidgin/pidgincolor.c	Thu Feb 10 22:02:53 2022 -0600
@@ -31,7 +31,7 @@
     GChecksum *checksum = NULL;
     guchar digest[20];
     gsize digest_len = sizeof(digest);
-    gdouble hue = 0, red = 0, green = 0, blue = 0;
+    gfloat hue = 0, red = 0, green = 0, blue = 0;
 
     g_return_if_fail(color != NULL);
 
@@ -49,16 +49,16 @@
     /* Calculate the hue based on the digest.  We need a value between 0 and 1
      * so we divide the value by 65535 which is the maximum value for 2 bytes.
      */
-    hue = (digest[0] << 8 | digest[1]) / 65535.0;
+    hue = (digest[0] << 8 | digest[1]) / 65535.0f;
 
     /* Get the rgb values for the hue at full saturation and value. */
-    gtk_hsv_to_rgb(hue, 1.0, 1.0, &red, &green, &blue);
+    gtk_hsv_to_rgb(hue, 1.0f, 1.0f, &red, &green, &blue);
 
     /* Finally calculate the color summing 20% of the inverted background color
      * with 80% of the color.
      */
-    color->red = (0.2 * (1 - background.red)) + (0.8 * red);
-    color->green = (0.2 * (1 - background.green)) + (0.8 * green);
-    color->blue = (0.2 * (1 - background.blue)) + (0.8 * blue);
-    color->alpha = 1.0;
+    color->red = (0.2f * (1 - background.red)) + (0.8f * red);
+    color->green = (0.2f * (1 - background.green)) + (0.8f * green);
+    color->blue = (0.2f * (1 - background.blue)) + (0.8f * blue);
+    color->alpha = 1.0f;
 }

mercurial