[network-manager-applet] page-dcb: fix always true/false comparisons



commit 274ad954c9a81e760ef3f1633e7ba9636b734508
Author: Jiří Klimeš <jklimes redhat com>
Date:   Sat Mar 8 00:42:39 2014 +0100

    page-dcb: fix always true/false comparisons
    
    Defect type: NO_EFFECT
    src/connection-editor/page-dcb.c:240:unsigned_compare – This greater-than-or-equal-to-zero comparison of 
an unsigned value is always true. "num >= 0UL".
    Defect type: NO_EFFECT
    src/connection-editor/page-dcb.c:180:unsigned_compare – This greater-than-or-equal-to-zero comparison of 
an unsigned value is always true. "num >= 0U".
    Defect type: NO_EFFECT
    src/connection-editor/page-dcb.c:125:unsigned_compare – This less-than-zero comparison of an unsigned 
value is never true. "num < 0UL".
    
    Found by Coverity.

 src/connection-editor/page-dcb.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/connection-editor/page-dcb.c b/src/connection-editor/page-dcb.c
index e40e5b2..04e6811 100644
--- a/src/connection-editor/page-dcb.c
+++ b/src/connection-editor/page-dcb.c
@@ -104,7 +104,7 @@ pfc_dialog_show (CEPageDcb *self)
 static gboolean
 uint_entries_validate (GtkBuilder *builder, const char *fmt, gint max, gboolean sum)
 {
-       unsigned long int num;
+       long int num;
        GtkEntry *entry;
        char *tmp;
        const char *text;
@@ -177,7 +177,7 @@ combos_handle (GtkBuilder *builder,
                        num = get_func (s_dcb, i);
                        if (other_num && (num == other_num))
                                gtk_combo_box_set_active (combo, last_idx);
-                       else if (num >= 0 && num <= max)
+                       else if (num <= max)
                                gtk_combo_box_set_active (combo, num);
                        g_signal_connect_swapped (combo, "changed", (GCallback) pg_dialog_valid_func, 
builder);
                } else if (set_func) {
@@ -231,7 +231,7 @@ uint_entries_handle (GtkBuilder *builder,
                        g_signal_connect (entry, "insert-text", (GCallback) uint_filter_cb, NULL);
                        g_signal_connect_swapped (entry, "changed", (GCallback) pg_dialog_valid_func, 
builder);
                } else if (set_func) {
-                       unsigned long int num;
+                       long int num;
 
                        text = gtk_entry_get_text (entry);
                        if (text) {


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