diff options
author | Colomban Wendling <[email protected]> | 2023-11-15 15:10:11 +0100 |
---|---|---|
committer | Luke from DC <[email protected]> | 2023-11-21 20:19:58 +0000 |
commit | 96c7ebc6dc9e8b8327db04a9570054ee78743353 (patch) | |
tree | 5d600712c7b3c035dbe78045641cdad9e358b91a /mate-panel/libpanel-util | |
parent | 7632b4fe9bb81a440bdde64c8cc45b15e07b1de8 (diff) | |
download | mate-panel-96c7ebc6dc9e8b8327db04a9570054ee78743353.tar.bz2 mate-panel-96c7ebc6dc9e8b8327db04a9570054ee78743353.tar.xz |
Reduce scope of variables
Mostly found by cppcheck.
Diffstat (limited to 'mate-panel/libpanel-util')
-rw-r--r-- | mate-panel/libpanel-util/panel-color.c | 8 | ||||
-rw-r--r-- | mate-panel/libpanel-util/panel-gtk.c | 3 | ||||
-rw-r--r-- | mate-panel/libpanel-util/panel-keyfile.c | 5 |
3 files changed, 9 insertions, 7 deletions
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; diff --git a/mate-panel/libpanel-util/panel-gtk.c b/mate-panel/libpanel-util/panel-gtk.c index d638d75d..3672fca8 100644 --- a/mate-panel/libpanel-util/panel-gtk.c +++ b/mate-panel/libpanel-util/panel-gtk.c @@ -119,7 +119,6 @@ panel_file_chooser_dialog_new_valist (const gchar *title, { GtkWidget *result; const char *button_text = first_button_text; - gint response_id; result = g_object_new (GTK_TYPE_FILE_CHOOSER_DIALOG, "title", title, @@ -131,7 +130,7 @@ panel_file_chooser_dialog_new_valist (const gchar *title, while (button_text) { - response_id = va_arg (varargs, gint); + gint response_id = va_arg (varargs, gint); if (g_strcmp0 (button_text, "process-stop") == 0) panel_dialog_add_button (GTK_DIALOG (result), _("_Cancel"), button_text, response_id); diff --git a/mate-panel/libpanel-util/panel-keyfile.c b/mate-panel/libpanel-util/panel-keyfile.c index 0b0104ef..b98058c3 100644 --- a/mate-panel/libpanel-util/panel-keyfile.c +++ b/mate-panel/libpanel-util/panel-keyfile.c @@ -53,8 +53,6 @@ _panel_key_file_make_executable (const gchar *path) { GFile *file; GFileInfo *info; - guint32 current_perms; - guint32 new_perms; file = g_file_new_for_path (path); @@ -72,6 +70,9 @@ _panel_key_file_make_executable (const gchar *path) } if (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_UNIX_MODE)) { + guint32 current_perms; + guint32 new_perms; + current_perms = g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_UNIX_MODE); new_perms = current_perms | S_IXGRP | S_IXUSR | S_IXOTH; |