Browse Source

CTest: Fix GTM coverage parsing line offset bug

In cmParseGTMCoverage::ReadMCovFile, initialize the lineoffset variable.
Also set lastoffset only if the function is found (thanks to Bill
Hoffman).
Zack Galbreath 12 years ago
parent
commit
782eba3a0c
1 changed files with 2 additions and 2 deletions
  1. 2 2
      Source/CTest/cmParseGTMCoverage.cxx

+ 2 - 2
Source/CTest/cmParseGTMCoverage.cxx

@@ -98,7 +98,7 @@ bool cmParseGTMCoverage::ReadMCovFile(const char* file)
     bool found = this->FindMumpsFile(routine, filepath);
     if(found)
       {
-      int lineoffset;
+      int lineoffset = 0;
       if(this->FindFunctionInMumpsFile(filepath,
                                        function,
                                        lineoffset))
@@ -106,8 +106,8 @@ bool cmParseGTMCoverage::ReadMCovFile(const char* file)
         cmCTestCoverageHandlerContainer::SingleFileCoverageVector&
           coverageVector = this->Coverage.TotalCoverage[filepath];
         coverageVector[lineoffset + linenumber] += count;
+        lastoffset = lineoffset;
         }
-      lastoffset = lineoffset;
       }
     else
       {