[telepathy-account-widgets] Use MIN instead of CLAMP for unsigned int types.



commit 2c9df052d8993590f9d2cc2bf596a07241a59ad4
Author: Diane Trout <diane ghic org>
Date:   Wed Apr 13 16:27:01 2016 -0700

    Use MIN instead of CLAMP for unsigned int types.
    
    CLAMP tested that the unsigned variable was > 0, which gcc 5.3.1
    generates a warning pointing out that will always be true.
    
    Using MIN guarantees the variable will be in the range
    0..G_MAXINT(31|64)
    
    https://bugzilla.gnome.org/show_bug.cgi?id=765022

 tp-account-widgets/tpaw-account-settings.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/tp-account-widgets/tpaw-account-settings.c b/tp-account-widgets/tpaw-account-settings.c
index c8bea64..0ccff20 100644
--- a/tp-account-widgets/tpaw-account-settings.c
+++ b/tp-account-widgets/tpaw-account-settings.c
@@ -880,11 +880,11 @@ tpaw_account_settings_get_int32 (TpawAccountSettings *settings,
   else if (g_variant_is_of_type (v, G_VARIANT_TYPE_INT32))
     ret = g_variant_get_int32 (v);
   else if (g_variant_is_of_type (v, G_VARIANT_TYPE_UINT32))
-    ret = CLAMP (g_variant_get_uint32 (v), 0, G_MAXINT32);
+    ret = MIN (g_variant_get_uint32 (v), G_MAXINT32);
   else if (g_variant_is_of_type (v, G_VARIANT_TYPE_INT64))
     ret = CLAMP (g_variant_get_int64 (v), G_MININT32, G_MAXINT32);
   else if (g_variant_is_of_type (v, G_VARIANT_TYPE_UINT64))
-    ret = CLAMP (g_variant_get_uint64 (v), 0, G_MAXINT32);
+    ret = MIN (g_variant_get_uint64 (v), G_MAXINT32);
   else
     {
       gchar *tmp;
@@ -918,7 +918,7 @@ tpaw_account_settings_get_int64 (TpawAccountSettings *settings,
   else if (g_variant_is_of_type (v, G_VARIANT_TYPE_INT64))
     ret = g_variant_get_int64 (v);
   else if (g_variant_is_of_type (v, G_VARIANT_TYPE_UINT64))
-    ret = CLAMP (g_variant_get_uint64 (v), 0, G_MAXINT64);
+    ret = MIN (g_variant_get_uint64 (v), G_MAXINT64);
   else
     {
       gchar *tmp;


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