Skip to content

Commit 633ed23

Browse files
committed
Fix Cppcheck warnings about mismatching function argument names
1 parent 35d1479 commit 633ed23

13 files changed

Lines changed: 71 additions & 71 deletions

cli/cppcheckexecutor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ class CppCheckExecutor : public ErrorLogger {
9090
static void reportStatus(std::size_t fileindex, std::size_t filecount, std::size_t sizedone, std::size_t sizetotal);
9191

9292
/**
93-
* @param fp Output file
93+
* @param exception_output Output file
9494
*/
95-
static void setExceptionOutput(FILE* fp);
95+
static void setExceptionOutput(FILE* exception_output);
9696
/**
9797
* @return file name to be used for output from exception handler. Has to be either "stdout" or "stderr".
9898
*/

cli/threadexecutor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class Settings;
4343
*/
4444
class ThreadExecutor : public ErrorLogger {
4545
public:
46-
ThreadExecutor(const std::map<std::string, std::size_t> &files, Settings &settings, ErrorLogger &_errorLogger);
46+
ThreadExecutor(const std::map<std::string, std::size_t> &files, Settings &settings, ErrorLogger &errorLogger);
4747
virtual ~ThreadExecutor();
4848
unsigned int check();
4949

gui/libraryeditargdialog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class LibraryEditArgDialog : public QDialog {
1212
Q_OBJECT
1313

1414
public:
15-
LibraryEditArgDialog(QWidget *parent, const CppcheckLibraryData::Function::Arg &a);
15+
LibraryEditArgDialog(QWidget *parent, const CppcheckLibraryData::Function::Arg &arg);
1616
~LibraryEditArgDialog();
1717

1818
CppcheckLibraryData::Function::Arg getArg() const;

gui/mainwindow.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -332,16 +332,16 @@ protected slots:
332332

333333
/**
334334
* @brief Load XML file to the GUI.
335-
* @param file Filename (inc. path) of XML file to load.
335+
* @param selectedFile Filename (inc. path) of XML file to load.
336336
*/
337-
void LoadResults(const QString file);
337+
void LoadResults(const QString selectedFile);
338338

339339
/**
340340
* @brief Load XML file to the GUI.
341-
* @param file Filename (inc. path) of XML file to load.
342-
* @param checkedDirectory Path to the directory that the results were generated for.
341+
* @param selectedFile Filename (inc. path) of XML file to load.
342+
* @param sourceDirectory Path to the directory that the results were generated for.
343343
*/
344-
void LoadResults(const QString file, const QString checkedDirectory);
344+
void LoadResults(const QString selectedFile, const QString sourceDirectory);
345345

346346
/**
347347
* @brief Load project file to the GUI.

lib/checkassert.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class CPPCHECKLIB CheckAssert : public Check {
4949
void assertWithSideEffects();
5050

5151
protected:
52-
void checkVariableAssignment(const Token* tmp, const Scope *assertionScope);
52+
void checkVariableAssignment(const Token* assignTok, const Scope *assertionScope);
5353
static bool inSameScope(const Token* returnTok, const Token* assignTok);
5454

5555
private:

lib/checkbufferoverrun.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1788,17 +1788,17 @@ CheckBufferOverrun::ArrayInfo::ArrayInfo()
17881788
{
17891789
}
17901790

1791-
CheckBufferOverrun::ArrayInfo::ArrayInfo(const Variable *var, const SymbolDatabase * symDb, const unsigned int forcedeclid)
1791+
CheckBufferOverrun::ArrayInfo::ArrayInfo(const Variable *var, const SymbolDatabase * symbolDatabase, const unsigned int forcedeclid)
17921792
: _varname(var->name()), _declarationId((forcedeclid == 0U) ? var->declarationId() : forcedeclid)
17931793
{
17941794
for (std::size_t i = 0; i < var->dimensions().size(); i++)
17951795
_num.push_back(var->dimension(i));
17961796
if (var->typeEndToken()->str() == "*")
1797-
_element_size = symDb->sizeOfType(var->typeEndToken());
1797+
_element_size = symbolDatabase->sizeOfType(var->typeEndToken());
17981798
else if (var->typeStartToken()->strAt(-1) == "struct")
17991799
_element_size = 100;
18001800
else {
1801-
_element_size = symDb->sizeOfType(var->typeEndToken());
1801+
_element_size = symbolDatabase->sizeOfType(var->typeEndToken());
18021802
}
18031803
}
18041804

lib/checkbufferoverrun.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,20 +180,20 @@ class CPPCHECKLIB CheckBufferOverrun : public Check {
180180

181181
/** Check for buffer overruns (based on ArrayInfo) */
182182
void checkScope(const Token *tok, const ArrayInfo &arrayInfo);
183-
void checkScope(const Token *tok, std::map<unsigned int, ArrayInfo> arrayInfo);
183+
void checkScope(const Token *tok, std::map<unsigned int, ArrayInfo> arrayInfos);
184184
void checkScope_inner(const Token *tok, const ArrayInfo &arrayInfo);
185185

186186
/** Check for buffer overruns */
187187
void checkScope(const Token *tok, const std::vector<const std::string*> &varname, const ArrayInfo &arrayInfo);
188188

189189
/**
190190
* Helper function for checkFunctionCall - check a function parameter
191-
* \param tok token for the function name
191+
* \param ftok token for the function name
192192
* \param paramIndex on what parameter is the array used
193193
* \param arrayInfo the array information
194194
* \param callstack call stack. This is used to prevent recursion and to provide better error messages. Pass a empty list from checkScope etc.
195195
*/
196-
void checkFunctionParameter(const Token &tok, const unsigned int paramIndex, const ArrayInfo &arrayInfo, const std::list<const Token *>& callstack);
196+
void checkFunctionParameter(const Token &ftok, const unsigned int paramIndex, const ArrayInfo &arrayInfo, const std::list<const Token *>& callstack);
197197

198198
/**
199199
* Helper function that checks if the array is used and if so calls the checkFunctionCall

lib/checkio.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,7 +1382,7 @@ void CheckIO::checkFormatString(const Token * const tok,
13821382
// We currently only support string literals, variables, and functions.
13831383
/// @todo add non-string literals, and generic expressions
13841384

1385-
CheckIO::ArgumentInfo::ArgumentInfo(const Token * tok, const Settings *settings, bool _isCPP)
1385+
CheckIO::ArgumentInfo::ArgumentInfo(const Token * arg, const Settings *settings, bool _isCPP)
13861386
: variableInfo(nullptr)
13871387
, typeToken(nullptr)
13881388
, functionInfo(nullptr)
@@ -1392,14 +1392,14 @@ CheckIO::ArgumentInfo::ArgumentInfo(const Token * tok, const Settings *settings,
13921392
, address(false)
13931393
, isCPP(_isCPP)
13941394
{
1395-
if (!tok)
1395+
if (!arg)
13961396
return;
13971397

13981398
// Use AST type info
13991399
// TODO: This is a bailout so that old code is used in simple cases. Remove the old code and always use the AST type.
1400-
if (!Token::Match(tok, "%str% ,|)") && !(Token::Match(tok,"%var%") && tok->variable() && tok->variable()->isArray())) {
1401-
const Token *top = tok;
1402-
while (top->astParent() && top->astParent()->str() != "," && top->astParent() != tok->previous())
1400+
if (!Token::Match(arg, "%str% ,|)") && !(Token::Match(arg,"%var%") && arg->variable() && arg->variable()->isArray())) {
1401+
const Token *top = arg;
1402+
while (top->astParent() && top->astParent()->str() != "," && top->astParent() != arg->previous())
14031403
top = top->astParent();
14041404
const ValueType *valuetype = top->argumentType();
14051405
if (valuetype && valuetype->type >= ValueType::Type::BOOL) {
@@ -1446,30 +1446,30 @@ CheckIO::ArgumentInfo::ArgumentInfo(const Token * tok, const Settings *settings,
14461446
}
14471447

14481448

1449-
if (tok->tokType() == Token::eString) {
1450-
typeToken = tok;
1449+
if (arg->tokType() == Token::eString) {
1450+
typeToken = arg;
14511451
return;
1452-
} else if (tok->str() == "&" || tok->tokType() == Token::eVariable ||
1453-
tok->tokType() == Token::eFunction || Token::Match(tok, "%type% ::") ||
1454-
(Token::Match(tok, "static_cast|reinterpret_cast|const_cast <") &&
1455-
Token::simpleMatch(tok->linkAt(1), "> (") &&
1456-
Token::Match(tok->linkAt(1)->linkAt(1), ") ,|)"))) {
1457-
if (Token::Match(tok, "static_cast|reinterpret_cast|const_cast")) {
1458-
typeToken = tok->tokAt(2);
1452+
} else if (arg->str() == "&" || arg->tokType() == Token::eVariable ||
1453+
arg->tokType() == Token::eFunction || Token::Match(arg, "%type% ::") ||
1454+
(Token::Match(arg, "static_cast|reinterpret_cast|const_cast <") &&
1455+
Token::simpleMatch(arg->linkAt(1), "> (") &&
1456+
Token::Match(arg->linkAt(1)->linkAt(1), ") ,|)"))) {
1457+
if (Token::Match(arg, "static_cast|reinterpret_cast|const_cast")) {
1458+
typeToken = arg->tokAt(2);
14591459
while (typeToken->str() == "const" || typeToken->str() == "extern")
14601460
typeToken = typeToken->next();
14611461
return;
14621462
}
1463-
if (tok->str() == "&") {
1463+
if (arg->str() == "&") {
14641464
address = true;
1465-
tok = tok->next();
1465+
arg = arg->next();
14661466
}
1467-
while (Token::Match(tok, "%type% ::"))
1468-
tok = tok->tokAt(2);
1469-
if (!tok || !(tok->tokType() == Token::eVariable || tok->tokType() == Token::eFunction))
1467+
while (Token::Match(arg, "%type% ::"))
1468+
arg = arg->tokAt(2);
1469+
if (!arg || !(arg->tokType() == Token::eVariable || arg->tokType() == Token::eFunction))
14701470
return;
14711471
const Token *varTok = nullptr;
1472-
const Token *tok1 = tok->next();
1472+
const Token *tok1 = arg->next();
14731473
for (; tok1; tok1 = tok1->next()) {
14741474
if (tok1->str() == "," || tok1->str() == ")") {
14751475
if (tok1->previous()->str() == "]") {

lib/checkstl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ class CPPCHECKLIB CheckStl : public Check {
183183
void uselessCallsEmptyError(const Token *tok);
184184
void uselessCallsRemoveError(const Token *tok, const std::string& function);
185185

186-
void dereferenceInvalidIteratorError(const Token* deref, const std::string &itername);
186+
void dereferenceInvalidIteratorError(const Token* deref, const std::string &iterName);
187187

188188
void readingEmptyStlContainerError(const Token *tok);
189189

lib/checkuninitvar.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ class CPPCHECKLIB CheckUninitVar : public Check {
6161
bool checkIfForWhileHead(const Token *startparentheses, const Variable& var, bool suppressErrors, bool isuninit, Alloc alloc, const std::string &membervar);
6262
bool checkLoopBody(const Token *tok, const Variable& var, const Alloc alloc, const std::string &membervar, const bool suppressErrors);
6363
void checkRhs(const Token *tok, const Variable &var, Alloc alloc, unsigned int number_of_if, const std::string &membervar);
64-
bool isVariableUsage(const Token *vartok, bool ispointer, Alloc alloc) const;
65-
int isFunctionParUsage(const Token *vartok, bool ispointer, Alloc alloc) const;
64+
bool isVariableUsage(const Token *vartok, bool pointer, Alloc alloc) const;
65+
int isFunctionParUsage(const Token *vartok, bool pointer, Alloc alloc) const;
6666
bool isMemberVariableAssignment(const Token *tok, const std::string &membervar) const;
6767
bool isMemberVariableUsage(const Token *tok, bool isPointer, Alloc alloc, const std::string &membervar) const;
6868

0 commit comments

Comments
 (0)