From: Tom Peters (thopeter) Date: Wed, 19 Dec 2018 19:19:14 +0000 (-0500) Subject: Merge pull request #1472 in SNORT/snort3 from ~MDAGON/snort3:cppcheck_fix to master X-Git-Tag: 3.0.0-251~79 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0f5a6cbc33e51e5ee0af949a87d8f5832940f129;p=thirdparty%2Fsnort3.git Merge pull request #1472 in SNORT/snort3 from ~MDAGON/snort3:cppcheck_fix to master Squashed commit of the following: commit 2833fb3255ead1286dd8d4966d5990ef028c12ce Author: Maya Dagon Date: Tue Dec 18 11:44:10 2018 -0500 dce_rpc: fix style warning non-boolean returned commit a2a70a56988806fa47749fff1258c153f3528f3f Author: Maya Dagon Date: Tue Dec 18 11:19:19 2018 -0500 protocols: fix style warning non-boolean value returned --- diff --git a/src/protocols/packet.h b/src/protocols/packet.h index 10edbfed8..f18357e2c 100644 --- a/src/protocols/packet.h +++ b/src/protocols/packet.h @@ -165,7 +165,7 @@ struct SO_PUBLIC Packet /* Boolean functions - general information about this packet */ inline bool is_eth() const - { return proto_bits & PROTO_BIT__ETH; } + { return ((proto_bits & PROTO_BIT__ETH) != 0); } inline bool has_ip() const { return ptrs.ip_api.is_ip(); } @@ -192,7 +192,7 @@ struct SO_PUBLIC Packet { return (ptrs.get_pkt_type() == PktType::PDU) or (ptrs.get_pkt_type() == PktType::FILE); } inline bool is_cooked() const - { return packet_flags & PKT_PSEUDO; } + { return ((packet_flags & PKT_PSEUDO) != 0); } inline bool is_fragment() const { return ptrs.decode_flags & DECODE_FRAG; } diff --git a/src/protocols/tcp.h b/src/protocols/tcp.h index e46972643..a52435571 100644 --- a/src/protocols/tcp.h +++ b/src/protocols/tcp.h @@ -119,7 +119,7 @@ struct TCPHdr { return (th_flags & flags) == flags; } inline bool is_syn() const - { return (th_flags & TH_SYN); } + { return ((th_flags & TH_SYN) != 0); } inline bool is_syn_only() const { return (th_flags & (TH_SYN | TH_ACK)) == TH_SYN; } @@ -128,16 +128,16 @@ struct TCPHdr { return are_flags_set(TH_SYN | TH_ACK); } inline bool is_ack() const - { return (th_flags & TH_ACK); } + { return ((th_flags & TH_ACK) != 0); } inline bool is_psh() const - { return (th_flags & TH_PUSH); } + { return ((th_flags & TH_PUSH) != 0); } inline bool is_rst() const - { return (th_flags & TH_RST); } + { return ((th_flags & TH_RST) != 0); } inline bool is_fin() const - { return (th_flags & TH_FIN); } + { return ((th_flags & TH_FIN) != 0); } /* raw data access */ inline uint16_t raw_src_port() const diff --git a/src/service_inspectors/dce_rpc/smb_message.h b/src/service_inspectors/dce_rpc/smb_message.h index 474b6847b..b0589e1d9 100644 --- a/src/service_inspectors/dce_rpc/smb_message.h +++ b/src/service_inspectors/dce_rpc/smb_message.h @@ -904,7 +904,7 @@ inline uint64_t SmbNtCreateAndXReqAllocSize(const SmbNtCreateAndXReq* req) inline bool SmbNtCreateAndXReqSequentialOnly(const SmbNtCreateAndXReq* req) { - return (snort::alignedNtohl(&req->smb_create_opts) & SMB_CREATE_OPTIONS__FILE_SEQUENTIAL_ONLY); + return ((snort::alignedNtohl(&req->smb_create_opts) & SMB_CREATE_OPTIONS__FILE_SEQUENTIAL_ONLY) != 0); } inline uint32_t SmbNtCreateAndXReqFileAttrs(const SmbNtCreateAndXReq* req) @@ -1736,7 +1736,7 @@ inline uint32_t SmbNtTransactCreateReqFileAttrs(const SmbNtTransactCreateReqPara inline bool SmbNtTransactCreateReqSequentialOnly(const SmbNtTransactCreateReqParams* req) { - return (snort::alignedNtohl(&req->create_options) & SMB_CREATE_OPTIONS__FILE_SEQUENTIAL_ONLY); + return ((snort::alignedNtohl(&req->create_options) & SMB_CREATE_OPTIONS__FILE_SEQUENTIAL_ONLY) != 0); } struct SmbNtTransactCreateReq