aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-tcpros.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2016-06-26 10:52:37 -0400
committerPascal Quantin <pascal.quantin@gmail.com>2016-06-27 15:20:06 +0000
commit2ab415579491e4bc66ea58627bda504cae833b9e (patch)
tree0f7f8eaa4bd9d90c8f6066036522ef0fc65d137d /epan/dissectors/packet-tcpros.c
parent8c37621ca733a24a972e3e069a537c06e650f435 (diff)
tvb_get_string_enc + proto_tree_add_item = proto_tree_add_item_ret_string
Also some other tricks to remove unnecessary tvb_get_string_enc calls. Change-Id: I2f40d9175b6c0bb0b1364b4089bfaa287edf0914 Reviewed-on: https://code.wireshark.org/review/16158 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-tcpros.c')
-rw-r--r--epan/dissectors/packet-tcpros.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/epan/dissectors/packet-tcpros.c b/epan/dissectors/packet-tcpros.c
index 24a2535f01..ed66fc40fe 100644
--- a/epan/dissectors/packet-tcpros.c
+++ b/epan/dissectors/packet-tcpros.c
@@ -99,11 +99,12 @@ dissect_ros_connection_header_field(tvbuff_t *tvb, proto_tree *tree, packet_info
/** If we find a separator, then split field name and value */
if( sep > 0 ) {
+ const guint8* field;
field_tree = proto_item_add_subtree(ti, ett_tcpros);
- proto_tree_add_item(field_tree, hf_tcpros_connection_header_field_name, tvb, offset, sep, ENC_UTF_8|ENC_NA);
+ proto_tree_add_item_ret_string(field_tree, hf_tcpros_connection_header_field_name, tvb, offset, sep, ENC_UTF_8|ENC_NA, wmem_packet_scope(), &field);
proto_tree_add_item(field_tree, hf_tcpros_connection_header_field_value, tvb, offset+sep+1, fLen - sep - 1, ENC_UTF_8|ENC_NA);
- col_append_str(pinfo->cinfo, COL_INFO, tvb_get_string_enc(wmem_packet_scope(), tvb, offset, sep, ENC_UTF_8));
+ col_append_str(pinfo->cinfo, COL_INFO, field);
}
ret = fLen + SIZE_OF_LENGTH_FIELD;
}
@@ -188,6 +189,7 @@ dissect_ros_message_header(tvbuff_t *tvb, proto_tree *root_tree, packet_info *pi
guint32 frame_id_len;
guint32 seq;
guint header_len;
+ const guint8* frame_str;
frame_id_len = tvb_get_letohl(tvb, offset + consumed_len + SIZE_OF_LENGTH_FIELD + SIZE_OF_LENGTH_STAMP);
@@ -213,8 +215,8 @@ dissect_ros_message_header(tvbuff_t *tvb, proto_tree *root_tree, packet_info *pi
proto_tree_add_item(sub_tree, hf_tcpros_message_header_frame_length, tvb, offset + consumed_len, SIZE_OF_LENGTH_FIELD, ENC_LITTLE_ENDIAN);
consumed_len += SIZE_OF_LENGTH_FIELD;
- proto_tree_add_item(sub_tree, hf_tcpros_message_header_frame_value, tvb, offset + consumed_len, frame_id_len, ENC_UTF_8|ENC_NA);
- col_append_fstr(pinfo->cinfo, COL_INFO, "Frame: '%s' ", tvb_get_string_enc(wmem_packet_scope(), tvb, offset + consumed_len, frame_id_len, ENC_UTF_8) );
+ proto_tree_add_item_ret_string(sub_tree, hf_tcpros_message_header_frame_value, tvb, offset + consumed_len, frame_id_len, ENC_UTF_8|ENC_NA, wmem_packet_scope(), &frame_str);
+ col_append_fstr(pinfo->cinfo, COL_INFO, "Frame: '%s' ", frame_str);
consumed_len += frame_id_len;
return consumed_len;