checkbufferoverrun.cpp: get rid of Match() usage with varid 0.
This commit is contained in:
parent
0f96299d87
commit
eebb1671a5
|
@ -248,13 +248,16 @@ void CheckBufferOverrun::checkScope(const Token *tok, const char *varname[], con
|
|||
else
|
||||
continue;
|
||||
|
||||
if (Token::Match(tok2, "%varid% < %num% ;", counter_varid))
|
||||
if (counter_varid)
|
||||
{
|
||||
max_counter_value = MathLib::toString<long>(atol(tok2->strAt(2)) - 1);
|
||||
}
|
||||
else if (Token::Match(tok2, "%varid% <= %num% ;", counter_varid))
|
||||
{
|
||||
max_counter_value = tok2->strAt(2);
|
||||
if (Token::Match(tok2, "%varid% < %num% ;", counter_varid))
|
||||
{
|
||||
max_counter_value = MathLib::toString<long>(atol(tok2->strAt(2)) - 1);
|
||||
}
|
||||
else if (Token::Match(tok2, "%varid% <= %num% ;", counter_varid))
|
||||
{
|
||||
max_counter_value = tok2->strAt(2);
|
||||
}
|
||||
}
|
||||
|
||||
// Get index variable and stopsize.
|
||||
|
|
Loading…
Reference in New Issue