forked from osmocom/wireshark
Fixed deprecated tvb_length and tvb_length_remaining.
Change-Id: Icb7b703319f2d76383fe0a52294ca8c2d06bef84 Reviewed-on: https://code.wireshark.org/review/1118 Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
834c25f50f
commit
920ae80d33
|
@ -516,7 +516,7 @@ static gboolean check_is_802_2(tvbuff_t *tvb, int fcs_len)
|
|||
length = reported_length;
|
||||
}
|
||||
/* Only allow inspection of 'length' number of bytes. */
|
||||
captured_length = tvb_length_remaining(tvb, ETH_HEADER_SIZE);
|
||||
captured_length = tvb_captured_length_remaining(tvb, ETH_HEADER_SIZE);
|
||||
if (captured_length > length)
|
||||
captured_length = length;
|
||||
|
||||
|
@ -585,7 +585,7 @@ add_ethernet_trailer(packet_info *pinfo, proto_tree *tree, proto_tree *fh_tree,
|
|||
gboolean has_fcs = FALSE;
|
||||
tvbuff_t *real_trailer_tvb;
|
||||
|
||||
trailer_length = tvb_length(trailer_tvb);
|
||||
trailer_length = tvb_captured_length(trailer_tvb);
|
||||
trailer_reported_length = tvb_reported_length(trailer_tvb);
|
||||
|
||||
/* There can not have been padding when the length of the frame (including the
|
||||
|
@ -676,7 +676,7 @@ add_ethernet_trailer(packet_info *pinfo, proto_tree *tree, proto_tree *fh_tree,
|
|||
if (has_fcs) {
|
||||
guint32 sent_fcs = tvb_get_ntohl(trailer_tvb, padding_length+trailer_length);
|
||||
if(eth_check_fcs){
|
||||
guint32 fcs = crc32_802_tvb(tvb, tvb_length(tvb) - 4);
|
||||
guint32 fcs = crc32_802_tvb(tvb, tvb_captured_length(tvb) - 4);
|
||||
if (fcs == sent_fcs) {
|
||||
item = proto_tree_add_uint_format_value(fh_tree, hf_eth_fcs, trailer_tvb,
|
||||
padding_length+trailer_length, 4, sent_fcs,
|
||||
|
@ -717,7 +717,7 @@ add_ethernet_trailer(packet_info *pinfo, proto_tree *tree, proto_tree *fh_tree,
|
|||
}
|
||||
trailer_length += 4;
|
||||
}
|
||||
proto_tree_set_appendix(fh_tree, tvb, tvb_length(tvb) - padding_length - trailer_length, padding_length + trailer_length);
|
||||
proto_tree_set_appendix(fh_tree, tvb, tvb_captured_length(tvb) - padding_length - trailer_length, padding_length + trailer_length);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -732,7 +732,7 @@ dissect_eth_maybefcs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
putting the frame on the network. Make sure these packets get
|
||||
a proper trailer (even though the sliced frame might not
|
||||
properly dissect. */
|
||||
if ( (eth_trailer_length > 0) && (eth_trailer_length < tvb_length(tvb)) ) {
|
||||
if ( (eth_trailer_length > 0) && (eth_trailer_length < tvb_captured_length(tvb)) ) {
|
||||
tvbuff_t *next_tvb;
|
||||
guint total_trailer_length;
|
||||
|
||||
|
@ -740,12 +740,12 @@ dissect_eth_maybefcs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
|
||||
/* Dissect the tvb up to, but not including the trailer */
|
||||
next_tvb = tvb_new_subset(tvb, 0,
|
||||
tvb_length(tvb) - total_trailer_length,
|
||||
tvb_captured_length(tvb) - total_trailer_length,
|
||||
tvb_reported_length(tvb) - total_trailer_length);
|
||||
fh_tree = dissect_eth_common(next_tvb, pinfo, tree, 0);
|
||||
|
||||
/* Now handle the ethernet trailer and optional FCS */
|
||||
next_tvb = tvb_new_subset_remaining(tvb, tvb_length(tvb) - total_trailer_length);
|
||||
next_tvb = tvb_new_subset_remaining(tvb, tvb_captured_length(tvb) - total_trailer_length);
|
||||
add_ethernet_trailer(pinfo, tree, fh_tree, hf_eth_trailer, tvb, next_tvb,
|
||||
eth_assume_fcs ? 4 : pinfo->pseudo_header->eth.fcs_len);
|
||||
} else {
|
||||
|
|
|
@ -1839,7 +1839,7 @@ dissect_esmc_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *treex)
|
|||
|
||||
{ /* padding */
|
||||
gint padding_size;
|
||||
padding_size = tvb_length_remaining(tvb, offset);
|
||||
padding_size = tvb_captured_length_remaining(tvb, offset);
|
||||
if (0 != padding_size)
|
||||
{
|
||||
proto_tree* tree_a;
|
||||
|
@ -2115,7 +2115,7 @@ dissect_oampdu_information(tvbuff_t *tvb, proto_tree *tree)
|
|||
|
||||
while (1)
|
||||
{
|
||||
bytes = tvb_length_remaining(tvb, offset);
|
||||
bytes = tvb_captured_length_remaining(tvb, offset);
|
||||
if (bytes < 1) break;
|
||||
|
||||
info_type = tvb_get_guint8(tvb, offset);
|
||||
|
@ -2303,7 +2303,7 @@ dissect_oampdu_event_notification(tvbuff_t *tvb, packet_info *pinfo, proto_tree
|
|||
|
||||
while (1)
|
||||
{
|
||||
bytes = tvb_length_remaining(tvb, offset);
|
||||
bytes = tvb_captured_length_remaining(tvb, offset);
|
||||
if (bytes < 1) break;
|
||||
|
||||
event_type = tvb_get_guint8(tvb, offset);
|
||||
|
@ -2751,7 +2751,7 @@ dissect_oampdu_loopback_control(tvbuff_t *tvb, proto_tree *tree)
|
|||
|
||||
offset = OAMPDU_HEADER_SIZE;
|
||||
|
||||
bytes = tvb_length_remaining(tvb, offset);
|
||||
bytes = tvb_captured_length_remaining(tvb, offset);
|
||||
|
||||
if (bytes >= 1)
|
||||
{
|
||||
|
@ -2810,7 +2810,7 @@ dissect_oampdu_vendor_specific(tvbuff_t *tvb, proto_tree *tree)
|
|||
|
||||
offset = OAMPDU_HEADER_SIZE;
|
||||
|
||||
bytes = tvb_length_remaining(tvb, offset);
|
||||
bytes = tvb_captured_length_remaining(tvb, offset);
|
||||
|
||||
if (bytes >= 3)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue