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 */
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<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) {
char *endptr = NULL;
char *endptr = nullptr;
errno = 0;
unsigned long val = strtoul(a.c_str(), &endptr, 10);