summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorEvan Huus <eapache@gmail.com>2015-04-04 13:41:30 -0400
committerEvan Huus <eapache@gmail.com>2015-04-05 12:27:34 +0000
commit32d0fc067367646b86c09a7e644ed5fc5817d246 (patch)
treee7ac0dc1db6fb0778d93cc3615dbf626e677e50d /plugins
parent8699bc285819244aca8c580e8aebd7780148fedd (diff)
downloadwireshark-32d0fc067367646b86c09a7e644ed5fc5817d246.tar.gz
irda: remove tvb_length calls
Change-Id: I5ea9ed7226217ab272d957ae3240a286c6a26de9 Reviewed-on: https://code.wireshark.org/review/7912 Reviewed-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/irda/packet-ircomm.c9
-rw-r--r--plugins/irda/packet-irda.c14
-rw-r--r--plugins/irda/packet-sir.c10
3 files changed, 16 insertions, 17 deletions
diff --git a/plugins/irda/packet-ircomm.c b/plugins/irda/packet-ircomm.c
index a4fcfd5180..9a75380f21 100644
--- a/plugins/irda/packet-ircomm.c
+++ b/plugins/irda/packet-ircomm.c
@@ -166,8 +166,7 @@ static int dissect_cooked_ircomm(tvbuff_t* tvb, packet_info* pinfo, proto_tree*
proto_tree *ircomm_tree, *ctrl_tree;
guint offset = 0;
guint clen;
- guint len = tvb_length(tvb);
-
+ gint len = tvb_reported_length(tvb);
if (len == 0)
return len;
@@ -176,7 +175,7 @@ static int dissect_cooked_ircomm(tvbuff_t* tvb, packet_info* pinfo, proto_tree*
col_set_str(pinfo->cinfo, COL_PROTOCOL, "IrCOMM");
clen = tvb_get_guint8(tvb, offset);
- len = tvb_length(tvb) - 1 - clen;
+ len -= 1 + clen;
if (len > 0)
col_add_fstr(pinfo->cinfo, COL_INFO, "Clen=%d, UserData: %d byte%s", clen, len, (len > 1)? "s": "");
@@ -184,7 +183,7 @@ static int dissect_cooked_ircomm(tvbuff_t* tvb, packet_info* pinfo, proto_tree*
col_add_fstr(pinfo->cinfo, COL_INFO, "Clen=%d", clen);
/* create display subtree for the protocol */
- ti = proto_tree_add_item(tree, proto_ircomm, tvb, 0, -1, ENC_NA);
+ ti = proto_tree_add_item(tree, proto_ircomm, tvb, 0, -1, ENC_NA);
ircomm_tree = proto_item_add_subtree(ti, ett_ircomm);
ti = proto_tree_add_item(ircomm_tree, hf_control, tvb, 0, clen + 1, ENC_NA);
@@ -206,7 +205,7 @@ static int dissect_cooked_ircomm(tvbuff_t* tvb, packet_info* pinfo, proto_tree*
*/
static int dissect_raw_ircomm(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data _U_)
{
- guint len = tvb_length(tvb);
+ guint len = tvb_reported_length(tvb);
if (len == 0)
return 0;
diff --git a/plugins/irda/packet-irda.c b/plugins/irda/packet-irda.c
index 63a6326bfa..f01af6271f 100644
--- a/plugins/irda/packet-irda.c
+++ b/plugins/irda/packet-irda.c
@@ -459,7 +459,7 @@ static guint dissect_ttp(tvbuff_t* tvb, packet_info* pinfo, proto_tree* root, gb
guint8 head;
char buf[128];
- if (tvb_length(tvb) == 0)
+ if (tvb_reported_length(tvb) == 0)
return 0;
/* Make entries in Protocol column on summary display */
@@ -513,7 +513,7 @@ static void dissect_iap_request(tvbuff_t* tvb, packet_info* pinfo, proto_tree* r
iap_conversation_t* iap_conv;
char buf[128];
- if (tvb_length(tvb) == 0)
+ if (tvb_reported_length(tvb) == 0)
return;
/* Make entries in Protocol column on summary display */
@@ -655,7 +655,7 @@ static void dissect_iap_request(tvbuff_t* tvb, packet_info* pinfo, proto_tree* r
static void dissect_iap_result(tvbuff_t* tvb, packet_info* pinfo, proto_tree* root, guint8 circuit_id)
{
guint offset = 0;
- guint len = tvb_length(tvb);
+ guint len = tvb_reported_length(tvb);
guint n = 0;
guint list_len;
guint8 op;
@@ -672,7 +672,7 @@ static void dissect_iap_result(tvbuff_t* tvb, packet_info* pinfo, proto_tree* ro
guint32 num;
- if (tvb_length(tvb) == 0)
+ if (len == 0)
return;
/* Make entries in Protocol column on summary display */
@@ -1064,7 +1064,7 @@ static void dissect_irlmp(tvbuff_t* tvb, packet_info* pinfo, proto_tree* root, g
}
else
col_add_fstr(pinfo->cinfo, COL_INFO, "%d > %d, Len=%d", slsap, dlsap,
- tvb_length(tvb) - 2);
+ tvb_reported_length(tvb) - 2);
if (root)
{
@@ -1097,7 +1097,7 @@ static void dissect_irlmp(tvbuff_t* tvb, packet_info* pinfo, proto_tree* root, g
{
case CONNECT_CMD:
case CONNECT_CNF:
- if (offset < tvb_length(tvb))
+ if (offset < tvb_reported_length(tvb))
{
proto_tree_add_item(tree, hf_lmp_rsvd, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
@@ -1141,7 +1141,7 @@ static void dissect_irlmp(tvbuff_t* tvb, packet_info* pinfo, proto_tree* root, g
{
case CONNECT_CMD:
case CONNECT_CNF:
- if (offset < tvb_length(tvb))
+ if (offset < tvb_reported_length(tvb))
offset++;
break;
diff --git a/plugins/irda/packet-sir.c b/plugins/irda/packet-sir.c
index 6296cd77ef..2c445da8f7 100644
--- a/plugins/irda/packet-sir.c
+++ b/plugins/irda/packet-sir.c
@@ -69,7 +69,7 @@ unescape_data(tvbuff_t *tvb, packet_info *pinfo)
if (tvb_find_guint8(tvb, 0, -1, SIR_CE) == -1) {
return tvb;
} else {
- guint length = tvb_length(tvb);
+ guint length = tvb_captured_length(tvb);
guint offset;
guint8 *data = (guint8 *)g_malloc(length);
guint8 *dst = data;
@@ -96,7 +96,7 @@ static tvbuff_t *
checksum_data(tvbuff_t *tvb, proto_tree *tree)
{
proto_item *hidden_item;
- int len = tvb_length(tvb) - 2;
+ int len = tvb_reported_length(tvb) - 2;
if (len < 0)
return tvb;
if (tree) {
@@ -130,7 +130,7 @@ dissect_sir(tvbuff_t *tvb, packet_info *pinfo, proto_tree *root)
gint bof_offset;
gint eof_offset;
- while (tvb_length_remaining(tvb, offset) > 0) {
+ while (tvb_reported_length_remaining(tvb, offset) > 0) {
bof_offset = tvb_find_guint8(tvb, offset, -1, SIR_BOF);
eof_offset = (bof_offset == -1) ? -1 :
tvb_find_guint8(tvb, bof_offset, -1, SIR_EOF);
@@ -148,8 +148,8 @@ dissect_sir(tvbuff_t *tvb, packet_info *pinfo, proto_tree *root)
data_offset, eof_offset - data_offset, -1);
next_tvb = unescape_data(next_tvb, pinfo);
if (root) {
- guint data_len = tvb_length(next_tvb) < 2 ? 0 :
- tvb_length(next_tvb) - 2;
+ guint data_len = tvb_reported_length(next_tvb) < 2 ? 0 :
+ tvb_reported_length(next_tvb) - 2;
proto_tree* ti = proto_tree_add_protocol_format(root,
proto_sir, tvb, offset, eof_offset - offset + 1,
"Serial Infrared, Len: %d", data_len);