mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 05:45:59 +03:00
Minor updates to simplify code and remove cppcheck suppressions
This commit is contained in:
parent
fde9d279b0
commit
94b68b2514
@ -46,7 +46,7 @@ std::string ModSecurityTest<T>::header() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
bool ModSecurityTest<T>::load_test_json(std::string file) {
|
bool ModSecurityTest<T>::load_test_json(const std::string &file) {
|
||||||
char errbuf[1024];
|
char errbuf[1024];
|
||||||
yajl_val node;
|
yajl_val node;
|
||||||
|
|
||||||
@ -76,13 +76,12 @@ bool ModSecurityTest<T>::load_test_json(std::string file) {
|
|||||||
u->filename = file;
|
u->filename = file;
|
||||||
|
|
||||||
if (this->count(u->filename + ":" + u->name) == 0) {
|
if (this->count(u->filename + ":" + u->name) == 0) {
|
||||||
std::vector<T *> *vector = new std::vector<T *>;
|
auto vec = new std::vector<T *>;
|
||||||
vector->push_back(u);
|
vec->push_back(u);
|
||||||
std::string filename(u->filename + ":" + u->name);
|
std::string filename(u->filename + ":" + u->name);
|
||||||
std::pair<std::string, std::vector<T*>*> a(filename, vector);
|
this->insert({filename, vec});
|
||||||
this->insert(a);
|
|
||||||
} else {
|
} else {
|
||||||
std::vector<T *> *vec = this->at(u->filename + ":" + u->name);
|
auto vec = this->at(u->filename + ":" + u->name);
|
||||||
vec->push_back(u);
|
vec->push_back(u);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -95,7 +94,7 @@ bool ModSecurityTest<T>::load_test_json(std::string file) {
|
|||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
std::pair<std::string, std::vector<T *>>*
|
std::pair<std::string, std::vector<T *>>*
|
||||||
ModSecurityTest<T>::load_tests(std::string path) {
|
ModSecurityTest<T>::load_tests(const std::string &path) {
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
struct dirent *ent;
|
struct dirent *ent;
|
||||||
struct stat buffer;
|
struct stat buffer;
|
||||||
|
@ -39,8 +39,8 @@ template <class T> class ModSecurityTest :
|
|||||||
std::string header();
|
std::string header();
|
||||||
void cmd_options(int, char **);
|
void cmd_options(int, char **);
|
||||||
std::pair<std::string, std::vector<T *>>* load_tests();
|
std::pair<std::string, std::vector<T *>>* load_tests();
|
||||||
std::pair<std::string, std::vector<T *>>* load_tests(std::string path);
|
std::pair<std::string, std::vector<T *>>* load_tests(const std::string &path);
|
||||||
bool load_test_json(std::string);
|
bool load_test_json(const std::string &file);
|
||||||
|
|
||||||
std::string target;
|
std::string target;
|
||||||
bool verbose = false;
|
bool verbose = false;
|
||||||
|
@ -43,7 +43,6 @@ functionStatic:src/engine/lua.h:70
|
|||||||
functionStatic:src/engine/lua.h:71
|
functionStatic:src/engine/lua.h:71
|
||||||
functionConst:src/utils/geo_lookup.h:49
|
functionConst:src/utils/geo_lookup.h:49
|
||||||
useInitializationList:src/operators/rbl.h:69
|
useInitializationList:src/operators/rbl.h:69
|
||||||
constStatement:test/common/modsecurity_test.cc:82
|
|
||||||
functionStatic:src/operators/geo_lookup.h:35
|
functionStatic:src/operators/geo_lookup.h:35
|
||||||
duplicateBreak:src/operators/validate_utf8_encoding.cc
|
duplicateBreak:src/operators/validate_utf8_encoding.cc
|
||||||
syntaxError:src/transaction.cc:62
|
syntaxError:src/transaction.cc:62
|
||||||
@ -55,8 +54,6 @@ rethrowNoCurrentException:src/rule_with_actions.cc:127
|
|||||||
ctunullpointer:src/rule_with_actions.cc:244
|
ctunullpointer:src/rule_with_actions.cc:244
|
||||||
ctunullpointer:src/rule_with_operator.cc:135
|
ctunullpointer:src/rule_with_operator.cc:135
|
||||||
ctunullpointer:src/rule_with_operator.cc:95
|
ctunullpointer:src/rule_with_operator.cc:95
|
||||||
passedByValue:test/common/modsecurity_test.cc:49
|
|
||||||
passedByValue:test/common/modsecurity_test.cc:98
|
|
||||||
unreadVariable:src/rule_with_operator.cc:219
|
unreadVariable:src/rule_with_operator.cc:219
|
||||||
|
|
||||||
uninitvar:src/operators/verify_cpf.cc:77
|
uninitvar:src/operators/verify_cpf.cc:77
|
||||||
|
Loading…
x
Reference in New Issue
Block a user