[glib] Drop dead code in GVariant parser



commit 23f684454f6f0151cb7181c527bf254f6b97ed35
Author: Ryan Lortie <desrt desrt ca>
Date:   Tue Jun 14 22:44:10 2011 -0400

    Drop dead code in GVariant parser
    
    There is no chance that an unsigned integer value will be negative after
    we do the bounds check that enforces its non-negativity.
    
    Caught by Matthias running Coverity.

 glib/gvariant-parser.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/glib/gvariant-parser.c b/glib/gvariant-parser.c
index 9550b91..02ed011 100644
--- a/glib/gvariant-parser.c
+++ b/glib/gvariant-parser.c
@@ -1886,7 +1886,7 @@ number_get_value (AST                 *ast,
     case 'q':
       if (negative || abs_val > G_MAXUINT16)
         return number_overflow (ast, type, error);
-      return g_variant_new_uint16 (negative ? -abs_val : abs_val);
+      return g_variant_new_uint16 (abs_val);
 
     case 'i':
       if (abs_val - negative > G_MAXINT32)
@@ -1896,7 +1896,7 @@ number_get_value (AST                 *ast,
     case 'u':
       if (negative || abs_val > G_MAXUINT32)
         return number_overflow (ast, type, error);
-      return g_variant_new_uint32 (negative ? -abs_val : abs_val);
+      return g_variant_new_uint32 (abs_val);
 
     case 'x':
       if (abs_val - negative > G_MAXINT64)
@@ -1906,7 +1906,7 @@ number_get_value (AST                 *ast,
     case 't':
       if (negative)
         return number_overflow (ast, type, error);
-      return g_variant_new_uint64 (negative ? -abs_val : abs_val);
+      return g_variant_new_uint64 (abs_val);
 
     case 'h':
       if (abs_val - negative > G_MAXINT32)



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