From 5ca357f245810f264965551524d6498662e7541d Mon Sep 17 00:00:00 2001 From: Jeff Morriss Date: Tue, 6 Mar 2012 02:19:23 +0000 Subject: [PATCH] Don't use FT_BOOLEAN with value_strings: the code to generate representations of former is expecting true_false_strings--which are quite different than the latter. svn path=/trunk/; revision=41363 --- epan/dissectors/packet-cipsafety.c | 10 ++++------ epan/dissectors/packet-gsm_a_common.c | 21 ++++++++++----------- epan/dissectors/packet-gsm_abis_om2000.c | 4 ++-- 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/epan/dissectors/packet-cipsafety.c b/epan/dissectors/packet-cipsafety.c index ea06ba5fb7..87222f9cfa 100644 --- a/epan/dissectors/packet-cipsafety.c +++ b/epan/dissectors/packet-cipsafety.c @@ -300,11 +300,9 @@ const value_string cipsafety_ssn_date_vals[8] = { { 0, NULL } }; -static const value_string cip_safety_vals_active_idle[] = { - { 0, "Idle" }, - { 1, "Active" }, - - { 0, NULL } +static const true_false_string cip_safety_vals_active_idle = { + "Idle", + "Active" }; /* Translate function to string - CIP Service codes for Safety Supervisor */ @@ -1626,7 +1624,7 @@ proto_register_cipsafety(void) { &hf_cipsafety_mcast_byte, { "MCAST Byte", "cipsafety.mcast_byte", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_cipsafety_mcast_byte_consumer_num, { "Consumer #", "cipsafety.mcast_byte.consumer_num", FT_UINT8, BASE_HEX, NULL, 0x0F, NULL, HFILL }}, { &hf_cipsafety_mcast_byte_reserved1, { "Reserved", "cipsafety.mcast_byte.reserved1", FT_UINT8, BASE_HEX, NULL, 0x10, NULL, HFILL }}, - { &hf_cipsafety_mcast_byte_mai, { "Multicast Active/Idle", "cipsafety.mcast_byte.active_idle", FT_BOOLEAN, BASE_DEC, VALS(cip_safety_vals_active_idle), 0x20, NULL, HFILL }}, + { &hf_cipsafety_mcast_byte_mai, { "Multicast Active/Idle", "cipsafety.mcast_byte.active_idle", FT_BOOLEAN, 8, TFS(&cip_safety_vals_active_idle), 0x20, NULL, HFILL }}, { &hf_cipsafety_mcast_byte_reserved2, { "Reserved", "cipsafety.mcast_byte.reserved2", FT_UINT8, BASE_HEX, NULL, 0x40, NULL, HFILL }}, { &hf_cipsafety_mcast_byte_parity_even, { "Parity Even", "cipsafety.mcast_byte.parity_even", FT_BOOLEAN, BASE_DEC, NULL, 0x80, NULL, HFILL }}, { &hf_cipsafety_mcast_byte2, { "MCAST Byte 2", "cipsafety.mcast_byte2", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }}, diff --git a/epan/dissectors/packet-gsm_a_common.c b/epan/dissectors/packet-gsm_a_common.c index d73024c2e4..cbcee49132 100644 --- a/epan/dissectors/packet-gsm_a_common.c +++ b/epan/dissectors/packet-gsm_a_common.c @@ -916,10 +916,9 @@ static const value_string gsm_a_velocity_type_vals[] = { { 0, NULL } }; -static const value_string gsm_a_dir_of_ver_speed_vals[] = { - { 0, "Downward" }, - { 1, "Upward" }, - { 0, NULL} +static const true_false_string gsm_a_dir_of_ver_speed_vals = { + "Downward", + "Upward" }; guint16 @@ -962,7 +961,7 @@ dissect_description_of_velocity(tvbuff_t *tvb, proto_tree *tree, packet_info *pi velocity_item = proto_tree_add_item(tree, hf_gsm_a_horizontal_speed, tvb, offset, 2, ENC_BIG_ENDIAN); proto_item_append_text(velocity_item," km/h"); curr_offset+=2; - /* Vertical Speed Octet 5 + /* Vertical Speed Octet 5 * Vertical speed is encoded in increments of 1 kilometre per hour using 8 bits giving a number N between 0 and 28-1. */ velocity_item = proto_tree_add_item(tree, hf_gsm_a_vertical_speed, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -980,7 +979,7 @@ dissect_description_of_velocity(tvbuff_t *tvb, proto_tree *tree, packet_info *pi velocity_item = proto_tree_add_item(tree, hf_gsm_a_horizontal_speed, tvb, offset, 2, ENC_BIG_ENDIAN); proto_item_append_text(velocity_item," km/h"); curr_offset+=2; - /* Uncertainty Speed Octet 5 + /* Uncertainty Speed Octet 5 * Uncertainty speed is encoded in increments of 1 kilometre per hour using an 8 bit binary coded number N. The value of * N gives the uncertainty speed except for N=255 which indicates that the uncertainty is not specified. */ @@ -1006,7 +1005,7 @@ dissect_description_of_velocity(tvbuff_t *tvb, proto_tree *tree, packet_info *pi velocity_item = proto_tree_add_item(tree, hf_gsm_a_horizontal_speed, tvb, offset, 2, ENC_BIG_ENDIAN); proto_item_append_text(velocity_item," km/h"); curr_offset+=2; - /* Vertical Speed Octet 5 + /* Vertical Speed Octet 5 * Vertical speed is encoded in increments of 1 kilometre per hour using 8 bits giving a number N between 0 and 28-1. */ velocity_item = proto_tree_add_item(tree, hf_gsm_a_vertical_speed, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -1220,7 +1219,7 @@ guint16 elem_tlv(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint8 iei /* * Type Extendable Length Value (TELV) element dissector - * This is a version where the length field can be one or two octets depending + * This is a version where the length field can be one or two octets depending * if the extension bit is set or not (TS 48.016 p 10.1.2). * 8 7 6 5 4 3 2 1 * octet 2 0/1 ext length @@ -3242,7 +3241,7 @@ de_nas_cont_for_ps_ho(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint curr_offset = offset; proto_tree_add_text(tree, tvb, curr_offset, len, "IE not dissected yet"); - /* 8 7 6 5 4 3 2 1 + /* 8 7 6 5 4 3 2 1 * 0 0 0 old 0 Type of ciphering * spare spare spare XID spare algorithm */ @@ -3255,7 +3254,7 @@ de_nas_cont_for_ps_ho(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint */ proto_tree_add_item(tree, hf_gsm_a_iov_ui, tvb, curr_offset, 4, ENC_BIG_ENDIAN); curr_offset+=4; - + EXTRANEOUS_DATA_CHECK_EXPERT(len, curr_offset - offset, pinfo); return(curr_offset - offset); @@ -4034,7 +4033,7 @@ proto_register_gsm_a_common(void) }, { &hf_gsm_a_d, { "Direction of Vertical Speed", "gsm_a.gad.d", - FT_BOOLEAN, 8, VALS(gsm_a_dir_of_ver_speed_vals), 0x08, + FT_BOOLEAN, 8, TFS(&gsm_a_dir_of_ver_speed_vals), 0x08, NULL, HFILL} }, { &hf_gsm_a_geo_loc_D, diff --git a/epan/dissectors/packet-gsm_abis_om2000.c b/epan/dissectors/packet-gsm_abis_om2000.c index 97c8771258..15df5a32ef 100644 --- a/epan/dissectors/packet-gsm_abis_om2000.c +++ b/epan/dissectors/packet-gsm_abis_om2000.c @@ -1181,7 +1181,7 @@ proto_register_abis_om2000(void) }, { &hf_om2k_icm_cr, { "ICM Channel Rate", "om2000.icm_cr", - FT_BOOLEAN, 1, VALS(om2k_icmcr_vals), 0, + FT_UINT8, BASE_DEC, VALS(om2k_icmcr_vals), 0, NULL, HFILL } }, { &hf_om2k_lsc_fm, @@ -1221,7 +1221,7 @@ proto_register_abis_om2000(void) }, { &hf_om2k_fill_mark, { "Filling Marker", "om2000.filling", - FT_BOOLEAN, 0x01, VALS(om2k_fill_vals), 0, + FT_UINT8, BASE_DEC, VALS(om2k_fill_vals), 0, NULL, HFILL } }, { &hf_om2k_bcc,