diff --git a/common/include/factory/pluginFactoryRegistrator.hpp b/common/include/factory/pluginFactoryRegistrator.hpp
index ecf164df..60275529 100644
--- a/common/include/factory/pluginFactoryRegistrator.hpp
+++ b/common/include/factory/pluginFactoryRegistrator.hpp
@@ -40,10 +40,10 @@ struct PluginFactoryRegistrator {
*/
explicit PluginFactoryRegistrator(
const PluginManifest& manifest,
- Generator generator = g_lambdaPluginGenerator)
+ const Generator& generator = g_lambdaPluginGenerator)
{
static_assert(
- std::is_base_of::value,
+ std::is_base_of_v,
"Derived template type must be derived from Base");
bool inserted;
diff --git a/modules/deduplicator/src/main.cpp b/modules/deduplicator/src/main.cpp
index 5f54ae65..984c4afa 100644
--- a/modules/deduplicator/src/main.cpp
+++ b/modules/deduplicator/src/main.cpp
@@ -32,7 +32,7 @@ using namespace Nemea;
* @param biInterface Bidirectional interface for Unirec communication.
* @param deduplicator Deduplicator instance.
*/
-void handleFormatChange(
+static void handleFormatChange(
UnirecBidirectionalInterface& biInterface,
Deduplicator::Deduplicator& deduplicator)
{
@@ -49,7 +49,7 @@ void handleFormatChange(
* @param biInterface Bidirectional interface for Unirec communication.
* @param deduplicator Deduplicator instance to process flows.
*/
-void processNextRecord(
+static void processNextRecord(
UnirecBidirectionalInterface& biInterface,
Deduplicator::Deduplicator& deduplicator)
{
@@ -73,7 +73,7 @@ void processNextRecord(
* @param biInterface Bidirectional interface for Unirec communication.
* @param deduplicator Deduplicator instance to process flows.
*/
-void processUnirecRecords(
+static void processUnirecRecords(
UnirecBidirectionalInterface& biInterface,
Deduplicator::Deduplicator& deduplicator)
{
diff --git a/modules/listDetector/src/ipAddressFieldMatcher.cpp b/modules/listDetector/src/ipAddressFieldMatcher.cpp
index 8cdd1146..eec1393c 100644
--- a/modules/listDetector/src/ipAddressFieldMatcher.cpp
+++ b/modules/listDetector/src/ipAddressFieldMatcher.cpp
@@ -77,13 +77,13 @@ uint16_t IpAddressFieldMatcher::getNotLastNodeNextNode(NodePos pos) const noexce
const auto& [octetIndex, startIndex] = pos;
if (octetIndex == 0) {
- return (uint16_t)m_octets[octetIndex].size();
+ return (uint16_t) m_octets[octetIndex].size();
}
auto index = startIndex + 1U;
for (; index < m_octets[octetIndex - 1UL].size() && m_octets[octetIndex - 1UL][index].isLast;
index++) {}
if (index == m_octets[octetIndex - 1UL].size()) {
- return (uint16_t)m_octets[octetIndex].size();
+ return (uint16_t) m_octets[octetIndex].size();
}
return m_octets[octetIndex - 1UL][index].index.nextNode;
}
diff --git a/modules/listDetector/src/ipAddressPrefix.cpp b/modules/listDetector/src/ipAddressPrefix.cpp
index c08526dd..b461017e 100644
--- a/modules/listDetector/src/ipAddressPrefix.cpp
+++ b/modules/listDetector/src/ipAddressPrefix.cpp
@@ -49,7 +49,7 @@ IpAddressPrefix::IpAddressPrefix(Nemea::IpAddress ipAddress, size_t prefix)
}
if (prefixBits != 0U) {
- m_mask.ip.bytes[prefixBytes] = (uint8_t)(UINT8_MAX << (CHAR_BIT - prefixBits));
+ m_mask.ip.bytes[prefixBytes] = (uint8_t) (UINT8_MAX << (CHAR_BIT - prefixBits));
}
}
diff --git a/modules/listDetector/src/main.cpp b/modules/listDetector/src/main.cpp
index 8954e1cd..2ac53525 100644
--- a/modules/listDetector/src/main.cpp
+++ b/modules/listDetector/src/main.cpp
@@ -28,9 +28,9 @@
using namespace Nemea;
-std::atomic g_stopFlag(false);
+static std::atomic g_stopFlag(false);
-void signalHandler(int signum)
+static void signalHandler(int signum)
{
Nm::loggerGet("signalHandler")->info("Interrupt signal {} received", signum);
g_stopFlag.store(true);
diff --git a/modules/listDetector/src/octetNode.hpp b/modules/listDetector/src/octetNode.hpp
index 8167369d..77ae4bdc 100644
--- a/modules/listDetector/src/octetNode.hpp
+++ b/modules/listDetector/src/octetNode.hpp
@@ -19,10 +19,10 @@ namespace ListDetector {
struct OctetNode {
public:
/**
- * @brief Operator for comparing two OctetNodes.
- * @param other The OctetNode to compare with.
- * @return True if the two OctetNodes have same value and mask, but current node is terminating.
- */
+ * @brief Operator for comparing two OctetNodes.
+ * @param other The OctetNode to compare with.
+ * @return True if the two OctetNodes have same value and mask, but current node is terminating.
+ */
bool operator==(const OctetNode& other) const noexcept
{
return value == other.value && mask == other.mask && !isLast;
diff --git a/modules/sampler/src/main.cpp b/modules/sampler/src/main.cpp
index 7c6bea7f..57a54fbc 100644
--- a/modules/sampler/src/main.cpp
+++ b/modules/sampler/src/main.cpp
@@ -27,9 +27,9 @@
using namespace Nemea;
-std::atomic g_stopFlag(false);
+static std::atomic g_stopFlag(false);
-void signalHandler(int signum)
+static void signalHandler(int signum)
{
Nm::loggerGet("signalHandler")->info("Interrupt signal {} received", signum);
g_stopFlag.store(true);
@@ -43,7 +43,7 @@ void signalHandler(int signum)
*
* @param biInterface Bidirectional interface for Unirec communication.
*/
-void handleFormatChange(UnirecBidirectionalInterface& biInterface)
+static void handleFormatChange(UnirecBidirectionalInterface& biInterface)
{
biInterface.changeTemplate();
}
@@ -58,7 +58,7 @@ void handleFormatChange(UnirecBidirectionalInterface& biInterface)
* @param sampler Sampler class for sampling.
*/
-void processNextRecord(UnirecBidirectionalInterface& biInterface, Sampler::Sampler& sampler)
+static void processNextRecord(UnirecBidirectionalInterface& biInterface, Sampler::Sampler& sampler)
{
std::optional unirecRecord = biInterface.receive();
if (!unirecRecord) {
@@ -80,7 +80,8 @@ void processNextRecord(UnirecBidirectionalInterface& biInterface, Sampler::Sampl
* @param biInterface Bidirectional interface for Unirec communication.
* @param sampler Sampler class for sampling.
*/
-void processUnirecRecords(UnirecBidirectionalInterface& biInterface, Sampler::Sampler& sampler)
+static void
+processUnirecRecords(UnirecBidirectionalInterface& biInterface, Sampler::Sampler& sampler)
{
while (!g_stopFlag.load()) {
try {
@@ -95,7 +96,7 @@ void processUnirecRecords(UnirecBidirectionalInterface& biInterface, Sampler::Sa
}
}
-telemetry::Content getSamplerTelemetry(const Sampler::Sampler& sampler)
+static telemetry::Content getSamplerTelemetry(const Sampler::Sampler& sampler)
{
auto stats = sampler.getStats();
diff --git a/modules/sampler/src/sampler.hpp b/modules/sampler/src/sampler.hpp
index 77cb0a0a..69d68231 100644
--- a/modules/sampler/src/sampler.hpp
+++ b/modules/sampler/src/sampler.hpp
@@ -17,7 +17,7 @@ namespace Sampler {
*/
struct SamplerStats {
uint64_t sampledRecords = 0; ///< Number of sampled records.
- uint64_t totalRecords = 0; ///< Total number of records.
+ uint64_t totalRecords = 0; ///< Total number of records.
};
/**
diff --git a/modules/telemetry/src/main.cpp b/modules/telemetry/src/main.cpp
index d29c8a3c..44abbd56 100644
--- a/modules/telemetry/src/main.cpp
+++ b/modules/telemetry/src/main.cpp
@@ -28,9 +28,9 @@
using namespace Nemea;
-std::atomic g_stopFlag(false);
+static std::atomic g_stopFlag(false);
-void signalHandler(int signum)
+static void signalHandler(int signum)
{
Nm::loggerGet("signalHandler")->info("Interrupt signal {} received", signum);
g_stopFlag.store(true);
@@ -44,7 +44,7 @@ void signalHandler(int signum)
*
* @param biInterface Bidirectional interface for Unirec communication.
*/
-void handleFormatChange(UnirecBidirectionalInterface& biInterface)
+static void handleFormatChange(UnirecBidirectionalInterface& biInterface)
{
biInterface.changeTemplate();
}
@@ -54,7 +54,7 @@ void handleFormatChange(UnirecBidirectionalInterface& biInterface)
*
* @param biInterface Bidirectional interface for Unirec communication.
*/
-void processNextRecord(UnirecBidirectionalInterface& biInterface)
+static void processNextRecord(UnirecBidirectionalInterface& biInterface)
{
std::optional unirecRecord = biInterface.receive();
if (!unirecRecord) {
@@ -72,7 +72,7 @@ void processNextRecord(UnirecBidirectionalInterface& biInterface)
*
* @param biInterface Bidirectional interface for Unirec communication.
*/
-void processUnirecRecords(UnirecBidirectionalInterface& biInterface)
+static void processUnirecRecords(UnirecBidirectionalInterface& biInterface)
{
while (!g_stopFlag.load()) {
try {
@@ -87,7 +87,7 @@ void processUnirecRecords(UnirecBidirectionalInterface& biInterface)
}
}
-std::pair splitPluginParams(const std::string& pluginParams)
+static std::pair splitPluginParams(const std::string& pluginParams)
{
const std::size_t position = pluginParams.find_first_of(':');
if (position == std::string::npos) {
@@ -99,7 +99,7 @@ std::pair splitPluginParams(const std::string& pluginP
std::string(pluginParams, position + 1));
}
-void showOutputPluginUsage()
+static void showOutputPluginUsage()
{
auto& outputPluginFactory = Nm::PluginFactory<
TelemetryStats::OutputPlugin,
diff --git a/modules/telemetry/src/ncurses-wrapper.cpp b/modules/telemetry/src/ncurses-wrapper.cpp
index 3d4f4be8..0c4d9560 100644
--- a/modules/telemetry/src/ncurses-wrapper.cpp
+++ b/modules/telemetry/src/ncurses-wrapper.cpp
@@ -29,7 +29,7 @@ void Ncurces::print(const std::string_view& string)
const std::lock_guard lock(m_mutex);
clear();
- printw("%s\n", string.data());
+ printw("%.*s\n", static_cast(string.size()), string.data());
refresh();
}