Cosmetics: Fix coding style

This commit is contained in:
Felipe Zimmerle
2016-07-12 21:39:37 -03:00
parent 3615c84ee5
commit 4cf6c714ac
34 changed files with 109 additions and 69 deletions

View File

@@ -142,7 +142,7 @@ void ModSecurityTest<T>::cmd_options(int argc, char **argv) {
m_automake_output = true;
}
if(const char* env_p = std::getenv("AUTOMAKE_TESTS")) {
if (const char* env_p = std::getenv("AUTOMAKE_TESTS")) {
m_automake_output = true;
}

View File

@@ -270,9 +270,11 @@ void perform_unit_test(ModSecurityTest<RegressionTest> *test,
modsec_transaction->processRequestHeaders();
actions(&r, modsec_transaction);
#if 0
if (r.status != 200) {
//goto end;
goto end;
}
#endif
modsec_transaction->appendRequestBody(
(unsigned char *)t->request_body.c_str(),
@@ -291,7 +293,8 @@ void perform_unit_test(ModSecurityTest<RegressionTest> *test,
headers.second.c_str());
}
modsec_transaction->processResponseHeaders(r.status, t->response_protocol);
modsec_transaction->processResponseHeaders(r.status,
t->response_protocol);
actions(&r, modsec_transaction);
#if 0
if (r.status != 200) {

View File

@@ -91,7 +91,6 @@ void perform_unit_test(ModSecurityTest<UnitTest> *test, UnitTest *t,
std::cout << t->name << " "
<< modsecurity::toHexIfNeeded(t->input) << std::endl;
}
}
@@ -150,9 +149,9 @@ int main(int argc, char **argv) {
if (results.size() == 0) {
std::cout << KGRN << "All tests passed" << RESET << std::endl;
} else {
std::cout << KRED << results.size() << " failed." << RESET << std::endl;
std::cout << KRED << results.size() << " failed.";
std::cout << RESET << std::endl;
}
}
for (std::pair<std::string, std::vector<UnitTest *> *> a : test) {

View File

@@ -21,7 +21,6 @@
#include <string>
#include <iostream>
#include <iterator>
#include <string>
#include "common/colors.h"
#include "src/utils.h"
@@ -62,7 +61,8 @@ void json2bin(std::string *str) {
modsecurity::Utils::Regex re2("\\\\u([a-z0-9A-Z]{4})");
modsecurity::Utils::SMatch match;
while (modsecurity::Utils::regex_search(*str, &match, re) && match.size() > 0) {
while (modsecurity::Utils::regex_search(*str, &match, re)
&& match.size() > 0) {
unsigned int p;
std::string toBeReplaced = match.str();
toBeReplaced.erase(0, 2);
@@ -70,7 +70,8 @@ void json2bin(std::string *str) {
replaceAll(str, match.str(), p);
}
while (modsecurity::Utils::regex_search(*str, &match, re2) && match.size() > 0) {
while (modsecurity::Utils::regex_search(*str, &match, re2)
&& match.size() > 0) {
unsigned int p;
std::string toBeReplaced = match.str();
toBeReplaced.erase(0, 2);