[PATCH rtems-tools 3/8] Explanations: Convert to C++

Ryan Long ryan.long at oarcorp.com
Fri Dec 3 14:47:54 UTC 2021


---
 tester/covoar/Explanations.cc | 10 +++++-----
 tester/covoar/Explanations.h  |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/tester/covoar/Explanations.cc b/tester/covoar/Explanations.cc
index 4142418..028c00e 100644
--- a/tester/covoar/Explanations.cc
+++ b/tester/covoar/Explanations.cc
@@ -27,14 +27,14 @@ namespace Coverage {
   }
 
   void Explanations::load(
-    const char* const explanations
+    const std::string& explanations
   )
   {
     std::ifstream  explain;
     Explanation    e;
     int            line = 1;
 
-    if (!explanations)
+    if (explanations.empty())
       return;
 
     explain.open( explanations );
@@ -121,13 +121,13 @@ namespace Coverage {
   }
 
   void Explanations::writeNotFound(
-    const char* const fileName
+    const std::string& fileName
   )
   {
     std::ofstream notFoundFile;
     bool  notFoundOccurred = false;
 
-    if (!fileName)
+    if (fileName.empty())
       return;
 
     notFoundFile.open( fileName );
@@ -151,7 +151,7 @@ namespace Coverage {
     }
 
     if (!notFoundOccurred) {
-      if (!unlink( fileName )) {
+      if (!unlink( fileName.c_str())) {
         std::cerr << "Warning: Unable to unlink " << fileName
                   << std::endl
                   << std::endl;
diff --git a/tester/covoar/Explanations.h b/tester/covoar/Explanations.h
index de0c051..ca7c749 100644
--- a/tester/covoar/Explanations.h
+++ b/tester/covoar/Explanations.h
@@ -88,7 +88,7 @@ namespace Coverage {
      *             the explanation information
      */
     void load(
-      const char* const explanations
+      const std::string& explanations
     );
 
     /*!
@@ -109,7 +109,7 @@ namespace Coverage {
      *  @param[in] fileName specifies the name of the file to write
      */
     void writeNotFound(
-      const char* const fileName
+      const std::string& fileName
     );
 
   };
-- 
1.8.3.1



More information about the devel mailing list