diff --git a/cli/cppcheckexecutor.h b/cli/cppcheckexecutor.h index f23251a79..d08ba3990 100644 --- a/cli/cppcheckexecutor.h +++ b/cli/cppcheckexecutor.h @@ -90,9 +90,9 @@ public: static void reportStatus(std::size_t fileindex, std::size_t filecount, std::size_t sizedone, std::size_t sizetotal); /** - * @param fp Output file + * @param exception_output Output file */ - static void setExceptionOutput(FILE* fp); + static void setExceptionOutput(FILE* exception_output); /** * @return file name to be used for output from exception handler. Has to be either "stdout" or "stderr". */ diff --git a/cli/threadexecutor.h b/cli/threadexecutor.h index e88cb171a..f8a0981a4 100644 --- a/cli/threadexecutor.h +++ b/cli/threadexecutor.h @@ -43,7 +43,7 @@ class Settings; */ class ThreadExecutor : public ErrorLogger { public: - ThreadExecutor(const std::map &files, Settings &settings, ErrorLogger &_errorLogger); + ThreadExecutor(const std::map &files, Settings &settings, ErrorLogger &errorLogger); virtual ~ThreadExecutor(); unsigned int check(); diff --git a/gui/libraryeditargdialog.h b/gui/libraryeditargdialog.h index ca5ebde78..ae9f2858a 100644 --- a/gui/libraryeditargdialog.h +++ b/gui/libraryeditargdialog.h @@ -12,7 +12,7 @@ class LibraryEditArgDialog : public QDialog { Q_OBJECT public: - LibraryEditArgDialog(QWidget *parent, const CppcheckLibraryData::Function::Arg &a); + LibraryEditArgDialog(QWidget *parent, const CppcheckLibraryData::Function::Arg &arg); ~LibraryEditArgDialog(); CppcheckLibraryData::Function::Arg getArg() const; diff --git a/gui/mainwindow.h b/gui/mainwindow.h index 4a3e4c4a4..af7402ed2 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -332,16 +332,16 @@ private: /** * @brief Load XML file to the GUI. - * @param file Filename (inc. path) of XML file to load. + * @param selectedFile Filename (inc. path) of XML file to load. */ - void LoadResults(const QString file); + void LoadResults(const QString selectedFile); /** * @brief Load XML file to the GUI. - * @param file Filename (inc. path) of XML file to load. - * @param checkedDirectory Path to the directory that the results were generated for. + * @param selectedFile Filename (inc. path) of XML file to load. + * @param sourceDirectory Path to the directory that the results were generated for. */ - void LoadResults(const QString file, const QString checkedDirectory); + void LoadResults(const QString selectedFile, const QString sourceDirectory); /** * @brief Load project file to the GUI. diff --git a/lib/checkassert.h b/lib/checkassert.h index 2e4b0e3f0..be6b28c40 100644 --- a/lib/checkassert.h +++ b/lib/checkassert.h @@ -49,7 +49,7 @@ public: void assertWithSideEffects(); protected: - void checkVariableAssignment(const Token* tmp, const Scope *assertionScope); + void checkVariableAssignment(const Token* assignTok, const Scope *assertionScope); static bool inSameScope(const Token* returnTok, const Token* assignTok); private: diff --git a/lib/checkbufferoverrun.cpp b/lib/checkbufferoverrun.cpp index be951abb2..6db8a0c06 100644 --- a/lib/checkbufferoverrun.cpp +++ b/lib/checkbufferoverrun.cpp @@ -1788,17 +1788,17 @@ CheckBufferOverrun::ArrayInfo::ArrayInfo() { } -CheckBufferOverrun::ArrayInfo::ArrayInfo(const Variable *var, const SymbolDatabase * symDb, const unsigned int forcedeclid) +CheckBufferOverrun::ArrayInfo::ArrayInfo(const Variable *var, const SymbolDatabase * symbolDatabase, const unsigned int forcedeclid) : _varname(var->name()), _declarationId((forcedeclid == 0U) ? var->declarationId() : forcedeclid) { for (std::size_t i = 0; i < var->dimensions().size(); i++) _num.push_back(var->dimension(i)); if (var->typeEndToken()->str() == "*") - _element_size = symDb->sizeOfType(var->typeEndToken()); + _element_size = symbolDatabase->sizeOfType(var->typeEndToken()); else if (var->typeStartToken()->strAt(-1) == "struct") _element_size = 100; else { - _element_size = symDb->sizeOfType(var->typeEndToken()); + _element_size = symbolDatabase->sizeOfType(var->typeEndToken()); } } diff --git a/lib/checkbufferoverrun.h b/lib/checkbufferoverrun.h index 46d2c168f..d43590832 100644 --- a/lib/checkbufferoverrun.h +++ b/lib/checkbufferoverrun.h @@ -180,7 +180,7 @@ public: /** Check for buffer overruns (based on ArrayInfo) */ void checkScope(const Token *tok, const ArrayInfo &arrayInfo); - void checkScope(const Token *tok, std::map arrayInfo); + void checkScope(const Token *tok, std::map arrayInfos); void checkScope_inner(const Token *tok, const ArrayInfo &arrayInfo); /** Check for buffer overruns */ @@ -188,12 +188,12 @@ public: /** * Helper function for checkFunctionCall - check a function parameter - * \param tok token for the function name + * \param ftok token for the function name * \param paramIndex on what parameter is the array used * \param arrayInfo the array information * \param callstack call stack. This is used to prevent recursion and to provide better error messages. Pass a empty list from checkScope etc. */ - void checkFunctionParameter(const Token &tok, const unsigned int paramIndex, const ArrayInfo &arrayInfo, const std::list& callstack); + void checkFunctionParameter(const Token &ftok, const unsigned int paramIndex, const ArrayInfo &arrayInfo, const std::list& callstack); /** * Helper function that checks if the array is used and if so calls the checkFunctionCall diff --git a/lib/checkio.cpp b/lib/checkio.cpp index cf0fdff5c..053d47b22 100644 --- a/lib/checkio.cpp +++ b/lib/checkio.cpp @@ -1382,7 +1382,7 @@ void CheckIO::checkFormatString(const Token * const tok, // We currently only support string literals, variables, and functions. /// @todo add non-string literals, and generic expressions -CheckIO::ArgumentInfo::ArgumentInfo(const Token * tok, const Settings *settings, bool _isCPP) +CheckIO::ArgumentInfo::ArgumentInfo(const Token * arg, const Settings *settings, bool _isCPP) : variableInfo(nullptr) , typeToken(nullptr) , functionInfo(nullptr) @@ -1392,14 +1392,14 @@ CheckIO::ArgumentInfo::ArgumentInfo(const Token * tok, const Settings *settings, , address(false) , isCPP(_isCPP) { - if (!tok) + if (!arg) return; // Use AST type info // TODO: This is a bailout so that old code is used in simple cases. Remove the old code and always use the AST type. - if (!Token::Match(tok, "%str% ,|)") && !(Token::Match(tok,"%var%") && tok->variable() && tok->variable()->isArray())) { - const Token *top = tok; - while (top->astParent() && top->astParent()->str() != "," && top->astParent() != tok->previous()) + if (!Token::Match(arg, "%str% ,|)") && !(Token::Match(arg,"%var%") && arg->variable() && arg->variable()->isArray())) { + const Token *top = arg; + while (top->astParent() && top->astParent()->str() != "," && top->astParent() != arg->previous()) top = top->astParent(); const ValueType *valuetype = top->argumentType(); if (valuetype && valuetype->type >= ValueType::Type::BOOL) { @@ -1446,30 +1446,30 @@ CheckIO::ArgumentInfo::ArgumentInfo(const Token * tok, const Settings *settings, } - if (tok->tokType() == Token::eString) { - typeToken = tok; + if (arg->tokType() == Token::eString) { + typeToken = arg; return; - } else if (tok->str() == "&" || tok->tokType() == Token::eVariable || - tok->tokType() == Token::eFunction || Token::Match(tok, "%type% ::") || - (Token::Match(tok, "static_cast|reinterpret_cast|const_cast <") && - Token::simpleMatch(tok->linkAt(1), "> (") && - Token::Match(tok->linkAt(1)->linkAt(1), ") ,|)"))) { - if (Token::Match(tok, "static_cast|reinterpret_cast|const_cast")) { - typeToken = tok->tokAt(2); + } else if (arg->str() == "&" || arg->tokType() == Token::eVariable || + arg->tokType() == Token::eFunction || Token::Match(arg, "%type% ::") || + (Token::Match(arg, "static_cast|reinterpret_cast|const_cast <") && + Token::simpleMatch(arg->linkAt(1), "> (") && + Token::Match(arg->linkAt(1)->linkAt(1), ") ,|)"))) { + if (Token::Match(arg, "static_cast|reinterpret_cast|const_cast")) { + typeToken = arg->tokAt(2); while (typeToken->str() == "const" || typeToken->str() == "extern") typeToken = typeToken->next(); return; } - if (tok->str() == "&") { + if (arg->str() == "&") { address = true; - tok = tok->next(); + arg = arg->next(); } - while (Token::Match(tok, "%type% ::")) - tok = tok->tokAt(2); - if (!tok || !(tok->tokType() == Token::eVariable || tok->tokType() == Token::eFunction)) + while (Token::Match(arg, "%type% ::")) + arg = arg->tokAt(2); + if (!arg || !(arg->tokType() == Token::eVariable || arg->tokType() == Token::eFunction)) return; const Token *varTok = nullptr; - const Token *tok1 = tok->next(); + const Token *tok1 = arg->next(); for (; tok1; tok1 = tok1->next()) { if (tok1->str() == "," || tok1->str() == ")") { if (tok1->previous()->str() == "]") { diff --git a/lib/checkstl.h b/lib/checkstl.h index b887c092a..781011c32 100644 --- a/lib/checkstl.h +++ b/lib/checkstl.h @@ -183,7 +183,7 @@ private: void uselessCallsEmptyError(const Token *tok); void uselessCallsRemoveError(const Token *tok, const std::string& function); - void dereferenceInvalidIteratorError(const Token* deref, const std::string &itername); + void dereferenceInvalidIteratorError(const Token* deref, const std::string &iterName); void readingEmptyStlContainerError(const Token *tok); diff --git a/lib/checkuninitvar.h b/lib/checkuninitvar.h index 743161095..9701d0bae 100644 --- a/lib/checkuninitvar.h +++ b/lib/checkuninitvar.h @@ -61,8 +61,8 @@ public: bool checkIfForWhileHead(const Token *startparentheses, const Variable& var, bool suppressErrors, bool isuninit, Alloc alloc, const std::string &membervar); bool checkLoopBody(const Token *tok, const Variable& var, const Alloc alloc, const std::string &membervar, const bool suppressErrors); void checkRhs(const Token *tok, const Variable &var, Alloc alloc, unsigned int number_of_if, const std::string &membervar); - bool isVariableUsage(const Token *vartok, bool ispointer, Alloc alloc) const; - int isFunctionParUsage(const Token *vartok, bool ispointer, Alloc alloc) const; + bool isVariableUsage(const Token *vartok, bool pointer, Alloc alloc) const; + int isFunctionParUsage(const Token *vartok, bool pointer, Alloc alloc) const; bool isMemberVariableAssignment(const Token *tok, const std::string &membervar) const; bool isMemberVariableUsage(const Token *tok, bool isPointer, Alloc alloc, const std::string &membervar) const; diff --git a/lib/errorlogger.h b/lib/errorlogger.h index 2d76e8e7d..9c9a21c60 100644 --- a/lib/errorlogger.h +++ b/lib/errorlogger.h @@ -221,9 +221,9 @@ public: /** * Format the error message in XML format * @param verbose use verbose message - * @param ver XML version + * @param version XML version */ - std::string toXML(bool verbose, int ver) const; + std::string toXML(bool verbose, int version) const; static std::string getXMLHeader(int xml_version); static std::string getXMLFooter(int xml_version); diff --git a/lib/mathlib.cpp b/lib/mathlib.cpp index f11bac912..d502dd08d 100644 --- a/lib/mathlib.cpp +++ b/lib/mathlib.cpp @@ -569,19 +569,19 @@ template<> std::string MathLib::toString(double value) return result.str(); } -bool MathLib::isFloat(const std::string &s) +bool MathLib::isFloat(const std::string &str) { - return isDecimalFloat(s) || isFloatHex(s); + return isDecimalFloat(str) || isFloatHex(str); } -bool MathLib::isDecimalFloat(const std::string &s) +bool MathLib::isDecimalFloat(const std::string &str) { - if (s.empty()) + if (str.empty()) return false; enum State { START, BASE_PLUSMINUS, BASE_DIGITS1, LEADING_DECIMAL, TRAILING_DECIMAL, BASE_DIGITS2, E, MANTISSA_PLUSMINUS, MANTISSA_DIGITS, SUFFIX_F, SUFFIX_L } state = START; - for (std::string::const_iterator it = s.begin(); it != s.end(); ++it) { + for (std::string::const_iterator it = str.begin(); it != str.end(); ++it) { switch (state) { case START: if (*it=='+' || *it=='-') @@ -672,18 +672,18 @@ bool MathLib::isDecimalFloat(const std::string &s) return (state==BASE_DIGITS2 || state==MANTISSA_DIGITS || state==TRAILING_DECIMAL || state==SUFFIX_F || state==SUFFIX_L); } -bool MathLib::isNegative(const std::string &s) +bool MathLib::isNegative(const std::string &str) { - if (s.empty()) + if (str.empty()) return false; - return (s[0] == '-'); + return (str[0] == '-'); } -bool MathLib::isPositive(const std::string &s) +bool MathLib::isPositive(const std::string &str) { - if (s.empty()) + if (str.empty()) return false; - return !MathLib::isNegative(s); + return !MathLib::isNegative(str); } /*! \brief Does the string represent an octal number? @@ -692,15 +692,15 @@ bool MathLib::isPositive(const std::string &s) * Additional information can be found here: * http://gcc.gnu.org/onlinedocs/gcc/Binary-constants.html * - * \param[in] s The string to check. In case the string is empty, the function returns false. + * \param str The string to check. In case the string is empty, the function returns false. * \return Return true in case a octal number is provided and false otherwise. **/ -bool MathLib::isOct(const std::string& s) +bool MathLib::isOct(const std::string& str) { enum Status { START, PLUSMINUS, OCTAL_PREFIX, DIGITS } state = START; - for (std::string::const_iterator it = s.begin(); it != s.end(); ++it) { + for (std::string::const_iterator it = str.begin(); it != str.end(); ++it) { switch (state) { case START: if (*it == '+' || *it == '-') @@ -726,19 +726,19 @@ bool MathLib::isOct(const std::string& s) if (isOctalDigit(static_cast(*it))) state = DIGITS; else - return isValidIntegerSuffix(it,s.end()); + return isValidIntegerSuffix(it,str.end()); break; } } return state == DIGITS; } -bool MathLib::isIntHex(const std::string& s) +bool MathLib::isIntHex(const std::string& str) { enum Status { START, PLUSMINUS, HEX_PREFIX, DIGIT, DIGITS } state = START; - for (std::string::const_iterator it = s.begin(); it != s.end(); ++it) { + for (std::string::const_iterator it = str.begin(); it != str.end(); ++it) { switch (state) { case START: if (*it == '+' || *it == '-') @@ -770,19 +770,19 @@ bool MathLib::isIntHex(const std::string& s) if (isxdigit(static_cast(*it))) state = DIGITS; else - return isValidIntegerSuffix(it,s.end()); + return isValidIntegerSuffix(it,str.end()); break; } } return state == DIGITS; } -bool MathLib::isFloatHex(const std::string& s) +bool MathLib::isFloatHex(const std::string& str) { enum Status { START, PLUSMINUS, HEX_PREFIX, WHOLE_NUMBER_DIGIT, WHOLE_NUMBER_DIGITS, FRACTION, EXPONENT_DIGIT, EXPONENT_DIGITS } state = START; - for (std::string::const_iterator it = s.begin(); it != s.end(); ++it) { + for (std::string::const_iterator it = str.begin(); it != str.end(); ++it) { switch (state) { case START: if (*it == '+' || *it == '-') @@ -935,15 +935,15 @@ bool MathLib::isValidIntegerSuffix(std::string::const_iterator it, std::string:: * Additional information can be found here: * http://gcc.gnu.org/onlinedocs/gcc/Binary-constants.html * - * \param[in] s The string to check. In case the string is empty, the function returns false. + * \param str The string to check. In case the string is empty, the function returns false. * \return Return true in case a binary number is provided and false otherwise. **/ -bool MathLib::isBin(const std::string& s) +bool MathLib::isBin(const std::string& str) { enum Status { START, PLUSMINUS, GNU_BIN_PREFIX, DIGIT, DIGITS } state = START; - for (std::string::const_iterator it = s.begin(); it != s.end(); ++it) { + for (std::string::const_iterator it = str.begin(); it != str.end(); ++it) { switch (state) { case START: if (*it == '+' || *it == '-') @@ -975,19 +975,19 @@ bool MathLib::isBin(const std::string& s) if (*it == '0' || *it == '1') state = DIGITS; else - return isValidIntegerSuffix(it,s.end()); + return isValidIntegerSuffix(it,str.end()); break; } } return state == DIGITS; } -bool MathLib::isDec(const std::string & s) +bool MathLib::isDec(const std::string & str) { enum Status { START, PLUSMINUS, DIGIT } state = START; - for (std::string::const_iterator it = s.begin(); it != s.end(); ++it) { + for (std::string::const_iterator it = str.begin(); it != str.end(); ++it) { switch (state) { case START: if (*it == '+' || *it == '-') @@ -1007,16 +1007,16 @@ bool MathLib::isDec(const std::string & s) if (isdigit(static_cast(*it))) state = DIGIT; else - return isValidIntegerSuffix(it,s.end()); + return isValidIntegerSuffix(it,str.end()); break; } } return state == DIGIT; } -bool MathLib::isInt(const std::string & s) +bool MathLib::isInt(const std::string & str) { - return isDec(s) || isIntHex(s) || isOct(s) || isBin(s); + return isDec(str) || isIntHex(str) || isOct(str) || isBin(str); } static std::string getsuffix(const std::string& value) diff --git a/lib/tokenlist.h b/lib/tokenlist.h index 2b8becf62..fa6dadd86 100644 --- a/lib/tokenlist.h +++ b/lib/tokenlist.h @@ -83,7 +83,7 @@ public: void deallocateTokens(); /** append file name if seen the first time; return its index in any case */ - unsigned int appendFileIfNew(const std::string &file); + unsigned int appendFileIfNew(const std::string &fileName); /** get first token of list */ const Token *front() const {