diff --git a/epan/next_tvb.c b/epan/next_tvb.c index 2a6512c3f3..dd79cc91dc 100644 --- a/epan/next_tvb.c +++ b/epan/next_tvb.c @@ -104,7 +104,7 @@ void next_tvb_call(next_tvb_list_t *list, packet_info *pinfo, proto_tree *tree, item = list->first; while (item) { - if (item->tvb && tvb_length(item->tvb)) { + if (item->tvb && tvb_captured_length(item->tvb)) { switch (item->type) { case NTVB_HANDLE: call_dissector((item->handle) ? item->handle : ((handle) ? handle : data_handle), item->tvb, pinfo, (item->tree) ? item->tree : tree); diff --git a/epan/packet.c b/epan/packet.c index 1432153ec4..5c1b1c96e7 100644 --- a/epan/packet.c +++ b/epan/packet.c @@ -340,7 +340,7 @@ remove_last_data_source(packet_info *pinfo) char* get_data_source_name(const struct data_source *src) { - guint length = tvb_length(src->tvb); + guint length = tvb_captured_length(src->tvb); return wmem_strdup_printf(NULL, "%s (%u byte%s)", src->name, length, plurality(length, "", "s")); @@ -613,7 +613,7 @@ call_dissector_through_handle(dissector_handle_t handle, tvbuff_t *tvb, len = (*handle->dissector.new_d)(tvb, pinfo, tree, data); } else { (*handle->dissector.old)(tvb, pinfo, tree); - len = tvb_length(tvb); + len = tvb_captured_length(tvb); if (len == 0) { /* * XXX - a tvbuff can have 0 bytes of data in @@ -807,7 +807,7 @@ call_dissector_work_error(dissector_handle_t handle, tvbuff_t *tvb, * the data in some tvbuff, so we'll assume that * the entire tvbuff was dissected. */ - len = tvb_length(tvb); + len = tvb_captured_length(tvb); } ENDTRY; @@ -2392,7 +2392,7 @@ call_dissector_with_data(dissector_handle_t handle, tvbuff_t *tvb, */ g_assert(data_handle->protocol != NULL); call_dissector_work(data_handle, tvb, pinfo, tree, TRUE, NULL); - return tvb_length(tvb); + return tvb_captured_length(tvb); } return ret; } diff --git a/epan/print.c b/epan/print.c index 1c2692dc84..423b7efb3c 100644 --- a/epan/print.c +++ b/epan/print.c @@ -711,7 +711,7 @@ write_carrays_hex_data(guint32 num, FILE *fh, epan_dissect_t *edt) memset(ascii, 0, sizeof(ascii)); src = (struct data_source *)src_le->data; tvb = get_data_source_tvb(src); - length = tvb_length(tvb); + length = tvb_captured_length(tvb); if (length == 0) continue; @@ -790,7 +790,7 @@ get_field_data(GSList *src_list, field_info *fi) * that could be expensive. Until we fix that, * we'll do the check here. */ - tvbuff_length = tvb_length_remaining(src_tvb, + tvbuff_length = tvb_captured_length_remaining(src_tvb, fi->start); if (tvbuff_length < 0) { return NULL; @@ -850,7 +850,7 @@ pdml_write_field_hex_value(write_pdml_data *pdata, field_info *fi) if (!fi->ds_tvb) return; - if (fi->length > tvb_length_remaining(fi->ds_tvb, fi->start)) { + if (fi->length > tvb_captured_length_remaining(fi->ds_tvb, fi->start)) { fprintf(pdata->fh, "field length invalid!"); return; } @@ -896,7 +896,7 @@ print_hex_data(print_stream_t *stream, epan_dissect_t *edt) print_line(stream, 0, line); g_free(line); } - length = tvb_length(tvb); + length = tvb_captured_length(tvb); if (length == 0) return TRUE; cp = tvb_get_ptr(tvb, 0, length); @@ -1458,7 +1458,7 @@ get_field_hex_value(GSList *src_list, field_info *fi) if (!fi->ds_tvb) return NULL; - if (fi->length > tvb_length_remaining(fi->ds_tvb, fi->start)) { + if (fi->length > tvb_captured_length_remaining(fi->ds_tvb, fi->start)) { return g_strdup("field length invalid!"); } diff --git a/epan/reassemble.c b/epan/reassemble.c index 811fd2fb3f..16abe70918 100644 --- a/epan/reassemble.c +++ b/epan/reassemble.c @@ -1451,7 +1451,7 @@ fragment_add_check(reassembly_table *table, tvbuff_t *tvb, const int offset, * If this is a short frame, then we can't, and don't, do * reassembly on it. We just give up. */ - if (tvb_reported_length(tvb) > tvb_length(tvb)) + if (tvb_reported_length(tvb) > tvb_captured_length(tvb)) return NULL; if (fragment_add_work(fd_head, tvb, offset, pinfo, frag_offset, @@ -2256,8 +2256,8 @@ show_fragment(fragment_item *fd, const int offset, const fragment_items *fit, } else { name = g_strdup(proto_registrar_get_name(*(fit->hf_fragments))); } - proto_item_set_text(fi, "%u %s (%u byte%s): ", count, name, tvb_length(tvb), - plurality(tvb_length(tvb), "", "s")); + proto_item_set_text(fi, "%u %s (%u byte%s): ", count, name, tvb_captured_length(tvb), + plurality(tvb_captured_length(tvb), "", "s")); g_free(name); } else { proto_item_append_text(fi, ", "); @@ -2379,13 +2379,13 @@ show_fragment_tree(fragment_head *fd_head, const fragment_items *fit, if (fit->hf_reassembled_length) { proto_item *fli = proto_tree_add_uint(ft, *(fit->hf_reassembled_length), - tvb, 0, 0, tvb_length (tvb)); + tvb, 0, 0, tvb_captured_length (tvb)); PROTO_ITEM_SET_GENERATED(fli); } if (fit->hf_reassembled_data) { proto_item *fli = proto_tree_add_item(ft, *(fit->hf_reassembled_data), - tvb, 0, tvb_length(tvb), ENC_NA); + tvb, 0, tvb_captured_length(tvb), ENC_NA); PROTO_ITEM_SET_GENERATED(fli); } @@ -2439,13 +2439,13 @@ show_fragment_seq_tree(fragment_head *fd_head, const fragment_items *fit, if (fit->hf_reassembled_length) { proto_item *fli = proto_tree_add_uint(ft, *(fit->hf_reassembled_length), - tvb, 0, 0, tvb_length (tvb)); + tvb, 0, 0, tvb_captured_length (tvb)); PROTO_ITEM_SET_GENERATED(fli); } if (fit->hf_reassembled_data) { proto_item *fli = proto_tree_add_item(ft, *(fit->hf_reassembled_data), - tvb, 0, tvb_length(tvb), ENC_NA); + tvb, 0, tvb_captured_length(tvb), ENC_NA); PROTO_ITEM_SET_GENERATED(fli); } diff --git a/epan/tvbtest.c b/epan/tvbtest.c index 0517c204b2..53a719dab1 100644 --- a/epan/tvbtest.c +++ b/epan/tvbtest.c @@ -46,7 +46,7 @@ test(tvbuff_t *tvb, const gchar* name, guint32 expected32; guint incr, i; - length = tvb_length(tvb); + length = tvb_captured_length(tvb); if (length != expected_length) { printf("01: Failed TVB=%s Length of tvb=%u while expected length=%u\n", diff --git a/epan/tvbuff_composite.c b/epan/tvbuff_composite.c index 684e6440e9..6d9d98557b 100644 --- a/epan/tvbuff_composite.c +++ b/epan/tvbuff_composite.c @@ -164,7 +164,7 @@ composite_memcpy(tvbuff_t *tvb, void* _target, guint abs_offset, guint abs_lengt * then iterate across the other member tvb's, copying their portions * until we have copied all data. */ - member_length = tvb_length_remaining(member_tvb, member_offset); + member_length = tvb_captured_length_remaining(member_tvb, member_offset); /* composite_memcpy() can't handle a member_length of zero. */ DISSECTOR_ASSERT(member_length > 0); diff --git a/epan/tvbuff_subset.c b/epan/tvbuff_subset.c index 3bb6e8fd18..b463e46b0f 100644 --- a/epan/tvbuff_subset.c +++ b/epan/tvbuff_subset.c @@ -181,7 +181,7 @@ tvb_new_subset_length(tvbuff_t *backing, const gint backing_offset, const gint b /* * Give the next dissector only captured_length bytes. */ - captured_length = tvb_length_remaining(backing, backing_offset); + captured_length = tvb_captured_length_remaining(backing, backing_offset); THROW_ON(captured_length < 0, BoundsError); if (captured_length > backing_length) captured_length = backing_length;