Refactoring; Use stl algorithm instead of for loop

This commit is contained in:
Daniel Marjamäki 2019-04-28 10:30:20 +02:00
parent f503386666
commit 9d72e24edb
1 changed files with 3 additions and 7 deletions

View File

@ -590,13 +590,9 @@ void CheckBufferOverrun::bufferOverflow()
const ValueFlow::Value bufferSize = getBufferSize(argtok);
if (bufferSize.intvalue <= 1)
continue;
bool error = true;
for (const Library::ArgumentChecks::MinSize &minsize : *minsizes) {
if (checkBufferSize(tok, minsize, args, bufferSize.intvalue, mSettings)) {
error = false;
break;
}
}
bool error = std::none_of(minsizes->begin(), minsizes->end(), [=](const Library::ArgumentChecks::MinSize &minsize) {
return checkBufferSize(tok, minsize, args, bufferSize.intvalue, mSettings);
});
if (error)
bufferOverflowError(args[argnr], &bufferSize);
}