Remove deprecated tvb_length calls
Trust that the files in epan/ immediately (not dissectors) know what they're doing so just blindly convert them to captured length. Change-Id: I872f7d58b2e15ae82c75fd56f4873996fbc97be7 Reviewed-on: https://code.wireshark.org/review/9083 Reviewed-by: Evan Huus <eapache@gmail.com>
This commit is contained in:
parent
893e1e516a
commit
9b5b7c1a90
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
10
epan/print.c
10
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!");
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue