From 8f8255e36bf7941a70572d9908627d3c7259ae31 Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Sat, 11 Oct 2014 14:34:56 +0000 Subject: [PATCH] [ROSAUTOTEST] - Do not duplicate console output in StringOut if forcePrint = false ROSTESTS-144 svn path=/trunk/; revision=64670 --- rostests/rosautotest/tools.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rostests/rosautotest/tools.cpp b/rostests/rosautotest/tools.cpp index 413a2b8aa18..38df4aa096c 100644 --- a/rostests/rosautotest/tools.cpp +++ b/rostests/rosautotest/tools.cpp @@ -143,14 +143,14 @@ StringOut(const string& String, bool forcePrint) } } - /* 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 */ + cout << NewString; + memcpy(DbgString, NewString.c_str() + start, size); DbgString[size] = 0; DbgPrint(DbgString); @@ -159,6 +159,9 @@ StringOut(const string& String, bool forcePrint) return NewString; } + /* Output full lines only */ + cout << NewString.substr(0, start); + /* Return the remaining chunk */ return NewString.substr(start, size); } -- 2.17.1