[WORDPAD] Sync with Wine Staging 1.7.55. CORE-10536
[reactos.git] / rostests / rosautotest / tools.cpp
index 413a2b8..b5276ba 100644 (file)
@@ -2,7 +2,7 @@
  * PROJECT:     ReactOS Automatic Testing Utility
  * LICENSE:     GNU GPLv2 or any later version as published by the Free Software Foundation
  * PURPOSE:     Various helper functions
- * COPYRIGHT:   Copyright 2008-2009 Colin Finck <colin@reactos.org>
+ * COPYRIGHT:   Copyright 2008-2015 Colin Finck <colin@reactos.org>
  */
 
 #include "precomp.h"
@@ -136,29 +136,34 @@ StringOut(const string& String, bool forcePrint)
                 }
 
                 DbgString[size] = 0;
-                DbgPrint(DbgString);
+                DbgPrint("%s", DbgString);
             }
 
             last_newline = curr_pos;
         }
     }
 
-    /* Output the string */
-    cout << NewString;
-
     size = curr_pos - start;
 
     /* Only print if forced to or if the rest is a whole line */
     if(forcePrint == true || NewString[curr_pos - 1] == '\n')
     {
+        /* Output the whole string */
+        if(Configuration.DoPrint())
+            cout << NewString << flush;
+
         memcpy(DbgString, NewString.c_str() + start, size);
         DbgString[size] = 0;
-        DbgPrint(DbgString);
+        DbgPrint("%s", DbgString);
 
         NewString.clear();
         return NewString;
     }
 
+    /* Output full lines only */
+    if(Configuration.DoPrint())
+        cout << NewString.substr(0, start) << flush;
+
     /* Return the remaining chunk */
     return NewString.substr(start, size);
 }