Fixes initialization defects in mythcommflag.

From: Erik Hovland <erik@hovland.org>


---

 .../programs/mythcommflag/ClassicCommDetector.cpp  |   38 +++++++++++--------
 .../programs/mythcommflag/ClassicLogoDetector.cpp  |   39 +++++++++-----------
 mythtv/programs/mythcommflag/CommDetector2.cpp     |    1 +
 mythtv/programs/mythcommflag/TemplateMatcher.cpp   |    1 +
 4 files changed, 42 insertions(+), 37 deletions(-)

diff --git a/mythtv/programs/mythcommflag/ClassicCommDetector.cpp b/mythtv/programs/mythcommflag/ClassicCommDetector.cpp
index fe941a0..3b2d195 100644
--- a/mythtv/programs/mythcommflag/ClassicCommDetector.cpp
+++ b/mythtv/programs/mythcommflag/ClassicCommDetector.cpp
@@ -131,22 +131,29 @@ ClassicCommDetector::ClassicCommDetector(SkipType commDetectMethod_in,
                                          const QDateTime& startedAt_in,
                                          const QDateTime& stopsAt_in,
                                          const QDateTime& recordingStartedAt_in,
-                                         const QDateTime& recordingStopsAt_in) :
-        commDetectMethod(commDetectMethod_in),
-        showProgress(showProgress_in),
-        fullSpeed(fullSpeed_in),
-        nvp(nvp_in),
-        startedAt(startedAt_in),
-        stopsAt(stopsAt_in),
-        recordingStartedAt(recordingStartedAt_in),
-        recordingStopsAt(recordingStopsAt_in),
-        framesProcessed(0),preRoll(0),postRoll(0),
-        logoDetector(0),
-        sceneChangeDetector(0)
+                                         const QDateTime& recordingStopsAt_in)
+    : commDetectMethod(commDetectMethod_in),     showProgress(showProgress_in),
+      fullSpeed(fullSpeed_in),                   nvp(nvp_in),
+      startedAt(startedAt_in),                   stopsAt(stopsAt_in),
+      recordingStartedAt(recordingStartedAt_in), recordingStopsAt(recordingStopsAt_in),
+      stillRecording(recordingStopsAt > QDateTime::currentDateTime()),
+      commBreakMapUpdateRequested(false),        sendCommBreakMapUpdates(false),
+      aggressiveDetection(false),                verboseDebugging(false),
+      lastFrameNumber(0),                        curFrameNumber(0),
+      width(0),                                  height(0),
+      horizSpacing(0),                           vertSpacing(0),
+      fps(0.0),                                  fpm(0.0),
+      blankFramesOnly(false),                    blankFrameCount(0),
+      currentAspect(0),                          framesProcessed(0),
+      preRoll(0),                                postRoll(0),
+      totalMinBrightness(0),                     detectBlankFrames(false),
+      detectSceneChanges(false),                 detectStationLogo(false),
+      logoInfoAvailable(false),                  logoDetector(0),
+      framePtr(0),                               frameIsBlank(false),
+      sceneHasChanged(false),                    stationLogoPresent(false),
+      lastFrameWasBlank(false),                  lastFrameWasSceneChange(false),
+      decoderFoundAspectChanges(false),          sceneChangeDetector(0)
 {
-
-    stillRecording = recordingStopsAt > QDateTime::currentDateTime();
-    
     commDetectBorder =
         gContext->GetNumSetting("CommDetectBorder", 20);
     commDetectBlankFrameMaxDiff =
@@ -171,7 +178,6 @@ ClassicCommDetector::ClassicCommDetector(SkipType commDetectMethod_in,
     skipAllBlanks = !!gContext->GetNumSetting("CommSkipAllBlanks", 1);
     commDetectBlankCanHaveLogo =
         !!gContext->GetNumSetting("CommDetectBlankCanHaveLogo", 1);
-
 }
 
 void ClassicCommDetector::Init()
diff --git a/mythtv/programs/mythcommflag/ClassicLogoDetector.cpp b/mythtv/programs/mythcommflag/ClassicLogoDetector.cpp
index 52938ba..f2e5e91 100644
--- a/mythtv/programs/mythcommflag/ClassicLogoDetector.cpp
+++ b/mythtv/programs/mythcommflag/ClassicLogoDetector.cpp
@@ -24,38 +24,35 @@ EdgeMaskEntry;
 
 
 ClassicLogoDetector::ClassicLogoDetector(ClassicCommDetector* commdetector,
-        unsigned int w, unsigned int h, unsigned int commdetectborder_in,
-        unsigned int xspacing_in, unsigned int yspacing_in):
-    LogoDetectorBase(w,h),
-    commDetector(commdetector),
-    frameNumber(0),
-    previousFrameWasSceneChange(false),
-    xspacing(xspacing_in),
-    yspacing(yspacing_in),
-    commDetectBorder(commdetectborder_in)
+                                         unsigned int w, unsigned int h,
+                                         unsigned int commdetectborder_in,
+                                         unsigned int xspacing_in,
+                                         unsigned int yspacing_in)
+    : LogoDetectorBase(w,h),
+      commDetector(commdetector),                       frameNumber(0),
+      previousFrameWasSceneChange(false),
+      xspacing(xspacing_in),                            yspacing(yspacing_in),
+      commDetectBorder(commdetectborder_in),            edgeMask(new EdgeMaskEntry[width * height]),
+      logoMaxValues(new unsigned char[width * height]), logoMinValues(new unsigned char[width * height]),
+      logoFrame(new unsigned char[width * height]),     logoMask(new unsigned char[width * height]),
+      logoCheckMask(new unsigned char[width * height]), tmpBuf(new unsigned char[width * height]),
+      logoEdgeDiff(0),                                  logoFrameCount(0),
+      logoMinX(0),                                      logoMaxX(0),
+      logoMinY(0),                                      logoMaxY(0),
+      logoInfoAvailable(false)
 {
     commDetectLogoSamplesNeeded =
         gContext->GetNumSetting("CommDetectLogoSamplesNeeded", 240);
     commDetectLogoSampleSpacing =
         gContext->GetNumSetting("CommDetectLogoSampleSpacing", 2);
+    commDetectLogoSecondsNeeded = commDetectLogoSamplesNeeded *
+                                  commDetectLogoSampleSpacing;
     commDetectLogoGoodEdgeThreshold =
         gContext->GetSetting("CommDetectLogoGoodEdgeThreshold", "0.75")
         .toDouble();
     commDetectLogoBadEdgeThreshold =
         gContext->GetSetting("CommDetectLogoBadEdgeThreshold", "0.85")
         .toDouble();
-    commDetectLogoSecondsNeeded = commDetectLogoSamplesNeeded *
-                                  commDetectLogoSampleSpacing;
-
-    edgeMask = new EdgeMaskEntry[width * height];
-    logoFrame = new unsigned char[width * height];
-    logoMask = new unsigned char[width * height];
-    logoCheckMask = new unsigned char[width * height];
-    logoMaxValues = new unsigned char[width * height];
-    logoMinValues = new unsigned char[width * height];
-    tmpBuf = new unsigned char[width * height];
-
-    logoFrameCount = 0;
 }
 
 unsigned int ClassicLogoDetector::getRequiredAvailableBufferForSearch()
diff --git a/mythtv/programs/mythcommflag/CommDetector2.cpp b/mythtv/programs/mythcommflag/CommDetector2.cpp
index 0d77abd..e899b48 100644
--- a/mythtv/programs/mythcommflag/CommDetector2.cpp
+++ b/mythtv/programs/mythcommflag/CommDetector2.cpp
@@ -336,6 +336,7 @@ CommDetector2::CommDetector2(
     , sendBreakMapUpdates(false)
     , breakMapUpdateRequested(false)
     , finished(false)
+    , currentFrameNumber(0)
     , logoFinder(NULL)
     , logoMatcher(NULL)
     , blankFrameDetector(NULL)
diff --git a/mythtv/programs/mythcommflag/TemplateMatcher.cpp b/mythtv/programs/mythcommflag/TemplateMatcher.cpp
index 01eb856..ddad52c 100644
--- a/mythtv/programs/mythcommflag/TemplateMatcher.cpp
+++ b/mythtv/programs/mythcommflag/TemplateMatcher.cpp
@@ -333,6 +333,7 @@ TemplateMatcher::TemplateMatcher(PGMConverter *pgmc, EdgeDetector *ed,
     , pgmConverter(pgmc)
     , edgeDetector(ed)
     , templateFinder(tf)
+    , tmpl(0)
     , tmplrow(-1)
     , tmplcol(-1)
     , tmplwidth(-1)
