From 0af8d7c091d5eca352474a71fd0423b3cebbc5d3 Mon Sep 17 00:00:00 2001 From: Martin Mathieson Date: Sat, 21 Mar 2020 20:45:45 +0000 Subject: Some cppcheck fixes. - UDPCP: fix test for Sync frame detection - Avoid a couple of redundant assignemnts Change-Id: Ib69a3ff4f0e802ddbbbd29eb2a803372c41a7ce4 Reviewed-on: https://code.wireshark.org/review/36526 Petri-Dish: Martin Mathieson Tested-by: Petri Dish Buildbot Reviewed-by: Martin Mathieson --- epan/dissectors/packet-catapult-dct2000.c | 2 +- epan/dissectors/packet-opensafety.c | 2 +- epan/dissectors/packet-rlc-lte.c | 2 +- epan/dissectors/packet-rlc-nr.c | 2 +- epan/dissectors/packet-udpcp.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/epan/dissectors/packet-catapult-dct2000.c b/epan/dissectors/packet-catapult-dct2000.c index 83bbbcc418..843f700c91 100644 --- a/epan/dissectors/packet-catapult-dct2000.c +++ b/epan/dissectors/packet-catapult-dct2000.c @@ -1216,7 +1216,7 @@ static void dissect_pdcp_lte(tvbuff_t *tvb, gint offset, { guint8 opcode; guint8 tag; - struct pdcp_lte_info *p_pdcp_lte_info = NULL; + struct pdcp_lte_info *p_pdcp_lte_info; tvbuff_t *pdcp_lte_tvb; guint16 ueid; guint8 channelId; diff --git a/epan/dissectors/packet-opensafety.c b/epan/dissectors/packet-opensafety.c index 76f61c143d..ae1f86d934 100644 --- a/epan/dissectors/packet-opensafety.c +++ b/epan/dissectors/packet-opensafety.c @@ -2482,7 +2482,7 @@ dissect_opensafety_udpdata(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree /* check for openSAFETY frame at beginning of data */ frameFound = findSafetyFrame(message_tvb, 0, global_udp_frame2_first, &frameOffset, &frameLength, NULL ); - if ( ! frameFound || ( frameFound && frameOffset >= 11 ) ) + if ( ! frameFound || ( frameOffset >= 11 ) ) { dissector_handle_t udp_transport = find_dissector ( "opensafety_udp_transport" ); if ( udp_transport != NULL ) diff --git a/epan/dissectors/packet-rlc-lte.c b/epan/dissectors/packet-rlc-lte.c index 1556ef129a..ea1d255921 100644 --- a/epan/dissectors/packet-rlc-lte.c +++ b/epan/dissectors/packet-rlc-lte.c @@ -2915,7 +2915,7 @@ static void dissect_rlc_lte_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree proto_item *ti; proto_item *mode_ti; gint offset = 0; - struct rlc_lte_info *p_rlc_lte_info = NULL; + struct rlc_lte_info *p_rlc_lte_info; /* Allocate and Zero tap struct */ rlc_lte_tap_info *tap_info = wmem_new0(wmem_packet_scope(), rlc_lte_tap_info); diff --git a/epan/dissectors/packet-rlc-nr.c b/epan/dissectors/packet-rlc-nr.c index 8bffdbd5f4..14b6965d37 100644 --- a/epan/dissectors/packet-rlc-nr.c +++ b/epan/dissectors/packet-rlc-nr.c @@ -1134,7 +1134,7 @@ static void dissect_rlc_nr_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree proto_item *ti; proto_item *mode_ti; gint offset = 0; - struct rlc_nr_info *p_rlc_nr_info = NULL; + struct rlc_nr_info *p_rlc_nr_info; /* Set protocol name */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "RLC-NR"); diff --git a/epan/dissectors/packet-udpcp.c b/epan/dissectors/packet-udpcp.c index 9bf4679b82..899448b4e7 100755 --- a/epan/dissectors/packet-udpcp.c +++ b/epan/dissectors/packet-udpcp.c @@ -283,7 +283,7 @@ dissect_udpcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U if (msg_type == DATA_FORMAT) { if (!data_length) { /* This could just be a sync frame */ - if (!message_id && !0 && !s) { + if (!message_id && !n && !s) { col_append_str(pinfo->cinfo, COL_INFO, " [Sync]"); } /* Nothing more to show here */ -- cgit v1.2.3