Use varid instead of varname in stl check.

This commit is contained in:
Reijo Tomperi 2009-10-07 23:49:06 +03:00
parent 014ad937cf
commit 668d4d0fe3
1 changed files with 3 additions and 3 deletions

View File

@ -113,7 +113,7 @@ void CheckStl::stlOutOfBounds()
{ {
unsigned int indent2 = 0; unsigned int indent2 = 0;
const std::string num(tok2->strAt(1)); const std::string num(tok2->strAt(1));
const std::string varname(tok2->strAt(3)); unsigned int varId = tok2->tokAt(3)->varId();
for (const Token *tok3 = tok2->tokAt(8); tok3; tok3 = tok3->next()) for (const Token *tok3 = tok2->tokAt(8); tok3; tok3 = tok3->next())
{ {
if (tok3->str() == "{") if (tok3->str() == "{")
@ -124,12 +124,12 @@ void CheckStl::stlOutOfBounds()
break; break;
--indent2; --indent2;
} }
else if (tok3->str() == varname) else if (tok3->varId() == varId)
{ {
if (Token::simpleMatch(tok3->next(), ". size ( )")) if (Token::simpleMatch(tok3->next(), ". size ( )"))
break; break;
else if (Token::simpleMatch(tok3->next(), ("[ " + num + " ]").c_str())) else if (Token::simpleMatch(tok3->next(), ("[ " + num + " ]").c_str()))
stlOutOfBoundsError(tok3, num, varname); stlOutOfBoundsError(tok3, num, tok3->str());
} }
} }
break; break;