]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Pull request #4488: side_channel: fix compiler warning in side channel formatting...
authorVitalii Serhiiovych Horbatov -X (vhorbato - SOFTSERVE INC at Cisco) <vhorbato@cisco.com>
Mon, 21 Oct 2024 20:41:36 +0000 (20:41 +0000)
committerOleksii Shumeiko -X (oshumeik - SOFTSERVE INC at Cisco) <oshumeik@cisco.com>
Mon, 21 Oct 2024 20:41:36 +0000 (20:41 +0000)
Merge in SNORT/snort3 from ~VHORBATO/snort3:sc_format_warn_fix to master

Squashed commit of the following:

commit 63b51eb539f5eeebc9c5f5897657a8e60fd829a8
Author: vhorbato <vhorbato@cisco.com>
Date:   Mon Oct 21 12:05:44 2024 +0300

    side_channel: fix compiler warning in side channel formatting test

src/side_channel/side_channel_format.cc

index 3c55f4383f7ecd129b0ea419640c3aa326c74174..2d109d66b55db795867d5a7ced30eee5b9cb940b 100644 (file)
@@ -132,15 +132,21 @@ ConnectorMsg from_text(const char* str_ptr, uint32_t size)
 #ifdef UNIT_TEST
 #include "catch/snort_catch.h"
 
-#define CHECK_CMSG(cmsg, expected_hdr, expected_msg)                                                 \
-    REQUIRE(cmsg.get_data());                                                                       \
-    REQUIRE(cmsg.get_length() == sizeof(expected_hdr) + sizeof(expected_msg));                      \
-    CHECK(memcmp(cmsg.get_data(), &expected_hdr, sizeof(expected_hdr)) == 0);                       \
-    CHECK(memcmp(cmsg.get_data() + sizeof(expected_hdr), expected_msg, sizeof(expected_msg)) == 0); \
-
-#define CHECK_NO_CMSG(cmsg)                                                                          \
-    REQUIRE(cmsg.get_data() == nullptr);                                                            \
-    REQUIRE(cmsg.get_length() == 0);                                                                \
+#define CHECK_CMSG(cmsg, expected_hdr, expected_msg)                                                    \
+    do                                                                                                  \
+    {                                                                                                   \
+        REQUIRE(cmsg.get_data());                                                                       \
+        REQUIRE(cmsg.get_length() == sizeof(expected_hdr) + sizeof(expected_msg));                      \
+        CHECK(memcmp(cmsg.get_data(), &expected_hdr, sizeof(expected_hdr)) == 0);                       \
+        CHECK(memcmp(cmsg.get_data() + sizeof(expected_hdr), expected_msg, sizeof(expected_msg)) == 0); \
+    } while ( false )
+
+#define CHECK_NO_CMSG(cmsg)                                                                             \
+    do                                                                                                  \
+    {                                                                                                   \
+        REQUIRE(cmsg.get_data() == nullptr);                                                            \
+        REQUIRE(cmsg.get_length() == 0);                                                                \
+    } while ( false )
 
 TEST_CASE("hdr_to_text", "[side_channel]")
 {