diff options
author | Martin Mathieson <martin.mathieson@keysight.com> | 2020-03-31 22:46:55 +0100 |
---|---|---|
committer | Martin Mathieson <martin.r.mathieson@googlemail.com> | 2020-04-01 10:32:08 +0000 |
commit | 71e9009825db727fd84f7cbc9cc278df988188b9 (patch) | |
tree | 9790df3a5df69b2dd683581253539a1703114026 | |
parent | 9b7a54d86c197af42c7b9a0a7925b42a637acd3c (diff) |
Check for true_false_string with identical true/false string.
Fixed a few instances where fix were obvious, others are
less clear.
The check in proto.c is protected by ENABLE_CHECK_FILTER.
Change-Id: I4edee4e67bd53bbf2eb809d68c87983a7c5a66f3
Reviewed-on: https://code.wireshark.org/review/36645
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
-rw-r--r-- | epan/dissectors/asn1/ansi_map/packet-ansi_map-template.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-ansi_map.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-aoe.c | 7 | ||||
-rw-r--r-- | epan/dissectors/packet-per.c | 12 | ||||
-rw-r--r-- | epan/dissectors/packet-smb.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-tn5250.c | 3 | ||||
-rw-r--r-- | epan/proto.c | 14 |
7 files changed, 23 insertions, 19 deletions
diff --git a/epan/dissectors/asn1/ansi_map/packet-ansi_map-template.c b/epan/dissectors/asn1/ansi_map/packet-ansi_map-template.c index 792cbc88a0..c25fd0f65d 100644 --- a/epan/dissectors/asn1/ansi_map/packet-ansi_map-template.c +++ b/epan/dissectors/asn1/ansi_map/packet-ansi_map-template.c @@ -1271,7 +1271,7 @@ static const true_false_string ansi_map_CDMACallMode_cls4_bool_val = { }; /* Call Mode (octet 1, bit H) */ static const true_false_string ansi_map_CDMACallMode_cls5_bool_val = { - "450 MHz channel (Band Class 5) not acceptable", + "450 MHz channel (Band Class 5) acceptable", "450 MHz channel (Band Class 5) not acceptable" }; /* Call Mode (octet 2, bit A) */ diff --git a/epan/dissectors/packet-ansi_map.c b/epan/dissectors/packet-ansi_map.c index f5a444171b..a82e801b23 100644 --- a/epan/dissectors/packet-ansi_map.c +++ b/epan/dissectors/packet-ansi_map.c @@ -2059,7 +2059,7 @@ static const true_false_string ansi_map_CDMACallMode_cls4_bool_val = { }; /* Call Mode (octet 1, bit H) */ static const true_false_string ansi_map_CDMACallMode_cls5_bool_val = { - "450 MHz channel (Band Class 5) not acceptable", + "450 MHz channel (Band Class 5) acceptable", "450 MHz channel (Band Class 5) not acceptable" }; /* Call Mode (octet 2, bit A) */ diff --git a/epan/dissectors/packet-aoe.c b/epan/dissectors/packet-aoe.c index c95809f0f6..4103dca878 100644 --- a/epan/dissectors/packet-aoe.c +++ b/epan/dissectors/packet-aoe.c @@ -58,10 +58,7 @@ static const true_false_string tfs_aflags_e = { "LBA48 extended command", "Normal command" }; -static const true_false_string tfs_aflags_d = { - "?", - "?" -}; + static const true_false_string tfs_aflags_a = { "ASYNCHRONOUS Write", "synchronous write" @@ -424,7 +421,7 @@ proto_register_aoe(void) { &hf_aoe_aflags_e, { "E", "aoe.aflags.e", FT_BOOLEAN, 8, TFS(&tfs_aflags_e), AOE_AFLAGS_E, "Whether this is a normal or LBA48 command", HFILL}}, { &hf_aoe_aflags_d, - { "D", "aoe.aflags.d", FT_BOOLEAN, 8, TFS(&tfs_aflags_d), AOE_AFLAGS_D, NULL, HFILL}}, + { "D", "aoe.aflags.d", FT_BOOLEAN, 8, NULL, AOE_AFLAGS_D, "Device/head register flag", HFILL}}, { &hf_aoe_aflags_a, { "A", "aoe.aflags.a", FT_BOOLEAN, 8, TFS(&tfs_aflags_a), AOE_AFLAGS_A, "Whether this is an asynchronous write or not", HFILL}}, { &hf_aoe_aflags_w, diff --git a/epan/dissectors/packet-per.c b/epan/dissectors/packet-per.c index 2d2ef35586..b14db61abd 100644 --- a/epan/dissectors/packet-per.c +++ b/epan/dissectors/packet-per.c @@ -100,10 +100,6 @@ static gboolean display_internal_per_fields = FALSE; -static const true_false_string tfs_extension_present_bit = { - "", - "" -}; static const true_false_string tfs_extension_bit = { "Extension bit is set", "Extension bit is clear" @@ -112,10 +108,6 @@ static const true_false_string tfs_small_number_bit = { "The number is small, 0-63", "The number is large, >63" }; -static const true_false_string tfs_optional_field_bit = { - "", - "" -}; #define BYTE_ALIGN_OFFSET(offset) if(offset&0x07){offset=(offset&0xfffffff8)+8;} @@ -2740,13 +2732,13 @@ proto_register_per(void) TFS(&tfs_extension_bit), 0x01, "The extension bit of an aggregate", HFILL }}, { &hf_per_extension_present_bit, { "Extension Present Bit", "per.extension_present_bit", FT_BOOLEAN, 8, - TFS(&tfs_extension_present_bit), 0x01, "Whether this optional extension is present or not", HFILL }}, + NULL, 0x01, "Whether this optional extension is present or not", HFILL }}, { &hf_per_small_number_bit, { "Small Number Bit", "per.small_number_bit", FT_BOOLEAN, 8, TFS(&tfs_small_number_bit), 0x01, "The small number bit for a section 10.6 integer", HFILL }}, { &hf_per_optional_field_bit, { "Optional Field Bit", "per.optional_field_bit", FT_BOOLEAN, 8, - TFS(&tfs_optional_field_bit), 0x01, "This bit specifies the presence/absence of an optional field", HFILL }}, + NULL, 0x01, "This bit specifies the presence/absence of an optional field", HFILL }}, { &hf_per_sequence_of_length, { "Sequence-Of Length", "per.sequence_of_length", FT_UINT32, BASE_DEC, NULL, 0, "Number of items in the Sequence Of", HFILL }}, diff --git a/epan/dissectors/packet-smb.c b/epan/dissectors/packet-smb.c index acbf46a9fd..c354ec300d 100644 --- a/epan/dissectors/packet-smb.c +++ b/epan/dissectors/packet-smb.c @@ -15857,7 +15857,7 @@ static const true_false_string tfs_smb_mac_getset_comments = { static const true_false_string tfs_smb_mac_desktopdb_calls = { "Macintosh Get & Set Desktop Database Info Supported", - "Macintosh Get & Set Desktop Database Info Supported" + "Macintosh Get & Set Desktop Database Info Not Supported" }; static const true_false_string tfs_smb_mac_unique_ids = { diff --git a/epan/dissectors/packet-tn5250.c b/epan/dissectors/packet-tn5250.c index 83dda5926c..246fdf825f 100644 --- a/epan/dissectors/packet-tn5250.c +++ b/epan/dissectors/packet-tn5250.c @@ -6,6 +6,7 @@ * Release 3.0 Document Number SC30-3533-04 * Chapters 12, 15, 16 * http://publibfp.dhe.ibm.com/cgi-bin/bookmgr/BOOKS/co2e2001/CCONTENTS + * [Found in 2020 in https://archive.org/details/5494RemoteControlUnitFunctionsReferenceSC30353304] * * Copyright 2009, Robert Hogan <robert@roberthogan.net> * @@ -1419,7 +1420,7 @@ static const struct true_false_string tn5250_field_dpo_flag1_6 = { }; static const struct true_false_string tn5250_field_dpo_flag1_7 = { - "Insert mode is toggled by the Insert key", + "Insert mode is reset by Error Reset key", "Insert mode is toggled by the Insert key" }; diff --git a/epan/proto.c b/epan/proto.c index f3675c9a38..92ecf37d42 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -8040,6 +8040,20 @@ tmp_fld_check_assert(header_field_info *hfinfo) } #endif +#if ENABLE_CHECK_FILTER + if (hfinfo->type == FT_BOOLEAN) { + const true_false_string *tfs = (const true_false_string*)hfinfo->strings; + if (tfs) { + if (strcmp(tfs->false_string, tfs->true_string) == 0) { + g_warning("Field '%s' (%s) has identical true and false strings (\"%s\", \"%s\")\n", + hfinfo->name, hfinfo->abbrev, + tfs->false_string, tfs->true_string); + } + } + } +#endif + + switch (hfinfo->type) { |