Fixed compiler errrors and warnings mentioned in #3783
This commit is contained in:
parent
ec00824fd3
commit
db914d7185
|
@ -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;
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue