Wireshark-commits: [Wireshark-commits] master c67c6e8: Add routines to add an item and return the i
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=c67c6e8f30b02450de2d9fb02b91026c5f954448
Submitter: Guy Harris (guy@xxxxxxxxxxxx)
Changed: branch: master
Repository: wireshark
Commits:
c67c6e8 by Guy Harris (guy@xxxxxxxxxxxx):
Add routines to add an item and return the item's real length.
proto_item_get_len() is *not* guaranteed to return a correct value.
Even if there's a non-null tree item, it might be pointing to a "faked"
item; it really shouldn't be used.
So add proto_tree_add_item_ret_length() and
proto_tree_add_item_new_ret_length(), which calculate the real length
themselves and return it through a pointer.
Fix as many places as we straightforwardly can to use them rather than
to use proto_item_get_len(). (There's a Lua API for
proto_item_get_len(), so we keep it around, but we should add Lua APIs
for the new routines, and deprecate the old API.)
Fix ptvcursor_add() to do the same thing that
proto_tree_add_item_ret_length() and
proto_tree_add_item_new_ret_length() do.
Split the TRY_TO_FAKE_THIS_ITEM macros into a macro to check for the
tree being null and to try to fake the item. We don't always use the
former macro, as we might need to do more than just return NULL if the
incoming tree is null (for example, calculating the item's real length
and using it...).
new_field_info() never returns NULL; remove checks for it. The check
for a null tree is done before the calls to new_field_info().
Change-Id: I002a218d1f810c73e0de837e0ac6ebcde21bacec
Reviewed-on: https://code.wireshark.org/review/13139
Reviewed-by: Guy Harris <guy@xxxxxxxxxxxx>
Actions performed:
from 628c068 Qt: Save the default capture device name.
adds c67c6e8 Add routines to add an item and return the item's real length.
Summary of changes:
debian/libwireshark0.symbols | 2 +
epan/dissectors/packet-lat.c | 5 +-
epan/dissectors/packet-quake.c | 48 +++---
epan/dissectors/packet-sccp.c | 3 +
epan/proto.c | 322 +++++++++++++++++++++++++++++++++++-----
epan/proto.h | 26 +++-
epan/wslua/wslua_tree.c | 1 +
7 files changed, 348 insertions(+), 59 deletions(-)