aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2011-02-17 19:43:16 +0000
committerGerald Combs <gerald@wireshark.org>2011-02-17 19:43:16 +0000
commit1b0516a27ea33e0b91f824248a8797f02b6af047 (patch)
tree969f03666b78e41767f358fbf15cc07c01ab0bf4
parent51e5e75373ed9886e5b311cb6db6dd3a09b0df03 (diff)
Fix various Visual C++ analysis warnings.
svn path=/trunk/; revision=35985
-rw-r--r--epan/dissectors/packet-3g-a11.c4
-rw-r--r--epan/dissectors/packet-afs.c2
-rw-r--r--epan/dissectors/packet-aim.c8
-rw-r--r--epan/dissectors/packet-alcap.c2
-rw-r--r--epan/dissectors/packet-amr.c4
-rw-r--r--epan/dissectors/packet-ansi_a.c14
-rw-r--r--epan/dissectors/packet-aoe.c2
7 files changed, 18 insertions, 18 deletions
diff --git a/epan/dissectors/packet-3g-a11.c b/epan/dissectors/packet-3g-a11.c
index d3c169d1b1..fc4b216fee 100644
--- a/epan/dissectors/packet-3g-a11.c
+++ b/epan/dissectors/packet-3g-a11.c
@@ -1375,7 +1375,7 @@ dissect_a11( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
/* Set up structures we will need to add the protocol subtree and manage it */
proto_item *ti;
- proto_tree *a11_tree;
+ proto_tree *a11_tree = NULL;
proto_item *tf;
proto_tree *flags_tree;
guint8 type;
@@ -1673,7 +1673,7 @@ dissect_a11( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
} /* End switch */
- if (tree) {
+ if (tree && a11_tree) {
if (tvb_reported_length_remaining(tvb, offset) > 0)
dissect_a11_extensions(tvb, offset, a11_tree);
}
diff --git a/epan/dissectors/packet-afs.c b/epan/dissectors/packet-afs.c
index 32e6ae57ae..61aee1bce6 100644
--- a/epan/dissectors/packet-afs.c
+++ b/epan/dissectors/packet-afs.c
@@ -1702,7 +1702,7 @@ dissect_acl(tvbuff_t *tvb, struct rxinfo *rxinfo _U_, proto_tree *tree, int offs
int old_offset;
gint32 bytes;
int i, n, pos, neg, acl;
- char user[128]; /* Be sure to adjust sscanf()s below if length is changed... */
+ char user[128] = "[Unknown]"; /* Be sure to adjust sscanf()s below if length is changed... */
old_offset = offset;
bytes = tvb_get_ntohl(tvb, offset);
diff --git a/epan/dissectors/packet-aim.c b/epan/dissectors/packet-aim.c
index 3a8dfb6f92..5273846564 100644
--- a/epan/dissectors/packet-aim.c
+++ b/epan/dissectors/packet-aim.c
@@ -703,7 +703,7 @@ dissect_aim_snac(tvbuff_t *tvb, packet_info *pinfo, int offset,
offset += 4;
- if( aim_tree )
+ if( aim_tree && subtype != NULL )
{
offset = orig_offset;
ti1 = proto_tree_add_text(aim_tree, tvb, 6, 10,
@@ -755,7 +755,7 @@ dissect_aim_snac(tvbuff_t *tvb, packet_info *pinfo, int offset,
if (family)
col_set_str(pinfo->cinfo, COL_PROTOCOL, family->name);
- if(subtype && family)
+ if(subtype != NULL && family != NULL)
{
col_set_str(pinfo->cinfo, COL_INFO, family->name);
col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", subtype->name);
@@ -770,7 +770,7 @@ dissect_aim_snac(tvbuff_t *tvb, packet_info *pinfo, int offset,
col_append_fstr(pinfo->cinfo, COL_INFO, ", Subtype: 0x%04x", subtype_id);
}
- if(aim_tree && family)
+ if(aim_tree && family != NULL)
{
proto_item *ti = proto_tree_add_item(root_tree, family->proto_id, subtvb, 0, -1, FALSE);
family_tree = proto_item_add_subtree(ti, family->ett);
@@ -778,7 +778,7 @@ dissect_aim_snac(tvbuff_t *tvb, packet_info *pinfo, int offset,
proto_item_append_text(ti, ", %s", subtype->name);
}
- if(tvb_length_remaining(tvb, offset) > 0 && subtype && subtype->dissector)
+ if(tvb_length_remaining(tvb, offset) > 0 && subtype != NULL && subtype->dissector)
{
subtype->dissector(subtvb, pinfo, family_tree);
}
diff --git a/epan/dissectors/packet-alcap.c b/epan/dissectors/packet-alcap.c
index 38ff09a51b..3e771ca240 100644
--- a/epan/dissectors/packet-alcap.c
+++ b/epan/dissectors/packet-alcap.c
@@ -1505,7 +1505,7 @@ static void dissect_alcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
break;
}
- if (leg && ( (! leg->msgs) || leg->msgs->last->framenum < pinfo->fd->num ) ) {
+ if (leg != NULL && ( (! leg->msgs) || leg->msgs->last->framenum < pinfo->fd->num ) ) {
alcap_msg_data_t* msg = se_alloc(sizeof(alcap_msg_data_t));
msg->msg_type = msg_info->msg_type;
msg->framenum = pinfo->fd->num;
diff --git a/epan/dissectors/packet-amr.c b/epan/dissectors/packet-amr.c
index 99fa779dc6..974c9b33fd 100644
--- a/epan/dissectors/packet-amr.c
+++ b/epan/dissectors/packet-amr.c
@@ -601,8 +601,8 @@ dissect_amr_name(tvbuff_t *tvb _U_, packet_info *pinfo, proto_tree *tree)
amr_capability_t *ftr = NULL;
actx = get_asn1_ctx(pinfo->private_data);
- DISSECTOR_ASSERT(actx);
- if (tree) {
+ DISSECTOR_ASSERT(actx != NULL);
+ if (tree && actx != NULL) {
ftr = find_cap(pinfo->match_string);
if (ftr) {
proto_item_append_text(actx->created_item, " - %s", ftr->name);
diff --git a/epan/dissectors/packet-ansi_a.c b/epan/dissectors/packet-ansi_a.c
index 8c53450973..14f81191a8 100644
--- a/epan/dissectors/packet-ansi_a.c
+++ b/epan/dissectors/packet-ansi_a.c
@@ -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;
diff --git a/epan/dissectors/packet-aoe.c b/epan/dissectors/packet-aoe.c
index f310cd37bf..a71ef0e919 100644
--- a/epan/dissectors/packet-aoe.c
+++ b/epan/dissectors/packet-aoe.c
@@ -305,7 +305,7 @@ dissect_ata_pdu(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset,
}
} else {
proto_tree_add_item(tree, hf_aoe_astatus, tvb, offset, 1, FALSE);
- if(ata_info && ata_info->request_frame){
+ if(ata_info != NULL && ata_info->request_frame){
/* we dont know what command it was unless we saw the request_frame */
tmp_item=proto_tree_add_uint(tree, hf_aoe_acmd, tvb, 0, 0, ata_info->cmd);
PROTO_ITEM_SET_GENERATED(tmp_item);