diff options
author | Michael Mann <mmann78@netscape.net> | 2016-06-26 10:52:37 -0400 |
---|---|---|
committer | Pascal Quantin <pascal.quantin@gmail.com> | 2016-06-27 15:20:06 +0000 |
commit | 2ab415579491e4bc66ea58627bda504cae833b9e (patch) | |
tree | 0f7f8eaa4bd9d90c8f6066036522ef0fc65d137d /epan/dissectors/packet-dnp.c | |
parent | 8c37621ca733a24a972e3e069a537c06e650f435 (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-dnp.c')
-rw-r--r-- | epan/dissectors/packet-dnp.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/epan/dissectors/packet-dnp.c b/epan/dissectors/packet-dnp.c index dac30fed13..3bb16ca653 100644 --- a/epan/dissectors/packet-dnp.c +++ b/epan/dissectors/packet-dnp.c @@ -1932,18 +1932,19 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, case AL_OBJ_DA_CONF: /* Device Attributes - DNP Subset and Conformance (Obj:00, Var:249) */ case AL_OBJ_DA_PROD: /* Device Attributes - Device Product Name and Model (Obj:00, Var:250) */ case AL_OBJ_DA_MFG: /* Device Attributes - Device Manufacturers Name (Obj:00, Var:252) */ - + { + const guint8* da_value; proto_tree_add_item(point_tree, hf_dnp3_al_datatype, tvb, offset, 1, ENC_LITTLE_ENDIAN); da_len = tvb_get_guint8(tvb, offset+1); proto_tree_add_item(point_tree, hf_dnp3_al_da_length, tvb, offset+1, 1, ENC_LITTLE_ENDIAN); - proto_tree_add_item(point_tree, hf_dnp3_al_da_value, tvb, offset+2, da_len, ENC_ASCII|ENC_NA); - proto_item_append_text(object_item, ", Value: %s", tvb_get_string_enc(wmem_packet_scope(), tvb, offset+2, da_len, ENC_ASCII)); + proto_tree_add_item_ret_string(point_tree, hf_dnp3_al_da_value, tvb, offset+2, da_len, ENC_ASCII|ENC_NA, wmem_packet_scope(), &da_value); + proto_item_append_text(object_item, ", Value: %s", da_value); offset += 2 + da_len; break; - + } /* Bit-based Data objects here */ case AL_OBJ_BI_1BIT: /* Single-Bit Binary Input (Obj:01, Var:01) */ case AL_OBJ_BO: /* Binary Output (Obj:10, Var:01) */ |