[PATCH 4/4] ReportsText.cc: Restore ostream format

Ryan Long ryan.long at oarcorp.com
Mon Jul 19 17:13:33 UTC 2021


CID 1505940: Not restoring ostream format

Save format of stream before changing it, and change it back before returning.

Closes #4472
---
 tester/covoar/ReportsText.cc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tester/covoar/ReportsText.cc b/tester/covoar/ReportsText.cc
index 35ad786..37c8a3f 100644
--- a/tester/covoar/ReportsText.cc
+++ b/tester/covoar/ReportsText.cc
@@ -144,6 +144,9 @@ bool ReportsText::PutCoverageLine(
 {
   const Coverage::Explanation*   explanation;
 
+  std::ofstream oldState;
+  oldState.copyfmt( report );
+
   report << "============================================" << std::endl
          << "Index                : " << range.id << std::endl
          << "Symbol               : " << symbolName
@@ -175,6 +178,8 @@ bool ReportsText::PutCoverageLine(
   }
 
   report << "============================================" << std::endl;
+  report.copyfmt( oldState );
+
   return true;
 }
 
-- 
1.8.3.1



More information about the devel mailing list