aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-media.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2014-08-13 08:56:22 -0400
committerAnders Broman <a.broman58@gmail.com>2014-08-14 04:21:05 +0000
commitd68d0e88b4924a610b5cd2fd3a748b00c9bbab1a (patch)
treef46c04238502faa689c173f1b8420c8d19d3c51e /epan/dissectors/packet-media.c
parentf64421df3f230e89e0d83e327926f4c46fbd70dc (diff)
Eliminate proto_tree_add_text from some dissectors.
Other minor cleanup while in the neighborhood. Change-Id: If73a029f564219782c313d4154c24c7ce7458b52 Reviewed-on: https://code.wireshark.org/review/3574 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-media.c')
-rw-r--r--epan/dissectors/packet-media.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/epan/dissectors/packet-media.c b/epan/dissectors/packet-media.c
index 01a295a1e1..6d4efefbc0 100644
--- a/epan/dissectors/packet-media.c
+++ b/epan/dissectors/packet-media.c
@@ -37,6 +37,7 @@ void proto_register_media(void);
* print routines
*/
int proto_media = -1;
+static gint hf_media_type = -1;
static gint ett_media = -1;
static heur_dissector_list_t heur_subdissector_list;
@@ -63,14 +64,14 @@ dissect_media(tvbuff_t *tvb, packet_info *pinfo , proto_tree *tree, void* data)
if (pinfo->private_data) {
/* The media type has parameters */
- proto_tree_add_text(media_tree, tvb, 0, bytes,
- "Media Type: %s; %s (%d byte%s)",
+ proto_tree_add_bytes_format_value(media_tree, hf_media_type, tvb, 0, bytes,
+ NULL, "%s; %s (%d byte%s)",
pinfo->match_string, (char *)pinfo->private_data,
bytes, plurality(bytes, "", "s"));
} else {
/* The media type has no parameters */
- proto_tree_add_text(media_tree, tvb, 0, bytes,
- "Media Type: %s (%d byte%s)",
+ proto_tree_add_bytes_format_value(media_tree, hf_media_type, tvb, 0, bytes,
+ NULL, "%s (%d byte%s)",
pinfo->match_string ? pinfo->match_string : "",
bytes, plurality(bytes, "", "s"));
}
@@ -83,6 +84,12 @@ dissect_media(tvbuff_t *tvb, packet_info *pinfo , proto_tree *tree, void* data)
void
proto_register_media(void)
{
+ static hf_register_info hf[] = {
+ { &hf_media_type,
+ { "Media type", "media.type",
+ FT_BYTES, BASE_NONE, NULL, 0,
+ NULL, HFILL }},
+ };
static gint *ett[] = {
&ett_media
};
@@ -94,6 +101,7 @@ proto_register_media(void)
);
new_register_dissector("media", dissect_media, proto_media);
register_heur_dissector_list("media", &heur_subdissector_list);
+ proto_register_field_array(proto_media, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
/*