Fixed several issues detected by static analysis
authorMaksim Shabunin <maksim.shabunin@gmail.com>
Thu, 22 Feb 2018 10:20:35 +0000 (13:20 +0300)
committerMaksim Shabunin <maksim.shabunin@gmail.com>
Thu, 22 Feb 2018 14:11:33 +0000 (17:11 +0300)
modules/dnn/src/dnn.cpp
modules/dnn/src/layers/pooling_layer.cpp
modules/imgcodecs/src/grfmt_tiff.cpp
modules/ml/src/ann_mlp.cpp

index 4b2b0a0..194648c 100644 (file)
@@ -338,7 +338,7 @@ struct LayerPin
 
 struct LayerData
 {
-    LayerData() : id(-1), flag(0) {}
+    LayerData() : id(-1), skip(false), flag(0) {}
     LayerData(int _id, const String &_name, const String &_type, LayerParams &_params)
         : id(_id), name(_name), type(_type), params(_params), skip(false), flag(0)
     {
index 10952ed..ee552b5 100644 (file)
@@ -270,7 +270,7 @@ public:
         int poolingType;
         float spatialScale;
 
-        PoolingInvoker() : src(0), rois(0), dst(0), mask(0), nstripes(0),
+        PoolingInvoker() : src(0), rois(0), dst(0), mask(0), avePoolPaddedArea(false), nstripes(0),
                            computeMaxIdx(0), poolingType(MAX), spatialScale(0) {}
 
         static void run(const Mat& src, const Mat& rois, Mat& dst, Mat& mask, Size kernel,
index f338240..372176e 100644 (file)
@@ -587,12 +587,13 @@ bool TiffDecoder::readData_32FC1(Mat& img)
     tsize_t scanlength = TIFFScanlineSize(tif);
     tdata_t buf = _TIFFmalloc(scanlength);
     float* data;
+    bool result = true;
     for (uint32 row = 0; row < img_height; row++)
     {
         if (TIFFReadScanline(tif, buf, row) != 1)
         {
-            close();
-            return false;
+            result = false;
+            break;
         }
         data=(float*)buf;
         for (uint32 i=0; i<img_width; i++)
@@ -603,7 +604,7 @@ bool TiffDecoder::readData_32FC1(Mat& img)
     _TIFFfree(buf);
     close();
 
-    return true;
+    return result;
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
index cd00024..22bacb3 100644 (file)
@@ -92,7 +92,7 @@ protected:
     double varTmp;
     int index;
 public:
-    SimulatedAnnealingANN_MLP(ml::ANN_MLP& x, const Ptr<ml::TrainData>& d) : nn(x), data(d)
+    SimulatedAnnealingANN_MLP(ml::ANN_MLP& x, const Ptr<ml::TrainData>& d) : nn(x), data(d), varTmp(0.0), index(0)
     {
         initVarMap();
     }