[PATCH] Reports: Convert to C++

Ryan Long ryan.long at oarcorp.com
Wed Jul 7 13:37:33 UTC 2021


I'll get those pointers changed to references, and remove the whitespace changes. Is there a particular reason to not use '\n' instead of std::endl? I read that std::endl is slower since it's flushing the buffer each time that it is used.

-----Original Message-----
From: Chris Johns <chrisj at rtems.org> 
Sent: Tuesday, July 6, 2021 7:13 PM
To: Ryan Long <ryan.long at oarcorp.com>; devel at rtems.org
Subject: Re: [PATCH] Reports: Convert to C++

On 7/7/21 1:53 am, Ryan Long wrote:
> Made formatting consistent and converted C code to C++.
> ---
>  tester/covoar/ReportsBase.cc |  525 +++++++++----------
>  tester/covoar/ReportsBase.h  |  156 +++---
>  tester/covoar/ReportsHtml.cc | 1183 +++++++++++++++++-------------------------
>  tester/covoar/ReportsHtml.h  |  141 ++---
>  tester/covoar/ReportsText.cc |  348 ++++++-------
>  tester/covoar/ReportsText.h  |   75 ++-
>  6 files changed, 1041 insertions(+), 1387 deletions(-)
> 
> diff --git a/tester/covoar/ReportsBase.cc b/tester/covoar/ReportsBase.cc
> index 328980d..3041df2 100644
> --- a/tester/covoar/ReportsBase.cc
> +++ b/tester/covoar/ReportsBase.cc
> @@ -4,6 +4,9 @@
>  #include <sys/stat.h>
>  #include <sys/types.h>
>  
> +#include <iomanip>
> +#include <sstream>
> +
>  #include "ReportsBase.h"
>  #include "app_common.h"
>  #include "CoverageRanges.h"
> @@ -20,10 +23,12 @@
>  
>  namespace Coverage {
>  
> -ReportsBase::ReportsBase( time_t timestamp, std::string symbolSetName ):
> -  reportExtension_m(""),
> -  symbolSetName_m(symbolSetName),
> -  timestamp_m( timestamp )
> +ReportsBase::ReportsBase(
> +  time_t             timestamp,
> +  const std::string& symbolSetName
> +): reportExtension_m( "" ),
> +   symbolSetName_m( symbolSetName ),
> +   timestamp_m(  timestamp  )
>  {
>  }
>  
> @@ -31,14 +36,14 @@ ReportsBase::~ReportsBase()
>  {
>  }
>  
> -FILE* ReportsBase::OpenFile(
> -  const char* const fileName,
> -  const char* const symbolSetName
> +std::ofstream* ReportsBase::OpenFile(

A raw pointer anywhere is a possible source of a leak and with exceptions it is
hard to track all possible paths.

> +  const std::string& fileName,
> +  const std::string& symbolSetName

Would having ...

     std::ostream& aFile

as a referenced arguement work?

>  )
>  {
> -  int          sc;
> -  FILE        *aFile;
> -  std::string  file;
> +  int            sc;
> +  std::ofstream* aFile = new std::ofstream;

Please consider std::shared_ptr<> or std::unique_ptr<> for pointers or just
avoid using them which I find simpler.

> +  std::string    file;
>  
>    std::string symbolSetOutputDirectory;
>    rld::path::path_join(
> @@ -51,136 +56,110 @@ FILE* ReportsBase::OpenFile(
>  #ifdef _WIN32
>    sc = _mkdir( symbolSetOutputDirectory );
>  #else
> -  sc = mkdir( symbolSetOutputDirectory.c_str(),0755 );
> +  sc = mkdir( symbolSetOutputDirectory.c_str(), 0755 );
>  #endif
> -  if ( (sc == -1) && (errno != EEXIST) ) {
> -    fprintf(
> -      stderr,
> -      "Unable to create output directory %s\n",
> -      symbolSetOutputDirectory.c_str()
> -    );
> +  if ( ( sc == -1 ) && ( errno != EEXIST ) ) {
> +    std::cerr << "Unable to create output directory "
> +              << symbolSetOutputDirectory << "\n";

Please do not use "\n", please use std::endl.

Why not throw an exception?

>      return NULL;

NULL should be nullptr in C++ but if this becomes 'void' it can be removed.

>    }
>  
>    file = symbolSetOutputDirectory;
> -  rld::path::path_join(file, fileName, file);
> +  rld::path::path_join( file, fileName, file );
>  
>    // Open the file.
> -  aFile = fopen( file.c_str(), "w" );
> -  if ( !aFile ) {
> -    fprintf( stderr, "Unable to open %s\n", file.c_str() );
> +  aFile->open( file );
> +  if ( !aFile->is_open() ) {
> +    std::cerr << "Unable to open " << file << "\n";
>    }
> +
>    return aFile;
>  }
>  
> -void ReportsBase::WriteIndex(
> -  const char* const fileName
> -)
> +void ReportsBase::WriteIndex( const std::string& fileName )
>  {
>  }
>  
> -FILE* ReportsBase::OpenAnnotatedFile(
> -  const char* const fileName
> -)
> +std::ofstream* ReportsBase::OpenAnnotatedFile( const std::string& fileName )

.. and here ..

>  {
> -  return OpenFile(fileName, symbolSetName_m.c_str());
> +  return OpenFile( fileName, symbolSetName_m );
>  }
>  
> -FILE* ReportsBase::OpenBranchFile(
> -  const char* const fileName,
> -  bool              hasBranches
> +std::ofstream* ReportsBase::OpenBranchFile(

... and here ...

> +  const std::string& fileName,
> +  bool               hasBranches
>  )
>  {
> -  return OpenFile(fileName, symbolSetName_m.c_str());
> +  return OpenFile( fileName, symbolSetName_m );
>  }
>  
> -FILE* ReportsBase::OpenCoverageFile(
> -  const char* const fileName
> -)
> +std::ofstream* ReportsBase::OpenCoverageFile( const std::string& fileName )
>  {
> -  return OpenFile(fileName, symbolSetName_m.c_str());
> +  return OpenFile( fileName, symbolSetName_m );
>  }
>  
> -FILE* ReportsBase::OpenNoRangeFile(
> -  const char* const fileName
> -)
> +std::ofstream* ReportsBase::OpenNoRangeFile( const std::string& fileName )
>  {
> -  return OpenFile(fileName, symbolSetName_m.c_str());
> +  return OpenFile( fileName, symbolSetName_m );
>  }
>  
>  
> -FILE* ReportsBase::OpenSizeFile(
> -  const char* const fileName
> -)
> +std::ofstream* ReportsBase::OpenSizeFile( const std::string& fileName )
>  {
> -  return OpenFile(fileName, symbolSetName_m.c_str());
> +  return OpenFile( fileName, symbolSetName_m );
>  }
>  
> -FILE* ReportsBase::OpenSymbolSummaryFile(
> -  const char* const fileName
> +std::ofstream* ReportsBase::OpenSymbolSummaryFile(
> +  const std::string& fileName
>  )
>  {
> -  return OpenFile(fileName, symbolSetName_m.c_str());
> +  return OpenFile( fileName, symbolSetName_m );
>  }
>  
> -void ReportsBase::CloseFile(
> -  FILE*  aFile
> -)
> +void ReportsBase::CloseFile( std::ofstream* aFile )
>  {
> -  fclose( aFile );
> +  aFile->close();
>  }
>  
> -void ReportsBase::CloseAnnotatedFile(
> -  FILE*  aFile
> -)
> +void ReportsBase::CloseAnnotatedFile( std::ofstream* aFile )
>  {
>    CloseFile( aFile );
>  }
>  
> -void ReportsBase::CloseBranchFile(
> -  FILE*  aFile,
> -  bool   hasBranches
> -)
> +void ReportsBase::CloseBranchFile( std::ofstream* aFile, bool hasBranches )
>  {
>    CloseFile( aFile );
>  }
>  
> -void  ReportsBase::CloseCoverageFile(
> -  FILE*  aFile
> -)
> +void  ReportsBase::CloseCoverageFile( std::ofstream* aFile )
>  {
>    CloseFile( aFile );
>  }
>  
> -void  ReportsBase::CloseNoRangeFile(
> -  FILE*  aFile
> -)
> +void  ReportsBase::CloseNoRangeFile( std::ofstream* aFile )
>  {
>    CloseFile( aFile );
>  }
>  
> -void  ReportsBase::CloseSizeFile(
> -  FILE*  aFile
> -)
> +void  ReportsBase::CloseSizeFile( std::ofstream* aFile )
>  {
>    CloseFile( aFile );
>  }
>  
> -void  ReportsBase::CloseSymbolSummaryFile(
> -  FILE*  aFile
> -)
> +void  ReportsBase::CloseSymbolSummaryFile( std::ofstream* aFile )
>  {
>    CloseFile( aFile );
>  }
>  
> -std::string expand_tabs(const std::string& in) {
> +std::string  expand_tabs( const std::string& in )
> +{
>    std::string expanded = "";
> -  int i = 0;
> +  int         i = 0;
>  
> -  for (char c : in) {
> -    if (c == '\t') {
> -      int num_tabs = 4 - (i % 4);
> -      expanded.append(num_tabs, ' ');
> +  for ( char c : in ) {
> +    if ( c == '\t' ) {
> +      int num_tabs = 4 - ( i % 4 );
> +      expanded.append( num_tabs, ' ' );
>        i += num_tabs;
>      } else {
>        expanded += c;
> @@ -194,62 +173,69 @@ std::string expand_tabs(const std::string& in) {
>  /*
>   *  Write annotated report
>   */
> -void ReportsBase::WriteAnnotatedReport(
> -  const char* const fileName
> -) {
> -  FILE*                      aFile = NULL;
> -  Coverage::CoverageRanges*  theBranches;
> -  Coverage::CoverageRanges*  theRanges;
> -  Coverage::CoverageMapBase* theCoverageMap = NULL;
> -  uint32_t                   bAddress = 0;
> -  AnnotatedLineState_t       state;
> -
> -  aFile = OpenAnnotatedFile(fileName);
> -  if (!aFile)
> +void ReportsBase::WriteAnnotatedReport( const std::string& fileName )
> +{
> +  std::ofstream*              aFile = NULL;
> +  Coverage::CoverageRanges*   theBranches;
> +  Coverage::CoverageRanges*   theRanges;
> +  Coverage::CoverageMapBase*  theCoverageMap = NULL;
> +  uint32_t                    bAddress = 0;
> +  AnnotatedLineState_t        state;
> +
> +  aFile = OpenAnnotatedFile( fileName );

Any exceptions possible in the code below? Using an instance and a reference to
Open works.

> +  if ( !aFile->is_open() ) {

Ouch ... if the open fails nullptr is returned and anyway throwing an exception
would be better.

>      return;
> +  }
>  
>    // Process uncovered branches for each symbol.
> -  const std::vector<std::string>& symbols = SymbolsToAnalyze->getSymbolsForSet(symbolSetName_m);
> +  const std::vector<std::string>& symbols =
> +    SymbolsToAnalyze->getSymbolsForSet( symbolSetName_m );
>  
> -  for (const auto& symbol : symbols) {
> -    const SymbolInformation& info = SymbolsToAnalyze->allSymbols().at(symbol);
> +  for ( const auto& symbol : symbols ) {
> +    const SymbolInformation& info =
> +      SymbolsToAnalyze->allSymbols().at( symbol );
>  
>      // If uncoveredRanges and uncoveredBranches don't exist, then the
>      // symbol was never referenced by any executable.  Just skip it.
> -    if ((info.uncoveredRanges == NULL) &&
> -        (info.uncoveredBranches == NULL))
> +    if ( ( info.uncoveredRanges == NULL ) &&
> +         ( info.uncoveredBranches == NULL ) )
>        continue;
>  
>      // If uncoveredRanges and uncoveredBranches are empty, then everything
>      // must have been covered for this symbol.  Just skip it.
> -    if ((info.uncoveredRanges->set.empty()) &&
> -        (info.uncoveredBranches->set.empty()))
> +    if ( ( info.uncoveredRanges->set.empty() ) &&
> +         ( info.uncoveredBranches->set.empty() ) )
>        continue;
>  
>      theCoverageMap = info.unifiedCoverageMap;
> -    bAddress = info.baseAddress;
> -    theRanges = info.uncoveredRanges;
> -    theBranches = info.uncoveredBranches;
> +    bAddress       = info.baseAddress;
> +    theRanges      = info.uncoveredRanges;
> +    theBranches    = info.uncoveredBranches;
>  
>      // Add annotations to each line where necessary
>      AnnotatedStart( aFile );
> -    for (const auto& instruction : info.instructions) {
> -      uint32_t           id = 0;
> -      std::string        annotation = "";
> -      std::string        line;
> -      const std::size_t  LINE_LENGTH = 150;
> -      char               textLine[LINE_LENGTH];
> +    for ( const auto& instruction : info.instructions ) {
> +      uint32_t          id = 0;
> +      std::string       annotation = "";
> +      std::string       line;
> +      const std::size_t LINE_LENGTH = 150;
> +      std::stringstream ss;
> +      std::string       textLine = "";
>  
>        state = A_SOURCE;
>  
>        if ( instruction.isInstruction ) {
> -        if (!theCoverageMap->wasExecuted( instruction.address - bAddress )){
> +        if ( !theCoverageMap->wasExecuted( instruction.address - bAddress ) ) {
>            annotation = "<== NOT EXECUTED";
>            state = A_NEVER_EXECUTED;
>            id = theRanges->getId( instruction.address );
> -        } else if (theCoverageMap->isBranch( instruction.address - bAddress )) {
> +        } else if (
> +          theCoverageMap->isBranch( instruction.address - bAddress )
> +        ) {
>            id = theBranches->getId( instruction.address );
> -          if (theCoverageMap->wasAlwaysTaken( instruction.address - bAddress )){
> +          if (
> +            theCoverageMap->wasAlwaysTaken( instruction.address - bAddress )
> +          ) {
>              annotation = "<== ALWAYS TAKEN";
>              state = A_BRANCH_TAKEN;
>            } else if (
> @@ -263,11 +249,16 @@ void ReportsBase::WriteAnnotatedReport(
>          }
>        }
>  
> -      std::string textLineWithoutTabs = expand_tabs(instruction.line);
> -      snprintf( textLine, LINE_LENGTH, "%-90s", textLineWithoutTabs.c_str() );
> +      std::string textLineWithoutTabs = expand_tabs( instruction.line );
> +
> +      ss << std::left << std::setw( 90 )
> +         << textLineWithoutTabs.c_str();
> +
> +      textLine = ss.str().substr( 0, LINE_LENGTH );
> +
>        line = textLine + annotation;
>  
> -      PutAnnotatedLine( aFile, state, line, id);
> +      PutAnnotatedLine( aFile, state, line, id );
>      }
>  
>      AnnotatedEnd( aFile );

Delete of aFile?

> @@ -279,37 +270,39 @@ void ReportsBase::WriteAnnotatedReport(
>  /*
>   *  Write branch report
>   */
> -void ReportsBase::WriteBranchReport(
> -  const char* const fileName
> -) {
> -  FILE*                     report = NULL;
> +void ReportsBase::WriteBranchReport( const std::string& fileName )
> +{
> +  std::ofstream*            report = NULL;

same again

>    Coverage::CoverageRanges* theBranches;
>    unsigned int              count;
>    bool                      hasBranches = true;
>  
> -  if ((SymbolsToAnalyze->getNumberBranchesFound(symbolSetName_m) == 0) ||
> -      (BranchInfoAvailable == false) )
> +  if ( ( SymbolsToAnalyze->getNumberBranchesFound( symbolSetName_m ) == 0 ) ||
> +       ( BranchInfoAvailable == false ) )
>       hasBranches = false;
>  
>    // Open the branch report file
>    report = OpenBranchFile( fileName, hasBranches );
> -  if (!report)
> +  if ( !report ) {
>      return;
> +  }
>  
>    // If no branches were found then branch coverage is not supported
> -  if ((SymbolsToAnalyze->getNumberBranchesFound(symbolSetName_m) != 0) &&
> -      (BranchInfoAvailable == true) ) {
> +  if ( ( SymbolsToAnalyze->getNumberBranchesFound( symbolSetName_m ) != 0 ) &&
> +       ( BranchInfoAvailable == true ) ) {
>      // Process uncovered branches for each symbol in the set.
> -    const std::vector<std::string>& symbols = SymbolsToAnalyze->getSymbolsForSet(symbolSetName_m);
> +    const std::vector<std::string>& symbols =
> +      SymbolsToAnalyze->getSymbolsForSet( symbolSetName_m );
>  
>      count = 0;
> -    for (const auto& symbol : symbols) {
> -      const SymbolInformation& info = SymbolsToAnalyze->allSymbols().at(symbol);
> +    for ( const auto& symbol : symbols ) {
> +      const SymbolInformation& info =
> +        SymbolsToAnalyze->allSymbols().at( symbol );
>  
>        theBranches = info.uncoveredBranches;
>  
> -      if (theBranches && !theBranches->set.empty()) {
> -        for (const auto& range : theBranches->set) {
> +      if ( theBranches && !theBranches->set.empty() ) {
> +        for ( const auto& range : theBranches->set ) {
>            count++;
>            PutBranchEntry( report, count, symbol, info, range );
>          }
> @@ -323,21 +316,19 @@ void ReportsBase::WriteBranchReport(
>  /*
>   *  Write coverage report
>   */
> -void ReportsBase::WriteCoverageReport(
> -  const char* const fileName
> -)
> +void ReportsBase::WriteCoverageReport( const std::string& fileName )
>  {
> -  FILE*                     report;
> -  Coverage::CoverageRanges* theRanges;
> -  unsigned int              count;
> -  FILE*                     NoRangeFile;
> -  std::string               NoRangeName;
> +  std::ofstream*             report;
> +  Coverage::CoverageRanges*  theRanges;
> +  unsigned int               count;
> +  std::ofstream*             NoRangeFile;
> +  std::string                NoRangeName;
>  
>    // Open special file that captures NoRange informaiton
>    NoRangeName = "no_range_";
>    NoRangeName +=  fileName;
> -  NoRangeFile = OpenNoRangeFile ( NoRangeName.c_str() );
> -  if (!NoRangeFile) {
> +  NoRangeFile = OpenNoRangeFile( NoRangeName.c_str() );
> +  if ( !NoRangeFile ) {
>      return;
>    }
>  
> @@ -348,11 +339,13 @@ void ReportsBase::WriteCoverageReport(
>    }
>  
>    // Process uncovered ranges for each symbol.
> -  const std::vector<std::string>& symbols = SymbolsToAnalyze->getSymbolsForSet(symbolSetName_m);
> +  const std::vector<std::string>& symbols =
> +    SymbolsToAnalyze->getSymbolsForSet( symbolSetName_m );
>  
>    count = 0;
> -  for (const auto& symbol : symbols) {
> -    const SymbolInformation& info = SymbolsToAnalyze->allSymbols().at(symbol);
> +  for ( const auto& symbol : symbols ) {
> +    const SymbolInformation& info =
> +      SymbolsToAnalyze->allSymbols().at( symbol );
>  
>      theRanges = info.uncoveredRanges;
>  
> @@ -360,11 +353,11 @@ void ReportsBase::WriteCoverageReport(
>      // referenced by any executable.  There may be a problem with the
>      // desired symbols list or with the executables so put something
>      // in the report.
> -    if (theRanges == NULL) {
> +    if ( theRanges == NULL ) {
>        putCoverageNoRange( report, NoRangeFile, count, symbol );
>        count++;
> -    }  else if (!theRanges->set.empty()) {
> -      for (const auto& range : theRanges->set) {
> +    }  else if ( !theRanges->set.empty() ) {
> +      for ( const auto& range : theRanges->set ) {
>          PutCoverageLine( report, count, symbol, info, range );
>          count++;
>        }
> @@ -373,17 +366,14 @@ void ReportsBase::WriteCoverageReport(
>  
>    CloseNoRangeFile( NoRangeFile );
>    CloseCoverageFile( report );
> -
>  }
>  
>  /*
>   * Write size report
>   */
> -void ReportsBase::WriteSizeReport(
> -  const char* const fileName
> -)
> +void ReportsBase::WriteSizeReport( const std::string& fileName )
>  {
> -  FILE*                     report;
> +  std::ofstream*            report;

same again

>    Coverage::CoverageRanges* theRanges;
>    unsigned int              count;
>  
> @@ -394,16 +384,18 @@ void ReportsBase::WriteSizeReport(
>    }
>  
>    // Process uncovered ranges for each symbol.
> -  const std::vector<std::string>& symbols = SymbolsToAnalyze->getSymbolsForSet(symbolSetName_m);
> +  const std::vector<std::string>& symbols =
> +    SymbolsToAnalyze->getSymbolsForSet( symbolSetName_m );
>  
>    count = 0;
> -  for (const auto& symbol : symbols) {
> -    const SymbolInformation& info = SymbolsToAnalyze->allSymbols().at(symbol);
> +  for ( const auto& symbol : symbols ) {
> +    const SymbolInformation& info =
> +      SymbolsToAnalyze->allSymbols().at( symbol );
>  
>      theRanges = info.uncoveredRanges;
>  
> -    if (theRanges && !theRanges->set.empty()) {
> -      for (const auto& range : theRanges->set) {
> +    if ( theRanges && !theRanges->set.empty() ) {
> +      for ( const auto& range : theRanges->set ) {
>          PutSizeLine( report, count, symbol, range );
>          count++;
>        }
> @@ -413,12 +405,10 @@ void ReportsBase::WriteSizeReport(
>    CloseSizeFile( report );
>  }
>  
> -void ReportsBase::WriteSymbolSummaryReport(
> -  const char* const fileName
> -)
> +void ReportsBase::WriteSymbolSummaryReport( const std::string& fileName )
>  {
> -  FILE*                                           report;
> -  unsigned int                                    count;
> +  std::ofstream* report;

and again

> +  unsigned int   count;
>  
>    // Open the report file.
>    report = OpenSymbolSummaryFile( fileName );
> @@ -427,11 +417,13 @@ void ReportsBase::WriteSymbolSummaryReport(
>    }
>  
>    // Process each symbol.
> -  const std::vector<std::string>& symbols = SymbolsToAnalyze->getSymbolsForSet(symbolSetName_m);
> +  const std::vector<std::string>& symbols =
> +    SymbolsToAnalyze->getSymbolsForSet( symbolSetName_m );
>  
>    count = 0;
> -  for (const auto& symbol : symbols) {
> -    const SymbolInformation& info = SymbolsToAnalyze->allSymbols().at(symbol);
> +  for ( const auto& symbol : symbols ) {
> +    const SymbolInformation& info =
> +      SymbolsToAnalyze->allSymbols().at( symbol );
>  
>      PutSymbolSummaryLine( report, count, symbol, info );
>      count++;
> @@ -441,42 +433,43 @@ void ReportsBase::WriteSymbolSummaryReport(
>  }
>  
>  void  ReportsBase::WriteSummaryReport(
> -  const char* const fileName,
> -  const char* const symbolSetName
> +  const std::string& fileName,
> +  const std::string& symbolSetName
>  )
>  {
>      // Calculate coverage statistics and output results.
> -  uint32_t                                        a;
> -  uint32_t                                        endAddress;
> -  uint32_t                                        notExecuted = 0;
> -  double                                          percentage;
> -  double                                          percentageBranches;
> -  Coverage::CoverageMapBase*                      theCoverageMap;
> -  uint32_t                                        totalBytes = 0;
> -  FILE*                                           report;
> +  uint32_t                   a;
> +  uint32_t                   endAddress;
> +  uint32_t                   notExecuted = 0;
> +  double                     percentage;
> +  double                     percentageBranches;
> +  Coverage::CoverageMapBase* theCoverageMap;
> +  uint32_t                   totalBytes = 0;
> +  std::ofstream*             report;

here as well

>  
>    // Open the report file.
>    report = OpenFile( fileName, symbolSetName );
> -  if ( !report ) {
> +  if ( !report->is_open() ) {
>      return;
>    }
>  
>    // Look at each symbol.
> -  const std::vector<std::string>& symbols = SymbolsToAnalyze->getSymbolsForSet(symbolSetName);
> +  const std::vector<std::string>& symbols =
> +    SymbolsToAnalyze->getSymbolsForSet( symbolSetName );
>  
> -  for (const auto& symbol : symbols) {
> -    SymbolInformation info = SymbolsToAnalyze->allSymbols().at(symbol);
> +  for ( const auto& symbol : symbols ) {
> +    SymbolInformation info = SymbolsToAnalyze->allSymbols().at( symbol );

A change like this means I need to carefully check each piece to see if it is
just white space. It would be helpful if you could please avoid white space
changes when making code changes that would be a big help when reviewing. Thanks.

I will wait for a V2 patch before I checking remainder in detail.

Chris

>      // If the symbol's unified coverage map exists, scan through it
>      // and count bytes.
>      theCoverageMap = info.unifiedCoverageMap;
> -    if (theCoverageMap) {
> +    if ( theCoverageMap ) {
>  
>        endAddress = info.stats.sizeInBytes - 1;
>  
> -      for (a = 0; a <= endAddress; a++) {
> +      for ( a = 0; a <= endAddress; a++ ) {
>          totalBytes++;
> -        if (!theCoverageMap->wasExecuted( a ))
> +        if ( !theCoverageMap->wasExecuted( a ) )
>            notExecuted++;
>        }
>      }
> @@ -489,75 +482,58 @@ void  ReportsBase::WriteSummaryReport(
>    }
>  
>    percentageBranches = (double) (
> -    SymbolsToAnalyze->getNumberBranchesAlwaysTaken(symbolSetName) +
> -      SymbolsToAnalyze->getNumberBranchesNeverTaken(symbolSetName) +
> -      (SymbolsToAnalyze->getNumberBranchesNotExecuted(symbolSetName) * 2)
> +    SymbolsToAnalyze->getNumberBranchesAlwaysTaken( symbolSetName ) +
> +    SymbolsToAnalyze->getNumberBranchesNeverTaken( symbolSetName ) +
> +  ( SymbolsToAnalyze->getNumberBranchesNotExecuted( symbolSetName ) * 2 )
>    );
>    percentageBranches /=
> -    (double) SymbolsToAnalyze->getNumberBranchesFound(symbolSetName) * 2;
> +    (double) SymbolsToAnalyze->getNumberBranchesFound( symbolSetName ) * 2;
>    percentageBranches *= 100.0;
>  
> -  fprintf( report, "Bytes Analyzed                   : %d\n", totalBytes );
> -  fprintf( report, "Bytes Not Executed               : %d\n", notExecuted );
> -  fprintf( report, "Percentage Executed              : %5.4g\n", 100.0 - percentage  );
> -  fprintf( report, "Percentage Not Executed          : %5.4g\n", percentage  );
> -  fprintf(
> -    report,
> -    "Unreferenced Symbols             : %d\n",
> -    SymbolsToAnalyze->getNumberUnreferencedSymbols(symbolSetName)
> -  );
> -  fprintf(
> -    report,
> -    "Uncovered ranges found           : %d\n\n",
> -    SymbolsToAnalyze->getNumberUncoveredRanges(symbolSetName)
> -  );
> -  if ((SymbolsToAnalyze->getNumberBranchesFound(symbolSetName) == 0) ||
> -      (BranchInfoAvailable == false) ) {
> -    fprintf( report, "No branch information available\n" );
> +  (*report) << "Bytes Analyzed                   : " << totalBytes << "\n"
> +            << "Bytes Not Executed               : " << notExecuted << "\n"
> +            << "Percentage Executed              : "
> +            << std::fixed << std::setprecision( 2 ) << std::setw( 5 )
> +            << 100.0 - percentage << "\n"
> +            << "Percentage Not Executed          : " << percentage << "\n"
> +            << "Unreferenced Symbols             : "
> +            << SymbolsToAnalyze->getNumberUnreferencedSymbols( symbolSetName )
> +            << "\nUncovered ranges found           : "
> +            << SymbolsToAnalyze->getNumberUncoveredRanges( symbolSetName )
> +            << "\n\n";
> +
> +  if ( ( SymbolsToAnalyze->getNumberBranchesFound( symbolSetName ) == 0 ) ||
> +       ( BranchInfoAvailable == false ) ) {
> +
> +    (*report) << "No branch information available\n";
> +
>    } else {
> -    fprintf(
> -      report,
> -      "Total conditional branches found : %d\n",
> -      SymbolsToAnalyze->getNumberBranchesFound(symbolSetName)
> -    );
> -    fprintf(
> -      report,
> -      "Total branch paths found         : %d\n",
> -      SymbolsToAnalyze->getNumberBranchesFound(symbolSetName) * 2
> -    );
> -    fprintf(
> -      report,
> -      "Uncovered branch paths found     : %d\n",
> -      SymbolsToAnalyze->getNumberBranchesAlwaysTaken(symbolSetName) +
> -       SymbolsToAnalyze->getNumberBranchesNeverTaken(symbolSetName) +
> -       (SymbolsToAnalyze->getNumberBranchesNotExecuted(symbolSetName) * 2)
> -    );
> -    fprintf(
> -      report,
> -      "   %d branches always taken\n",
> -      SymbolsToAnalyze->getNumberBranchesAlwaysTaken(symbolSetName)
> -    );
> -    fprintf(
> -      report,
> -      "   %d branches never taken\n",
> -      SymbolsToAnalyze->getNumberBranchesNeverTaken(symbolSetName)
> -    );
> -    fprintf(
> -      report,
> -      "   %d branch paths not executed\n",
> -      SymbolsToAnalyze->getNumberBranchesNotExecuted(symbolSetName) * 2
> -    );
> -    fprintf(
> -      report,
> -      "Percentage branch paths covered  : %4.4g\n",
> -      100.0 - percentageBranches
> -    );
> +
> +    (*report) << "Total conditional branches found : "
> +              << SymbolsToAnalyze->getNumberBranchesFound( symbolSetName )
> +              << "\nTotal branch paths found         : "
> +              << SymbolsToAnalyze->getNumberBranchesFound( symbolSetName ) * 2
> +              << "\nUncovered branch paths found     : "
> +              << SymbolsToAnalyze->getNumberBranchesAlwaysTaken( symbolSetName ) +
> +                 SymbolsToAnalyze->getNumberBranchesNeverTaken( symbolSetName ) +
> +                 ( SymbolsToAnalyze->getNumberBranchesNotExecuted( symbolSetName ) * 2 )
> +              << "\n   "
> +              << SymbolsToAnalyze->getNumberBranchesAlwaysTaken( symbolSetName )
> +              << " branches always taken\n   "
> +              << SymbolsToAnalyze->getNumberBranchesNeverTaken( symbolSetName )
> +              << " branches never taken\n   "
> +              << SymbolsToAnalyze->getNumberBranchesNotExecuted( symbolSetName ) * 2
> +              << " branch paths not executed\n"
> +              << "Percentage branch paths covered  : "
> +              << std::fixed << std::setprecision( 2 ) << std::setw( 4 )
> +              << 100.0 - percentageBranches << "\n";
> +
>    }
>  
> -  fclose( report );
> +  CloseFile( report );
>  }
>  
> -void GenerateReports(const std::string& symbolSetName)
> +void GenerateReports( const std::string& symbolSetName )
>  {
>    typedef std::list<ReportsBase *> reportList_t;
>  
> @@ -565,68 +541,69 @@ void GenerateReports(const std::string& symbolSetName)
>    reportList_t::iterator ritr;
>    std::string            reportName;
>    ReportsBase*           reports;
> +  time_t                 timestamp;
>  
> -  time_t timestamp;
>  
> +  timestamp = time( NULL ); /* get current cal time */
>  
> -  timestamp = time(NULL); /* get current cal time */
> -  reports = new ReportsText(timestamp, symbolSetName);
> -  reportList.push_back(reports);
> -  reports = new ReportsHtml(timestamp, symbolSetName);
> -  reportList.push_back(reports);
> +  reports = new ReportsText( timestamp, symbolSetName );
> +  reportList.push_back( reports );
>  
> -  for (ritr = reportList.begin(); ritr != reportList.end(); ritr++ ) {
> +  reports = new ReportsHtml( timestamp, symbolSetName );
> +  reportList.push_back( reports );
> +
> +  for ( ritr = reportList.begin(); ritr != reportList.end(); ritr++ ) {
>      reports = *ritr;
>  
>      reportName = "index" + reports->ReportExtension();
> -    if (Verbose)
> -      fprintf(
> -        stderr, "Generate %s\n", reportName.c_str()
> -      );
> -    reports->WriteIndex( reportName.c_str() );
> +    if ( Verbose ) {
> +      std::cerr << "Generate " << reportName << "\n";
> +    }
> +
> +    reports->WriteIndex( reportName );
>  
>      reportName = "annotated" + reports->ReportExtension();
> -    if (Verbose)
> -      fprintf(
> -        stderr, "Generate %s\n", reportName.c_str()
> -      );
> -    reports->WriteAnnotatedReport( reportName.c_str() );
> +    if ( Verbose ) {
> +      std::cerr << "Generate " << reportName << "\n";
> +    }
> +
> +    reports->WriteAnnotatedReport( reportName );
>  
>      reportName = "branch" + reports->ReportExtension();
> -    if (Verbose)
> -      fprintf(
> -        stderr, "Generate %s\n", reportName.c_str()
> -      );
> -    reports->WriteBranchReport(reportName.c_str() );
> +    if ( Verbose ) {
> +      std::cerr << "Generate " << reportName << "\n";
> +    }
> +
> +    reports->WriteBranchReport( reportName );
>  
>      reportName = "uncovered" + reports->ReportExtension();
> -    if (Verbose)
> -      fprintf(
> -        stderr, "Generate %s\n", reportName.c_str()
> -      );
> -    reports->WriteCoverageReport(reportName.c_str() );
> +    if ( Verbose ) {
> +      std::cerr << "Generate " << reportName << "\n";
> +    }
> +
> +    reports->WriteCoverageReport( reportName );
>  
>      reportName = "sizes" + reports->ReportExtension();
> -    if (Verbose)
> -      fprintf(
> -        stderr, "Generate %s\n", reportName.c_str()
> -      );
> -    reports->WriteSizeReport(reportName.c_str() );
> +    if ( Verbose ) {
> +    std::cerr << "Generate " << reportName << "\n";
> +    }
> +
> +    reports->WriteSizeReport( reportName );
>  
>      reportName = "symbolSummary" + reports->ReportExtension();
> -    if (Verbose)
> -      fprintf(
> -        stderr, "Generate %s\n", reportName.c_str()
> -      );
> -    reports->WriteSymbolSummaryReport(reportName.c_str() );
> +    if ( Verbose ) {
> +      std::cerr << "Generate " << reportName << "\n";
> +    }
> +
> +    reports->WriteSymbolSummaryReport( reportName );
>    }
>  
> -  for (ritr = reportList.begin(); ritr != reportList.end(); ritr++ ) {
> +  for ( ritr = reportList.begin(); ritr != reportList.end(); ritr++ ) {
>      reports = *ritr;
>      delete reports;
>    }
>  
> -  ReportsBase::WriteSummaryReport( "summary.txt", symbolSetName.c_str() );
> +  ReportsBase::WriteSummaryReport( "summary.txt", symbolSetName );
>  }
>  
>  }
> diff --git a/tester/covoar/ReportsBase.h b/tester/covoar/ReportsBase.h
> index ab8f8dd..9dfa080 100644
> --- a/tester/covoar/ReportsBase.h
> +++ b/tester/covoar/ReportsBase.h
> @@ -11,6 +11,8 @@
>  
>  #include <stdint.h>
>  #include <string>
> +#include <iostream>
> +#include <fstream>
>  #include <time.h>
>  #include "DesiredSymbols.h"
>  
> @@ -24,7 +26,8 @@ namespace Coverage {
>  class ReportsBase {
>  
>    public:
> -    ReportsBase( time_t timestamp, std::string symbolSetName );
> +    ReportsBase( time_t timestamp, const std::string& symbolSetName );
> +
>      virtual ~ReportsBase();
>  
>      /*!
> @@ -32,9 +35,7 @@ class ReportsBase {
>       *
>       *  @param[in] fileName identifies the report file name
>       */
> -    virtual void WriteIndex(
> -      const char* const fileName
> -    );
> +    virtual void WriteIndex( const std::string& fileName );
>  
>      /*!
>       *  This method produces an annotated assembly listing report containing
> @@ -42,9 +43,7 @@ class ReportsBase {
>       *
>       *  @param[in] fileName identifies the annotated report file name
>       */
> -    void WriteAnnotatedReport(
> -      const char* const fileName
> -    );
> +    void WriteAnnotatedReport( const std::string& fileName );
>  
>      /*!
>       *  This method produces a report that contains information about each
> @@ -52,9 +51,7 @@ class ReportsBase {
>       *
>       *  @param[in] fileName identifies the branch report file name
>       */
> -    void WriteBranchReport(
> -      const char* const fileName
> -    );
> +    void WriteBranchReport( const std::string& fileName );
>  
>      /*!
>       *  This method produces a report that contains information about each
> @@ -62,9 +59,7 @@ class ReportsBase {
>       *
>       *  @param[in] fileName identifies the coverage report file name
>       */
> -    void WriteCoverageReport(
> -      const char* const fileName
> -    );
> +    void WriteCoverageReport( const std::string& fileName );
>  
>      /*!
>       *  This method produces a summary report that lists each uncovered
> @@ -72,9 +67,7 @@ class ReportsBase {
>       *
>       *  @param[in] fileName identifies the report file name
>       */
> -    void WriteSizeReport(
> -      const char* const fileName
> -    );
> +    void WriteSizeReport( const std::string& fileName );
>  
>      /*!
>       *  This method produces a summary report that lists information on
> @@ -82,16 +75,14 @@ class ReportsBase {
>       *
>       *  @param[in] fileName identifies the report file name
>       */
> -    void WriteSymbolSummaryReport(
> -      const char* const fileName
> -    );
> +    void WriteSymbolSummaryReport( const std::string& fileName );
>  
>      /*!
>       *  This method produces a sumary report for the overall test run.
>       */
>      static void  WriteSummaryReport(
> -      const char* const fileName,
> -      const char* const symbolSetName
> +      const std::string& fileName,
> +      const std::string& symbolSetName
>      );
>  
>      /*!
> @@ -136,9 +127,9 @@ class ReportsBase {
>       *  @param[in] fileName identifies the report file name
>       *  @param[in] symbolSetName identifies the name of the report's symbol set
>       */
> -     static FILE* OpenFile(
> -      const char* const fileName,
> -      const char* const symbolSetName
> +    static std::ofstream* OpenFile(
> +      const std::string& fileName,
> +      const std::string& symbolSetName
>      );
>  
>      /*!
> @@ -147,9 +138,7 @@ class ReportsBase {
>       *
>       *  @param[in] fileName identifies the report file name
>       */
> -    virtual FILE* OpenAnnotatedFile(
> -      const char* const fileName
> -    );
> +    virtual std::ofstream* OpenAnnotatedFile( const std::string& fileName );
>  
>      /*!
>       *  This method opens a report file and verifies that it opened.
> @@ -158,9 +147,9 @@ class ReportsBase {
>       *  @param[in] fileName identifies the report file name
>       *  @param[in] hasBranches indicates if there are branches to report
>       */
> -    virtual FILE* OpenBranchFile(
> -      const char* const fileName,
> -      bool              hasBranches
> +    virtual std::ofstream* OpenBranchFile(
> +      const std::string& fileName,
> +      bool               hasBranches
>      );
>  
>      /*!
> @@ -169,9 +158,7 @@ class ReportsBase {
>       *
>       *  @param[in] fileName identifies the report file name
>       */
> -    virtual FILE* OpenCoverageFile(
> -      const char* const fileName
> -    );
> +    virtual std::ofstream* OpenCoverageFile( const std::string& fileName );
>  
>      /*!
>       *  This method opens a report file and verifies that it opened.
> @@ -179,9 +166,7 @@ class ReportsBase {
>       *
>       *  @param[in] fileName identifies the report file name
>       */
> -    virtual FILE* OpenNoRangeFile(
> -      const char* const fileName
> -    );
> +    virtual std::ofstream* OpenNoRangeFile( const std::string& fileName );
>  
>      /*!
>       *  This method opens a report file and verifies that it opened.
> @@ -189,9 +174,7 @@ class ReportsBase {
>       *
>       *  @param[in] fileName identifies the report file name
>       */
> -    virtual FILE* OpenSizeFile(
> -      const char* const fileName
> -    );
> +    virtual std::ofstream* OpenSizeFile( const std::string& fileName );
>  
>      /*!
>       *  This method opens a report file and verifies that it opened.
> @@ -199,8 +182,8 @@ class ReportsBase {
>       *
>       *  @param[in] fileName identifies the report file name
>       */
> -    virtual FILE* OpenSymbolSummaryFile(
> -      const char* const fileName
> +    virtual std::ofstream* OpenSymbolSummaryFile(
> +      const std::string& fileName
>      );
>  
>      /*!
> @@ -208,9 +191,7 @@ class ReportsBase {
>       *
>       *  @param[in] aFile identifies the report file name
>       */
> -    static void CloseFile(
> -      FILE*  aFile
> -    );
> +    static void CloseFile( std::ofstream* aFile );
>  
>      /*!
>       *  This method puts any necessary footer information into
> @@ -218,9 +199,7 @@ class ReportsBase {
>       *
>       *  @param[in] aFile identifies the report file name
>       */
> -    virtual void CloseAnnotatedFile(
> -      FILE*  aFile
> -    );
> +    virtual void CloseAnnotatedFile( std::ofstream* aFile );
>  
>      /*!
>       *  This method puts any necessary footer information into
> @@ -229,10 +208,7 @@ class ReportsBase {
>       *  @param[in] aFile identifies the report file name
>       *  @param[in] hasBranches indicates if there are branches to report
>       */
> -    virtual void CloseBranchFile(
> -      FILE*  aFile,
> -      bool   hasBranches
> -    );
> +    virtual void CloseBranchFile( std::ofstream* aFile, bool hasBranches );
>  
>      /*!
>       *  This method puts any necessary footer information into
> @@ -240,9 +216,7 @@ class ReportsBase {
>       *
>       *  @param[in] aFile identifies the report file name
>       */
> -    virtual void CloseCoverageFile(
> -      FILE*  aFile
> -    );
> +    virtual void CloseCoverageFile( std::ofstream* aFile );
>  
>      /*!
>       *  This method puts any necessary footer information into
> @@ -250,9 +224,7 @@ class ReportsBase {
>       *
>       *  @param[in] aFile identifies the report file name
>       */
> -    void  CloseNoRangeFile(
> -      FILE*  aFile
> -    );
> +    void  CloseNoRangeFile( std::ofstream* aFile );
>  
>      /*!
>       *  This method puts any necessary footer information into
> @@ -260,9 +232,7 @@ class ReportsBase {
>       *
>       *  @param[in] aFile identifies the report file name
>       */
> -    virtual void CloseSizeFile(
> -      FILE*  aFile
> -    );
> +    virtual void CloseSizeFile( std::ofstream* aFile );
>  
>      /*!
>       *  This method puts any necessary footer information into
> @@ -270,9 +240,7 @@ class ReportsBase {
>       *
>       *  @param[in] aFile identifies the report file name
>       */
> -    virtual void CloseSymbolSummaryFile(
> -      FILE*  aFile
> -    );
> +    virtual void CloseSymbolSummaryFile( std::ofstream* aFile );
>  
>      /*!
>       *  This method puts any necessary a line of annotated
> @@ -284,9 +252,9 @@ class ReportsBase {
>       *  @param[in] id identifies the branch or range id.
>       */
>      virtual void PutAnnotatedLine(
> -      FILE*                aFile,
> +      std::ofstream*       aFile,
>        AnnotatedLineState_t state,
> -      std::string          line,
> +      const std::string&   line,
>        uint32_t             id
>      )=0;
>  
> @@ -296,9 +264,7 @@ class ReportsBase {
>       *
>       *  @param[in] aFile identifies the report file name
>       */
> -     virtual void AnnotatedStart(
> -      FILE*                aFile
> -    )=0;
> +    virtual void AnnotatedStart( std::ofstream* aFile )=0;
>  
>      /*!
>       *  This method puts any necessary footer information in
> @@ -306,9 +272,7 @@ class ReportsBase {
>       *
>       *  @param[in] aFile identifies the report file name
>       */
> -     virtual void AnnotatedEnd(
> -      FILE*                aFile
> -    )=0;
> +    virtual void AnnotatedEnd( std::ofstream* aFile )=0;
>  
>  
>      /*!
> @@ -317,9 +281,7 @@ class ReportsBase {
>       *
>       *  @param[in] report identifies the report file name
>       */
> -    virtual bool PutNoBranchInfo(
> -      FILE* report
> -    ) = 0;
> +    virtual bool PutNoBranchInfo( std::ofstream* report )=0;
>  
>      /*!
>       *  This method puts a branch entry into the branch report.
> @@ -331,11 +293,11 @@ class ReportsBase {
>       *  @param[in] range is the range information.
>       */
>      virtual bool PutBranchEntry(
> -      FILE*                                            report,
> -      unsigned int                                     number,
> -      const std::string&                               symbolName,
> -      const SymbolInformation&                         symbolInfo,
> -      const CoverageRanges::coverageRange_t&           range
> +      std::ofstream*                         report,
> +      unsigned int                           number,
> +      const std::string&                     symbolName,
> +      const SymbolInformation&               symbolInfo,
> +      const CoverageRanges::coverageRange_t& range
>      )=0;
>  
>      /*!
> @@ -347,10 +309,10 @@ class ReportsBase {
>       *  @param[in] symbol is a pointer to the symbol information
>       */
>      virtual void putCoverageNoRange(
> -      FILE*        report,
> -      FILE*        noRangeFile,
> -      unsigned int number,
> -      std::string  symbol
> +      std::ofstream*     report,
> +      std::ofstream*     noRangeFile,
> +      unsigned int       number,
> +      const std::string& symbol
>      )=0;
>  
>      /*!
> @@ -363,11 +325,11 @@ class ReportsBase {
>       *  @param[in] range is the range information.
>       */
>      virtual bool PutCoverageLine(
> -      FILE*                                           report,
> -      unsigned int                                    number,
> -      const std::string&                              symbolName,
> -      const SymbolInformation&                        symbolInfo,
> -      const CoverageRanges::coverageRange_t&          range
> +      std::ofstream*                         report,
> +      unsigned int                           number,
> +      const std::string&                     symbolName,
> +      const SymbolInformation&               symbolInfo,
> +      const CoverageRanges::coverageRange_t& range
>      )=0;
>  
>      /*!
> @@ -379,10 +341,10 @@ class ReportsBase {
>       *  @param[in] range is the range information.
>       */
>      virtual bool PutSizeLine(
> -      FILE*                                           report,
> -      unsigned int                                    number,
> -      const std::string&                              symbolName,
> -      const CoverageRanges::coverageRange_t&          range
> +      std::ofstream*                         report,
> +      unsigned int                           number,
> +      const std::string&                     symbolName,
> +      const CoverageRanges::coverageRange_t& range
>      )=0;
>  
>      /*!
> @@ -394,10 +356,10 @@ class ReportsBase {
>       *  @param[in] symbolInfo is the symbol's information.
>       */
>      virtual bool PutSymbolSummaryLine(
> -      FILE*                                           report,
> -      unsigned int                                    number,
> -      const std::string&                              symbolName,
> -      const SymbolInformation&                        symbolInfo
> +      std::ofstream*           report,
> +      unsigned int             number,
> +      const std::string&       symbolName,
> +      const SymbolInformation& symbolInfo
>      )=0;
>  };
>  
> @@ -407,7 +369,7 @@ class ReportsBase {
>   *
>   *  @param[in] symbolSetName is the name of the symbol set to report on.
>   */
> -void GenerateReports(const std::string& symbolSetName);
> +void GenerateReports( const std::string& symbolSetName );
>  
>  }
>  
> diff --git a/tester/covoar/ReportsHtml.cc b/tester/covoar/ReportsHtml.cc
> index fe75cdd..6e4bc7e 100644
> --- a/tester/covoar/ReportsHtml.cc
> +++ b/tester/covoar/ReportsHtml.cc
> @@ -2,6 +2,9 @@
>  #include <stdlib.h>
>  #include <string.h>
>  
> +#include <sstream>
> +#include <iomanip>
> +
>  #include <rld.h>
>  
>  #include "ReportsHtml.h"
> @@ -25,14 +28,16 @@
>     "</tr>\n" \
>     "</tfoot>\n"
>  #else
> -#define TABLE_HEADER_CLASS
> -#define TABLE_FOOTER
> +#define TABLE_HEADER_CLASS ""
> +#define TABLE_FOOTER ""
>  #endif
>  
>  namespace Coverage {
>  
> -  ReportsHtml::ReportsHtml( time_t timestamp, std::string symbolSetName ):
> -    ReportsBase( timestamp, symbolSetName )
> +  ReportsHtml::ReportsHtml(
> +    time_t             timestamp,
> +    const std::string& symbolSetName
> +  ): ReportsBase( timestamp, symbolSetName )
>    {
>      reportExtension_m = ".html";
>    }
> @@ -41,400 +46,309 @@ namespace Coverage {
>    {
>    }
>  
> -  void ReportsHtml::WriteIndex(
> -    const char* const fileName
> -  )
> +  void ReportsHtml::WriteIndex( const std::string& fileName )
>    {
>      #define PRINT_ITEM( _t, _n ) \
> -       fprintf( \
> -         aFile, \
> -         "<li>%s (<a href=\"%s.html\">html</a> or "\
> -         "<a href=\"%s.txt\">text</a>)</li>\n", \
> -        _t, _n, _n );
> +       (*aFile) << "<li>" \
> +                << _t << " (<a href=\"" \
> +                << _n << ".html\">html</a> or <a href=\"" \
> +                << _n << ".txt\">text</a>)</li>\n";
>      #define PRINT_TEXT_ITEM( _t, _n ) \
> -       fprintf( \
> -         aFile, \
> -         "<li>%s (<a href=\"%s\">text</a>)</li>\n", \
> -        _t, _n );
> +       (*aFile) << "<li>" \
> +                << _t << " (<a href=\"" \
> +                << _n << "\">text</a>)</li>\n";
>  
> -    FILE*  aFile;
> +    std::ofstream*  aFile;
>  
>      // Open the file
>      aFile = OpenFile( fileName );
>  
> -    fprintf(
> -      aFile,
> -      "<title>Index</title>\n"
> -      "<div class=\"heading-title\">"
> -    );
> +    (*aFile) << "<title>Index</title>\n"
> +             << "<div class=\"heading-title\">";
>  
> -    if (projectName)
> -      fprintf(
> -        aFile,
> -         "%s<br>",
> -         projectName
> -      );
> -
> -    fprintf(
> -      aFile,
> -      "Coverage Analysis Reports</div>\n"
> -      "<div class =\"datetime\">%s</div>\n",
> -      asctime( localtime(&timestamp_m) )
> -    );
> +    if ( projectName ) {
> +      (*aFile) << projectName << "<br>";
> +    }
>  
> -    fprintf( aFile, "<ul>\n" );
> +    (*aFile) << "Coverage Analysis Reports</div>\n"
> +             << "<div class =\"datetime\">"
> +             <<  asctime( localtime( &timestamp_m ) ) << "</div>\n";
>  
> -    PRINT_TEXT_ITEM( "Summary",         "summary.txt" );
> -    PRINT_ITEM( "Coverage Report",      "uncovered" );
> -    PRINT_ITEM( "Branch Report",        "branch" );
> -    PRINT_ITEM( "Annotated Assembly",   "annotated" );
> -    PRINT_ITEM( "Symbol Summary",       "symbolSummary" );
> -    PRINT_ITEM( "Uncovered Range Size Report",          "sizes" );
> +    (*aFile) << "<ul>\n";
>  
> -    PRINT_TEXT_ITEM( "Explanations Not Found", "ExplanationsNotFound.txt" );
> +    PRINT_TEXT_ITEM( "Summary",                     "summary.txt" );
> +    PRINT_ITEM(      "Coverage Report",             "uncovered" );
> +    PRINT_ITEM(      "Branch Report",               "branch" );
> +    PRINT_ITEM(      "Annotated Assembly",          "annotated" );
> +    PRINT_ITEM(      "Symbol Summary",              "symbolSummary" );
> +    PRINT_ITEM(      "Uncovered Range Size Report", "sizes" );
> +    PRINT_TEXT_ITEM( "Explanations Not Found",      "ExplanationsNotFound.txt" );
>  
> -    fprintf(
> -      aFile,
> -      "</ul>\n"
> -      "<!-- INSERT PROJECT SPECIFIC ITEMS HERE -->\n"
> -      "</html>\n"
> -    );
> +    (*aFile) << "</ul>\n"
> +             << "<!-- INSERT PROJECT SPECIFIC ITEMS HERE -->\n"
> +             << "</html>\n";
>  
>      CloseFile( aFile );
>  
> +    delete aFile;
> +
>      #undef PRINT_ITEM
>      #undef PRINT_TEXT_ITEM
>    }
>  
> -  FILE* ReportsHtml::OpenFile(
> -    const char* const fileName
> -  )
> +  std::ofstream* ReportsHtml::OpenFile( const std::string& fileName )
>    {
> -    FILE*  aFile;
> +    std::ofstream* aFile;
>  
>      // Open the file
> -    aFile = ReportsBase::OpenFile( fileName, symbolSetName_m.c_str() );
> +    aFile = ReportsBase::OpenFile( fileName, symbolSetName_m );
>  
>      // Put Header information on the file
> -    fprintf(
> -      aFile,
> -      "<html>\n"
> -      "<meta http-equiv=\"Content-Language\" content=\"English\" >\n"
> -      "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=us-ascii\" >\n"
> -      "<link rel=\"stylesheet\" type=\"text/css\" href=\"../covoar.css\" media=\"screen\" >\n"
> -      "<script type=\"text/javascript\" src=\"../table.js\"></script>\n"
> -    );
> +    (*aFile) << "<html>\n"
> +             << "<meta http-equiv=\"Content-Language\" content=\"English\" >\n"
> +             << "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=us-ascii\" >\n"
> +             << "<link rel=\"stylesheet\" type=\"text/css\" href=\"../covoar.css\" media=\"screen\" >\n"
> +             << "<script type=\"text/javascript\" src=\"../table.js\"></script>"
> +             << "\n";
>  
>      return aFile;
>    }
>  
> -  FILE* ReportsHtml::OpenAnnotatedFile(
> -    const char* const fileName
> -  )
> +  std::ofstream* ReportsHtml::OpenAnnotatedFile( const std::string& fileName )
>    {
> -    FILE *aFile;
> +    std::ofstream* aFile;
>  
>      // Open the file
> -    aFile = OpenFile(fileName);
> +    aFile = OpenFile( fileName );
>  
> -    fprintf(
> -      aFile,
> -      "<title>Annotated Report</title>\n"
> -      "<div class=\"heading-title\">"
> -    );
> +    (*aFile) << "<title>Annotated Report</title>\n"
> +             << "<div class=\"heading-title\">";
>  
> -    if (projectName)
> -      fprintf(
> -        aFile,
> -         "%s<br>",
> -         projectName
> -      );
> -
> -    fprintf(
> -      aFile,
> -      "Annotated Report</div>\n"
> -      "<div class =\"datetime\">%s</div>\n"
> -      "<body>\n"
> -      "<pre class=\"code\">\n",
> -      asctime( localtime(&timestamp_m) )
> -    );
> +    if ( projectName ) {
> +      (*aFile) << projectName << "<br>";
> +    }
> +
> +    (*aFile) << "Annotated Report</div>\n"
> +             << "<div class =\"datetime\">"
> +             << asctime( localtime( &timestamp_m ) ) << "</div>\n"
> +             << "<body>\n"
> +             << "<pre class=\"code\">\n";
>  
>      return aFile;
>    }
>  
> -  FILE* ReportsHtml::OpenBranchFile(
> -    const char* const fileName,
> -    bool              hasBranches
> +  std::ofstream* ReportsHtml::OpenBranchFile(
> +    const std::string& fileName,
> +    bool               hasBranches
>    )
>    {
> -    FILE *aFile;
> +    std::ofstream* aFile;
>  
>      // Open the file
> -    aFile = OpenFile(fileName);
> +    aFile = OpenFile( fileName );
>  
>      // Put header information into the file
> -    fprintf(
> -      aFile,
> -      "<title>Branch Report</title>\n"
> -      "<div class=\"heading-title\">"
> -    );
> +    (*aFile) << "<title>Branch Report</title>\n"
> +             << "<div class=\"heading-title\">";
>  
> -    if (projectName)
> -      fprintf(
> -        aFile,
> -        "%s<br>",
> -        projectName
> -      );
> -
> -    fprintf(
> -      aFile,
> -      "Branch Report</div>\n"
> -      "<div class =\"datetime\">%s</div>\n"
> -      "<body>\n"
> -      "<table class=\"covoar table-autosort:0 table-autofilter table-stripeclass:covoar-tr-odd"
> -          TABLE_HEADER_CLASS "\">\n"
> -      "<thead>\n"
> -      "<tr>\n"
> -      "<th class=\"table-sortable:default\" align=\"left\">Symbol</th>\n"
> -      "<th class=\"table-sortable:default\" align=\"left\">Line</th>\n"
> -      "<th class=\"table-filterable table-sortable:default\" align=\"left\">File</th>\n"
> -      "<th class=\"table-sortable:numeric\" align=\"left\">Size <br>Bytes</th>\n"
> -      "<th class=\"table-sortable:default\" align=\"left\">Reason</th>\n"
> -      "<th class=\"table-filterable table-sortable:default\" align=\"left\">Taken</th>\n"
> -      "<th class=\"table-filterable table-sortable:default\" align=\"left\">Not Taken</th>\n"
> -      "<th class=\"table-filterable table-sortable:default\" align=\"left\">Classification</th>\n"
> -      "<th class=\"table-sortable:default\" align=\"left\">Explanation</th>\n"
> -      "</tr>\n"
> -      "</thead>\n"
> -      "<tbody>\n",
> -      asctime( localtime(&timestamp_m) )
> -    );
> +    if ( projectName ) {
> +      (*aFile) << projectName << "<br>";
> +    }
> +
> +    (*aFile) << "Branch Report</div>\n"
> +             << "<div class =\"datetime\">"
> +             << asctime( localtime( &timestamp_m ) ) << "</div>\n"
> +             << "<body>\n"
> +             << "<table class=\"covoar table-autosort:0 table-autofilter table-stripeclass:covoar-tr-odd"
> +             << TABLE_HEADER_CLASS << "\">\n"
> +             << "<thead>\n"
> +             << "<tr>\n"
> +             << "<th class=\"table-sortable:default\" align=\"left\">Symbol</th>\n"
> +             << "<th class=\"table-sortable:default\" align=\"left\">Line</th>\n"
> +             << "<th class=\"table-filterable table-sortable:default\" align=\"left\">File</th>\n"
> +             << "<th class=\"table-sortable:numeric\" align=\"left\">Size <br>Bytes</th>\n"
> +             << "<th class=\"table-sortable:default\" align=\"left\">Reason</th>\n"
> +             << "<th class=\"table-filterable table-sortable:default\" align=\"left\">Taken</th>\n"
> +             << "<th class=\"table-filterable table-sortable:default\" align=\"left\">Not Taken</th>\n"
> +             << "<th class=\"table-filterable table-sortable:default\" align=\"left\">Classification</th>\n"
> +             << "<th class=\"table-sortable:default\" align=\"left\">Explanation</th>\n"
> +             << "</tr>\n"
> +             << "</thead>\n"
> +             << "<tbody>\n";
>  
>      return aFile;
>    }
>  
> -  FILE*  ReportsHtml::OpenCoverageFile(
> -    const char* const fileName
> -  )
> +  std::ofstream*  ReportsHtml::OpenCoverageFile( const std::string& fileName )
>    {
> -    FILE *aFile;
> +    std::ofstream* aFile;
>  
>      // Open the file
> -    aFile = OpenFile(fileName);
> +    aFile = OpenFile( fileName );
>  
>      // Put header information into the file
> -    fprintf(
> -      aFile,
> -        "<title>Coverage Report</title>\n"
> -        "<div class=\"heading-title\">"
> -    );
> +    (*aFile) << "<title>Coverage Report</title>\n"
> +             << "<div class=\"heading-title\">";
>  
> -    if (projectName)
> -      fprintf(
> -        aFile,
> -        "%s<br>",
> -        projectName
> -      );
> -
> -    fprintf(
> -      aFile,
> -       "Coverage Report</div>\n"
> -       "<div class =\"datetime\">%s</div>\n"
> -       "<body>\n"
> -       "<table class=\"covoar table-autosort:0 table-autofilter table-stripeclass:covoar-tr-odd"
> -           TABLE_HEADER_CLASS "\">\n"
> -      "<thead>\n"
> -      "<tr>\n"
> -      "<th class=\"table-sortable:default\" align=\"left\">Symbol</th>\n"
> -      "<th class=\"table-sortable:default\" align=\"left\">Range</th>\n"
> -      "<th class=\"table-filterable table-sortable:default\" align=\"left\">File</th>\n"
> -      "<th class=\"table-sortable:numeric\" align=\"left\">Size <br>Bytes</th>\n"
> -      "<th class=\"table-sortable:numeric\" align=\"left\">Size <br>Instructions</th>\n"
> -      "<th class=\"table-filterable table-sortable:default\" align=\"left\">Classification</th>\n"
> -      "<th class=\"table-sortable:default\" align=\"left\">Explanation</th>\n"
> -      "</tr>\n"
> -      "</thead>\n"
> -      "<tbody>\n",
> -        asctime( localtime(&timestamp_m) )
> -
> -     );
> +    if ( projectName ) {
> +      (*aFile) << projectName << "<br>";
> +    }
> +
> +    (*aFile) << "Coverage Report</div>\n"
> +             << "<div class =\"datetime\">"
> +             << asctime( localtime( &timestamp_m ) ) << "</div>\n"
> +             << "<body>\n"
> +             << "<table class=\"covoar table-autosort:0 table-autofilter table-stripeclass:covoar-tr-odd"
> +             << TABLE_HEADER_CLASS << "\">\n"
> +             << "<thead>\n"
> +             << "<tr>\n"
> +             << "<th class=\"table-sortable:default\" align=\"left\">Symbol</th>\n"
> +             << "<th class=\"table-sortable:default\" align=\"left\">Range</th>\n"
> +             << "<th class=\"table-filterable table-sortable:default\" align=\"left\">File</th>\n"
> +             << "<th class=\"table-sortable:numeric\" align=\"left\">Size <br>Bytes</th>\n"
> +             << "<th class=\"table-sortable:numeric\" align=\"left\">Size <br>Instructions</th>\n"
> +             << "<th class=\"table-filterable table-sortable:default\" align=\"left\">Classification</th>\n"
> +             << "<th class=\"table-sortable:default\" align=\"left\">Explanation</th>\n"
> +             << "</tr>\n"
> +             << "</thead>\n"
> +             << "<tbody>\n";
>  
>      return aFile;
>    }
>  
> -  FILE* ReportsHtml::OpenNoRangeFile(
> -    const char* const fileName
> -  )
> +  std::ofstream* ReportsHtml::OpenNoRangeFile( const std::string& fileName )
>    {
> -    FILE *aFile;
> +    std::ofstream*  aFile;
>  
>      // Open the file
> -    aFile = OpenFile(fileName);
> +    aFile = OpenFile( fileName );
>  
>      // Put header information into the file
> -    fprintf(
> -      aFile,
> -        "<title> Report</title>\n"
> -        "<div class=\"heading-title\">"
> -    );
> +    (*aFile) << "<title> Report</title>\n"
> +             << "<div class=\"heading-title\">";
> +
> +    if ( projectName ) {
> +      (*aFile) << projectName << "<br>";
> +    }
>  
> -    if (projectName)
> -      fprintf(
> -        aFile,
> -        "%s<br>",
> -        projectName
> -      );
> -
> -    fprintf(
> -      aFile,
> -       "No Range Report</div>\n"
> -       "<div class =\"datetime\">%s</div>\n"
> -        "<body>\n"
> -      "<table class=\"covoar table-autosort:0 table-autofilter table-stripeclass:covoar-tr-odd"
> -           TABLE_HEADER_CLASS "\">\n"
> -      "<thead>\n"
> -      "<tr>\n"
> -      "<th class=\"table-sortable:default\" align=\"left\">Symbol</th>\n"
> -      "</tr>\n"
> -      "</thead>\n"
> -      "<tbody>\n",
> -        asctime( localtime(&timestamp_m) )
> -
> -     );
> +    (*aFile) << "No Range Report</div>\n"
> +             << "<div class =\"datetime\">"
> +             << asctime( localtime( &timestamp_m ) ) << "</div>\n"
> +             << "<body>\n"
> +             << "<table class=\"covoar table-autosort:0 table-autofilter table-stripeclass:covoar-tr-odd"
> +             << TABLE_HEADER_CLASS << "\">\n"
> +             << "<thead>\n"
> +             << "<tr>\n"
> +             << "<th class=\"table-sortable:default\" align=\"left\">Symbol</th>\n"
> +             << "</tr>\n"
> +             << "</thead>\n"
> +             << "<tbody>\n";
>  
>      return aFile;
>     }
>  
>  
>  
> -  FILE*  ReportsHtml::OpenSizeFile(
> -    const char* const fileName
> -  )
> +  std::ofstream* ReportsHtml::OpenSizeFile( const std::string& fileName )
>    {
> -    FILE *aFile;
> +    std::ofstream* aFile;
>  
>      // Open the file
> -    aFile = OpenFile(fileName);
> +    aFile = OpenFile( fileName );
>  
>      // Put header information into the file
> -    fprintf(
> -      aFile,
> -      "<title>Uncovered Range Size Report</title>\n"
> -        "<div class=\"heading-title\">"
> -    );
> +    (*aFile) << "<title>Uncovered Range Size Report</title>\n"
> +          << "<div class=\"heading-title\">";
> +
> +    if ( projectName ) {
> +      (*aFile) << projectName << "<br>";
> +    }
>  
> -    if (projectName)
> -      fprintf(
> -        aFile,
> -        "%s<br>",
> -        projectName
> -      );
> -
> -    fprintf(
> -      aFile,
> -      "Uncovered Range Size Report</div>\n"
> -       "<div class =\"datetime\">%s</div>\n"
> -      "<body>\n"
> -      "<table class=\"covoar table-autosort:0 table-autofilter table-stripeclass:covoar-tr-odd"
> -           TABLE_HEADER_CLASS "\">\n"
> -      "<thead>\n"
> -      "<tr>\n"
> -      "<th class=\"table-sortable:numeric\" align=\"left\">Size</th>\n"
> -      "<th class=\"table-sortable:default\" align=\"left\">Symbol</th>\n"
> -      "<th class=\"table-sortable:default\" align=\"left\">Line</th>\n"
> -      "<th class=\"table-filterable table-sortable:default\" align=\"left\">File</th>\n"
> -      "</tr>\n"
> -      "</thead>\n"
> -      "<tbody>\n",
> -        asctime( localtime(&timestamp_m) )
> +    (*aFile) << "Uncovered Range Size Report</div>\n"
> +             << "<div class =\"datetime\">"
> +             << asctime( localtime( &timestamp_m ) ) << "</div>\n"
> +             << "<body>\n"
> +             << "<table class=\"covoar table-autosort:0 table-autofilter table-stripeclass:covoar-tr-odd"
> +             << TABLE_HEADER_CLASS << "\">\n"
> +             << "<thead>\n"
> +             << "<tr>\n"
> +             << "<th class=\"table-sortable:numeric\" align=\"left\">Size</th>\n"
> +             << "<th class=\"table-sortable:default\" align=\"left\">Symbol</th>\n"
> +             << "<th class=\"table-sortable:default\" align=\"left\">Line</th>\n"
> +             << "<th class=\"table-filterable table-sortable:default\" align=\"left\">File</th>\n"
> +             << "</tr>\n"
> +             << "</thead>\n"
> +             << "<tbody>\n";
>  
> -    );
>      return aFile;
>    }
>  
> -  FILE*  ReportsHtml::OpenSymbolSummaryFile(
> -    const char* const fileName
> +  std::ofstream* ReportsHtml::OpenSymbolSummaryFile(
> +    const std::string& fileName
>    )
>    {
> -    FILE *aFile;
> +    std::ofstream* aFile;
>  
>      // Open the file
> -    aFile = OpenFile(fileName);
> +    aFile = OpenFile( fileName );
>  
>      // Put header information into the file
> -    fprintf(
> -      aFile,
> -      "<title>Symbol Summary Report</title>\n"
> -      "<div class=\"heading-title\">"
> -    );
> +    (*aFile) << "<title>Symbol Summary Report</title>\n"
> +             << "<div class=\"heading-title\">";
>  
> -    if (projectName)
> -      fprintf(
> -        aFile,
> -        "%s<br>",
> -        projectName
> -      );
> -
> -    fprintf(
> -      aFile,
> -      "Symbol Summary Report</div>\n"
> -       "<div class =\"datetime\">%s</div>\n"
> -      "<body>\n"
> -      "<table class=\"covoar table-autosort:0 table-autofilter table-stripeclass:covoar-tr-odd"
> -           TABLE_HEADER_CLASS "\">\n"
> -      "<thead>\n"
> -      "<tr>\n"
> -      "<th class=\"table-sortable:default\" align=\"center\">Symbol</th>\n"
> -      "<th class=\"table-sortable:numeric\" align=\"center\">Total<br>Size<br>Bytes</th>\n"
> -      "<th class=\"table-sortable:numeric\" align=\"center\">Total<br>Size<br>Instr</th>\n"
> -      "<th class=\"table-sortable:numeric\" align=\"center\">#<br>Ranges</th>\n"
> -      "<th class=\"table-sortable:numeric\" align=\"center\">Uncovered<br>Size<br>Bytes</th>\n"
> -      "<th class=\"table-sortable:numeric\" align=\"center\">Uncovered<br>Size<br>Instr</th>\n"
> -      "<th class=\"table-sortable:numeric\" align=\"center\">#<br>Branches</th>\n"
> -      "<th class=\"table-sortable:numeric\" align=\"center\">#<br>Always<br>Taken</th>\n"
> -      "<th class=\"table-sortable:numeric\" align=\"center\">#<br>Never<br>Taken</th>\n"
> -      "<th class=\"table-sortable:numeric\" align=\"center\">Percent<br>Uncovered<br>Instructions</th>\n"
> -      "<th class=\"table-sortable:numeric\" align=\"center\">Percent<br>Uncovered<br>Bytes</th>\n"
> -      "</tr>\n"
> -      "</thead>\n"
> -      "<tbody>\n",
> -        asctime( localtime(&timestamp_m) )
> +    if ( projectName ) {
> +      (*aFile) << projectName << "<br>";
> +    }
> +
> +    (*aFile) << "Symbol Summary Report</div>\n"
> +             << "<div class =\"datetime\">"
> +             << asctime( localtime( &timestamp_m ) ) << "</div>\n"
> +             << "<body>\n"
> +             << "<table class=\"covoar table-autosort:0 table-autofilter table-stripeclass:covoar-tr-odd"
> +             << TABLE_HEADER_CLASS << "\">\n"
> +             << "<thead>\n"
> +             << "<tr>\n"
> +             << "<th class=\"table-sortable:default\" align=\"center\">Symbol</th>\n"
> +             << "<th class=\"table-sortable:numeric\" align=\"center\">Total<br>Size<br>Bytes</th>\n"
> +             << "<th class=\"table-sortable:numeric\" align=\"center\">Total<br>Size<br>Instr</th>\n"
> +             << "<th class=\"table-sortable:numeric\" align=\"center\">#<br>Ranges</th>\n"
> +             << "<th class=\"table-sortable:numeric\" align=\"center\">Uncovered<br>Size<br>Bytes</th>\n"
> +             << "<th class=\"table-sortable:numeric\" align=\"center\">Uncovered<br>Size<br>Instr</th>\n"
> +             << "<th class=\"table-sortable:numeric\" align=\"center\">#<br>Branches</th>\n"
> +             << "<th class=\"table-sortable:numeric\" align=\"center\">#<br>Always<br>Taken</th>\n"
> +             << "<th class=\"table-sortable:numeric\" align=\"center\">#<br>Never<br>Taken</th>\n"
> +             << "<th class=\"table-sortable:numeric\" align=\"center\">Percent<br>Uncovered<br>Instructions</th>\n"
> +             << "<th class=\"table-sortable:numeric\" align=\"center\">Percent<br>Uncovered<br>Bytes</th>\n"
> +             << "</tr>\n"
> +             << "</thead>\n"
> +             << "<tbody>\n";
>  
> -    );
>      return aFile;
>    }
>  
> -  void ReportsHtml::AnnotatedStart(
> -    FILE*                aFile
> -  )
> +  void ReportsHtml::AnnotatedStart( std::ofstream* aFile )
>    {
> -    fprintf(
> -      aFile,
> -      "<hr>\n"
> -    );
> +    (*aFile) << "<hr>\n";
>    }
>  
> -  void ReportsHtml::AnnotatedEnd(
> -    FILE*                aFile
> -  )
> +  void ReportsHtml::AnnotatedEnd( std::ofstream* aFile )
>    {
>    }
>  
>    void ReportsHtml::PutAnnotatedLine(
> -    FILE*                aFile,
> +    std::ofstream*       aFile,
>      AnnotatedLineState_t state,
> -    std::string          line,
> +    const std::string&   line,
>      uint32_t             id
>    )
>    {
>      std::string stateText;
> -    char        number[10];
> -
> +    std::string number;
>  
> -    sprintf(number,"%d", id);
> +    number = std::to_string( id );
>  
>      // Set the stateText based upon the current state.
> -    switch (state) {
> +    switch ( state ) {
>        case  A_SOURCE:
>          stateText = "</pre>\n<pre class=\"code\">\n";
>          break;
> @@ -460,7 +374,7 @@ namespace Coverage {
>          stateText += "\"></a><pre class=\"codeNeverTaken\">\n";
>          break;
>        default:
> -        throw rld::error( "Unknown state", "ReportsHtml::PutAnnotatedLine");
> +        throw rld::error( "Unknown state", "ReportsHtml::PutAnnotatedLine" );
>          break;
>      }
>  
> @@ -468,40 +382,43 @@ namespace Coverage {
>      // format.  If it has changed close out the old format and open up the
>      // new format.
>      if ( state != lastState_m ) {
> -      fprintf( aFile, "%s", stateText.c_str() );
> +      (*aFile) << stateText;
>        lastState_m = state;
>      }
>  
>      // For all the characters in the line replace html reserved special
>      // characters and output the line. Note that for a /pre block this
>      // is only a '<' symbol.
> -    for (unsigned int i=0; i<line.size(); i++ ) {
> -      if ( line[i] == '<' )
> -        fprintf( aFile, "<" );
> -      else
> -        fprintf( aFile, "%c", line[i] );
> +    for ( unsigned int i = 0; i < line.size(); i++ ) {
> +      if ( line[i] == '<' ) {
> +        (*aFile) << "<";
> +      } else {
> +        (*aFile) << line[i];
> +      }
>      }
> -    fprintf( aFile, "\n");
> +
> +    (*aFile) << "\n";
>    }
>  
> -  bool ReportsHtml::PutNoBranchInfo(
> -    FILE* report
> -  )
> +  bool ReportsHtml::PutNoBranchInfo( std::ofstream* report )
>    {
> -    if (BranchInfoAvailable &&
> -      SymbolsToAnalyze->getNumberBranchesFound(symbolSetName_m) != 0)
> -      fprintf( report, "All branch paths taken.\n" );
> -    else
> -      fprintf( report, "No branch information found.\n" );
> +    if ( BranchInfoAvailable &&
> +         SymbolsToAnalyze->getNumberBranchesFound( symbolSetName_m ) != 0
> +    ) {
> +      (*report) << "All branch paths taken." << "\n";
> +    } else {
> +      (*report) << "No branch information found." << "\n";
> +    }
> +
>      return true;
>    }
>  
>    bool ReportsHtml::PutBranchEntry(
> -    FILE*                                            report,
> -    unsigned int                                     count,
> -    const std::string&                               symbolName,
> -    const SymbolInformation&                         symbolInfo,
> -    const CoverageRanges::coverageRange_t&           range
> +    std::ofstream*                         report,
> +    unsigned int                           count,
> +    const std::string&                     symbolName,
> +    const SymbolInformation&               symbolInfo,
> +    const CoverageRanges::coverageRange_t& range
>    )
>    {
>      const Coverage::Explanation* explanation;
> @@ -512,125 +429,110 @@ namespace Coverage {
>      Coverage::CoverageMapBase*   theCoverageMap = NULL;
>  
>      // Mark the background color different for odd and even lines.
> -    if ( ( count%2 ) != 0 )
> -      fprintf( report, "<tr class=\"covoar-tr-odd\">\n");
> -    else
> -      fprintf( report, "<tr>\n");
> +    if ( ( count % 2 ) != 0 ) {
> +      (*report) << "<tr class=\"covoar-tr-odd\">\n";
> +    } else {
> +      (*report) << "<tr>\n";
> +    }
>  
>      // symbol
> -    fprintf(
> -      report,
> -      "<td class=\"covoar-td\" align=\"center\">%s</td>\n",
> -      symbolName.c_str()
> -    );
> +    (*report) << "<td class=\"covoar-td\" align=\"center\">"
> +              << symbolName << "</td>\n";
>  
>      // line
> -    fprintf(
> -      report,
> -      "<td class=\"covoar-td\" align=\"center\"><a href =\"annotated.html#range%d\">%s</td>\n",
> -      range.id,
> -      range.lowSourceLine.c_str()
> -    );
> +    (*report) << "<td class=\"covoar-td\" align=\"center\"><a href =\"annotated.html#range"
> +              << range.id << "\">"
> +              << range.lowSourceLine << "</td>\n";
>  
>      // File
> -    i = range.lowSourceLine.find(":");
> -    temp =  range.lowSourceLine.substr (0, i);
> -    fprintf(
> -      report,
> -      "<td class=\"covoar-td\" align=\"center\">%s</td>\n",
> -      temp.c_str()
> -    );
> +    i = range.lowSourceLine.find( ":" );
> +    temp =  range.lowSourceLine.substr( 0, i );
> +
> +    (*report) << "<td class=\"covoar-td\" align=\"center\">"
> +              << temp << "</td>\n";
>  
>      // Size in bytes
> -    fprintf(
> -      report,
> -      "<td class=\"covoar-td\" align=\"center\">%d</td>\n",
> -      range.highAddress - range.lowAddress + 1
> -    );
> +    (*report) << "<td class=\"covoar-td\" align=\"center\">"
> +              << range.highAddress - range.lowAddress + 1 << "</td>\n";
>  
>      // Reason Branch was uncovered
> -    if (range.reason ==
> -      Coverage::CoverageRanges::UNCOVERED_REASON_BRANCH_ALWAYS_TAKEN)
> -      fprintf(
> -        report,
> -        "<td class=\"covoar-td\" align=\"center\">Always Taken</td>\n"
> -      );
> -    else if (range.reason ==
> -      Coverage::CoverageRanges::UNCOVERED_REASON_BRANCH_NEVER_TAKEN)
> -      fprintf(
> -        report,
> -        "<td class=\"covoar-td\" align=\"center\">Never Taken</td>\n"
> -      );
> +    if (
> +      range.reason ==
> +      Coverage::CoverageRanges::UNCOVERED_REASON_BRANCH_ALWAYS_TAKEN
> +    ) {
> +      (*report) << "<td class=\"covoar-td\" align=\"center\">Always Taken</td>"
> +                << "\n";
> +    } else if (
> +      range.reason ==
> +      Coverage::CoverageRanges::UNCOVERED_REASON_BRANCH_NEVER_TAKEN
> +    ) {
> +      (*report) << "<td class=\"covoar-td\" align=\"center\">Never Taken</td>"
> +                << "\n";
> +    }
>  
>      // Taken / Not taken counts
> -    lowAddress = range.lowAddress;
> -    bAddress = symbolInfo.baseAddress;
> +    lowAddress     = range.lowAddress;
> +    bAddress       = symbolInfo.baseAddress;
>      theCoverageMap = symbolInfo.unifiedCoverageMap;
> -    fprintf(
> -      report,
> -      "<td class=\"covoar-td\" align=\"center\">%d</td>\n",
> -      theCoverageMap->getWasTaken( lowAddress - bAddress )
> -    );
> -        fprintf(
> -      report,
> -      "<td class=\"covoar-td\" align=\"center\">%d</td>\n",
> -      theCoverageMap->getWasNotTaken( lowAddress - bAddress )
> -    );
> +
> +    (*report) << "<td class=\"covoar-td\" align=\"center\">"
> +              << theCoverageMap->getWasTaken( lowAddress - bAddress )
> +              << "</td>\n"
> +              << "<td class=\"covoar-td\" align=\"center\">"
> +              << theCoverageMap->getWasNotTaken( lowAddress - bAddress )
> +              << "</td>" << "\n";
>  
>      // See if an explanation is available and write the Classification and
>      // the Explination Columns.
>      explanation = AllExplanations->lookupExplanation( range.lowSourceLine );
>      if ( !explanation ) {
>        // Write Classificationditr->second.baseAddress
> -      fprintf(
> -        report,
> -        "<td class=\"covoar-td\" align=\"center\">NONE</td>\n"
> -        "<td class=\"covoar-td\" align=\"center\">No Explanation</td>\n"
> -      );
> +      (*report) << "<td class=\"covoar-td\" align=\"center\">NONE</td>\n"
> +                << "<td class=\"covoar-td\" align=\"center\">No Explanation</td>"
> +                << "\n";
>      } else {
> -      char explanationFile[48];
> -      sprintf( explanationFile, "explanation%d.html", range.id );
> -      fprintf(
> -        report,
> -        "<td class=\"covoar-td\" align=\"center\">%s</td>\n"
> -        "<td class=\"covoar-td\" align=\"center\">"
> -        "<a href=\"%s\">Explanation</a></td>\n",
> -        explanation->classification.c_str(),
> -        explanationFile
> -      );
> -      WriteExplationFile( explanationFile, explanation );
> +      std::stringstream explanationFile( "explanation" );
> +      explanationFile << range.id << ".html";
> +
> +      (*report) << "<td class=\"covoar-td\" align=\"center\">"
> +                << explanation->classification << "</td>\n"
> +                << "<td class=\"covoar-td\" align=\"center\">"
> +                << "<a href=\"" << explanationFile.str()
> +                << "\">Explanation</a></td>" << "\n";
> +
> +      WriteExplanationFile( explanationFile.str(), explanation );
>      }
>  
> -    fprintf( report, "</tr>\n");
> +    (*report) << "</tr>\n";
>  
>      return true;
>    }
>  
> -  bool ReportsHtml::WriteExplationFile(
> -    const char*                  fileName,
> +  bool ReportsHtml::WriteExplanationFile(
> +    const std::string&           fileName,
>      const Coverage::Explanation* explanation
>    )
>    {
> -    FILE* report;
> +    std::ofstream* report;
>  
>      report = OpenFile( fileName );
>  
> -    for ( unsigned int i=0 ; i < explanation->explanation.size(); i++) {
> -      fprintf(
> -        report,
> -        "%s\n",
> -        explanation->explanation[i].c_str()
> -      );
> +    for ( unsigned int i = 0; i < explanation->explanation.size(); i++ ) {
> +      (*report) << explanation->explanation[i] << "\n";
>      }
> +
>      CloseFile( report );
> +
> +    delete report;
> +
>      return true;
>    }
>  
>    void ReportsHtml::putCoverageNoRange(
> -    FILE*         report,
> -    FILE*         noRangeFile,
> -    unsigned int  count,
> -    std::string   symbol
> +    std::ofstream*     report,
> +    std::ofstream*     noRangeFile,
> +    unsigned int       count,
> +    const std::string& symbol
>    )
>    {
>      Coverage::Explanation explanation;
> @@ -645,425 +547,320 @@ namespace Coverage {
>      );
>  
>      // Mark the background color different for odd and even lines.
> -    if ( ( count%2 ) != 0 ){
> -      fprintf( report, "<tr class=\"covoar-tr-odd\">\n");
> -      fprintf( noRangeFile,  "<tr class=\"covoar-tr-odd\">\n");
> +    if ( ( count % 2 ) != 0 ) {
> +      (*report) << "<tr class=\"covoar-tr-odd\">" << "\n";
> +      (*noRangeFile) << "<tr class=\"covoar-tr-odd\">" << "\n";
>      } else {
> -      fprintf( report, "<tr>\n");
> -      fprintf( noRangeFile,  "<tr>\n");
> +      (*report) << "<tr>\n";
> +      (*noRangeFile) << "<tr>\n";
>      }
>  
>      // symbol
> -    fprintf(
> -      report,
> -      "<td class=\"covoar-td\" align=\"center\">%s</td>\n",
> -      symbol.c_str()
> -    );
> -    fprintf(
> -      noRangeFile,
> -      "<td class=\"covoar-td\" align=\"center\">%s</td>\n",
> -      symbol.c_str()
> -    );
> +    (*report) << "<td class=\"covoar-td\" align=\"center\">"
> +              << symbol << "</td>\n";
> +    (*noRangeFile) << "<td class=\"covoar-td\" align=\"center\">"
> +                   << symbol << "</td>\n";
>  
>      // starting line
> -    fprintf(
> -      report,
> -      "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
> -     );
> +    (*report) << "<td class=\"covoar-td\" align=\"center\">unknown</td>\n";
>  
>      // file
> -    fprintf(
> -      report,
> -      "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
> -     );
> +    (*report) << "<td class=\"covoar-td\" align=\"center\">unknown</td>\n";
>  
>       // Size in bytes
> -    fprintf(
> -      report,
> -      "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
> -    );
> +    (*report) << "<td class=\"covoar-td\" align=\"center\">unknown</td>\n";
>  
>      // Size in instructions
> -    fprintf(
> -      report,
> -      "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
> -    );
> +    (*report) << "<td class=\"covoar-td\" align=\"center\">unknown</td>\n";
>  
>      // See if an explanation is available
> -    fprintf(
> -      report,
> -      "<td class=\"covoar-td\" align=\"center\">Unknown</td>\n"
> -      "<td class=\"covoar-td\" align=\"center\">"
> -      "<a href=\"NotReferenced.html\">No data</a></td>\n"
> -    );
> -    WriteExplationFile( "NotReferenced.html", &explanation );
> +    (*report) << "<td class=\"covoar-td\" align=\"center\">Unknown</td>\n"
> +              << "<td class=\"covoar-td\" align=\"center\">"
> +              << "<a href=\"NotReferenced.html\">No data</a></td>\n";
>  
> -    fprintf( report, "</tr>\n");
> -    fprintf( noRangeFile, "</tr>\n");
> +    WriteExplanationFile( "NotReferenced.html", &explanation );
> +
> +    (*report) << "</tr>\n";
> +    (*noRangeFile) << "</tr>\n";
>    }
>  
>    bool ReportsHtml::PutCoverageLine(
> -    FILE*                                            report,
> -    unsigned int                                     count,
> -    const std::string&                               symbolName,
> -    const SymbolInformation&                         symbolInfo,
> -    const CoverageRanges::coverageRange_t&           range
> +    std::ofstream*                         report,
> +    unsigned int                           count,
> +    const std::string&                     symbolName,
> +    const SymbolInformation&               symbolInfo,
> +    const CoverageRanges::coverageRange_t& range
>    )
>    {
> -    const Coverage::Explanation*   explanation;
> -    std::string                    temp;
> -    int                            i;
> +    const Coverage::Explanation* explanation;
> +    std::string                  temp;
> +    int                          i;
>  
>      // Mark the background color different for odd and even lines.
> -    if ( ( count%2 ) != 0 )
> -      fprintf( report, "<tr class=\"covoar-tr-odd\">\n");
> -    else
> -      fprintf( report, "<tr>\n");
> +    if ( ( count % 2 ) != 0 ) {
> +      (*report) << "<tr class=\"covoar-tr-odd\">\n";
> +    } else {
> +      (*report) << "<tr>\n";
> +    }
>  
>      // symbol
> -    fprintf(
> -      report,
> -      "<td class=\"covoar-td\" align=\"center\">%s</td>\n",
> -      symbolName.c_str()
> -    );
> +    (*report) << "<td class=\"covoar-td\" align=\"center\">"
> +              << symbolName << "</td>\n";
>  
>      // Range
> -    fprintf(
> -      report,
> -      "<td class=\"covoar-td\" align=\"center\"><a href =\"annotated.html#range%d\">%s <br>%s</td>\n",
> -      range.id,
> -      range.lowSourceLine.c_str(),
> -      range.highSourceLine.c_str()
> -     );
> +    (*report) << "<td class=\"covoar-td\" align=\"center\"><a href =\"annotated.html#range"
> +              << range.id << "\">"
> +              << range.lowSourceLine << " <br>"
> +              << range.highSourceLine << "</td>\n";
>  
>      // File
> -    i = range.lowSourceLine.find(":");
> -    temp =  range.lowSourceLine.substr (0, i);
> -    fprintf(
> -      report,
> -      "<td class=\"covoar-td\" align=\"center\">%s</td>\n",
> -      temp.c_str()
> -    );
> +    i = range.lowSourceLine.find( ":" );
> +    temp = range.lowSourceLine.substr( 0, i );
> +
> +    (*report) << "<td class=\"covoar-td\" align=\"center\">"
> +              << temp << "</td>\n";
>  
>      // Size in bytes
> -    fprintf(
> -      report,
> -      "<td class=\"covoar-td\" align=\"center\">%d</td>\n",
> -      range.highAddress - range.lowAddress + 1
> -    );
> +    (*report) << "<td class=\"covoar-td\" align=\"center\">"
> +              << range.highAddress - range.lowAddress + 1 << "</td>\n";
>  
>      // Size in instructions
> -    fprintf(
> -      report,
> -      "<td class=\"covoar-td\" align=\"center\">%d</td>\n",
> -      range.instructionCount
> -    );
> +    (*report) << "<td class=\"covoar-td\" align=\"center\">"
> +              << range.instructionCount << "</td>\n";
>  
>      // See if an explanation is available
>      explanation = AllExplanations->lookupExplanation( range.lowSourceLine );
>      if ( !explanation ) {
> -      fprintf(
> -        report,
> -        "<td class=\"covoar-td\" align=\"center\">NONE</td>\n"
> -      );
> -      fprintf(
> -        report,
> -        "<td class=\"covoar-td\" align=\"center\">No Explanation</td>\n"
> -      );
> +      (*report) << "<td class=\"covoar-td\" align=\"center\">NONE</td>\n"
> +                << "<td class=\"covoar-td\" align=\"center\">No Explanation</td>"
> +                << "\n";
>      } else {
> -      char explanationFile[48];
> -
> -      sprintf( explanationFile, "explanation%d.html", range.id );
> -      fprintf(
> -        report,
> -        "<td class=\"covoar-td\" align=\"center\">%s</td>\n"
> -        "<td class=\"covoar-td\" align=\"center\">"
> -        "<a href=\"%s\">Explanation</a></td>\n",
> -        explanation->classification.c_str(),
> -        explanationFile
> -      );
> -      WriteExplationFile( explanationFile, explanation );
> +      std::stringstream explanationFile( "explanation" );
> +
> +      explanationFile << range.id << ".html";
> +
> +      (*report) << "<td class=\"covoar-td\" align=\"center\">"
> +                << explanation->classification << "</td>\n"
> +                << "<td class=\"covoar-td\" align=\"center\">"
> +                << "<a href=\""
> +                << explanationFile.str() << "\">Explanation</a></td>\n";
> +
> +      WriteExplanationFile( explanationFile.str(), explanation );
>      }
>  
> -    fprintf( report, "</tr>\n");
> +    (*report) << "</tr>\n";
>  
>      return true;
>    }
>  
>    bool  ReportsHtml::PutSizeLine(
> -    FILE*                                           report,
> -    unsigned int                                    count,
> -    const std::string&                              symbolName,
> -    const CoverageRanges::coverageRange_t&          range
> +    std::ofstream*                         report,
> +    unsigned int                           count,
> +    const std::string&                     symbolName,
> +    const CoverageRanges::coverageRange_t& range
>    )
>    {
> -    std::string  temp;
> -    int          i;
> +    std::string temp;
> +    int         i;
>  
>      // Mark the background color different for odd and even lines.
> -    if ( ( count%2 ) != 0 )
> -      fprintf( report, "<tr class=\"covoar-tr-odd\">\n");
> -    else
> -      fprintf( report, "<tr>\n");
> +    if ( ( count % 2 ) != 0 ) {
> +      (*report) << "<tr class=\"covoar-tr-odd\">\n";
> +    } else {
> +      (*report) << "<tr>\n";
> +    }
>  
>      // size
> -    fprintf(
> -      report,
> -      "<td class=\"covoar-td\" align=\"center\">%d</td>\n",
> -      range.highAddress - range.lowAddress + 1
> -    );
> +    (*report) << "<td class=\"covoar-td\" align=\"center\">"
> +              << range.highAddress - range.lowAddress + 1 << "</td>\n";
>  
>      // symbol
> -    fprintf(
> -      report,
> -      "<td class=\"covoar-td\" align=\"center\">%s</td>\n",
> -      symbolName.c_str()
> -    );
> +    (*report) << "<td class=\"covoar-td\" align=\"center\">"
> +              << symbolName << "</td>\n";
>  
>      // line
> -    fprintf(
> -      report,
> -      "<td class=\"covoar-td\" align=\"center\"><a href =\"annotated.html#range%d\">%s</td>\n",
> -      range.id,
> -      range.lowSourceLine.c_str()
> -    );
> +    (*report) << "<td class=\"covoar-td\" align=\"center\"><a href =\"annotated.html#range"
> +              << range.id << "\">"
> +              << range.lowSourceLine << "</td>\n";
>  
>      // File
> -    i = range.lowSourceLine.find(":");
> -    temp =  range.lowSourceLine.substr (0, i);
> -    fprintf(
> -      report,
> -      "<td class=\"covoar-td\" align=\"center\">%s</td>\n",
> -      temp.c_str()
> -    );
> -
> -    fprintf( report, "</tr>\n");
> +    i = range.lowSourceLine.find( ":" );
> +    temp =  range.lowSourceLine.substr( 0, i );
> +    (*report) << "<td class=\"covoar-td\" align=\"center\">"
> +              << temp << "</td>\n"
> +              << "</tr>\n";
>  
>      return true;
>    }
>  
>    bool  ReportsHtml::PutSymbolSummaryLine(
> -    FILE*                                           report,
> -    unsigned int                                    count,
> -    const std::string&                              symbolName,
> -    const SymbolInformation&                        symbolInfo
> +    std::ofstream*           report,
> +    unsigned int             count,
> +    const std::string&       symbolName,
> +    const SymbolInformation& symbolInfo
>    )
>    {
>  
>      // Mark the background color different for odd and even lines.
> -    if ( ( count%2 ) != 0 )
> -      fprintf( report, "<tr class=\"covoar-tr-odd\">\n");
> -    else
> -      fprintf( report, "<tr>\n");
> +    if ( ( count % 2 ) != 0 ) {
> +      (*report) << "<tr class=\"covoar-tr-odd\">\n";
> +    } else {
> +      (*report) << "<tr>\n";
> +    }
>  
>      // symbol
> -    fprintf(
> -      report,
> -      "<td class=\"covoar-td\" align=\"center\">%s</td>\n",
> -      symbolName.c_str()
> -    );
> +    (*report) << "<td class=\"covoar-td\" align=\"center\">"
> +              << symbolName << "</td>\n";
>  
> -    if (symbolInfo.stats.sizeInBytes == 0) {
> +    if ( symbolInfo.stats.sizeInBytes == 0 ) {
>        // The symbol has never been seen. Write "unknown" for all columns.
> -      fprintf(
> -        report,
> -        "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
> -        "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
> -        "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
> -        "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
> -        "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
> -        "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
> -        "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
> -        "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
> -        "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
> -        "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
> -      );
> +      (*report) << "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
> +                << "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
> +                << "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
> +                << "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
> +                << "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
> +                << "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
> +                << "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
> +                << "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
> +                << "<td class=\"covoar-td\" align=\"center\">unknown</td>\n"
> +                << "<td class=\"covoar-td\" align=\"center\">unknown</td>\n";
>      } else {
>        // Total Size in Bytes
> -      fprintf(
> -        report,
> -        "<td class=\"covoar-td\" align=\"center\">%d</td>\n",
> -        symbolInfo.stats.sizeInBytes
> -      );
> +      (*report) << "<td class=\"covoar-td\" align=\"center\">"
> +                << symbolInfo.stats.sizeInBytes << "</td>\n";
>  
>        // Total Size in Instructions
> -      fprintf(
> -        report,
> -        "<td class=\"covoar-td\" align=\"center\">%d</td>\n",
> -        symbolInfo.stats.sizeInInstructions
> -      );
> +      (*report) << "<td class=\"covoar-td\" align=\"center\">"
> +                << symbolInfo.stats.sizeInInstructions << "</td>\n";
>  
>        // Total Uncovered Ranges
> -      fprintf(
> -        report,
> -        "<td class=\"covoar-td\" align=\"center\">%d</td>\n",
> -        symbolInfo.stats.uncoveredRanges
> -      );
> +      (*report) << "<td class=\"covoar-td\" align=\"center\">"
> +                << symbolInfo.stats.uncoveredRanges << "</td>\n";
>  
>        // Uncovered Size in Bytes
> -      fprintf(
> -        report,
> -        "<td class=\"covoar-td\" align=\"center\">%d</td>\n",
> -        symbolInfo.stats.uncoveredBytes
> -      );
> +      (*report) << "<td class=\"covoar-td\" align=\"center\">"
> +                << symbolInfo.stats.uncoveredBytes << "</td>\n";
>  
>        // Uncovered Size in Instructions
> -      fprintf(
> -        report,
> -        "<td class=\"covoar-td\" align=\"center\">%d</td>\n",
> -        symbolInfo.stats.uncoveredInstructions
> -      );
> +      (*report) << "<td class=\"covoar-td\" align=\"center\">"
> +                << symbolInfo.stats.uncoveredInstructions << "</td>\n";
>  
>        // Total number of branches
> -      fprintf(
> -        report,
> -        "<td class=\"covoar-td\" align=\"center\">%d</td>\n",
> -        symbolInfo.stats.branchesNotExecuted + symbolInfo.stats.branchesExecuted
> -      );
> +      (*report) << "<td class=\"covoar-td\" align=\"center\">"
> +                << symbolInfo.stats.branchesNotExecuted +
> +                   symbolInfo.stats.branchesExecuted
> +                << "</td>\n";
>  
>        // Total Always Taken
> -      fprintf(
> -        report,
> -        "<td class=\"covoar-td\" align=\"center\">%d</td>\n",
> -        symbolInfo.stats.branchesAlwaysTaken
> -      );
> +      (*report) << "<td class=\"covoar-td\" align=\"center\">"
> +                << symbolInfo.stats.branchesAlwaysTaken << "</td>\n";
>  
>        // Total Never Taken
> -      fprintf(
> -        report,
> -        "<td class=\"covoar-td\" align=\"center\">%d</td>\n",
> -        symbolInfo.stats.branchesNeverTaken
> -      );
> +      (*report) << "<td class=\"covoar-td\" align=\"center\">"
> +                << symbolInfo.stats.branchesNeverTaken << "</td>\n";
>  
>        // % Uncovered Instructions
> -      if ( symbolInfo.stats.sizeInInstructions == 0 )
> -        fprintf(
> -          report,
> -          "<td class=\"covoar-td\" align=\"center\">100.00</td>\n"
> -        );
> -      else
> -        fprintf(
> -          report,
> -          "<td class=\"covoar-td\" align=\"center\">%.2f</td>\n",
> -          (symbolInfo.stats.uncoveredInstructions*100.0)/
> -           symbolInfo.stats.sizeInInstructions
> -        );
> +      if ( symbolInfo.stats.sizeInInstructions == 0 ) {
> +        (*report) << "<td class=\"covoar-td\" align=\"center\">100.00</td>\n";
> +      } else {
> +        (*report) << "<td class=\"covoar-td\" align=\"center\">"
> +                  << std::fixed << std::setprecision( 2 )
> +                  << ( symbolInfo.stats.uncoveredInstructions * 100.0 ) /
> +                       symbolInfo.stats.sizeInInstructions
> +                  << "</td>\n";
> +      }
>  
>        // % Uncovered Bytes
> -      if ( symbolInfo.stats.sizeInBytes == 0 )
> -        fprintf(
> -          report,
> -          "<td class=\"covoar-td\" align=\"center\">100.00</td>\n"
> -        );
> -      else
> -        fprintf(
> -          report,
> -          "<td class=\"covoar-td\" align=\"center\">%.2f</td>\n",
> -          (symbolInfo.stats.uncoveredBytes*100.0)/
> -           symbolInfo.stats.sizeInBytes
> -        );
> +      if ( symbolInfo.stats.sizeInBytes == 0 ) {
> +        (*report) << "<td class=\"covoar-td\" align=\"center\">100.00</td>\n";
> +      } else {
> +        (*report) << "<td class=\"covoar-td\" align=\"center\">"
> +                  << ( symbolInfo.stats.uncoveredBytes * 100.0 ) /
> +                       symbolInfo.stats.sizeInBytes
> +                  << "</td>\n";
> +      }
>      }
>  
> -    fprintf( report, "</tr>\n");
> +    (*report) << "</tr>\n";
> +
>      return true;
>    }
>  
> -  void ReportsHtml::CloseAnnotatedFile(
> -    FILE*  aFile
> -  )
> +  void ReportsHtml::CloseAnnotatedFile( std::ofstream* aFile )
>    {
> -    fprintf(
> -      aFile,
> -      "</pre>\n"
> -      "</body>\n"
> -      "</html>"
> -    );
> +    (*aFile) << "</pre>\n</body>\n</html>";
> +
> +    CloseFile( aFile );
>  
> -    CloseFile(aFile);
> +    delete aFile;
>    }
>  
> -  void ReportsHtml::CloseBranchFile(
> -    FILE*  aFile,
> -    bool   hasBranches
> -  )
> +  void ReportsHtml::CloseBranchFile( std::ofstream* aFile, bool hasBranches )
>    {
> -    fprintf(
> -      aFile,
> -      TABLE_FOOTER
> -      "</tbody>\n"
> -      "</table>\n"
> -    );
> +    (*aFile) << TABLE_FOOTER
> +             << "</tbody>\n"
> +             << "</table>\n";
> +
> +    CloseFile( aFile );
>  
> -    CloseFile(aFile);
> +    delete aFile;
>    }
>  
> -  void ReportsHtml::CloseCoverageFile(
> -    FILE*  aFile
> -  )
> +  void ReportsHtml::CloseCoverageFile( std::ofstream* aFile )
>    {
> -    fprintf(
> -      aFile,
> -      TABLE_FOOTER
> -      "</tbody>\n"
> -      "</table>\n"
> -      "</pre>\n"
> -      "</body>\n"
> -      "</html>"
> -    );
> +    (*aFile) << TABLE_FOOTER
> +             << "</tbody>\n"
> +             << "</table>\n"
> +             << "</pre>\n"
> +             << "</body>\n"
> +             << "</html>";
> +
> +    CloseFile( aFile );
>  
> -    CloseFile(aFile);
> +    delete aFile;
>    }
>  
> -  void ReportsHtml::CloseNoRangeFile(
> -    FILE*  aFile
> -  )
> +  void ReportsHtml::CloseNoRangeFile( std::ofstream* aFile )
>    {
> -    fprintf(
> -      aFile,
> -      TABLE_FOOTER
> -      "</tbody>\n"
> -      "</table>\n"
> -      "</pre>\n"
> -      "</body>\n"
> -      "</html>"
> -    );
> +    (*aFile) << TABLE_FOOTER
> +             << "</tbody>\n"
> +             << "</table>\n"
> +             << "</pre>\n"
> +             << "</body>\n"
> +             << "</html>";
> +
> +    CloseFile( aFile );
>  
> -    CloseFile(aFile);
> +    delete aFile;
>    }
>  
>  
> -  void ReportsHtml::CloseSizeFile(
> -    FILE*  aFile
> -  )
> +  void ReportsHtml::CloseSizeFile( std::ofstream* aFile )
>    {
> -    fprintf(
> -      aFile,
> -      TABLE_FOOTER
> -      "</tbody>\n"
> -      "</table>\n"
> -      "</pre>\n"
> -      "</body>\n"
> -      "</html>"
> -    );
> +    (*aFile) << TABLE_FOOTER
> +             << "</tbody>\n"
> +             << "</table>\n"
> +             << "</pre>\n"
> +             << "</body>\n"
> +             << "</html>";
>  
>      CloseFile( aFile );
> +
> +    delete aFile;
>    }
>  
> -  void ReportsHtml::CloseSymbolSummaryFile(
> -    FILE*  aFile
> -  )
> +  void ReportsHtml::CloseSymbolSummaryFile( std::ofstream* aFile )
>    {
> -    fprintf(
> -      aFile,
> -      TABLE_FOOTER
> -       "</tbody>\n"
> -      "</table>\n"
> -      "</pre>\n"
> -      "</body>\n"
> -      "</html>"
> -    );
> +    (*aFile) << TABLE_FOOTER
> +             << "</tbody>\n"
> +             << "</table>\n"
> +             << "</pre>\n"
> +             << "</body>\n"
> +             << "</html>";
>  
>       CloseFile( aFile );
> +
> +     delete aFile;
>    }
>  
>  }
> diff --git a/tester/covoar/ReportsHtml.h b/tester/covoar/ReportsHtml.h
> index 8d209ae..6144476 100644
> --- a/tester/covoar/ReportsHtml.h
> +++ b/tester/covoar/ReportsHtml.h
> @@ -9,6 +9,9 @@
>  #ifndef __REPORTSHTML_H__
>  #define __REPORTSHTML_H__
>  
> +#include <string>
> +#include <fstream>
> +
>  #include <stdint.h>
>  #include "ReportsBase.h"
>  #include "Explanations.h"
> @@ -22,7 +25,8 @@ namespace Coverage {
>  class ReportsHtml: public ReportsBase {
>  
>    public:
> -    ReportsHtml( time_t timestamp, std::string symbolSetName );
> +    ReportsHtml( time_t timestamp, const std::string& symbolSetName );
> +
>     ~ReportsHtml();
>  
>     /*!
> @@ -30,9 +34,7 @@ class ReportsHtml: public ReportsBase {
>      *
>      *  @param[in] fileName identifies the file name.
>      */
> -   void WriteIndex(
> -     const char* const fileName
> -   );
> +   void WriteIndex( const std::string& fileName );
>  
>     /*!
>      *  This method produces a report that contains information about each
> @@ -40,9 +42,7 @@ class ReportsHtml: public ReportsBase {
>      *
>      *  @param[in] fileName identifies the branch report file name
>      */
> -   void WriteBranchReport(
> -     const char* const fileName
> -   );
> +   void WriteBranchReport( const std::string& fileName );
>  
>     /*!
>      *  This method produces a report that contains information about each
> @@ -50,9 +50,7 @@ class ReportsHtml: public ReportsBase {
>      *
>      *  @param[in] fileName identifies the coverage report file name
>      */
> -   void WriteCoverageReport(
> -     const char* const fileName
> -   );
> +   void WriteCoverageReport( const std::string& fileName );
>  
>     /*!
>      *  This method produces a summary report that lists each uncovered
> @@ -60,9 +58,7 @@ class ReportsHtml: public ReportsBase {
>      *
>      *  @param[in] fileName identifies the size report file name
>      */
> -   void WriteSizeReport(
> -     const char* const fileName
> -   );
> +   void WriteSizeReport( const std::string& fileName );
>  
>    protected:
>  
> @@ -75,140 +71,111 @@ class ReportsHtml: public ReportsBase {
>      AnnotatedLineState_t lastState_m;
>  
>      /* Inherit documentation from base class. */
> -    virtual FILE* OpenAnnotatedFile(
> -      const char* const fileName
> -    );
> +    virtual std::ofstream*  OpenAnnotatedFile( const std::string& fileName );
>  
>      /* Inherit documentation from base class. */
> -    virtual FILE* OpenBranchFile(
> -      const char* const fileName,
> -      bool              hasBranches
> +    virtual std::ofstream* OpenBranchFile(
> +      const std::string&   fileName,
> +      bool                 hasBranches
>      );
>  
>      /* Inherit documentation from base class. */
> -    virtual FILE* OpenCoverageFile(
> -      const char* const fileName
> -    );
> +    virtual std::ofstream* OpenCoverageFile( const std::string& fileName );
>  
>      /* Inherit documentation from base class. */
> -    FILE* OpenNoRangeFile(
> -      const char* const fileName
> -    );
> +    std::ofstream* OpenNoRangeFile( const std::string& fileName );
>  
>      /* Inherit documentation from base class. */
> -    virtual FILE* OpenSizeFile(
> -      const char* const fileName
> -    );
> +    virtual std::ofstream* OpenSizeFile( const std::string& fileName );
>  
>      /* Inherit documentation from base class. */
> -    virtual FILE* OpenSymbolSummaryFile(
> -      const char* const fileName
> +    virtual std::ofstream* OpenSymbolSummaryFile(
> +      const std::string& fileName
>      );
>  
>      /* Inherit documentation from base class. */
> -    virtual void CloseAnnotatedFile(
> -      FILE*  aFile
> -    );
> +    virtual void CloseAnnotatedFile( std::ofstream* aFile );
>  
>      /* Inherit documentation from base class. */
> -    virtual void CloseBranchFile(
> -      FILE*  aFile,
> -      bool   hasBranches
> -    );
> +    virtual void CloseBranchFile( std::ofstream* aFile, bool hasBranches );
>  
>      /* Inherit documentation from base class. */
> -    virtual void CloseCoverageFile(
> -      FILE*  aFile
> -    );
> +    virtual void CloseCoverageFile( std::ofstream* aFile );
>  
>      /* Inherit documentation from base class. */
> -    void CloseNoRangeFile(
> -      FILE*  aFile
> -    );
> +    void CloseNoRangeFile( std::ofstream* aFile );
>  
>      /* Inherit documentation from base class. */
> -    virtual void CloseSizeFile(
> -      FILE*  aFile
> -    );
> +    virtual void CloseSizeFile( std::ofstream* aFile );
>  
>      /* Inherit documentation from base class. */
> -    virtual void CloseSymbolSummaryFile(
> -      FILE*  aFile
> -    );
> +    virtual void CloseSymbolSummaryFile( std::ofstream* aFile );
>  
>      /* Inherit documentation from base class. */
>      virtual void PutAnnotatedLine(
> -      FILE*                aFile,
> +      std::ofstream*       aFile,
>        AnnotatedLineState_t state,
> -      std::string          line,
> +      const std::string&   line,
>        uint32_t             id
>      );
>  
>      /* Inherit documentation from base class. */
> -     virtual void AnnotatedStart(
> -      FILE*                aFile
> -    );
> +     virtual void AnnotatedStart( std::ofstream* aFile );
>  
>      /* Inherit documentation from base class. */
> -     virtual void AnnotatedEnd(
> -      FILE*                aFile
> -    );
> +     virtual void AnnotatedEnd( std::ofstream* aFile );
>  
>      /* Inherit documentation from base class. */
> -    virtual bool PutNoBranchInfo(
> -      FILE* report
> -    );
> +    virtual bool PutNoBranchInfo( std::ofstream* report );
>  
>      /* Inherit documentation from base class. */
>      virtual bool PutBranchEntry(
> -      FILE*                                            report,
> -      unsigned int                                     number,
> -      const std::string&                               symbolName,
> -      const SymbolInformation&                         symbolInfo,
> -      const CoverageRanges::coverageRange_t&           range
> +      std::ofstream*                         report,
> +      unsigned int                           number,
> +      const std::string&                     symbolName,
> +      const SymbolInformation&               symbolInfo,
> +      const CoverageRanges::coverageRange_t& range
>      );
>  
>      /* Inherit documentation from base class. */
>      virtual void putCoverageNoRange(
> -      FILE*        report,
> -      FILE*        noRangeFile,
> -      unsigned int number,
> -      std::string  symbol
> +      std::ofstream*     report,
> +      std::ofstream*     noRangeFile,
> +      unsigned int       number,
> +      const std::string& symbol
>      );
>  
>      /* Inherit documentation from base class. */
>      virtual bool PutCoverageLine(
> -      FILE*                                           report,
> -      unsigned int                                    number,
> -      const std::string&                              symbolName,
> -      const SymbolInformation&                        symbolInfo,
> -      const CoverageRanges::coverageRange_t&          range
> +      std::ofstream*                         report,
> +      unsigned int                           number,
> +      const std::string&                     symbolName,
> +      const SymbolInformation&               symbolInfo,
> +      const CoverageRanges::coverageRange_t& range
>      );
>  
>      /* Inherit documentation from base class. */
>      virtual bool PutSizeLine(
> -      FILE*                                           report,
> -      unsigned int                                    number,
> -      const std::string&                              symbolName,
> -      const CoverageRanges::coverageRange_t&          range
> +      std::ofstream*                         report,
> +      unsigned int                           number,
> +      const std::string&                     symbolName,
> +      const CoverageRanges::coverageRange_t& range
>      );
>  
>      /* Inherit documentation from base class. */
>      virtual bool PutSymbolSummaryLine(
> -      FILE*                                           report,
> -      unsigned int                                    number,
> -      const std::string&                              symbolName,
> -      const SymbolInformation&                        symbolInfo
> +      std::ofstream*           report,
> +      unsigned int             number,
> +      const std::string&       symbolName,
> +      const SymbolInformation& symbolInfo
>      );
>  
>      /* Inherit documentation from base class. */
> -    virtual FILE* OpenFile(
> -      const char* const fileName
> -    );
> +    virtual std::ofstream* OpenFile( const std::string& fileName );
>  
>      /* Inherit documentation from base class. */
> -    virtual bool WriteExplationFile(
> -      const char*                  fileName,
> +    virtual bool WriteExplanationFile(
> +      const std::string&           fileName,
>        const Coverage::Explanation* explanation
>      );
>    };
> diff --git a/tester/covoar/ReportsText.cc b/tester/covoar/ReportsText.cc
> index 33be32f..1218ebc 100644
> --- a/tester/covoar/ReportsText.cc
> +++ b/tester/covoar/ReportsText.cc
> @@ -1,6 +1,8 @@
>  #include <stdio.h>
>  #include <string.h>
>  
> +#include <iomanip>
> +
>  #include "ReportsText.h"
>  #include "app_common.h"
>  #include "CoverageRanges.h"
> @@ -11,8 +13,10 @@
>  
>  namespace Coverage {
>  
> -ReportsText::ReportsText( time_t timestamp, std::string symbolSetName ):
> -  ReportsBase( timestamp, symbolSetName )
> +ReportsText::ReportsText(
> +  time_t             timestamp,
> +  const std::string& symbolSetName
> +): ReportsBase( timestamp, symbolSetName )
>  {
>    reportExtension_m = ".txt";
>  }
> @@ -21,272 +25,230 @@ ReportsText::~ReportsText()
>  {
>  }
>  
> -void ReportsText::AnnotatedStart(
> -  FILE*                aFile
> -)
> +void ReportsText::AnnotatedStart( std::ofstream* aFile )
>  {
> -  fprintf(
> -    aFile,
> -    "========================================"
> -    "=======================================\n"
> -  );
> +  (*aFile) << "========================================"
> +           << "=======================================\n";
>  }
>  
> -void ReportsText::AnnotatedEnd(
> -  FILE*                aFile
> -)
> +void ReportsText::AnnotatedEnd( std::ofstream* aFile )
>  {
>  }
>  
>  void ReportsText::PutAnnotatedLine(
> -  FILE*                aFile,
> +  std::ofstream*       aFile,
>    AnnotatedLineState_t state,
> -  std::string          line,
> +  const std::string&   line,
>    uint32_t             id
>  )
>  {
> -  fprintf( aFile, "%s\n", line.c_str());
> +  (*aFile) << line << "\n";
>  }
>  
> -bool ReportsText::PutNoBranchInfo(
> -  FILE*           report
> -)
> +bool ReportsText::PutNoBranchInfo( std::ofstream* report )
>  {
>    if ( BranchInfoAvailable &&
> -    SymbolsToAnalyze->getNumberBranchesFound(symbolSetName_m) != 0 )
> -    fprintf( report, "All branch paths taken.\n" );
> -  else
> -    fprintf( report, "No branch information found.\n" );
> +       SymbolsToAnalyze->getNumberBranchesFound( symbolSetName_m ) != 0
> +  ) {
> +    (*report) << "All branch paths taken.\n";
> +  } else {
> +    (*report) << "No branch information found.\n";
> +  }
> +
>    return true;
>  }
>  
>  
>  bool ReportsText::PutBranchEntry(
> -  FILE*                                            report,
> -  unsigned int                                     number,
> -  const std::string&                               symbolName,
> -  const SymbolInformation&                         symbolInfo,
> -  const CoverageRanges::coverageRange_t&           range
> +  std::ofstream*                         report,
> +  unsigned int                           number,
> +  const std::string&                     symbolName,
> +  const SymbolInformation&               symbolInfo,
> +  const CoverageRanges::coverageRange_t& range
>  )
>  {
>    const Coverage::Explanation* explanation;
>  
>    // Add an entry to the report
> -  fprintf(
> -    report,
> -    "============================================\n"
> -    "Symbol        : %s (0x%x)\n"
> -    "Line          : %s (0x%x)\n"
> -    "Size in Bytes : %d\n",
> -    symbolName.c_str(),
> -    symbolInfo.baseAddress,
> -    range.lowSourceLine.c_str(),
> -    range.lowAddress,
> -    range.highAddress - range.lowAddress + 1
> -  );
> -
> -  if (range.reason ==
> -    Coverage::CoverageRanges::UNCOVERED_REASON_BRANCH_ALWAYS_TAKEN)
> -    fprintf(
> -      report, "Reason        : %s\n\n", "ALWAYS TAKEN"
> -    );
> -  else if (range.reason ==
> -    Coverage::CoverageRanges::UNCOVERED_REASON_BRANCH_NEVER_TAKEN)
> -    fprintf( report, "Reason        : %s\n\n", "NEVER TAKEN" );
> +  (*report) << "============================================\n"
> +            << "Symbol        : " << symbolName
> +            << std::hex << " (0x" << symbolInfo.baseAddress << ")\n"
> +            << "Line          : " << range.lowSourceLine
> +            << " (0x" << range.lowAddress << ")\n"
> +            << "Size in Bytes : " << range.highAddress - range.lowAddress + 1
> +            << std::dec << "\n";
> +
> +  if (
> +    range.reason ==
> +    Coverage::CoverageRanges::UNCOVERED_REASON_BRANCH_ALWAYS_TAKEN
> +  ) {
> +    (*report) << "Reason        : ALWAYS TAKEN\n\n";
> +  } else if (
> +      range.reason ==
> +      Coverage::CoverageRanges::UNCOVERED_REASON_BRANCH_NEVER_TAKEN
> +    ) {
> +      (*report) << "Reason        : NEVER TAKEN\n\n";
> +  }
>  
>    // See if an explanation is available
>    explanation = AllExplanations->lookupExplanation( range.lowSourceLine );
>  
>    if ( !explanation ) {
> -    fprintf(
> -      report,
> -      "Classification: NONE\n"
> -      "\n"
> -      "Explanation:\n"
> -      "No Explanation\n"
> -    );
> +    (*report) << "Classification: NONE\n"
> +              << "\n"
> +              << "Explanation:\n"
> +              << "No Explanation\n";
>    } else {
> -    fprintf(
> -      report,
> -      "Classification: %s\n"
> -      "\n"
> -      "Explanation:\n",
> -      explanation->classification.c_str()
> -    );
> -
> -    for ( unsigned int i=0 ;
> -          i < explanation->explanation.size();
> -          i++) {
> -      fprintf(
> -        report,
> -        "%s\n",
> -        explanation->explanation[i].c_str()
> -      );
> +    (*report) << "Classification: " << explanation->classification << "\n"
> +              << "\n"
> +              << "Explanation:\n";
> +
> +    for ( unsigned int i = 0; i < explanation->explanation.size(); i++ ) {
> +      (*report) << explanation->explanation[i] << "\n";
>      }
>    }
>  
> -  fprintf(
> -    report, "============================================\n"
> -  );
> +  (*report) << "============================================\n";
>  
>    return true;
>  }
>  
>  void ReportsText::putCoverageNoRange(
> -  FILE*         report,
> -  FILE*         noRangeFile,
> -  unsigned int  number,
> -  std::string   symbol
> +  std::ofstream*     report,
> +  std::ofstream*     noRangeFile,
> +  unsigned int       number,
> +  const std::string& symbol
>  )
>  {
> -      fprintf(
> -        report,
> -        "============================================\n"
> -        "Symbol        : %s\n\n"
> -        "          *** NEVER REFERENCED ***\n\n"
> -        "This symbol was never referenced by an analyzed executable.\n"
> -        "Therefore there is no size or disassembly for this symbol.\n"
> -        "This could be due to symbol misspelling or lack of a test for\n"
> -        "this symbol.\n"
> -        "============================================\n",
> -        symbol.c_str()
> -      );
> -      fprintf( noRangeFile, "%s\n", symbol.c_str() );
> +  (*report) << "============================================\n"
> +            << "Symbol        : " << symbol << "\n\n"
> +            << "          *** NEVER REFERENCED ***\n\n"
> +            << "This symbol was never referenced by an analyzed executable.\n"
> +            << "Therefore there is no size or disassembly for this symbol.\n"
> +            << "This could be due to symbol misspelling or lack of a test for\n"
> +            << "this symbol.\n"
> +            << "============================================\n";
> +
> +  (*noRangeFile) << symbol << "\n";
>  }
>  
>  bool ReportsText::PutCoverageLine(
> -  FILE*                                           report,
> -  unsigned int                                    number,
> -  const std::string&                              symbolName,
> -  const SymbolInformation&                        symbolInfo,
> -  const CoverageRanges::coverageRange_t&          range
> +  std::ofstream*                         report,
> +  unsigned int                           number,
> +  const std::string&                     symbolName,
> +  const SymbolInformation&               symbolInfo,
> +  const CoverageRanges::coverageRange_t& range
>  )
>  {
> -  const Coverage::Explanation*   explanation;
> -
> -  fprintf(
> -    report,
> -    "============================================\n"
> -    "Index                : %d\n"
> -    "Symbol               : %s (0x%x)\n"
> -    "Starting Line        : %s (0x%x)\n"
> -    "Ending Line          : %s (0x%x)\n"
> -    "Size in Bytes        : %d\n"
> -    "Size in Instructions : %d\n\n",
> -    range.id,
> -    symbolName.c_str(),
> -    symbolInfo.baseAddress,
> -    range.lowSourceLine.c_str(),
> -    range.lowAddress,
> -    range.highSourceLine.c_str(),
> -    range.highAddress,
> -    range.highAddress - range.lowAddress + 1,
> -    range.instructionCount
> -  );
> +  const Coverage::Explanation* explanation;
> +
> +  (*report) << "============================================\n"
> +            << "Index                : " << range.id << "\n"
> +            << "Symbol               : " << symbolName
> +            << std::hex << " (0x" << symbolInfo.baseAddress << ")\n"
> +            << "Starting Line        : " << range.lowSourceLine
> +            << " (0x" << range.lowAddress << ")\n"
> +            << "Ending Line          : " << range.highSourceLine
> +            << " (0x" << range.highAddress << ")\n"
> +            << std::dec
> +            << "Size in Bytes        : "
> +            << range.highAddress - range.lowAddress + 1 << "\n"
> +            << "Size in Instructions : " << range.instructionCount << "\n\n";
>  
>    explanation = AllExplanations->lookupExplanation( range.lowSourceLine );
>  
>    if ( !explanation ) {
> -    fprintf(
> -      report,
> -      "Classification: NONE\n"
> -      "\n"
> -      "Explanation:\n"
> -      "No Explanation\n"
> -    );
> +    (*report) << "Classification: NONE\n"
> +              << "\n"
> +              << "Explanation:\n"
> +              << "No Explanation\n";
>    } else {
> -    fprintf(
> -      report,
> -      "Classification: %s\n"
> -      "\n"
> -      "Explanation:\n",
> -      explanation->classification.c_str()
> -    );
> -
> -    for ( unsigned int i=0; i < explanation->explanation.size(); i++) {
> -      fprintf( report,"%s\n", explanation->explanation[i].c_str() );
> +    (*report) << "Classification: " << explanation->classification << "\n"
> +              << "\n"
> +              << "Explanation:\n";
> +
> +    for ( unsigned int i = 0; i < explanation->explanation.size(); i++ ) {
> +      (*report) << explanation->explanation[i] << "\n";
>      }
>    }
>  
> -  fprintf(report, "============================================\n");
> +  (*report) << "============================================\n";
> +
>    return true;
>  }
>  
>  bool  ReportsText::PutSizeLine(
> -  FILE*                                           report,
> -  unsigned int                                    number,
> -  const std::string&                              symbolName,
> -  const CoverageRanges::coverageRange_t&          range
> +  std::ofstream*                         report,
> +  unsigned int                           number,
> +  const std::string&                     symbolName,
> +  const CoverageRanges::coverageRange_t& range
>  )
>  {
> -  fprintf(
> -    report,
> -    "%d\t%s\t%s\n",
> -    range.highAddress - range.lowAddress + 1,
> -    symbolName.c_str(),
> -    range.lowSourceLine.c_str()
> -  );
> +  (*report) << range.highAddress - range.lowAddress + 1 << "\t"
> +            << symbolName << "\t"
> +            << range.lowSourceLine << "\n";
> +
>    return true;
>  }
>  
>  bool  ReportsText::PutSymbolSummaryLine(
> -  FILE*                                           report,
> -  unsigned int                                    number,
> -  const std::string&                              symbolName,
> -  const SymbolInformation&                        symbolInfo
> +  std::ofstream*           report,
> +  unsigned int             number,
> +  const std::string&       symbolName,
> +  const SymbolInformation& symbolInfo
>  )
>  {
>    float uncoveredBytes;
>    float uncoveredInstructions;
>  
> -  if (symbolInfo.stats.sizeInBytes == 0) {
> -    fprintf(
> -      report,
> -      "============================================\n"
> -      "Symbol                            : %s\n"
> -      "          *** NEVER REFERENCED ***\n\n"
> -      "This symbol was never referenced by an analyzed executable.\n"
> -      "Therefore there is no size or disassembly for this symbol.\n"
> -      "This could be due to symbol misspelling or lack of a test for\n"
> -      "this symbol.\n",
> -      symbolName.c_str()
> -    );
> +  if ( symbolInfo.stats.sizeInBytes == 0 ) {
> +    (*report) << "============================================\n"
> +              << "Symbol                            : " << symbolName << "\n"
> +              << "          *** NEVER REFERENCED ***\n\n"
> +              << "This symbol was never referenced by an analyzed executable.\n"
> +              << "Therefore there is no size or disassembly for this symbol.\n"
> +              << "This could be due to symbol misspelling or lack of a test for\n"
> +              << "this symbol.\n"
> +              << "============================================\n";
>    } else {
> -    if ( symbolInfo.stats.sizeInInstructions == 0 )
> +    if ( symbolInfo.stats.sizeInInstructions == 0 ) {
>        uncoveredInstructions = 0;
> -    else
> -      uncoveredInstructions = (symbolInfo.stats.uncoveredInstructions*100.0)/
> -                              symbolInfo.stats.sizeInInstructions;
> +    } else {
> +      uncoveredInstructions = ( symbolInfo.stats.uncoveredInstructions*100.0 ) /
> +                                symbolInfo.stats.sizeInInstructions;
> +    }
>  
> -    if ( symbolInfo.stats.sizeInBytes == 0 )
> +    if ( symbolInfo.stats.sizeInBytes == 0 ) {
>        uncoveredBytes = 0;
> -    else
> -      uncoveredBytes = (symbolInfo.stats.uncoveredBytes*100.0)/
> -                       symbolInfo.stats.sizeInBytes;
> -
> -    fprintf(
> -      report,
> -      "============================================\n"
> -      "Symbol                            : %s\n"
> -      "Total Size in Bytes               : %d\n"
> -      "Total Size in Instructions        : %d\n"
> -      "Total number Branches             : %d\n"
> -      "Total Always Taken                : %d\n"
> -      "Total Never Taken                 : %d\n"
> -      "Percentage Uncovered Instructions : %.2f\n"
> -      "Percentage Uncovered Bytes        : %.2f\n",
> -      symbolName.c_str(),
> -      symbolInfo.stats.sizeInBytes,
> -      symbolInfo.stats.sizeInInstructions,
> -      symbolInfo.stats.branchesNotExecuted +  symbolInfo.stats.branchesExecuted,
> -      symbolInfo.stats.branchesAlwaysTaken,
> -      symbolInfo.stats.branchesNeverTaken,
> -      uncoveredInstructions,
> -      uncoveredBytes
> -    );
> +    } else {
> +      uncoveredBytes = ( symbolInfo.stats.uncoveredBytes * 100.0 ) /
> +                         symbolInfo.stats.sizeInBytes;
> +    }
> +
> +    (*report) << "============================================\n"
> +              << "Symbol                            : "
> +              << symbolName << "\n"
> +              << "Total Size in Bytes               : "
> +              << symbolInfo.stats.sizeInBytes << "\n"
> +              << "Total Size in Instructions        : "
> +              << symbolInfo.stats.sizeInInstructions << "\n"
> +              << "Total number Branches             : "
> +              << symbolInfo.stats.branchesNotExecuted +  symbolInfo.stats.branchesExecuted
> +              << "\n"
> +              << "Total Always Taken                : "
> +              << symbolInfo.stats.branchesAlwaysTaken << "\n"
> +              << "Total Never Taken                 : "
> +              << symbolInfo.stats.branchesNeverTaken << "\n"
> +              << std::fixed << std::setprecision( 2 )
> +              << "Percentage Uncovered Instructions : "
> +              << uncoveredInstructions << "\n"
> +              << "Percentage Uncovered Bytes        : "
> +              << uncoveredBytes << "\n";
> +
> +  (*report) << "============================================\n";
> +
>    }
>  
> -  fprintf(report, "============================================\n");
>    return true;
>  }
>  
> diff --git a/tester/covoar/ReportsText.h b/tester/covoar/ReportsText.h
> index 23a1003..d5ce272 100644
> --- a/tester/covoar/ReportsText.h
> +++ b/tester/covoar/ReportsText.h
> @@ -21,7 +21,8 @@ namespace Coverage {
>  class ReportsText: public ReportsBase {
>  
>    public:
> -    ReportsText( time_t timestamp, std::string symbolSetName );
> +    ReportsText( time_t timestamp, const std::string& symbolSetName );
> +
>      virtual ~ReportsText();
>  
>    /*!
> @@ -30,9 +31,7 @@ class ReportsText: public ReportsBase {
>     *
>     *  @param[in] fileName identifies the branch report file name
>     */
> -  void WriteBranchReport(
> -    const char* const fileName
> -  );
> +  void WriteBranchReport( const std::string& fileName );
>  
>    /*!
>     *  This method produces a report that contains information about each
> @@ -40,9 +39,7 @@ class ReportsText: public ReportsBase {
>     *
>     *  @param[in] fileName identifies the coverage report file name
>     */
> -  void WriteCoverageReport(
> -    const char* const fileName
> -  );
> +  void WriteCoverageReport( const std::string& fileName );
>  
>    /*!
>     *  This method produces a summary report that lists each uncovered
> @@ -50,75 +47,67 @@ class ReportsText: public ReportsBase {
>     *
>     *  @param[in] fileName identifies the size report file name
>     */
> -  void WriteSizeReport(
> -    const char* const fileName
> -  );
> +  void WriteSizeReport( const std::string& fileName );
>  
>    protected:
>  
>     /* Inherit documentation from base class. */
>      virtual void PutAnnotatedLine(
> -      FILE*                aFile,
> +      std::ofstream*       aFile,
>        AnnotatedLineState_t state,
> -      std::string          line,
> +      const std::string&   line,
>        uint32_t             id
>      );
>  
>     /* Inherit documentation from base class. */
> -     virtual void AnnotatedStart(
> -      FILE*                aFile
> -    );
> +     virtual void AnnotatedStart( std::ofstream* aFile );
>  
>      /* Inherit documentation from base class. */
> -     virtual void AnnotatedEnd(
> -      FILE*                aFile
> -    );
> +     virtual void AnnotatedEnd( std::ofstream* aFile );
>  
>     /* Inherit documentation from base class. */
> -    virtual bool PutNoBranchInfo(
> -      FILE* report
> -    );
> +    virtual bool PutNoBranchInfo( std::ofstream* report );
>  
>     /* Inherit documentation from base class. */
>      virtual bool PutBranchEntry(
> -      FILE*                                            report,
> -      unsigned int                                     number,
> -      const std::string&                               symbolName,
> -      const SymbolInformation&                         symbolInfo,
> -      const CoverageRanges::coverageRange_t&           range
> +      std::ofstream*                         report,
> +      unsigned int                           number,
> +      const std::string&                     symbolName,
> +      const SymbolInformation&               symbolInfo,
> +      const CoverageRanges::coverageRange_t& range
>      );
>  
>     /* Inherit documentation from base class. */
>      virtual void putCoverageNoRange(
> -      FILE*        report,
> -      FILE*        noRangeFile,
> -      unsigned int number,
> -      std::string  symbol
> +      std::ofstream*     report,
> +      std::ofstream*     noRangeFile,
> +      unsigned int       number,
> +      const std::string& symbol
>      );
>  
>     /* Inherit documentation from base class. */
>      virtual bool PutCoverageLine(
> -      FILE*                                           report,
> -      unsigned int                                    number,
> -      const std::string&                              symbolName,
> -      const SymbolInformation&                        symbolInfo,
> -      const CoverageRanges::coverageRange_t&          range
> +      std::ofstream*                         report,
> +      unsigned int                           number,
> +      const std::string&                     symbolName,
> +      const SymbolInformation&               symbolInfo,
> +      const CoverageRanges::coverageRange_t& range
>      );
>  
>     /* Inherit documentation from base class. */
>      virtual bool PutSizeLine(
> -      FILE*                                           report,
> -      unsigned int                                    number,
> -      const std::string&                              symbolName,
> -      const CoverageRanges::coverageRange_t&          range
> +      std::ofstream*                         report,
> +      unsigned int                           number,
> +      const std::string&                     symbolName,
> +      const CoverageRanges::coverageRange_t& range
>      );
>  
>     /* Inherit documentation from base class. */
>      virtual bool PutSymbolSummaryLine(
> -      FILE*                                           report,
> -      unsigned int                                    number,
> -      const std::string&                              symbolName,
> -      const SymbolInformation&                        symbolInfo
> +      std::ofstream*           report,
> +      unsigned int             number,
> +      const std::string&       symbolName,
> +      const SymbolInformation& symbolInfo
>      );
>  };
>  
> 


More information about the devel mailing list