diff options
author | Hadriel Kaplan <hadrielk@yahoo.com> | 2014-04-01 00:20:07 -0400 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2014-04-01 06:03:57 +0000 |
commit | 97cddf538c6438b1b995e742c3152b50be1d18d3 (patch) | |
tree | a5c3e682d14eddd11319b10ac2e1dc98519de6db | |
parent | dc4c26cbb8fee6a1c4397e6e9152ea218db130e0 (diff) | |
download | wireshark-97cddf538c6438b1b995e742c3152b50be1d18d3.tar.gz |
Fix proto.c to pass checkAPIs script
Since proto.c was using strcat(), changes to the file won't pass checkAPIs.
So this commit replaces it with the appropriate function, and also replaces
the deprecated tvb_length_remaining and tvb_ensure_length_remaining function
calls with the new versions, since checkAPIs was warning about that too.
This commit does not change the ep_* memorry calls to the new wmem-based
ones though, as that's a bigger deal than this trivial commit I think.
Change-Id: I51e6d5b3a6e03233f2695c890ff4c10d02fdb0c0
Reviewed-on: https://code.wireshark.org/review/905
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r-- | epan/proto.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/epan/proto.c b/epan/proto.c index d52e4017a6..8bf3714a71 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -2790,7 +2790,7 @@ proto_tree_set_string_tvb(field_info *fi, tvbuff_t *tvb, gint start, gint length gchar *string; if (length == -1) { - length = tvb_ensure_length_remaining(tvb, start); + length = tvb_ensure_captured_length_remaining(tvb, start); } string = tvb_get_string_enc(wmem_packet_scope(), tvb, start, length, encoding); @@ -3590,7 +3590,7 @@ get_hfi_length(header_field_info *hfinfo, tvbuff_t *tvb, const gint start, gint * end of the tvbuff, so we throw an * exception. */ - *length = tvb_length_remaining(tvb, start); + *length = tvb_captured_length_remaining(tvb, start); if (*length < 0) { /* * Use "tvb_ensure_bytes_exist()" @@ -3605,7 +3605,7 @@ get_hfi_length(header_field_info *hfinfo, tvbuff_t *tvb, const gint start, gint case FT_NONE: case FT_BYTES: case FT_STRING: - *length = tvb_ensure_length_remaining(tvb, start); + *length = tvb_ensure_captured_length_remaining(tvb, start); DISSECTOR_ASSERT(*length >= 0); break; @@ -3635,7 +3635,7 @@ get_hfi_length(header_field_info *hfinfo, tvbuff_t *tvb, const gint start, gint */ /* XXX - what to do, if we don't have a tvb? */ if (tvb) { - length_remaining = tvb_length_remaining(tvb, start); + length_remaining = tvb_captured_length_remaining(tvb, start); if (*item_length < 0 || (*item_length > 0 && (length_remaining < *item_length))) @@ -6921,7 +6921,7 @@ construct_match_selected_string(field_info *finfo, epan_dissect_t *edt, /* * Don't go past the end of that tvbuff. */ - length_remaining = tvb_length_remaining(finfo->ds_tvb, finfo->start); + length_remaining = tvb_captured_length_remaining(finfo->ds_tvb, finfo->start); if (length > length_remaining) length = length_remaining; if (length <= 0) @@ -7652,8 +7652,8 @@ _proto_tree_add_bits_format_value(proto_tree *tree, const int hfindex, str = decode_bits_in_field(bit_offset, no_of_bits, value); - strcat(str, " = "); - strcat(str, hf_field->name); + g_strlcat(str, " = ", 256+64); + g_strlcat(str, hf_field->name, 256+64); /* * This function does not receive an actual value but a dimensionless pointer to that value. |