From 68161a4b4d30b63d89af41c8f1fec8a6d1e9672a Mon Sep 17 00:00:00 2001 From: Ervin Hegedus Date: Wed, 16 Jul 2025 22:28:28 +0200 Subject: [PATCH] Fix SonarCloud errors --- headers/modsecurity/rules_set_properties.h | 30 +++++++++++----------- src/utils/string.h | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/headers/modsecurity/rules_set_properties.h b/headers/modsecurity/rules_set_properties.h index afc04de8..6f899b9b 100644 --- a/headers/modsecurity/rules_set_properties.h +++ b/headers/modsecurity/rules_set_properties.h @@ -71,9 +71,9 @@ using modsecurity::audit_log::AuditLog; /** @ingroup ModSecurity_CPP_API */ class ConfigInt { public: - ConfigInt() : m_set(false), m_value(0) { } - bool m_set; - int m_value; + bool m_set = false; + int m_value = 0; + ConfigInt() = default; void merge(const ConfigInt *from) { if (m_set == true || from->m_set == false) { @@ -87,9 +87,9 @@ class ConfigInt { class ConfigUnsignedInt { public: - ConfigUnsignedInt() : m_set(false), m_value(0) { } - bool m_set; - unsigned int m_value; + bool m_set = false; + unsigned int m_value = 0; + ConfigUnsignedInt() = default; void merge(const ConfigUnsignedInt *from) { if (m_set == true || from->m_set == false) { @@ -104,9 +104,9 @@ class ConfigUnsignedInt { class ConfigDouble { public: - ConfigDouble() : m_set(false), m_value(0) { } - bool m_set; - double m_value; + bool m_set = false; + double m_value = 0.0; + ConfigDouble() = default; void merge(const ConfigDouble *from) { if (m_set == true || from->m_set == false) { @@ -121,9 +121,9 @@ class ConfigDouble { class ConfigString { public: - ConfigString() : m_set(false), m_value("") { } - bool m_set; - std::string m_value; + bool m_set = false; + std::string m_value = ""; + ConfigString() = default; void merge(const ConfigString *from) { if (m_set == true || from->m_set == false) { @@ -138,10 +138,10 @@ class ConfigString { class ConfigSet { public: - ConfigSet() : m_set(false), m_clear(false) { } - bool m_set; - bool m_clear; + bool m_set = false; + bool m_clear = false; std::set m_value; + ConfigSet() = default; }; diff --git a/src/utils/string.h b/src/utils/string.h index 8e5c57c9..fc47ab1c 100644 --- a/src/utils/string.h +++ b/src/utils/string.h @@ -278,7 +278,7 @@ inline std::string toupper(std::string str) { // cppcheck-suppress passedByValue } inline int parse_unsigned_int(const std::string &a, unsigned int *res) { - char *endptr = NULL; + char *endptr = nullptr; errno = 0; unsigned long val = strtoul(a.c_str(), &endptr, 10);