Cosmetics: address cppcheck warnings on src/actions

This commit is contained in:
Felipe Zimmerle
2020-01-22 10:37:24 -03:00
parent a6620604d4
commit 9101a8ab15
96 changed files with 99 additions and 97 deletions

View File

@@ -30,7 +30,7 @@ namespace transformations {
class Base64Decode : public Transformation {
public:
explicit Base64Decode(std::string action) : Transformation(action) { }
explicit Base64Decode(const std::string &action) : Transformation(action) { }
std::string evaluate(std::string exp,
Transaction *transaction) override;

View File

@@ -30,7 +30,7 @@ namespace transformations {
class Base64DecodeExt : public Transformation {
public:
explicit Base64DecodeExt(std::string action) : Transformation(action) { }
explicit Base64DecodeExt(const std::string &action) : Transformation(action) { }
std::string evaluate(std::string exp,
Transaction *transaction) override;

View File

@@ -30,7 +30,7 @@ namespace transformations {
class Base64Encode : public Transformation {
public:
explicit Base64Encode(std::string action) : Transformation(action) { }
explicit Base64Encode(const std::string &action) : Transformation(action) { }
std::string evaluate(std::string exp,
Transaction *transaction) override;

View File

@@ -30,7 +30,7 @@ namespace transformations {
class CmdLine : public Transformation {
public:
explicit CmdLine(std::string action)
explicit CmdLine(const std::string &action)
: Transformation(action) { }
std::string evaluate(std::string exp,

View File

@@ -30,7 +30,7 @@ namespace modsecurity {
namespace actions {
namespace transformations {
CompressWhitespace::CompressWhitespace(std::string action)
CompressWhitespace::CompressWhitespace(const std::string &action)
: Transformation(action) {
this->action_kind = 1;
}

View File

@@ -30,7 +30,7 @@ namespace transformations {
class CompressWhitespace : public Transformation {
public:
explicit CompressWhitespace(std::string action);
explicit CompressWhitespace(const std::string &action) ;
std::string evaluate(std::string exp,
Transaction *transaction) override;
};

View File

@@ -31,7 +31,7 @@ namespace transformations {
class CssDecode : public Transformation {
public:
explicit CssDecode(std::string action)
explicit CssDecode(const std::string &action)
: Transformation(action) { }
std::string evaluate(std::string exp,
Transaction *transaction) override;

View File

@@ -31,7 +31,7 @@ namespace modsecurity {
namespace actions {
namespace transformations {
EscapeSeqDecode::EscapeSeqDecode(std::string action)
EscapeSeqDecode::EscapeSeqDecode(const std::string &action)
: Transformation(action) {
this->action_kind = 1;
}

View File

@@ -30,7 +30,7 @@ namespace transformations {
class EscapeSeqDecode : public Transformation {
public:
explicit EscapeSeqDecode(std::string action);
explicit EscapeSeqDecode(const std::string &action) ;
std::string evaluate(std::string exp,
Transaction *transaction) override;
int ansi_c_sequences_decode_inplace(unsigned char *input, int input_len);

View File

@@ -30,7 +30,7 @@ namespace transformations {
class HexDecode : public Transformation {
public:
explicit HexDecode(std::string action) : Transformation(action) { }
explicit HexDecode(const std::string &action) : Transformation(action) { }
std::string evaluate(std::string exp,
Transaction *transaction) override;

View File

@@ -31,7 +31,7 @@ namespace modsecurity {
namespace actions {
namespace transformations {
HexEncode::HexEncode(std::string action)
HexEncode::HexEncode(const std::string &action)
: Transformation(action) {
this->action_kind = 1;
}

View File

@@ -30,7 +30,7 @@ namespace transformations {
class HexEncode : public Transformation {
public:
explicit HexEncode(std::string action);
explicit HexEncode(const std::string &action) ;
std::string evaluate(std::string exp,
Transaction *transaction) override;
};

View File

@@ -60,7 +60,7 @@ int HtmlEntityDecode::inplace(unsigned char *input, uint64_t input_len) {
unsigned char *d = input;
int i, count;
if ((input == NULL) || (input_len <= 0)) {
if ((input == NULL) || (input_len == 0)) {
return 0;
}

View File

@@ -33,7 +33,7 @@ namespace transformations {
class HtmlEntityDecode : public Transformation {
public:
explicit HtmlEntityDecode(std::string action)
explicit HtmlEntityDecode(const std::string &action)
: Transformation(action) { }
std::string evaluate(std::string exp,

View File

@@ -30,7 +30,7 @@ namespace transformations {
class JsDecode : public Transformation {
public:
explicit JsDecode(std::string action)
explicit JsDecode(const std::string &action)
: Transformation(action) { }
std::string evaluate(std::string exp,

View File

@@ -30,7 +30,7 @@ namespace modsecurity {
namespace actions {
namespace transformations {
Length::Length(std::string action)
Length::Length(const std::string &action)
: Transformation(action) {
this->action_kind = 1;
}

View File

@@ -30,7 +30,7 @@ namespace transformations {
class Length : public Transformation {
public:
explicit Length(std::string action);
explicit Length(const std::string &action) ;
std::string evaluate(std::string exp,
Transaction *transaction) override;
};

View File

@@ -27,7 +27,7 @@ namespace actions {
namespace transformations {
LowerCase::LowerCase(std::string a)
LowerCase::LowerCase(const std::string &a)
: Transformation(a) {
}

View File

@@ -32,7 +32,7 @@ namespace transformations {
class LowerCase : public Transformation {
public:
explicit LowerCase(std::string action);
explicit LowerCase(const std::string &action) ;
std::string evaluate(std::string exp,
Transaction *transaction) override;
};

View File

@@ -30,7 +30,7 @@ namespace transformations {
class Md5 : public Transformation {
public:
explicit Md5(std::string action) : Transformation(action) { }
explicit Md5(const std::string &action) : Transformation(action) { }
std::string evaluate(std::string exp,
Transaction *transaction) override;

View File

@@ -30,7 +30,7 @@ namespace transformations {
class None : public Transformation {
public:
explicit None(std::string action)
explicit None(const std::string &action)
: Transformation(action)
{ m_isNone = true; }

View File

@@ -32,7 +32,7 @@ namespace modsecurity {
namespace actions {
namespace transformations {
NormalisePath::NormalisePath(std::string action)
NormalisePath::NormalisePath(const std::string &action)
: Transformation(action) {
this->action_kind = 1;
}

View File

@@ -30,7 +30,7 @@ namespace transformations {
class NormalisePath : public Transformation {
public:
explicit NormalisePath(std::string action);
explicit NormalisePath(const std::string &action) ;
std::string evaluate(std::string exp,
Transaction *transaction) override;

View File

@@ -30,7 +30,7 @@ namespace transformations {
class NormalisePathWin : public Transformation {
public:
explicit NormalisePathWin(std::string action)
explicit NormalisePathWin(const std::string &action)
: Transformation(action) { }
std::string evaluate(std::string exp,

View File

@@ -30,7 +30,7 @@ namespace transformations {
class ParityEven7bit : public Transformation {
public:
explicit ParityEven7bit(std::string action) : Transformation(action) { }
explicit ParityEven7bit(const std::string &action) : Transformation(action) { }
std::string evaluate(std::string exp, Transaction *transaction) override;
static bool inplace(unsigned char *input, uint64_t input_len);

View File

@@ -30,7 +30,7 @@ namespace transformations {
class ParityOdd7bit : public Transformation {
public:
explicit ParityOdd7bit(std::string action) : Transformation(action) { }
explicit ParityOdd7bit(const std::string &action) : Transformation(action) { }
std::string evaluate(std::string exp, Transaction *transaction) override;
static bool inplace(unsigned char *input, uint64_t input_len);

View File

@@ -30,7 +30,7 @@ namespace transformations {
class ParityZero7bit : public Transformation {
public:
explicit ParityZero7bit(std::string action) : Transformation(action) { }
explicit ParityZero7bit(const std::string &action) : Transformation(action) { }
std::string evaluate(std::string exp, Transaction *transaction) override;
static bool inplace(unsigned char *input, uint64_t input_len);

View File

@@ -31,7 +31,7 @@ namespace transformations {
class RemoveComments : public Transformation {
public:
explicit RemoveComments(std::string action) : Transformation(action) { }
explicit RemoveComments(const std::string &action) : Transformation(action) { }
std::string evaluate(std::string exp,
Transaction *transaction) override;

View File

@@ -30,7 +30,7 @@ namespace modsecurity {
namespace actions {
namespace transformations {
RemoveCommentsChar::RemoveCommentsChar(std::string action)
RemoveCommentsChar::RemoveCommentsChar(const std::string &action)
: Transformation(action) {
this->action_kind = 1;
}

View File

@@ -30,7 +30,7 @@ namespace transformations {
class RemoveCommentsChar : public Transformation {
public:
explicit RemoveCommentsChar(std::string action);
explicit RemoveCommentsChar(const std::string &action) ;
std::string evaluate(std::string exp,
Transaction *transaction) override;
};

View File

@@ -30,7 +30,7 @@ namespace transformations {
class RemoveNulls : public Transformation {
public:
explicit RemoveNulls(std::string action)
explicit RemoveNulls(const std::string &action)
: Transformation(action) { }
std::string evaluate(std::string exp,

View File

@@ -31,7 +31,7 @@ namespace modsecurity {
namespace actions {
namespace transformations {
RemoveWhitespace::RemoveWhitespace(std::string action)
RemoveWhitespace::RemoveWhitespace(const std::string &action)
: Transformation(action) {
this->action_kind = 1;
}

View File

@@ -30,7 +30,7 @@ namespace transformations {
class RemoveWhitespace : public Transformation {
public:
explicit RemoveWhitespace(std::string action);
explicit RemoveWhitespace(const std::string &action) ;
std::string evaluate(std::string exp,
Transaction *transaction) override;
};

View File

@@ -31,7 +31,7 @@ namespace modsecurity {
namespace actions {
namespace transformations {
ReplaceComments::ReplaceComments(std::string action)
ReplaceComments::ReplaceComments(const std::string &action)
: Transformation(action) {
this->action_kind = 1;
}

View File

@@ -30,7 +30,7 @@ namespace transformations {
class ReplaceComments : public Transformation {
public:
explicit ReplaceComments(std::string action);
explicit ReplaceComments(const std::string &action) ;
std::string evaluate(std::string exp,
Transaction *transaction) override;
};

View File

@@ -30,7 +30,7 @@ namespace modsecurity {
namespace actions {
namespace transformations {
ReplaceNulls::ReplaceNulls(std::string action)
ReplaceNulls::ReplaceNulls(const std::string &action)
: Transformation(action) {
this->action_kind = 1;
}

View File

@@ -30,7 +30,7 @@ namespace transformations {
class ReplaceNulls : public Transformation {
public:
explicit ReplaceNulls(std::string action);
explicit ReplaceNulls(const std::string &action) ;
std::string evaluate(std::string exp,
Transaction *transaction) override;
};

View File

@@ -31,7 +31,7 @@ namespace modsecurity {
namespace actions {
namespace transformations {
Sha1::Sha1(std::string action)
Sha1::Sha1(const std::string &action)
: Transformation(action) {
this->action_kind = 1;
}

View File

@@ -30,7 +30,7 @@ namespace transformations {
class Sha1 : public Transformation {
public:
explicit Sha1(std::string action);
explicit Sha1(const std::string &action) ;
std::string evaluate(std::string exp,
Transaction *transaction) override;
};

View File

@@ -30,7 +30,7 @@ namespace transformations {
class SqlHexDecode : public Transformation {
public:
explicit SqlHexDecode(std::string action) : Transformation(action) { }
explicit SqlHexDecode(const std::string &action) : Transformation(action) { }
std::string evaluate(std::string exp,
Transaction *transaction) override;

View File

@@ -50,7 +50,7 @@ std::string *Trim::trim(std::string *s) {
}
Trim::Trim(std::string action)
Trim::Trim(const std::string &action)
: Transformation(action) {
this->action_kind = 1;
}

View File

@@ -30,7 +30,7 @@ namespace transformations {
class Trim : public Transformation {
public:
explicit Trim(std::string action);
explicit Trim(const std::string &action) ;
std::string evaluate(std::string exp,
Transaction *transaction) override;

View File

@@ -33,7 +33,7 @@ namespace transformations {
TrimLeft::TrimLeft(std::string action)
TrimLeft::TrimLeft(const std::string &action)
: Trim(action) {
this->action_kind = 1;
}

View File

@@ -31,7 +31,7 @@ namespace transformations {
class TrimLeft : public Trim {
public:
explicit TrimLeft(std::string action);
explicit TrimLeft(const std::string &action) ;
std::string evaluate(std::string exp,
Transaction *transaction) override;
};

View File

@@ -31,7 +31,7 @@ namespace actions {
namespace transformations {
TrimRight::TrimRight(std::string action)
TrimRight::TrimRight(const std::string &action)
: Trim(action) {
this->action_kind = 1;
}

View File

@@ -31,7 +31,7 @@ namespace transformations {
class TrimRight : public Trim {
public:
explicit TrimRight(std::string action);
explicit TrimRight(const std::string &action) ;
std::string evaluate(std::string exp,
Transaction *transaction) override;
};

View File

@@ -27,7 +27,7 @@ namespace actions {
namespace transformations {
UpperCase::UpperCase(std::string a)
UpperCase::UpperCase(const std::string &a)
: Transformation(a) {
}

View File

@@ -32,7 +32,7 @@ namespace transformations {
class UpperCase : public Transformation {
public:
explicit UpperCase(std::string action);
explicit UpperCase(const std::string &action) ;
std::string evaluate(std::string exp,
Transaction *transaction) override;
};

View File

@@ -32,7 +32,7 @@ namespace actions {
namespace transformations {
UrlDecode::UrlDecode(std::string action)
UrlDecode::UrlDecode(const std::string &action)
: Transformation(action) {
this->action_kind = 1;
}

View File

@@ -32,7 +32,7 @@ namespace transformations {
class UrlDecode : public Transformation {
public:
explicit UrlDecode(std::string action);
explicit UrlDecode(const std::string &action) ;
std::string evaluate(std::string exp,
Transaction *transaction) override;
};

View File

@@ -31,7 +31,7 @@ namespace transformations {
class UrlDecodeUni : public Transformation {
public:
explicit UrlDecodeUni(std::string action) : Transformation(action) { }
explicit UrlDecodeUni(const std::string &action) : Transformation(action) { }
std::string evaluate(std::string exp, Transaction *transaction) override;
static int inplace(unsigned char *input, uint64_t input_len,

View File

@@ -31,7 +31,7 @@ namespace actions {
namespace transformations {
UrlEncode::UrlEncode(std::string action)
UrlEncode::UrlEncode(const std::string &action)
: Transformation(action) {
this->action_kind = 1;
}

View File

@@ -30,7 +30,7 @@ namespace transformations {
class UrlEncode : public Transformation {
public:
explicit UrlEncode(std::string action);
explicit UrlEncode(const std::string &action) ;
std::string evaluate(std::string exp,
Transaction *transaction) override;

View File

@@ -35,7 +35,7 @@ namespace transformations {
class Utf8ToUnicode : public Transformation {
public:
explicit Utf8ToUnicode(std::string action) : Transformation(action) { }
explicit Utf8ToUnicode(const std::string &action) : Transformation(action) { }
std::string evaluate(std::string exp,
Transaction *transaction) override;