[gnome-settings-daemon] power: Fix signed/unsigned assignment and comparison



commit 74a57e126678365341800a0e5c13280723ee6c21
Author: Philip Withnall <withnall endlessm com>
Date:   Mon Mar 27 10:36:35 2017 +0100

    power: Fix signed/unsigned assignment and comparison
    
    The value retrieved from GSettings is a gint, so don’t implicitly cast
    to to a guint before clamping it to a non-negative value.
    
    Coverity ID: 1418248
    
    https://bugzilla.gnome.org/show_bug.cgi?id=780587

 plugins/power/gsd-power-manager.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index ab9e3dc..f6d32b6 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -1708,9 +1708,10 @@ idle_configure (GsdPowerManager *manager)
                                            "sleep-inactive-battery-type" : "sleep-inactive-ac-type");
         timeout_sleep = 0;
         if (!is_action_inhibited (manager, action_type)) {
-                timeout_sleep = g_settings_get_int (manager->priv->settings, on_battery ?
-                                                    "sleep-inactive-battery-timeout" : 
"sleep-inactive-ac-timeout");
-                timeout_sleep = CLAMP(timeout_sleep, 0, G_MAXINT);
+                gint timeout_sleep_;
+                timeout_sleep_ = g_settings_get_int (manager->priv->settings, on_battery ?
+                                                     "sleep-inactive-battery-timeout" : 
"sleep-inactive-ac-timeout");
+                timeout_sleep = CLAMP (timeout_sleep_, 0, G_MAXINT);
         }
 
         clear_idle_watch (manager->priv->idle_monitor,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]