diff options
author | Bill Meier <wmeier@newsguy.com> | 2015-01-30 13:49:59 -0500 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2015-01-30 19:04:32 +0000 |
commit | eda485ea53c7ac77470f47e886b6513f28f0c20b (patch) | |
tree | 6b5adad845db04d441bb5a177f0ce8fe6cb92346 /epan/dissectors/packet-rtmpt.c | |
parent | 7b929e2ff78c5196e5ab7c4413b0eae1b542e445 (diff) |
Cleanup:
Including:
tvb_length...() ==> tvb_reported_length...()
Remove some dead initializers;
Localize some variables;
Whitespace.
Change-Id: Ide9490f248d558bb7e3af96a1fc17d8f911de4ef
Reviewed-on: https://code.wireshark.org/review/6862
Reviewed-by: Bill Meier <wmeier@newsguy.com>
Diffstat (limited to 'epan/dissectors/packet-rtmpt.c')
-rw-r--r-- | epan/dissectors/packet-rtmpt.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/epan/dissectors/packet-rtmpt.c b/epan/dissectors/packet-rtmpt.c index 362dfef13c..3a058c46c3 100644 --- a/epan/dissectors/packet-rtmpt.c +++ b/epan/dissectors/packet-rtmpt.c @@ -561,7 +561,7 @@ static gint rtmpt_get_amf_length(tvbuff_t *tvb, gint offset) { guint8 iObjType; - gint remain = tvb_length_remaining(tvb, offset); + gint remain = tvb_reported_length_remaining(tvb, offset); guint32 depth = 0; gint itemlen = 0; gint rv = 0; @@ -640,7 +640,7 @@ rtmpt_get_amf_length(tvbuff_t *tvb, gint offset) static gchar * rtmpt_get_amf_param(tvbuff_t *tvb, gint offset, gint param, const gchar *prop) { - guint32 remain = tvb_length_remaining(tvb, offset); + guint32 remain = tvb_reported_length_remaining(tvb, offset); guint32 itemlen; guint32 iStringLength; @@ -694,7 +694,7 @@ rtmpt_get_amf_param(tvbuff_t *tvb, gint offset, gint param, const gchar *prop) static guint32 rtmpt_get_amf_txid(tvbuff_t *tvb, gint offset) { - guint32 remain = tvb_length_remaining(tvb, offset); + guint32 remain = tvb_reported_length_remaining(tvb, offset); if (remain > 0) { guint32 itemlen = rtmpt_get_amf_length(tvb, offset); @@ -739,7 +739,7 @@ rtmpt_get_packet_desc(tvbuff_t *tvb, guint32 offset, guint32 remain, rtmpt_conv_ } else if (tp->cmd == RTMPT_TYPE_UCM) { guint16 iUCM = -1; - const gchar *sFunc = NULL; + const gchar *sFunc; const gchar *sParam = ""; if (tp->len < 2 || remain < 2) @@ -1111,7 +1111,7 @@ dissect_amf0_value_type(tvbuff_t *tvb, gint offset, proto_tree *tree, gboolean * * If we can't determine the length, don't carry on; * just skip to the end of the tvbuff. */ - iValueOffset = tvb_length(tvb); + iValueOffset = tvb_reported_length(tvb); break; } proto_item_set_end(ti, tvb, iValueOffset); @@ -1546,7 +1546,7 @@ dissect_amf3_value_type(tvbuff_t *tvb, gint offset, proto_tree *tree, proto_item * If we can't determine the length, don't carry on; * just skip to the end of the tvbuff. */ - iValueOffset = tvb_length(tvb); + iValueOffset = tvb_reported_length(tvb); break; } proto_item_set_end(ti, tvb, iValueOffset); @@ -1626,7 +1626,7 @@ dissect_rtmpt_body_aggregate(tvbuff_t *tvb, gint offset, proto_tree *rtmpt_tree) proto_tree *data_tree; - while (tvb_length_remaining(tvb, offset) > 0) { + while (tvb_reported_length_remaining(tvb, offset) > 0) { guint8 iTagType; guint iDataSize; @@ -1667,9 +1667,6 @@ dissect_rtmpt_body_aggregate(tvbuff_t *tvb, gint offset, proto_tree *rtmpt_tree) static void dissect_rtmpt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_conv_t *rconv, int cdir, rtmpt_packet_t *tp) { - proto_tree *rtmpt_tree = NULL; - proto_tree *rtmptroot_tree = NULL; - proto_item *ti = NULL; gint offset = 0; gchar *sDesc = NULL; @@ -1682,22 +1679,22 @@ dissect_rtmpt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_conv_t RTMPT_DEBUG("Dissect: frame=%u visited=%d len=%d tree=%p\n", pinfo->fd->num, pinfo->fd->flags.visited, - tvb_length_remaining(tvb, offset), tree); + tvb_reported_length_remaining(tvb, offset), tree); /* Clear any previous data in Info column (RTMP packets are protected by a "fence") */ col_clear(pinfo->cinfo, COL_INFO); - if (tvb_length_remaining(tvb, offset) < 1) return; + if (tvb_reported_length_remaining(tvb, offset) < 1) return; if (tp->id <= RTMPT_ID_MAX) { if (tp->fmt < 3 - && tvb_length_remaining(tvb, offset) >= tp->bhlen+3 + && tvb_reported_length_remaining(tvb, offset) >= tp->bhlen+3 && tvb_get_ntoh24(tvb, offset+tp->bhlen) == 0xffffff) { haveETS = TRUE; } iBodyOffset = offset + tp->bhlen + tp->mhlen; - iBodyRemain = tvb_length_remaining(tvb, iBodyOffset); + iBodyRemain = tvb_reported_length_remaining(tvb, iBodyOffset); if (tp->cmd == RTMPT_TYPE_CHUNK_SIZE && tp->len >= 4 && iBodyRemain >= 4) { guint32 newchunksize = tvb_get_ntohl(tvb, iBodyOffset); @@ -1742,6 +1739,9 @@ dissect_rtmpt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_conv_t if (tree) { + proto_tree *rtmpt_tree = NULL; + proto_tree *rtmptroot_tree = NULL; + proto_item *ti; ti = proto_tree_add_item(tree, proto_rtmpt, tvb, offset, -1, ENC_NA); if (tp->id > RTMPT_ID_MAX) { @@ -1875,7 +1875,7 @@ dissect_rtmpt_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_ rtmpt_packet_t *tp; tvbuff_t *pktbuf; - remain = tvb_length(tvb); + remain = tvb_reported_length(tvb); if (!remain) return; @@ -2304,7 +2304,7 @@ dissect_rtmpt_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* dat conv->key_ptr->port2 == pinfo->destport) ? 0 : 1; dissect_rtmpt_common(tvb, pinfo, tree, rconv, cdir, tcpinfo->seq, tcpinfo->lastackseq); - return tvb_length(tvb); + return tvb_reported_length(tvb); } static void @@ -2319,7 +2319,7 @@ dissect_rtmpt_http(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) gint remain; offset = 0; - remain = tvb_length_remaining(tvb, 0); + remain = tvb_reported_length_remaining(tvb, 0); /* * Request flow: @@ -2429,7 +2429,7 @@ static gboolean dissect_rtmpt_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { conversation_t *conversation; - if (tvb_length(tvb) >= 12) + if (tvb_reported_length(tvb) >= 12) { /* To avoid a too high rate of false positive, this heuristics only matches the protocol from the first server response packet and not from the client request packets before. |