checkunusedfunctions.cpp: Fix files.txt parsing (#1197)

On Windows searching for the last colon finds the colon which is part of
the path of the source file (e.g. "C:/projects/a.cpp"). Thus the path is
saved incomplete. This fix searches for the second instead of the last
colon and uses the data after the second colon as the path of the source
file.
This commit is contained in:
Sebastian 2018-05-01 08:09:11 +02:00 committed by Daniel Marjamäki
parent b370861bed
commit f0646d3754
1 changed files with 3 additions and 3 deletions

View File

@ -392,11 +392,11 @@ void CheckUnusedFunctions::analyseWholeProgram(ErrorLogger * const errorLogger,
const std::string::size_type firstColon = filesTxtLine.find(':');
if (firstColon == std::string::npos)
continue;
const std::string::size_type lastColon = filesTxtLine.rfind(':');
if (firstColon == lastColon)
const std::string::size_type secondColon = filesTxtLine.find(':', firstColon+1);
if (secondColon == std::string::npos)
continue;
const std::string xmlfile = buildDir + '/' + filesTxtLine.substr(0,firstColon);
const std::string sourcefile = filesTxtLine.substr(lastColon+1);
const std::string sourcefile = filesTxtLine.substr(secondColon+1);
tinyxml2::XMLDocument doc;
const tinyxml2::XMLError error = doc.LoadFile(xmlfile.c_str());