mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-11-16 09:31:53 +03:00
Cosmetics: fix some cppcheck complains to please QA
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include "modsecurity/rule.h"
|
||||
#include "modsecurity/rule_message.h"
|
||||
|
||||
#ifdef MSC_DOCUMENTATION
|
||||
/**
|
||||
* Description: Assigns a tag (category) to a rule or a chain.
|
||||
*
|
||||
@@ -44,7 +45,7 @@
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
namespace modsecurity {
|
||||
namespace actions {
|
||||
|
||||
@@ -41,11 +41,12 @@ std::string RemoveWhitespace::evaluate(const std::string &val,
|
||||
std::string value(val);
|
||||
|
||||
int64_t i = 0;
|
||||
char nonBreakingSpaces = 0xa0;
|
||||
|
||||
// loop through all the chars
|
||||
while (i < value.size()) {
|
||||
// remove whitespaces and non breaking spaces (NBSP)
|
||||
if (isspace(value[i]) || (value[i] == NBSP)) {
|
||||
if (isspace(value[i]) || (value[i] == nonBreakingSpaces)) {
|
||||
value.erase(i, 1);
|
||||
} else {
|
||||
/* if the space is not a whitespace char, increment counter
|
||||
|
||||
@@ -32,15 +32,25 @@ namespace transformations {
|
||||
|
||||
|
||||
std::string *Trim::ltrim(std::string *s) {
|
||||
s->erase(s->begin(), std::find_if(s->begin(), s->end(),
|
||||
std::not1(std::ptr_fun<int, int>(std::isspace))));
|
||||
s->erase(
|
||||
s->begin(),
|
||||
std::find_if(s->begin(), s->end(), [](unsigned char c) {
|
||||
return !std::isspace(c);
|
||||
})
|
||||
);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
std::string *Trim::rtrim(std::string *s) {
|
||||
s->erase(std::find_if(s->rbegin(), s->rend(),
|
||||
std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s->end());
|
||||
s->erase(
|
||||
std::find_if(s->rbegin(), s->rend(), [](unsigned char c) {
|
||||
return !std::isspace(c);
|
||||
}).base(),
|
||||
s->end()
|
||||
);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ UrlDecode::UrlDecode(const std::string &action)
|
||||
|
||||
std::string UrlDecode::evaluate(const std::string &value,
|
||||
Transaction *transaction) {
|
||||
unsigned char *val = NULL;
|
||||
unsigned char *val(NULL);
|
||||
int invalid_count = 0;
|
||||
int changed;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user