checkbufferoverrun.cpp: get rid of Match() usage with varid 0.

This commit is contained in:
Slava Semushin 2009-08-09 01:09:45 +07:00
parent 0f96299d87
commit eebb1671a5
1 changed files with 9 additions and 6 deletions

View File

@ -248,13 +248,16 @@ void CheckBufferOverrun::checkScope(const Token *tok, const char *varname[], con
else else
continue; continue;
if (Token::Match(tok2, "%varid% < %num% ;", counter_varid)) if (counter_varid)
{ {
max_counter_value = MathLib::toString<long>(atol(tok2->strAt(2)) - 1); if (Token::Match(tok2, "%varid% < %num% ;", counter_varid))
} {
else if (Token::Match(tok2, "%varid% <= %num% ;", counter_varid)) max_counter_value = MathLib::toString<long>(atol(tok2->strAt(2)) - 1);
{ }
max_counter_value = tok2->strAt(2); else if (Token::Match(tok2, "%varid% <= %num% ;", counter_varid))
{
max_counter_value = tok2->strAt(2);
}
} }
// Get index variable and stopsize. // Get index variable and stopsize.