Fix Coverity uninitialized member warnings

This commit is contained in:
Nyall Dawson 2017-02-03 07:09:14 +10:00
parent 5939ae23e7
commit f84508a35d
3 changed files with 11 additions and 33 deletions

View File

@ -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 )
{

View File

@ -67,7 +67,7 @@ class ANALYSIS_EXPORT QgsZonalStatistics
int calculateStatistics( QProgressDialog* p );
private:
QgsZonalStatistics();
QgsZonalStatistics() = default;
class FeatureStats
{
@ -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 )

View File

@ -30,9 +30,6 @@ class TestQgsZonalStatistics : public QObject
{
Q_OBJECT
public:
TestQgsZonalStatistics();
private slots:
void initTestCase();
void cleanupTestCase();
@ -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();