From b3c51deb2455c2ee07781d1808a02646f3395a35 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Tue, 10 Apr 2018 10:52:32 -0700 Subject: Rename the last argument to tvb_new_subset_length(). In tvb_new_subset_length_caplen(), the captured length argument is backing_length and the reported length argument is reported_length. The length argument to tvb_new_subset_length() is a reported length, not a captured length, so call it reported_length, not backing_length. Change-Id: Ibfb30e15bdd885d3c0fd66e2b4b07c4a45327f14 Reviewed-on: https://code.wireshark.org/review/26863 Reviewed-by: Guy Harris --- epan/tvbuff.h | 4 ++-- epan/tvbuff_subset.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/epan/tvbuff.h b/epan/tvbuff.h index 145ad3b28e..81e6a9bf78 100644 --- a/epan/tvbuff.h +++ b/epan/tvbuff.h @@ -180,10 +180,10 @@ WS_DLL_PUBLIC tvbuff_t *tvb_new_subset_length_caplen(tvbuff_t *backing, /** * Similar to tvb_new_subset_length_caplen() but with captured length calculated * to fit within the existing captured length and the specified - * backing length (which is used as the reported length). + * reported length. * Can throw ReportedBoundsError. */ WS_DLL_PUBLIC tvbuff_t *tvb_new_subset_length(tvbuff_t *backing, - const gint backing_offset, const gint backing_length); + const gint backing_offset, const gint reported_length); /** Similar to tvb_new_subset_length_caplen() but with backing_length and reported_length set * to -1. Can throw ReportedBoundsError. */ diff --git a/epan/tvbuff_subset.c b/epan/tvbuff_subset.c index cfcfbdec60..518d573bc5 100644 --- a/epan/tvbuff_subset.c +++ b/epan/tvbuff_subset.c @@ -155,7 +155,7 @@ tvb_new_subset_length_caplen(tvbuff_t *backing, const gint backing_offset, const } tvbuff_t * -tvb_new_subset_length(tvbuff_t *backing, const gint backing_offset, const gint backing_length) +tvb_new_subset_length(tvbuff_t *backing, const gint backing_offset, const gint reported_length) { gint captured_length; tvbuff_t *tvb; @@ -164,21 +164,21 @@ tvb_new_subset_length(tvbuff_t *backing, const gint backing_offset, const gint b DISSECTOR_ASSERT(backing && backing->initialized); - THROW_ON(backing_length < 0, ReportedBoundsError); + THROW_ON(reported_length < 0, ReportedBoundsError); /* * Give the next dissector only captured_length bytes. */ captured_length = tvb_captured_length_remaining(backing, backing_offset); THROW_ON(captured_length < 0, BoundsError); - if (captured_length > backing_length) - captured_length = backing_length; + if (captured_length > reported_length) + captured_length = reported_length; tvb_check_offset_length(backing, backing_offset, captured_length, &subset_tvb_offset, &subset_tvb_length); - tvb = tvb_new_with_subset(backing, backing_length, + tvb = tvb_new_with_subset(backing, reported_length, subset_tvb_offset, subset_tvb_length); tvb_add_to_chain(backing, tvb); -- cgit v1.2.3