Added const reported by cppcheck 2.14

This commit is contained in:
Eduardo Arias
2024-04-28 21:23:43 -03:00
committed by Eduardo Arias
parent d053ec6de6
commit bbef22b3b5
46 changed files with 110 additions and 112 deletions

View File

@@ -33,7 +33,7 @@ class GeoLookup : public Operator {
protected:
// cppcheck-suppress functionStatic
bool debug(Transaction *transaction, int x, const std::string &a) {
bool debug(const Transaction *transaction, int x, const std::string &a) {
ms_dbg_a(transaction, x, a);
return true;
}

View File

@@ -136,7 +136,7 @@ class Operator {
std::string m_match_message;
bool m_negation;
std::string m_op;
const std::string m_op;
std::string m_param;
std::unique_ptr<RunTimeString> m_string;
bool m_couldContainsMacro;

View File

@@ -73,8 +73,8 @@ std::string Rbl::mapIpToAddress(const std::string &ipStr, Transaction *trans) co
void Rbl::futherInfo_httpbl(struct sockaddr_in *sin, const std::string &ipStr,
Transaction *trans) {
char *respBl;
const Transaction *trans) {
const char *respBl;
int first, days, score, type;
#ifndef NO_LOGS
std::string ptype;
@@ -131,7 +131,7 @@ void Rbl::futherInfo_httpbl(struct sockaddr_in *sin, const std::string &ipStr,
void Rbl::futherInfo_spamhaus(unsigned int high8bits, const std::string &ipStr,
Transaction *trans) {
const Transaction *trans) {
switch (high8bits) {
case 2:
case 3:
@@ -158,7 +158,7 @@ void Rbl::futherInfo_spamhaus(unsigned int high8bits, const std::string &ipStr,
void Rbl::futherInfo_uribl(unsigned int high8bits, const std::string &ipStr,
Transaction *trans) {
const Transaction *trans) {
switch (high8bits) {
case 2:
ms_dbg_a(trans, 4, "RBL lookup of " + ipStr + " succeeded (BLACK).");
@@ -185,7 +185,7 @@ void Rbl::futherInfo_uribl(unsigned int high8bits, const std::string &ipStr,
void Rbl::furtherInfo(struct sockaddr_in *sin, const std::string &ipStr,
Transaction *trans, RblProvider provider) {
const Transaction *trans, RblProvider provider) {
unsigned int high8bits = sin->sin_addr.s_addr >> 24;
switch (provider) {

View File

@@ -88,13 +88,13 @@ class Rbl : public Operator {
std::string mapIpToAddress(const std::string &ipStr, Transaction *trans) const;
static void futherInfo_httpbl(struct sockaddr_in *sin, const std::string &ipStr,
Transaction *trans);
const Transaction *trans);
static void futherInfo_spamhaus(unsigned int high8bits, const std::string &ipStr,
Transaction *trans);
const Transaction *trans);
static void futherInfo_uribl(unsigned int high8bits, const std::string &ipStr,
Transaction *trans);
const Transaction *trans);
static void furtherInfo(struct sockaddr_in *sin, const std::string &ipStr,
Transaction *trans, RblProvider provider);
const Transaction *trans, RblProvider provider);
private:
std::string m_service;

View File

@@ -62,7 +62,7 @@ class ValidateDTD : public Operator {
static void error_runtime(void *ctx, const char *msg, ...) {
Transaction *t = reinterpret_cast<Transaction *>(ctx);
const Transaction *t = reinterpret_cast<Transaction *>(ctx);
char buf[1024];
std::string s;
va_list args;
@@ -79,7 +79,7 @@ class ValidateDTD : public Operator {
static void warn_runtime(void *ctx, const char *msg, ...) {
Transaction *t = reinterpret_cast<Transaction *>(ctx);
const Transaction *t = reinterpret_cast<Transaction *>(ctx);
char buf[1024];
std::string s;
va_list args;
@@ -95,7 +95,7 @@ class ValidateDTD : public Operator {
}
static void null_error(void *ctx, const char *msg, ...) {
static void null_error(void *ctx, const char *msg, ...) { // cppcheck-suppress[constParameterPointer,constParameterCallback]
}
private:

View File

@@ -75,7 +75,7 @@ class ValidateSchema : public Operator {
static void error_runtime(void *ctx, const char *msg, ...) {
Transaction *t = reinterpret_cast<Transaction *>(ctx);
const Transaction *t = reinterpret_cast<Transaction *>(ctx);
char buf[1024];
std::string s;
va_list args;
@@ -92,7 +92,7 @@ class ValidateSchema : public Operator {
static void warn_runtime(void *ctx, const char *msg, ...) {
Transaction *t = reinterpret_cast<Transaction *>(ctx);
const Transaction *t = reinterpret_cast<Transaction *>(ctx);
char buf[1024];
std::string s;
va_list args;
@@ -107,7 +107,7 @@ class ValidateSchema : public Operator {
ms_dbg_a(t, 4, s);
}
static void null_error(void *ctx, const char *msg, ...) {
static void null_error(void *ctx, const char *msg, ...) { // cppcheck-suppress[constParameterPointer,constParameterCallback]
}
private:

View File

@@ -38,7 +38,7 @@ int VerifyCPF::convert_to_int(const char c) {
}
bool VerifyCPF::verify(const char *cpfnumber, int len) {
bool VerifyCPF::verify(const char *cpfnumber, int len) const {
int factor, part_1, part_2, var_len = len;
unsigned int sum = 0, i = 0, cpf_len = 11, c;
int cpf[11];

View File

@@ -45,7 +45,7 @@ class VerifyCPF : public Operator {
const std::string& input,
RuleMessage &ruleMessage) override;
bool verify(const char *ssnumber, int len);
bool verify(const char *ssnumber, int len) const;
private:
static int convert_to_int(const char c);

View File

@@ -24,7 +24,7 @@ int VerifySVNR::convert_to_int(const char c) {
}
bool VerifySVNR::verify(const char *svnrnumber, int len) {
bool VerifySVNR::verify(const char *svnrnumber, int len) const {
int var_len = len;
int sum = 0;
unsigned int i = 0, svnr_len = 10;

View File

@@ -31,7 +31,7 @@ class VerifySVNR : public Operator {
const std::string& input,
RuleMessage &ruleMessage) override;
bool verify(const char *ssnumber, int len);
bool verify(const char *ssnumber, int len) const;
private:
std::unique_ptr<Regex> m_re;