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

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


CID 1505939: Not restoring ostream format

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

Closes #4471
---
 tester/covoar/ReportsHtml.cc | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/tester/covoar/ReportsHtml.cc b/tester/covoar/ReportsHtml.cc
index e276732..687722f 100644
--- a/tester/covoar/ReportsHtml.cc
+++ b/tester/covoar/ReportsHtml.cc
@@ -6,7 +6,6 @@
 #include <iomanip>
 
 #include <rld.h>
-#include <rtems-utils.h>
 
 #include "ReportsHtml.h"
 #include "app_common.h"
@@ -14,8 +13,6 @@
 #include "DesiredSymbols.h"
 #include "ObjdumpProcessor.h"
 
-typedef rtems::utils::ostream_guard ostream_guard;
-
 #if 0
 #define TABLE_HEADER_CLASS \
   " table-autopage:10 table-page-number:pagenum table-page-count:pages "
@@ -727,8 +724,6 @@ namespace Coverage {
     const SymbolInformation& symbolInfo
   )
   {
-    ostream_guard old_state( report );
-
     // Mark the background color different for odd and even lines.
     if ( ( count % 2 ) != 0 ) {
       report << "<tr class=\"covoar-tr-odd\">" << std::endl;
@@ -802,11 +797,15 @@ namespace Coverage {
         report << "<td class=\"covoar-td\" align=\"center\">100.00</td>"
                << std::endl;
       } else {
+        std::streamsize ss = report.precision();
+
         report << "<td class=\"covoar-td\" align=\"center\">"
                << std::fixed << std::setprecision( 2 )
                << ( symbolInfo.stats.uncoveredInstructions * 100.0 ) /
                     symbolInfo.stats.sizeInInstructions
-               << "</td>" << std::endl;
+               << "</td>" << std::endl
+               << std::resetiosflags( std::ios_base::fixed )
+               << std::setprecision( ss );
       }
 
       // % Uncovered Bytes
-- 
1.8.3.1



More information about the devel mailing list