Merge topic 'fix-GenerateExportHeader-on-borland'

d5eb7d85 GenerateExportHeader: Work around buggy std::getline behavior in BCB5.
This commit is contained in:
Brad King 2016-01-07 13:28:23 -05:00 committed by CMake Topic Stage
commit 5c6cbd390e
1 changed files with 12 additions and 0 deletions

View File

@ -39,6 +39,18 @@ void compare(const char* refName, const char* testName)
std::string testLine;
std::getline(ref, refLine);
std::getline(test, testLine);
// Some very old Borland runtimes (C++ Builder 5 WITHOUT Update 1) add a
// trailing null to the string that we need to strip before testing for a
// trailing space.
if (refLine.size() && refLine[refLine.size()-1] == 0)
{
refLine = refLine.substr(0, refLine.size() - 1);
}
if (testLine.size() && testLine[testLine.size()-1] == 0)
{
testLine = testLine.substr(0, testLine.size() - 1);
}
// The reference files never have trailing spaces:
if (testLine.size() && testLine[testLine.size()-1] == ' ')
{
testLine = testLine.substr(0, testLine.size() - 1);