Wireshark mailing list archives

Re: [Wireshark-commits] master 14824e6: Revert "Fixup: tvb_* -> tvb_captured"


From: Jeff Morriss <jeff.morriss.ws () gmail com>
Date: Fri, 20 Jun 2014 10:33:53 -0400

On 06/20/14 03:46, Dario Lombardo wrote:
On Thu, Jun 19, 2014 at 9:18 PM, Evan Huus <eapache () gmail com> wrote:
We were not bulk-converting them so that we could catch the ones that really
should have been tvb_reported_length and tvb_reported_length_remaining from
the beginning.

If you look at the code in epan/tvbuff.h:228,237,244 you can find those defines

#define tvb_length tvb_captured_length
#define tvb_length_remaining tvb_captured_length_remaining
#define tvb_ensure_length_remaining tvb_ensure_captured_length_remaining

This means that tvb_length doesn't go to the compiler, since it's
changed to tvb_captured_length by the preprocessor. What about a
change that replaces only these? This should be safe.

It's not a question of what gets to the compiler, it's a question of going through each one to make sure the dissector is using the one they really meant to use.

IOW the reason these functions were renamed was because a large portion of the time dissector-writers would use tvb_length() when they really should have been using tvb_reported_length(). By renaming the functions and adding a macro--which is listed as deprecated by checkAPIs--for backwards compatibility we can know which calls have yet to be audited/checked for correctness. That is, the whole point is to *not* systematically replace tvb_length() but rather check each call and replace it with the correct one.

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
            mailto:wireshark-dev-request () wireshark org?subject=unsubscribe


Current thread: