mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-12-31 21:59:11 +03:00
Added const reported by cppcheck 2.14
This commit is contained in:
committed by
Eduardo Arias
parent
d053ec6de6
commit
bbef22b3b5
@@ -84,10 +84,10 @@ bool RuleRemoveById::init(std::string *error) {
|
||||
}
|
||||
|
||||
bool RuleRemoveById::evaluate(RuleWithActions *rule, Transaction *transaction) {
|
||||
for (auto &i : m_ids) {
|
||||
for (const auto &i : m_ids) {
|
||||
transaction->m_ruleRemoveById.push_back(i);
|
||||
}
|
||||
for (auto &i : m_ranges) {
|
||||
for (const auto &i : m_ranges) {
|
||||
transaction->m_ruleRemoveByIdRange.push_back(i);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ static inline int inplace(std::string &value) {
|
||||
|
||||
const auto len = value.length();
|
||||
auto d = reinterpret_cast<unsigned char *>(value.data());
|
||||
const auto data = d;
|
||||
const auto *data = d;
|
||||
|
||||
for (int i = 0; i <= len - 2; i += 2) {
|
||||
*d++ = utils::string::x2c(&data[i]);
|
||||
|
||||
@@ -118,7 +118,7 @@ static inline bool inplace(std::string &value) {
|
||||
j++;
|
||||
}
|
||||
if (j > k) { /* Do we have at least one digit? */
|
||||
const auto x = reinterpret_cast<const char*>(&input[k]);
|
||||
const auto *x = reinterpret_cast<const char*>(&input[k]);
|
||||
|
||||
/* Decode the entity. */
|
||||
/* ENH What about others? */
|
||||
|
||||
@@ -29,9 +29,6 @@ bool NormalisePath::transform(std::string &value, const Transaction *trans) cons
|
||||
* IMP1 Assumes NUL-terminated
|
||||
*/
|
||||
bool NormalisePath::normalize_path_inplace(std::string &val, const bool win) {
|
||||
unsigned char *src;
|
||||
unsigned char *dst;
|
||||
unsigned char *end;
|
||||
int hitroot = 0;
|
||||
int done = 0;
|
||||
int relative;
|
||||
@@ -49,13 +46,13 @@ bool NormalisePath::normalize_path_inplace(std::string &val, const bool win) {
|
||||
* ENH: Deal with UNC and drive letters?
|
||||
*/
|
||||
|
||||
src = dst = input;
|
||||
end = input + (input_len - 1);
|
||||
auto src = input;
|
||||
auto dst = input;
|
||||
const auto *end = input + (input_len - 1);
|
||||
|
||||
relative = ((*input == '/') || (win && (*input == '\\'))) ? 0 : 1;
|
||||
trailing = ((*end == '/') || (win && (*end == '\\'))) ? 1 : 0;
|
||||
|
||||
|
||||
while (!done && (src <= end) && (dst <= end)) {
|
||||
/* Convert backslash to forward slash on Windows only. */
|
||||
if (win) {
|
||||
@@ -152,7 +149,7 @@ copy:
|
||||
|
||||
/* Skip to the last forward slash when multiple are used. */
|
||||
if (*src == '/') {
|
||||
unsigned char *oldsrc = src;
|
||||
const unsigned char *oldsrc = src;
|
||||
|
||||
while ((src < end)
|
||||
&& ((*(src + 1) == '/') || (win && (*(src + 1) == '\\'))) ) {
|
||||
|
||||
@@ -38,7 +38,7 @@ static inline bool inplace(std::string &value) {
|
||||
|
||||
auto d = reinterpret_cast<unsigned char*>(value.data());
|
||||
const unsigned char *data = d;
|
||||
const auto end = data + value.size();
|
||||
const auto *end = data + value.size();
|
||||
|
||||
bool changed = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user