Use different way to remove items from vector.

The way I was using caused a debug error in Visual Studio 2008. Probably
because the iterator got invalidated. So access items as array instead.
This commit is contained in:
Kimmo Varis 2011-02-01 23:02:07 +02:00
parent 51a1f64531
commit 1a83e3ef81
1 changed files with 4 additions and 7 deletions

View File

@ -93,15 +93,12 @@ bool CppCheckExecutor::parseFromArgs(CppCheck *cppcheck, int argc, const char* c
if (!filenames.empty())
{
PathMatch matcher(parser.GetIgnoredPaths());
// Ignore files
std::vector<std::string>::iterator iter = filenames.end();
do
std::vector<std::string>::iterator iterBegin = filenames.begin();
for (int i = (int)filenames.size() - 1; i >= 0; i--)
{
--iter;
if (matcher.Match(*iter))
filenames.erase(iter);
if (matcher.Match(filenames[i]))
filenames.erase(iterBegin + i);
}
while (iter != filenames.begin());
}
else
{