summaryrefslogtreecommitdiff
path: root/epan/dissectors/packet-dcm.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2014-08-03 21:10:24 -0400
committerAnders Broman <a.broman58@gmail.com>2014-08-05 07:36:26 +0000
commit9d5f9141af289d3d8b253907eaaae101da1bd9fd (patch)
tree4d2816511482c04e3e8af66bd6251f5f7ce2dc2f /epan/dissectors/packet-dcm.c
parentedbb9edf3928e79b41f9b84d2399205810febef2 (diff)
downloadwireshark-9d5f9141af289d3d8b253907eaaae101da1bd9fd.tar.gz
Eliminate proto_tree_add_text from some dissectors.
Other minor cleanup while in the area. Change-Id: Id8d957d3d68a2e3dd5089f490bd59d773e1be967 Reviewed-on: https://code.wireshark.org/review/3427 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-dcm.c')
-rw-r--r--epan/dissectors/packet-dcm.c81
1 files changed, 37 insertions, 44 deletions
diff --git a/epan/dissectors/packet-dcm.c b/epan/dissectors/packet-dcm.c
index 64713ee757..4c79d825f4 100644
--- a/epan/dissectors/packet-dcm.c
+++ b/epan/dissectors/packet-dcm.c
@@ -6273,67 +6273,60 @@ dissect_dcm_tag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
Display the information we collected so far. Don't wait until the value is parsed,
because that parsing might cause an exception. If that happens within a sequence,
the sequence tag would not show up with the value
+
+ Use different ett_ for Sequences & Items, so that fold/unfold state makes sense
*/
tag_summary = dcm_tag_summary(grp, elm, vl, tag_def->description, vr, tag_def->is_retired, is_implicit);
-
- if (vl == 0xFFFFFFFF) {
- /* 'Just' mark header as the length of the item */
- tag_pitem = proto_tree_add_text(tree, tvb, offset_tag, offset - offset_tag, "%s", tag_summary);
- vl_max = 0; /* We don't know who long this sequence/item is */
- }
- else if (offset + vl <= endpos) {
- /* Show real length of item */
- tag_pitem = proto_tree_add_text(tree, tvb, offset_tag, offset + vl - offset_tag, "%s", tag_summary);
- vl_max = vl;
- }
- else {
- /* Value is longer than what we have in the PDV, -> we do have a OPEN tag */
- tag_pitem = proto_tree_add_text(tree, tvb, offset_tag, endpos - offset_tag, "%s", tag_summary);
- vl_max = endpos - offset;
- }
-
is_sequence = (strcmp(vr, "SQ") == 0) || (vl == 0xFFFFFFFF);
is_item = ((grp == 0xFFFE) && (elm == 0xE000));
+ if (vl == 0xFFFFFFFF) {
+ /* 'Just' mark header as the length of the item */
+ tag_ptree = proto_tree_add_subtree(tree, tvb, offset_tag, offset - offset_tag,
+ is_item ? ett_dcm_data_item : ett_dcm_data_seq, &tag_pitem, tag_summary);
+ vl_max = 0; /* We don't know who long this sequence/item is */
+ }
+ else if (offset + vl <= endpos) {
+ /* Show real length of item */
+ tag_ptree = proto_tree_add_subtree(tree, tvb, offset_tag, offset + vl - offset_tag,
+ is_item ? ett_dcm_data_item : ett_dcm_data_seq, &tag_pitem, tag_summary);
+ vl_max = vl;
+ }
+ else {
+ /* Value is longer than what we have in the PDV, -> we do have a OPEN tag */
+ tag_ptree = proto_tree_add_subtree(tree, tvb, offset_tag, endpos - offset_tag,
+ is_item ? ett_dcm_data_item : ett_dcm_data_seq, &tag_pitem, tag_summary);
+ vl_max = endpos - offset;
+ }
/* If you are going to touch the following 25 lines, make sure you reserve a few hours to go
through both display options and check for proper tree display :-)
*/
- if (is_sequence | is_item) {
-
- if (global_dcm_seq_subtree) {
- /* Use different ett_ for Sequences & Items, so that fold/unfold state makes sense */
- seq_ptree = proto_item_add_subtree(tag_pitem, (is_sequence ? ett_dcm_data_seq : ett_dcm_data_item));
- if (global_dcm_tag_subtree)
- tag_ptree = seq_ptree;
- else
- tag_ptree = NULL;
+ if (is_sequence | is_item) {
+
+ if (global_dcm_seq_subtree) {
+ if (!global_dcm_tag_subtree)
+ tag_ptree = NULL;
+ }
+ else {
+ seq_ptree = tree;
+ if (!global_dcm_tag_subtree) {
+ tag_ptree = NULL;
+ }
+ }
}
else {
- seq_ptree = tree;
- if (global_dcm_tag_subtree) {
- tag_ptree = proto_item_add_subtree(tag_pitem, ett_dcm_data_tag);
- }
- else {
+ /* For tags */
+ if (!global_dcm_tag_subtree) {
tag_ptree = NULL;
- }
- }
- }
- else {
- /* For tags */
- if (global_dcm_tag_subtree) {
- tag_ptree = proto_item_add_subtree(tag_pitem, ett_dcm_data_tag);
- }
- else {
- tag_ptree = NULL;
+ }
}
- }
- /* ---------------------------------------------------------------
+ /* ---------------------------------------------------------------
Tag details as separate items
---------------------------------------------------------------
- */
+ */
proto_tree_add_uint_format_value(tag_ptree, hf_dcm_tag, tvb, offset_tag, 4,
(grp << 16) | elm, "%04x,%04x (%s)", grp, elm, tag_def->description);