]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #1472 in SNORT/snort3 from ~MDAGON/snort3:cppcheck_fix to master
authorTom Peters (thopeter) <thopeter@cisco.com>
Wed, 19 Dec 2018 19:19:14 +0000 (14:19 -0500)
committerTom Peters (thopeter) <thopeter@cisco.com>
Wed, 19 Dec 2018 19:19:14 +0000 (14:19 -0500)
Squashed commit of the following:

commit 2833fb3255ead1286dd8d4966d5990ef028c12ce
Author: Maya Dagon <mdagon@cisco.com>
Date:   Tue Dec 18 11:44:10 2018 -0500

    dce_rpc: fix style warning non-boolean returned

commit a2a70a56988806fa47749fff1258c153f3528f3f
Author: Maya Dagon <mdagon@cisco.com>
Date:   Tue Dec 18 11:19:19 2018 -0500

    protocols: fix style warning non-boolean value returned

src/protocols/packet.h
src/protocols/tcp.h
src/service_inspectors/dce_rpc/smb_message.h

index 10edbfed840a63bdc80999ead9324b4a1914379e..f18357e2c927aacc7aa134249c6e5000559f9b4e 100644 (file)
@@ -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; }
index e46972643c4761b58f71307047d43546ca59212a..a52435571f4f306b1c4f58d83c71fa9bccec5294 100644 (file)
@@ -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
index 474b6847b9e17333f8547e35fff19da79d2f2b49..b0589e1d9d9330b53939789c37fdd956da53dc48 100644 (file)
@@ -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