Skip to content

Commit 227ff53

Browse files
committed
Make getParserError() to const (cppcheck warnings in rules_set code)
1 parent db5e551 commit 227ff53

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

headers/modsecurity/rules_set.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ class RulesSet : public RulesSetProperties {
7575
int merge(RulesSet *rules);
7676

7777
int evaluate(int phase, Transaction *transaction);
78+
std::string getParserError() const;
7879
std::string getParserError();
7980

8081
void debug(int level, const std::string &id, const std::string &uri,

src/rules_set.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,14 @@ int RulesSet::load(const char *plainRules) {
101101
}
102102

103103

104-
std::string RulesSet::getParserError() {
104+
std::string RulesSet::getParserError() const {
105105
return this->m_parserError.str();
106106
}
107107

108+
std::string RulesSet::getParserError() {
109+
return static_cast<const RulesSet&>(*this).getParserError();
110+
}
111+
108112
void RulesSet::cleanMatchedVars(Transaction *trans) {
109113
ms_dbg_a(trans, 9, "Matched vars cleaned.");
110114
// cppcheck-suppress ctunullpointer
@@ -119,7 +123,7 @@ int RulesSet::evaluate(int phase, Transaction *t) {
119123
return 0;
120124
}
121125

122-
Rules *rules = m_rulesSetPhases[phase];
126+
const Rules *rules = m_rulesSetPhases[phase];
123127

124128
ms_dbg_a(t, 9, "This phase consists of " \
125129
+ std::to_string(rules->size()) + " rule(s).");

0 commit comments

Comments
 (0)