mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-13 21:36:00 +03:00
Merge pull request #3217 from gberkes/v3/sonarcloud_Replace_this_declaration_by_a_structured_binding_declaration
V3/sonarcloud replace this declaration by a structured binding declaration
This commit is contained in:
commit
a519c65902
@ -133,45 +133,33 @@ bool RuleWithOperator::executeOperatorAt(Transaction *trans, const std::string &
|
||||
|
||||
void RuleWithOperator::getVariablesExceptions(Transaction *t,
|
||||
variables::Variables *exclusion, variables::Variables *addition) {
|
||||
for (const auto &a : t->m_rules->m_exceptions.m_variable_update_target_by_tag) { // cppcheck-suppress ctunullpointer
|
||||
if (containsTag(*a.first.get(), t) == false) {
|
||||
continue;
|
||||
}
|
||||
Variable *b = a.second.get();
|
||||
if (dynamic_cast<variables::VariableModificatorExclusion*>(b)) {
|
||||
exclusion->push_back(
|
||||
dynamic_cast<variables::VariableModificatorExclusion*>(
|
||||
b)->m_base.get());
|
||||
} else {
|
||||
addition->push_back(b);
|
||||
for (const auto &[tag, v] : t->m_rules->m_exceptions.m_variable_update_target_by_tag) { // cppcheck-suppress ctunullpointer
|
||||
if (containsTag(*tag.get(), t)) {
|
||||
if (Variable *b{v.get()};dynamic_cast<variables::VariableModificatorExclusion*>(b)) {
|
||||
exclusion->push_back(dynamic_cast<variables::VariableModificatorExclusion*>(b)->m_base.get());
|
||||
} else {
|
||||
addition->push_back(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto &a : t->m_rules->m_exceptions.m_variable_update_target_by_msg) {
|
||||
if (containsMsg(*a.first.get(), t) == false) {
|
||||
continue;
|
||||
}
|
||||
Variable *b = a.second.get();
|
||||
if (dynamic_cast<variables::VariableModificatorExclusion*>(b)) {
|
||||
exclusion->push_back(
|
||||
dynamic_cast<variables::VariableModificatorExclusion*>(
|
||||
b)->m_base.get());
|
||||
} else {
|
||||
addition->push_back(b);
|
||||
for (const auto &[msg, v] : t->m_rules->m_exceptions.m_variable_update_target_by_msg) {
|
||||
if (containsMsg(*msg.get(), t)) {
|
||||
if (Variable *b{v.get()}; dynamic_cast<variables::VariableModificatorExclusion *>(b)) {
|
||||
exclusion->push_back(dynamic_cast<variables::VariableModificatorExclusion *>(b)->m_base.get());
|
||||
} else {
|
||||
addition->push_back(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto &a : t->m_rules->m_exceptions.m_variable_update_target_by_id) {
|
||||
if (m_ruleId != a.first) {
|
||||
continue;
|
||||
}
|
||||
Variable *b = a.second.get();
|
||||
if (dynamic_cast<variables::VariableModificatorExclusion*>(b)) {
|
||||
exclusion->push_back(
|
||||
dynamic_cast<variables::VariableModificatorExclusion*>(
|
||||
b)->m_base.get());
|
||||
} else {
|
||||
addition->push_back(b);
|
||||
for (const auto &[id, v] : t->m_rules->m_exceptions.m_variable_update_target_by_id) { // cppcheck-suppress unassignedVariable
|
||||
if (m_ruleId == id) {
|
||||
if (Variable *b{v.get()};dynamic_cast<variables::VariableModificatorExclusion *>(b)) {
|
||||
exclusion->push_back(dynamic_cast<variables::VariableModificatorExclusion *>(b)->m_base.get());
|
||||
} else {
|
||||
addition->push_back(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user