[PATCH v1 5/5] ReportsText.cc: Restore ostream format

Ryan Long ryan.long at oarcorp.com
Wed Aug 4 15:54:24 UTC 2021


CID 1505940: Not restoring ostream format

Remove ostream_guard, add call to resetiosflags(), store precision value
before changing it and restore it afterwards.

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

diff --git a/tester/covoar/ReportsText.cc b/tester/covoar/ReportsText.cc
index c4a5dbc..b76a8ae 100644
--- a/tester/covoar/ReportsText.cc
+++ b/tester/covoar/ReportsText.cc
@@ -10,10 +10,6 @@
 #include "Explanations.h"
 #include "ObjdumpProcessor.h"
 
-#include <rtems-utils.h>
-
-typedef rtems::utils::ostream_guard ostream_guard;
-
 namespace Coverage {
 
 ReportsText::ReportsText( time_t timestamp, const std::string& symbolSetName ):
@@ -148,8 +144,6 @@ bool ReportsText::PutCoverageLine(
 {
   const Coverage::Explanation* explanation;
 
-  ostream_guard oldState( report );
-
   report << "============================================" << std::endl
          << "Index                : " << range.id << std::endl
          << "Symbol               : " << symbolName
@@ -238,6 +232,8 @@ bool  ReportsText::PutSymbolSummaryLine(
                        symbolInfo.stats.sizeInBytes;
     }
 
+    std::streamsize ss = report.precision();
+
     report << "============================================" << std::endl
            << "Symbol                            : "
            << symbolName << std::endl
@@ -257,7 +253,9 @@ bool  ReportsText::PutSymbolSummaryLine(
            << "Percentage Uncovered Instructions : "
            << uncoveredInstructions << std::endl
            << "Percentage Uncovered Bytes        : "
-           << uncoveredBytes << std::endl;
+           << uncoveredBytes << std::endl
+           << std::resetiosflags( std::ios_base::fixed )
+           << std::setprecision( ss );
 
   report << "============================================" << std::endl;
   }
-- 
1.8.3.1



More information about the devel mailing list