mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-11-18 02:10:36 +03:00
Added const reported by cppcheck 2.14
This commit is contained in:
committed by
Eduardo Arias
parent
d053ec6de6
commit
bbef22b3b5
@@ -54,7 +54,7 @@ void Env::evaluate(Transaction *transaction,
|
||||
}
|
||||
|
||||
const auto hasName = m_name.length() > 0;
|
||||
for (auto& x : transaction->m_variableEnvs) {
|
||||
for (const auto& x : transaction->m_variableEnvs) {
|
||||
#ifndef WIN32
|
||||
if (hasName && x.first != m_name) {
|
||||
#else
|
||||
|
||||
@@ -48,23 +48,23 @@ Variable::Variable(const std::string &name)
|
||||
}
|
||||
|
||||
|
||||
Variable::Variable(Variable *var) :
|
||||
Variable::Variable(const Variable *var) :
|
||||
m_name(var->m_name),
|
||||
m_collectionName(var->m_collectionName),
|
||||
m_fullName(var->m_fullName) { }
|
||||
|
||||
|
||||
void Variable::addsKeyExclusion(Variable *v) {
|
||||
void Variable::addsKeyExclusion(const Variable *v) {
|
||||
std::unique_ptr<KeyExclusion> r;
|
||||
VariableModificatorExclusion *ve = \
|
||||
dynamic_cast<VariableModificatorExclusion *>(v);
|
||||
VariableRegex *vr;
|
||||
const auto *ve = \
|
||||
dynamic_cast<const VariableModificatorExclusion *>(v);
|
||||
const VariableRegex *vr;
|
||||
|
||||
if (!ve) {
|
||||
return;
|
||||
}
|
||||
|
||||
vr = dynamic_cast<VariableRegex *>(ve->m_base.get());
|
||||
vr = dynamic_cast<const VariableRegex *>(ve->m_base.get());
|
||||
|
||||
if (vr == NULL) {
|
||||
r.reset(new KeyExclusionString(v->m_name));
|
||||
@@ -76,12 +76,12 @@ void Variable::addsKeyExclusion(Variable *v) {
|
||||
}
|
||||
|
||||
|
||||
std::string operator+(const std::string &a, Variable *v) {
|
||||
std::string operator+(const std::string &a, const Variable *v) {
|
||||
return a + *v->m_fullName.get();
|
||||
}
|
||||
|
||||
|
||||
std::string operator+(const std::string &a, Variables *v) {
|
||||
std::string operator+(const std::string &a, const Variables *v) {
|
||||
std::string test;
|
||||
for (const auto &b : *v) {
|
||||
if (test.empty()) {
|
||||
|
||||
@@ -132,7 +132,7 @@ class KeyExclusionRegex : public KeyExclusion {
|
||||
|
||||
class KeyExclusionString : public KeyExclusion {
|
||||
public:
|
||||
explicit KeyExclusionString(std::string &a)
|
||||
explicit KeyExclusionString(const std::string &a)
|
||||
: m_key(utils::string::toupper(a)) { }
|
||||
|
||||
~KeyExclusionString() override { }
|
||||
@@ -589,7 +589,7 @@ class VariableMonkeyResolution {
|
||||
class Variable : public VariableMonkeyResolution {
|
||||
public:
|
||||
explicit Variable(const std::string &name);
|
||||
explicit Variable(Variable *_name);
|
||||
explicit Variable(const Variable *_name);
|
||||
virtual ~Variable() { }
|
||||
|
||||
|
||||
@@ -608,7 +608,7 @@ class Variable : public VariableMonkeyResolution {
|
||||
}
|
||||
|
||||
|
||||
void addsKeyExclusion(Variable *v);
|
||||
void addsKeyExclusion(const Variable *v);
|
||||
|
||||
|
||||
bool operator==(const Variable& b) const {
|
||||
@@ -718,8 +718,8 @@ class VariableModificatorCount : public Variable {
|
||||
};
|
||||
|
||||
|
||||
std::string operator+(const std::string &a, modsecurity::variables::Variable *v);
|
||||
std::string operator+(const std::string &a, modsecurity::variables::Variables *v);
|
||||
std::string operator+(const std::string &a, const modsecurity::variables::Variable *v);
|
||||
std::string operator+(const std::string &a, const modsecurity::variables::Variables *v);
|
||||
|
||||
|
||||
} // namespace variables
|
||||
|
||||
Reference in New Issue
Block a user