[gnome-settings-daemon] Fix BRIGHTESS_STEP_AMOUNT calculation macro



commit 76351c8827a5fe3b99d83fecea816b00763d5fd8
Author: Kamal Mostafa <kamal canonical com>
Date:   Thu Sep 1 10:31:58 2011 +0200

    Fix BRIGHTESS_STEP_AMOUNT calculation macro
    
    The BRIGHTNESS_STEP_AMOUNT macro calculates a bogus value when called
    as BRIGHTNESS_STEP_AMOUNT(max - min + 1) due to missing parentheses.
    
    https://bugs.launchpad.net/ubuntu/+source/gnome-settings-daemon/+bug/827517

 plugins/power/gsd-power-manager.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index 80040cd..1421b19 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -123,7 +123,7 @@ static const gchar introspection_xml[] =
 "</node>";
 
 /* on ACPI machines we have 4-16 levels, on others it's ~150 */
-#define BRIGHTNESS_STEP_AMOUNT(max) (max < 20 ? 1 : max / 20)
+#define BRIGHTNESS_STEP_AMOUNT(max) ((max) < 20 ? 1 : (max) / 20)
 
 /* take a discrete value with offset and convert to percentage */
 #define ABS_TO_PERCENTAGE(min, max, value) (((value - min) * 100) / (max - min))



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