diff --git a/lib/checkmemoryleak.cpp b/lib/checkmemoryleak.cpp index 41809c62e..ce687623e 100644 --- a/lib/checkmemoryleak.cpp +++ b/lib/checkmemoryleak.cpp @@ -507,7 +507,7 @@ const char *CheckMemoryLeak::functionArgAlloc(const Function *func, unsigned int // Check if pointer is allocated. int realloc = 0; - for (const Token* tok = func->start; tok && tok != func->start->link(); tok = tok->next()) { + for (tok = func->start; tok && tok != func->start->link(); tok = tok->next()) { if (tok->varId() == arg->varId()) { if (Token::Match(tok->tokAt(-3), "free ( * %var% )")) { realloc = 1; diff --git a/lib/checkuninitvar.cpp b/lib/checkuninitvar.cpp index 810c51239..d929b15ad 100644 --- a/lib/checkuninitvar.cpp +++ b/lib/checkuninitvar.cpp @@ -748,7 +748,7 @@ private: (Token::Match(&tok, "( *| %var% .|::") && Token::Match(tok.link()->tokAt(-2), ".|:: %var% ) ("))) { // is the variable passed as a parameter to some function? const Token *tok2 = tok.link()->next(); - for (const Token* const end = tok2->link(); tok2 != end; tok2 = tok2->next()) { + for (const Token* const end2 = tok2->link(); tok2 != end2; tok2 = tok2->next()) { if (tok2->varId()) { // it is possible that the variable is initialized here ExecutionPath::bailOutVar(checks, tok2->varId()); @@ -908,8 +908,8 @@ private: return; if (Token::simpleMatch(tok, "if (")) { // bail out all variables that are used in the condition - const Token* const end = tok->linkAt(1); - for (const Token *tok2 = tok->tokAt(2); tok2 != end; tok2 = tok2->next()) { + const Token* const end2 = tok->linkAt(1); + for (const Token *tok2 = tok->tokAt(2); tok2 != end2; tok2 = tok2->next()) { if (tok2->varId()) ExecutionPath::bailOutVar(checks, tok2->varId()); } diff --git a/lib/cppcheck.cpp b/lib/cppcheck.cpp index 49ada4a23..82c22bfec 100644 --- a/lib/cppcheck.cpp +++ b/lib/cppcheck.cpp @@ -384,14 +384,14 @@ void CppCheck::checkFile(const std::string &code, const char FileName[]) // determine location.. ErrorLogger::ErrorMessage::FileLocation loc; - loc.setfile(_tokenizer.getFiles().front()); + loc.setfile(_tokenizer.getSourceFilePath()); loc.line = 0; unsigned int len = 0; for (const Token *tok = _tokenizer.tokens(); tok; tok = tok->next()) { len = len + 1 + tok->str().size(); if (len > pos1) { - loc.setfile(_tokenizer.getFiles().at(tok->fileIndex())); + loc.setfile(_tokenizer.list.getFiles().at(tok->fileIndex())); loc.line = tok->linenr(); break; }