template simplifier: fix cppcheck warnings (#1793)

This commit is contained in:
IOBYTE 2019-04-09 14:07:13 -04:00 committed by Daniel Marjamäki
parent e47b6bf862
commit 3094026e59
1 changed files with 4 additions and 2 deletions

View File

@ -365,6 +365,8 @@ unsigned int TemplateSimplifier::templateParameters(const Token *tok)
tok = tok->link();
if (tok)
tok = tok->next();
if (!tok)
return 0;
if (tok->str() == ">" && level == 0)
return numberOfParameters;
else if (tok->str() == "," && level == 0) {
@ -2333,8 +2335,8 @@ const Token * TemplateSimplifier::getTemplateParametersInDeclaration(
std::vector<const Token *> & typeParametersInDeclaration)
{
typeParametersInDeclaration.clear();
const Token *closing = tok->previous()->findClosingBracket();
for (; tok && tok!= closing; tok = tok->next()) {
const Token *end = tok->previous()->findClosingBracket();
for (; tok && tok!= end; tok = tok->next()) {
if (Token::simpleMatch(tok, "template <")) {
const Token *closing = tok->next()->findClosingBracket();
if (closing)