Skip to content

Commit

Permalink
Fix Coverity uninitialized member warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Feb 2, 2017
1 parent 5939ae2 commit f84508a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 33 deletions.
15 changes: 1 addition & 14 deletions src/analysis/vector/qgszonalstatistics.cpp
Expand Up @@ -34,21 +34,8 @@ QgsZonalStatistics::QgsZonalStatistics( QgsVectorLayer* polygonLayer, QgsRasterL
, mRasterBand( rasterBand )
, mPolygonLayer( polygonLayer )
, mAttributePrefix( attributePrefix )
, mInputNodataValue( -1 )
, mStatistics( stats )
{

}

QgsZonalStatistics::QgsZonalStatistics()
: mRasterLayer( nullptr )
, mRasterBand( 0 )
, mPolygonLayer( nullptr )
, mInputNodataValue( -1 )
, mStatistics( QgsZonalStatistics::All )
{

}
{}

int QgsZonalStatistics::calculateStatistics( QProgressDialog* p )
{
Expand Down
16 changes: 8 additions & 8 deletions src/analysis/vector/qgszonalstatistics.h
Expand Up @@ -67,7 +67,7 @@ class ANALYSIS_EXPORT QgsZonalStatistics
int calculateStatistics( QProgressDialog* p );

private:
QgsZonalStatistics();
QgsZonalStatistics() = default;

class FeatureStats
{
Expand Down Expand Up @@ -128,15 +128,15 @@ class ANALYSIS_EXPORT QgsZonalStatistics

QString getUniqueFieldName( const QString& fieldName, const QList<QgsField>& newFields );

QgsRasterLayer* mRasterLayer;
QgsRasterDataProvider* mRasterProvider;
//! Raster band to calculate statistics from (defaults to 1)
int mRasterBand;
QgsVectorLayer* mPolygonLayer;
QgsRasterLayer* mRasterLayer = nullptr;
QgsRasterDataProvider* mRasterProvider = nullptr;
//! Raster band to calculate statistics
int mRasterBand = 0;
QgsVectorLayer* mPolygonLayer = nullptr;
QString mAttributePrefix;
//! The nodata value of the input layer
float mInputNodataValue;
Statistics mStatistics;
float mInputNodataValue = -1;
Statistics mStatistics = QgsZonalStatistics::All;
};

Q_DECLARE_OPERATORS_FOR_FLAGS( QgsZonalStatistics::Statistics )
Expand Down
13 changes: 2 additions & 11 deletions tests/src/analysis/testqgszonalstatistics.cpp
Expand Up @@ -30,9 +30,6 @@ class TestQgsZonalStatistics : public QObject
{
Q_OBJECT

public:
TestQgsZonalStatistics();

private slots:
void initTestCase();
void cleanupTestCase();
Expand All @@ -42,16 +39,10 @@ class TestQgsZonalStatistics : public QObject
void testStatistics();

private:
QgsVectorLayer* mVectorLayer;
QgsRasterLayer* mRasterLayer;
QgsVectorLayer* mVectorLayer = nullptr;
QgsRasterLayer* mRasterLayer = nullptr;
};

TestQgsZonalStatistics::TestQgsZonalStatistics()
: mVectorLayer( nullptr )
{

}

void TestQgsZonalStatistics::initTestCase()
{
QgsApplication::init();
Expand Down

0 comments on commit f84508a

Please sign in to comment.