diff options
author | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2015-12-06 19:59:44 +0100 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2015-12-07 01:21:49 +0000 |
commit | b259d763a20ca04d000b8f763b1002dcf820fd51 (patch) | |
tree | c0a006458b1de475422728f9e61735e4c9af5328 /epan/dissectors/packet-v5ua.c | |
parent | 0d2fce11894f9e91959341ad9ee38bf9da296547 (diff) |
v5ua: The 'then' statement is equivalent to the 'else' statement found by PVS Studio (V523)
Change-Id: I0aa35944dbae45477a9db365f30cf24355f5328d
Reviewed-on: https://code.wireshark.org/review/12454
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-v5ua.c')
-rw-r--r-- | epan/dissectors/packet-v5ua.c | 83 |
1 files changed, 25 insertions, 58 deletions
diff --git a/epan/dissectors/packet-v5ua.c b/epan/dissectors/packet-v5ua.c index 2bf110abd4..eaf321b846 100644 --- a/epan/dissectors/packet-v5ua.c +++ b/epan/dissectors/packet-v5ua.c @@ -244,67 +244,34 @@ dissect_dlci_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, prot sapi = tvb_get_ntohs(parameter_tvb, offset-DLCI_TEI_LENGTH-DLCI_SAPI_LENGTH)>>2; tei = tvb_get_ntohs(parameter_tvb, offset-DLCI_TEI_LENGTH)>>1; - /* if SAPI & TEI not set to ZERO, value of EFA must be decode (EFA = 0 -> ISDN protocol)*/ - if(tvb_get_ntohs(parameter_tvb,offset-DLCI_TEI_LENGTH) != 0x01){ - - offset += DLCI_TEI_LENGTH; - efa = tvb_get_ntohs(parameter_tvb, offset); - dlci_efa = tvb_get_ntohs(parameter_tvb, offset); - - if (dlci_efa >= 0 && dlci_efa <= 8175) { col_append_fstr(pinfo->cinfo, COL_INFO, " | ISDN: %u", dlci_efa); } - else if (dlci_efa == 8176) { col_append_str(pinfo->cinfo, COL_INFO, " | PSTN"); } - else if (dlci_efa == 8177) { col_append_str(pinfo->cinfo, COL_INFO, " | Ctrl"); } - else if (dlci_efa == 8178) { col_append_str(pinfo->cinfo, COL_INFO, " | BCC"); } - else if (dlci_efa == 8179) { col_append_str(pinfo->cinfo, COL_INFO, " | ProtProt"); } - else if (dlci_efa == 8180) { col_append_str(pinfo->cinfo, COL_INFO, " | LinkCtrl"); } - - if(efa <= 8175) { - proto_tree_add_uint_format_value(parameter_tree, hf_efa, parameter_tvb, offset, EFA_LENGTH, efa, - "ISDN (%u)", efa); - proto_item_append_text(parameter_item, " (SAPI:%u TEI:%u EFA:ISDN (%u))",sapi,tei,efa); - } - else if (efa > 8175 && efa <= 8180){ - proto_tree_add_uint_format_value(parameter_tree, hf_efa, parameter_tvb, offset, EFA_LENGTH, efa, - "%s (%u)", val_to_str_const(efa, efa_values, "unknown EFA"),tvb_get_ntohs(parameter_tvb, offset)); - proto_item_append_text(parameter_item, " (SAPI:%u TEI:%u EFA:%s (%u))",sapi,tei,val_to_str_const(efa, efa_values, "unknown EFA-value"),efa); - } - else { - proto_tree_add_uint_format_value(parameter_tree, hf_efa, parameter_tvb, offset, EFA_LENGTH, efa, - "RESERVED (%u)", efa); - proto_item_append_text(parameter_item, " (SAPI:%u TEI:%u EFA:RESERVED (%u))",sapi,tei,efa); - } + offset += DLCI_TEI_LENGTH; + efa = tvb_get_ntohs(parameter_tvb, offset); + dlci_efa = tvb_get_ntohs(parameter_tvb, offset); + + if (dlci_efa >= 0 && dlci_efa <= 8175) { col_append_fstr(pinfo->cinfo, COL_INFO, " | ISDN: %u", dlci_efa); } + else if (dlci_efa == 8176) { col_append_str(pinfo->cinfo, COL_INFO, " | PSTN"); } + else if (dlci_efa == 8177) { col_append_str(pinfo->cinfo, COL_INFO, " | Ctrl"); } + else if (dlci_efa == 8178) { col_append_str(pinfo->cinfo, COL_INFO, " | BCC"); } + else if (dlci_efa == 8179) { col_append_str(pinfo->cinfo, COL_INFO, " | ProtProt"); } + else if (dlci_efa == 8180) { col_append_str(pinfo->cinfo, COL_INFO, " | LinkCtrl"); } + + if(efa <= 8175) { + proto_tree_add_uint_format_value(parameter_tree, hf_efa, parameter_tvb, offset, EFA_LENGTH, efa, + "ISDN (%u)", efa); + proto_item_append_text(parameter_item, " (SAPI:%u TEI:%u EFA:ISDN (%u))",sapi,tei,efa); + } + else if (efa > 8175 && efa <= 8180){ + proto_tree_add_uint_format_value(parameter_tree, hf_efa, parameter_tvb, offset, EFA_LENGTH, efa, + "%s (%u)", val_to_str_const(efa, efa_values, "unknown EFA"),tvb_get_ntohs(parameter_tvb, offset)); + proto_item_append_text(parameter_item, " (SAPI:%u TEI:%u EFA:%s (%u))",sapi,tei,val_to_str_const(efa, efa_values, "unknown EFA-value"),efa); + } + else { + proto_tree_add_uint_format_value(parameter_tree, hf_efa, parameter_tvb, offset, EFA_LENGTH, efa, + "RESERVED (%u)", efa); + proto_item_append_text(parameter_item, " (SAPI:%u TEI:%u EFA:RESERVED (%u))",sapi,tei,efa); } - /* if SAPI & TEI set to ZERO, EFA also shall be set to ZERO and didn't comply with value for ISDN protocol */ - else{ - offset += DLCI_TEI_LENGTH; - efa = tvb_get_ntohs(parameter_tvb, offset); - dlci_efa = tvb_get_ntohs(parameter_tvb, offset); - - if (dlci_efa >= 0 && dlci_efa <= 8175) { col_append_fstr(pinfo->cinfo, COL_INFO, " | ISDN: %u", dlci_efa); } - else if (dlci_efa == 8176) { col_append_str(pinfo->cinfo, COL_INFO, " | PSTN"); } - else if (dlci_efa == 8177) { col_append_str(pinfo->cinfo, COL_INFO, " | Ctrl"); } - else if (dlci_efa == 8178) { col_append_str(pinfo->cinfo, COL_INFO, " | BCC"); } - else if (dlci_efa == 8179) { col_append_str(pinfo->cinfo, COL_INFO, " | ProtProt"); } - else if (dlci_efa == 8180) { col_append_str(pinfo->cinfo, COL_INFO, " | LinkCtrl"); } - - if (efa <= 8175) { - proto_tree_add_uint_format_value(parameter_tree, hf_efa, parameter_tvb, offset, EFA_LENGTH, efa, - "ISDN (%u)", efa); - proto_item_append_text(parameter_item, " (SAPI:%u TEI:%u EFA:ISDN (%u))",sapi,tei,efa); - } - else if (efa > 8175 && efa <= 8180){ - proto_tree_add_uint_format_value(parameter_tree, hf_efa, parameter_tvb, offset, EFA_LENGTH, efa, - "%s (%u)", val_to_str_const(efa, efa_values, "unknown EFA"),tvb_get_ntohs(parameter_tvb, offset)); - proto_item_append_text(parameter_item, " (SAPI:%u TEI:%u EFA:%s (%u))",sapi,tei,val_to_str_const(efa, efa_values, "unknown EFA-value"),efa); - } - else { - proto_tree_add_uint_format_value(parameter_tree, hf_efa, parameter_tvb, offset, EFA_LENGTH, efa, - "RESERVED (%u)", efa); - proto_item_append_text(parameter_item, " (SAPI:%u TEI:%u EFA:RESERVED (%u))",sapi,tei,efa); - } - } } /*----------------------DLCI & Envelope Function Address------------------------*/ |