diff --git a/lib/checkio.cpp b/lib/checkio.cpp index 40c2e3ec4..24c619746 100644 --- a/lib/checkio.cpp +++ b/lib/checkio.cpp @@ -471,7 +471,7 @@ void CheckIO::checkWrongPrintfScanfArguments() varTypeTok = varTypeTok->next(); if (scan && varTypeTok) { - if ((!variableInfo->isPointer() && !variableInfo->isArray()) || varTypeTok->str() == "const") + if ((!variableInfo->isPointer() && !variableInfo->isArray()) || varTypeTok->strAt(-1) == "const") invalidScanfArgTypeError(tok, tok->str(), numFormat); } else if (!scan) { switch (*i) { @@ -480,7 +480,7 @@ void CheckIO::checkWrongPrintfScanfArguments() invalidPrintfArgTypeError_s(tok, numFormat); break; case 'n': - if ((varTypeTok && isKnownType(variableInfo, varTypeTok) && ((!variableInfo->isPointer() && !variableInfo->isArray()) || varTypeTok->str() == "const")) || argListTok->type() == Token::eString) + if ((varTypeTok && isKnownType(variableInfo, varTypeTok) && ((!variableInfo->isPointer() && !variableInfo->isArray()) || varTypeTok->strAt(-1) == "const")) || argListTok->type() == Token::eString) invalidPrintfArgTypeError_n(tok, numFormat); break; case 'c': diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 7cc6e5ad4..97533d86d 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -2238,7 +2238,7 @@ void CheckOther::checkDuplicateBranch() // check for duplicates if (branch1 == branch2) - duplicateBranchError(scope->classDef, scope->classEnd->tokAt(1)); + duplicateBranchError(scope->classDef, scope->classEnd->next()); } } }