Bläddra i källkod

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

James Johnston 10 år sedan
förälder
incheckning
d5eb7d8565
1 ändrade filer med 12 tillägg och 0 borttagningar
  1. 12 0
      Tests/Module/GenerateExportHeader/exportheader_test.cpp

+ 12 - 0
Tests/Module/GenerateExportHeader/exportheader_test.cpp

@@ -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);