mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 03:34:29 +03:00
Minor codebase improvements suggested by Sonarcloud
- src/modsecurity.cc - Replace the redundant type with "auto". - src/transaction.cc - Avoid this unnecessary copy by using a "const" reference. - test/common/custom_debug_log.cc - Use "=default" instead of the default implementation of this special member functions. - Removed the unnecessary destructor override instead. - Annotate this function with "override" or "final". - Removed the unnecessary destructor override instead. - Remove this "const" qualifier from the return type in all declarations. - test/common/modsecurity_test_context.h - Replace the redundant type with "auto". - test/regression/regression.cc - Use the "nullptr" literal. - Replace this declaration by a structured binding declaration. - Replace "reinterpret_cast" with a safer operation.
This commit is contained in:
@@ -199,13 +199,13 @@ void ModSecurity::serverLog(void *data, const RuleMessage &rm) {
|
||||
|
||||
if (m_logProperties & TextLogProperty) {
|
||||
auto d = rm.log();
|
||||
const void *a = static_cast<const void *>(d.c_str());
|
||||
auto a = static_cast<const void *>(d.c_str());
|
||||
m_logCb(data, a);
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_logProperties & RuleMessageLogProperty) {
|
||||
const void *a = static_cast<const void *>(&rm);
|
||||
auto a = static_cast<const void *>(&rm);
|
||||
m_logCb(data, a);
|
||||
return;
|
||||
}
|
||||
|
@@ -1529,7 +1529,7 @@ std::string Transaction::toOldAuditLogFormat(int parts,
|
||||
}
|
||||
if (parts & audit_log::AuditLog::HAuditLogPart) {
|
||||
audit_log << "--" << trailer << "-" << "H--" << std::endl;
|
||||
for (auto a : m_rulesMessages) {
|
||||
for (const auto &a : m_rulesMessages) {
|
||||
audit_log << a.log(0, m_httpCodeReturned) << std::endl;
|
||||
}
|
||||
audit_log << std::endl;
|
||||
|
Reference in New Issue
Block a user