From 62fabfc793b545250dafaf37f75650cbfdce095f Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Wed, 15 Nov 2023 15:10:11 +0100 Subject: Reduce scope of variables Mostly found by cppcheck. origin commit was: https://github.com/mate-desktop/mate-panel/commit/96c7ebc --- mate-panel/libpanel-util/panel-color.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'mate-panel/libpanel-util/panel-color.c') diff --git a/mate-panel/libpanel-util/panel-color.c b/mate-panel/libpanel-util/panel-color.c index f6148aaa..661e6fb5 100644 --- a/mate-panel/libpanel-util/panel-color.c +++ b/mate-panel/libpanel-util/panel-color.c @@ -17,7 +17,6 @@ rgb_to_hls (gdouble *r, gdouble *g, gdouble *b) gdouble green; gdouble blue; gdouble h, l, s; - gdouble delta; red = *r; green = *g; @@ -50,6 +49,8 @@ rgb_to_hls (gdouble *r, gdouble *g, gdouble *b) h = 0; if (max != min) { + gdouble delta; + if (l <= 0.5) s = (max - min) / (max + min); else @@ -84,11 +85,9 @@ rgb_to_hls (gdouble *r, gdouble *g, gdouble *b) static void hls_to_rgb (gdouble *h, gdouble *l, gdouble *s) { - gdouble hue; gdouble lightness; gdouble saturation; gdouble m1, m2; - gdouble r, g, b; lightness = *l; saturation = *s; @@ -104,6 +103,9 @@ hls_to_rgb (gdouble *h, gdouble *l, gdouble *s) *l = lightness; *s = lightness; } else { + gdouble hue; + gdouble r, g, b; + hue = *h + 120; while (hue > 360) hue -= 360; -- cgit v1.2.1