]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Code review fixes.
authorEd Borgoyn <eborgoyn@cisco.com>
Thu, 21 Apr 2016 19:05:02 +0000 (15:05 -0400)
committerEd Borgoyn <eborgoyn@cisco.com>
Thu, 21 Apr 2016 19:05:02 +0000 (15:05 -0400)
src/connectors/file_connector/test/file_connector_test.cc
src/flow/ha.cc
src/flow/test/ha_test.cc
src/side_channel/test/side_channel_test.cc

index 20ec905c1d4fd15937fa2b9e84035acf23d0406f..4db9059d163299039c40f28fd2e749cd3142e2c1 100644 (file)
 #include <CppUTest/CommandLineTestRunner.h>
 #include <CppUTest/TestHarness.h>
 
-#include "../file_connector.h"
-#include "../file_connector_module.h"
+#include "connectors/file_connector/file_connector.h"
+#include "connectors/file_connector/file_connector_module.h"
 
-#include "../../../main/snort_debug.h"
+#include "main/snort_debug.h"
 
 void show_stats(PegCount*, const PegInfo*, unsigned, const char*) { }
 
@@ -36,8 +36,7 @@ void show_stats(PegCount*, const PegInfo*, IndexVec&, const char*, FILE*) { }
 const char* get_instance_file(std::string& file, const char* name)
 { UNUSED(file); UNUSED(name); return "filename"; }
 
-void Debug::print(const char* file, int line, uint64_t dbg, const char* fmt, ...)
-{ UNUSED(file);  UNUSED(line); UNUSED(dbg); UNUSED(fmt); }
+void Debug::print(const char*, int, uint64_t, const char*, ...) { }
 
 TEST_GROUP(file_connector_msg_handle)
 {
index 6fec3aef973be033610a50a39ebb8d5ac38283d4..a0f8745592bdf2fdde838a7f29e89b6ad07b191d 100644 (file)
@@ -39,7 +39,7 @@ static const uint8_t key_size_ip6 = sizeof(FlowKey);
 // ip4 key is smaller by 2*(ip6-addr-size - ip4-addr-size) or 2*(16 - 4) = 24
 static const uint8_t key_size_ip4 = sizeof(FlowKey)-24;
 
-static const int ONE_MILLION = 1000000;
+static const suseconds_t USEC_PER_SEC = 1000000;
 
 enum
 {
@@ -144,9 +144,9 @@ bool FlowHAState::old_enough()
 void FlowHAState::set_next_update()
 {
     next_update.tv_usec += min_session_lifetime.tv_usec;
-    if (next_update.tv_usec > ONE_MILLION)
+    if (next_update.tv_usec > USEC_PER_SEC)
     {
-        next_update.tv_usec -= ONE_MILLION;
+        next_update.tv_usec -= USEC_PER_SEC;
         next_update.tv_sec++;
     }
     next_update.tv_sec += min_session_lifetime.tv_sec;
index f6f80a72ce765cf972355000733da0791e5cc035..1e15384d254aaea8b112bf34d444127b200fae62 100644 (file)
 #include <CppUTest/CommandLineTestRunner.h>
 #include <CppUTest/TestHarness.h>
 
-#include "../ha.h"
+#include "flow/ha.h"
 
-#include "../flow.h"
-#include "../../main/snort_debug.h"
+#include "flow/flow.h"
+#include "main/snort_debug.h"
 
 #define MSG_SIZE 100
 
@@ -36,8 +36,11 @@ public:
     ~StreamHAClient() { }
     void consume(Flow*, HAMessage*) { }
     void produce(Flow*, HAMessage* msg)
-    { for ( uint8_t i=0; i<10; i++,*(msg->cursor)++=i); }
-    size_t get_message_size() { return sizeof(10); }
+    {
+        for ( uint8_t i=0; i<10; i++ )
+            *(msg->cursor)++ = i;
+    }
+    size_t get_message_size() { return 10; }
 
 private:
 };
@@ -49,11 +52,9 @@ static SCMessage s_sc_message;
 static Flow s_flow;
 static DAQ_PktHdr_t s_pkthdr;
 
-void LogMessage(const char* format,...)
-{ UNUSED(format); }
+void LogMessage(const char*,...) { }
 
-void Debug::print(const char* file, int line, uint64_t dbg, const char* fmt, ...)
-{ UNUSED(file);  UNUSED(line); UNUSED(dbg); UNUSED(fmt); }
+void Debug::print(const char*, int, uint64_t, const char*, ...) { }
 
 void packet_gettimeofday(struct timeval* tv)
 { *tv = s_time; }
index 6ee10f90a4e11e64d3722ad99f510b920ec4487d..69d4d03e6408873c5a3f2fb85dcbfa8cf459a517 100644 (file)
 #include <CppUTest/CommandLineTestRunner.h>
 #include <CppUTest/TestHarness.h>
 
-#include "../side_channel.h"
+#include "side_channel/side_channel.h"
+#include "side_channel/side_channel_module.h"
 
-#include "../../log/messages.h"
-#include "../main/snort_debug.h"
-#include "../managers/connector_manager.h"
-#include "../side_channel_module.h"
+#include "log/messages.h"
+#include "main/snort_debug.h"
+#include "managers/connector_manager.h"
 
 class TestConnector : public Connector
 {
@@ -50,11 +50,9 @@ void show_stats(PegCount*, const PegInfo*, unsigned, const char*) { }
 
 void show_stats(PegCount*, const PegInfo*, IndexVec&, const char*) { }
 
-void ParseWarning(WarningGroup wg, const char* format, ...)
-{ UNUSED(wg); UNUSED(format); }
+void ParseWarning(WarningGroup, const char*, ...) { }
 
-void Debug::print(const char* file, int line, uint64_t dbg, const char* fmt, ...)
-{ UNUSED(file);  UNUSED(line); UNUSED(dbg); UNUSED(fmt); }
+void Debug::print(const char*, int, uint64_t, const char*, ...) { }
 
 TEST_GROUP(side_channel)
 {