Cosmetics: reducing the compilation warnings

This commit is contained in:
Felipe Zimmerle 2016-07-29 18:33:16 -03:00
parent 0e5f72977e
commit 062dd17f14
4 changed files with 10 additions and 11 deletions

View File

@ -122,13 +122,10 @@ bool SetVar::evaluate(Rule *rule, Transaction *transm_parser_payload) {
value = 0; value = 0;
} }
switch (m_operation) { if (m_operation == sumAndSetOperation) {
case sumAndSetOperation: targetValue = std::to_string(value + pre);
targetValue = std::to_string(value + pre); } else if (m_operation == substractAndSetOperation) {
break; targetValue = std::to_string(value - pre);
case substractAndSetOperation:
targetValue = std::to_string(value - pre);
break;
} }
} }

View File

@ -31,7 +31,7 @@ class Status : public Action {
public: public:
explicit Status(std::string action) : Action(action, 2) { } explicit Status(std::string action) : Action(action, 2) { }
bool init(std::string *error); bool init(std::string *error) override;
bool evaluate(Rule *rule, Transaction *transaction) override; bool evaluate(Rule *rule, Transaction *transaction) override;
void fillIntervention(ModSecurityIntervention *i) override; void fillIntervention(ModSecurityIntervention *i) override;

View File

@ -68,11 +68,13 @@ bool RulesExceptions::load(const std::string &a, std::string *error) {
bool RulesExceptions::addNumber(int a) { bool RulesExceptions::addNumber(int a) {
m_numbers.push_back(a); m_numbers.push_back(a);
return true;
} }
bool RulesExceptions::addRange(int a, int b) { bool RulesExceptions::addRange(int a, int b) {
m_ranges.push_back(std::make_pair(a, b)); m_ranges.push_back(std::make_pair(a, b));
return true;
} }

View File

@ -322,13 +322,13 @@ void createDir(std::string dir, int mode) {
double cpu_seconds(void) { double cpu_seconds(void) {
struct timespec t; struct timespec t;
if (!clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &t)) if (!clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &t))
return static_cast<double>(t.tv_sec) return static_cast<double>(t.tv_sec)
+ static_cast<double>(t.tv_nsec / 1000000000.0); + static_cast<double>(t.tv_nsec / 1000000000.0);
else else
return static_cast<double>(clock()) / return static_cast<double>(clock()) /
static_cast<double>(CLOCKS_PER_SEC); static_cast<double>(CLOCKS_PER_SEC);
return 0;
} }
@ -642,7 +642,7 @@ length:
* Converts a single hexadecimal digit into a decimal value. * Converts a single hexadecimal digit into a decimal value.
*/ */
unsigned char xsingle2c(unsigned char *what) { unsigned char xsingle2c(unsigned char *what) {
register unsigned char digit; unsigned char digit;
digit = (what[0] >= 'A' ? ((what[0] & 0xdf) - 'A') + 10 : (what[0] - '0')); digit = (what[0] >= 'A' ? ((what[0] & 0xdf) - 'A') + 10 : (what[0] - '0'));
@ -651,7 +651,7 @@ unsigned char xsingle2c(unsigned char *what) {
unsigned char x2c(unsigned char *what) { unsigned char x2c(unsigned char *what) {
register unsigned char digit; unsigned char digit;
digit = (what[0] >= 'A' ? ((what[0] & 0xdf) - 'A') + 10 : (what[0] - '0')); digit = (what[0] >= 'A' ? ((what[0] & 0xdf) - 'A') + 10 : (what[0] - '0'));
digit *= 16; digit *= 16;