GenerateExportHeader: Work around buggy std::getline behavior in BCB5.

This commit is contained in:
James Johnston 2015-12-31 17:45:34 +00:00
parent 4aff1650d6
commit d5eb7d8565
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::string testLine;
std::getline(ref, refLine); std::getline(ref, refLine);
std::getline(test, testLine); 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] == ' ') if (testLine.size() && testLine[testLine.size()-1] == ' ')
{ {
testLine = testLine.substr(0, testLine.size() - 1); testLine = testLine.substr(0, testLine.size() - 1);