Fix various Visual C++ analysis warnings.
[obnox/wireshark/wip.git] / epan / dissectors / packet-ansi_a.c
index 8c5345097385186d06b67673d0db9471437592ca..14f81191a89da166a8073e16d7885f57535aa603 100644 (file)
@@ -657,7 +657,7 @@ static int proto_a_dtap = -1;
 const ext_value_string_t *ansi_a_bsmap_strings = NULL;
 const ext_value_string_t *ansi_a_dtap_strings = NULL;
 const ext_value_string_t *ansi_a_elem_1_strings = NULL;
-static guint ansi_a_elem_1_max = 0;
+static gint ansi_a_elem_1_max = 0;
 
 static int ansi_a_tap = -1;
 
@@ -8729,7 +8729,7 @@ elem_tlv(tvbuff_t *tvb, proto_tree *tree, elem_idx_t idx, guint32 offset, guint
     curr_offset = offset;
     consumed = 0;
 
-    if ((unsigned) idx >= ansi_a_elem_1_max-1)
+    if (idx < 0 || idx >= ansi_a_elem_1_max-1)
     {
         /* Unknown index, skip the element */
         return tvb_length_remaining(tvb, offset) ;
@@ -8812,7 +8812,7 @@ elem_tv(tvbuff_t *tvb, proto_tree *tree, elem_idx_t idx, guint32 offset, const g
     curr_offset = offset;
     consumed = 0;
 
-    if ((unsigned) idx >= ansi_a_elem_1_max-1)
+    if (idx < 0 || idx >= ansi_a_elem_1_max-1)
     {
         /* Unknown index, skip the element */
         return tvb_length_remaining(tvb, offset) ;
@@ -8886,7 +8886,7 @@ elem_t(tvbuff_t *tvb, proto_tree *tree, elem_idx_t idx, guint32 offset, const gc
     curr_offset = offset;
     consumed = 0;
 
-    if ((unsigned)idx >= ansi_a_elem_1_max-1)
+    if (idx < 0 || idx >= ansi_a_elem_1_max-1)
     {
         /* Unknown index, skip the element */
         return tvb_length_remaining(tvb, offset) ;
@@ -8924,7 +8924,7 @@ elem_lv(tvbuff_t *tvb, proto_tree *tree, elem_idx_t idx, guint32 offset, guint l
     curr_offset = offset;
     consumed = 0;
 
-    if ((unsigned) idx >= ansi_a_elem_1_max-1)
+    if (idx < 0 || idx >= ansi_a_elem_1_max-1)
     {
         /* Unknown index, skip the element */
         return tvb_length_remaining(tvb, offset) ;
@@ -8992,7 +8992,7 @@ elem_v(tvbuff_t *tvb, proto_tree *tree, elem_idx_t idx, guint32 offset)
     curr_offset = offset;
     consumed = 0;
 
-    if ((unsigned) idx >= ansi_a_elem_1_max-1)
+    if (idx < 0 || idx >= ansi_a_elem_1_max-1)
     {
         /* Unknown index, skip the element */
         return tvb_length_remaining(tvb, offset) ;
@@ -11614,7 +11614,7 @@ dissect_cdma2000_a1_elements(tvbuff_t *tvb, _U_ packet_info *pinfo, proto_tree *
     guint32     curr_offset;
     guint32     consumed;
     guint       curr_len;
-    guint       idx;
+    gint        idx;
     guint8      oct;
 
     curr_offset = offset;