Fix SonarCloud errors

This commit is contained in:
Ervin Hegedus 2025-07-16 22:28:28 +02:00
parent 6637569d03
commit 68161a4b4d
No known key found for this signature in database
GPG Key ID: 5FA5BC3F5EC41F61
2 changed files with 16 additions and 16 deletions

View File

@ -71,9 +71,9 @@ using modsecurity::audit_log::AuditLog;
/** @ingroup ModSecurity_CPP_API */ /** @ingroup ModSecurity_CPP_API */
class ConfigInt { class ConfigInt {
public: public:
ConfigInt() : m_set(false), m_value(0) { } bool m_set = false;
bool m_set; int m_value = 0;
int m_value; ConfigInt() = default;
void merge(const ConfigInt *from) { void merge(const ConfigInt *from) {
if (m_set == true || from->m_set == false) { if (m_set == true || from->m_set == false) {
@ -87,9 +87,9 @@ class ConfigInt {
class ConfigUnsignedInt { class ConfigUnsignedInt {
public: public:
ConfigUnsignedInt() : m_set(false), m_value(0) { } bool m_set = false;
bool m_set; unsigned int m_value = 0;
unsigned int m_value; ConfigUnsignedInt() = default;
void merge(const ConfigUnsignedInt *from) { void merge(const ConfigUnsignedInt *from) {
if (m_set == true || from->m_set == false) { if (m_set == true || from->m_set == false) {
@ -104,9 +104,9 @@ class ConfigUnsignedInt {
class ConfigDouble { class ConfigDouble {
public: public:
ConfigDouble() : m_set(false), m_value(0) { } bool m_set = false;
bool m_set; double m_value = 0.0;
double m_value; ConfigDouble() = default;
void merge(const ConfigDouble *from) { void merge(const ConfigDouble *from) {
if (m_set == true || from->m_set == false) { if (m_set == true || from->m_set == false) {
@ -121,9 +121,9 @@ class ConfigDouble {
class ConfigString { class ConfigString {
public: public:
ConfigString() : m_set(false), m_value("") { } bool m_set = false;
bool m_set; std::string m_value = "";
std::string m_value; ConfigString() = default;
void merge(const ConfigString *from) { void merge(const ConfigString *from) {
if (m_set == true || from->m_set == false) { if (m_set == true || from->m_set == false) {
@ -138,10 +138,10 @@ class ConfigString {
class ConfigSet { class ConfigSet {
public: public:
ConfigSet() : m_set(false), m_clear(false) { } bool m_set = false;
bool m_set; bool m_clear = false;
bool m_clear;
std::set<std::string> m_value; std::set<std::string> m_value;
ConfigSet() = default;
}; };

View File

@ -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) { inline int parse_unsigned_int(const std::string &a, unsigned int *res) {
char *endptr = NULL; char *endptr = nullptr;
errno = 0; errno = 0;
unsigned long val = strtoul(a.c_str(), &endptr, 10); unsigned long val = strtoul(a.c_str(), &endptr, 10);