Add additional checking to avoid ethernal loops when someone is using incorrect different case for the same file.

It should be unlikely that anyone would actually use different files in the same project and separate them only by 
casing of some letters.
This commit is contained in:
Reijo Tomperi 2009-01-23 20:36:43 +00:00
parent 8d6f41397a
commit c9133fb85d
1 changed files with 5 additions and 3 deletions

View File

@ -491,15 +491,17 @@ void Preprocessor::handleIncludes(std::string &code, const std::string &filename
filename = getHeaderFileName(filename);
if (filename.length() == 0)
continue;
if (handledFiles.find(filename) != handledFiles.end())
std::string tempFile = filename;
std::transform(tempFile.begin(), tempFile.end(), tempFile.begin(), static_cast < int(*)(int) > (std::tolower));
if (handledFiles.find(tempFile) != handledFiles.end())
{
// We have processed this file already once, skip
// it this time to avoid ethernal loop.
continue;
}
handledFiles[ filename ] = true;
handledFiles[ tempFile ] = true;
// filename contains now a file name e.g. "menu.h"
std::string processedFile;