diff options
author | Michael Mann <mmann78@netscape.net> | 2014-08-13 08:56:22 -0400 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2014-08-14 04:21:05 +0000 |
commit | d68d0e88b4924a610b5cd2fd3a748b00c9bbab1a (patch) | |
tree | f46c04238502faa689c173f1b8420c8d19d3c51e /epan/dissectors/packet-kingfisher.c | |
parent | f64421df3f230e89e0d83e327926f4c46fbd70dc (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-kingfisher.c')
-rw-r--r-- | epan/dissectors/packet-kingfisher.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/epan/dissectors/packet-kingfisher.c b/epan/dissectors/packet-kingfisher.c index 2235bf9cd3..80d3b3bc35 100644 --- a/epan/dissectors/packet-kingfisher.c +++ b/epan/dissectors/packet-kingfisher.c @@ -51,6 +51,7 @@ static int hf_kingfisher_via = -1; static int hf_kingfisher_message = -1; static int hf_kingfisher_function = -1; static int hf_kingfisher_checksum = -1; +static int hf_kingfisher_message_data = -1; static dissector_handle_t kingfisher_conv_handle; @@ -183,7 +184,7 @@ static gboolean dissect_kingfisher(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_conv_dissector) { kingfisher_packet_t kfp; - proto_tree *kingfisher_tree=NULL; + proto_tree *kingfisher_tree; proto_item *item=NULL; const char *func_string = NULL; unsigned short checksum; @@ -269,10 +270,8 @@ dissect_kingfisher(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean message = (kfp.message & 0x0f) | ((kfp.message & 0xf0) >> 4); - if(tree){ - item = proto_tree_add_protocol_format(tree, proto_kingfisher, tvb, 0, -1, "Kingfisher Protocol, From RTU: %d, Target RTU: %d", kfp.from, kfp.target ); - kingfisher_tree = proto_item_add_subtree( item, ett_kingfisher ); - } + item = proto_tree_add_protocol_format(tree, proto_kingfisher, tvb, 0, -1, "Kingfisher Protocol, From RTU: %d, Target RTU: %d", kfp.from, kfp.target ); + kingfisher_tree = proto_item_add_subtree( item, ett_kingfisher ); /* version */ proto_tree_add_uint(kingfisher_tree, hf_kingfisher_version, tvb, 6, 1, kfp.version); @@ -300,7 +299,7 @@ dissect_kingfisher(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean /* message data */ if(kfp.length > ((kfp.version==3)?11:8)){ - proto_tree_add_text(kingfisher_tree, tvb, ((kfp.version==3)?10:7), kfp.length - ((kfp.version==3)?11:8), "Message Data"); + proto_tree_add_item(kingfisher_tree, hf_kingfisher_message_data, tvb, ((kfp.version==3)?10:7), kfp.length - ((kfp.version==3)?11:8), ENC_NA); } /* checksum */ @@ -355,6 +354,7 @@ proto_register_kingfisher( void ) { &hf_kingfisher_message, { "Message Number", "kingfisher.message", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_kingfisher_function, { "Function Code", "kingfisher.function", FT_UINT8, BASE_DEC, VALS( function_code_vals ), 0x0, NULL, HFILL } }, { &hf_kingfisher_checksum, { "Checksum", "kingfisher.checksum", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { &hf_kingfisher_message_data, { "Message Data", "kingfisher.message_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, }; static gint *ett[] = { |