[PATCH v2 3/5] CoverageMapBase.cc: Restore ostream format

Ryan Long ryan.long at oarcorp.com
Tue Jul 20 15:06:55 UTC 2021


CID 1503022: Not restoring ostream format

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

Closes #4470
---
 tester/covoar/CoverageMapBase.cc | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tester/covoar/CoverageMapBase.cc b/tester/covoar/CoverageMapBase.cc
index f0b5890..4de9307 100644
--- a/tester/covoar/CoverageMapBase.cc
+++ b/tester/covoar/CoverageMapBase.cc
@@ -12,9 +12,12 @@
 #include <iomanip>
 
 #include <rld.h>
+#include <rtems-utils.h>
 
 #include "CoverageMapBase.h"
 
+typedef rtems::utils::ostream_guard ostream_guard;
+
 namespace Coverage {
 
   AddressInfo::AddressInfo ()
@@ -75,6 +78,8 @@ namespace Coverage {
 
   void AddressRange::dump (std::ostream& out, bool show_slots) const
   {
+    ostream_guard old_state( out );
+
     out << std::hex << std::setfill('0')
         << "Address range: low = " << std::setw(8) << lowAddress
         << " high = " << std::setw(8) << highAddress
@@ -99,6 +104,7 @@ namespace Coverage {
             << std::endl;
       }
     }
+
   }
 
   CoverageMapBase::CoverageMapBase(
-- 
1.8.3.1



More information about the devel mailing list