Skip to content

Commit 4fac8d7

Browse files
committed
Address some constParameter complaints from cppcheck
1 parent e9277e1 commit 4fac8d7

File tree

4 files changed

+5
-7
lines changed

4 files changed

+5
-7
lines changed

src/utils/string.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ void chomp(std::string *str) {
225225
}
226226

227227

228-
unsigned char x2c(unsigned char *what) {
228+
unsigned char x2c(const unsigned char *what) {
229229
unsigned char digit;
230230

231231
digit = (what[0] >= 'A' ? ((what[0] & 0xdf) - 'A') + 10 : (what[0] - '0'));
@@ -239,7 +239,7 @@ unsigned char x2c(unsigned char *what) {
239239
/**
240240
* Converts a single hexadecimal digit into a decimal value.
241241
*/
242-
unsigned char xsingle2c(unsigned char *what) {
242+
unsigned char xsingle2c(const unsigned char *what) {
243243
unsigned char digit;
244244

245245
digit = (what[0] >= 'A' ? ((what[0] & 0xdf) - 'A') + 10 : (what[0] - '0'));

src/utils/string.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ void replaceAll(std::string *str, const std::string& from,
7373
std::string removeWhiteSpacesIfNeeded(std::string a);
7474
std::string parserSanitizer(std::string a);
7575

76-
unsigned char x2c(unsigned char *what);
77-
unsigned char xsingle2c(unsigned char *what);
76+
unsigned char x2c(const unsigned char *what);
77+
unsigned char xsingle2c(const unsigned char *what);
7878
unsigned char *c2x(unsigned what, unsigned char *where);
7979

8080
} // namespace string

src/variables/variable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ class Variables : public std::vector<Variable *> {
608608
public:
609609
bool contains(Variable *v) {
610610
return std::find_if(begin(), end(),
611-
[v](Variable *m) -> bool { return *v == *m; }) != end();
611+
[v](const Variable *m) -> bool { return *v == *m; }) != end();
612612
};
613613
bool contains(const VariableValue *v) {
614614
return std::find_if(begin(), end(),

test/cppcheck_suppressions.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ missingInclude
8080

8181
purgedConfiguration
8282

83-
constParameter
84-
8583
nullPointerRedundantCheck
8684
knownConditionTrueFalse
8785
cstyleCast

0 commit comments

Comments
 (0)