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:
Eduardo Arias
2024-09-10 14:47:00 -03:00
parent 4df297b596
commit b7b2d9a40d
6 changed files with 22 additions and 25 deletions

View File

@@ -31,8 +31,8 @@ namespace modsecurity_test {
private:
static void logCb(void *data, const void *msgv) {
const char *msg = reinterpret_cast<const char *>(msgv);
std::stringstream *ss = (std::stringstream *)data;
auto msg = reinterpret_cast<const char *>(msgv);
auto ss = reinterpret_cast<std::stringstream *>(data);
*ss << msg << std::endl;
}
};