Fix more cppcheck uninitialized member warnings

This commit is contained in:
Nyall Dawson 2023-04-13 15:33:06 +10:00
parent ee471bffe6
commit 2ec10bf62d
21 changed files with 88 additions and 83 deletions

View File

@ -61,19 +61,19 @@ class QgsFuzzifyRasterAlgorithmBase : public QgsProcessingAlgorithm
*/
virtual void fuzzify( QgsProcessingFeedback *feedback ) = 0;
QgsRasterLayer *mInputRaster;
int mBand;
QgsRasterLayer *mInputRaster = nullptr;
int mBand = 1;
std::unique_ptr< QgsRasterInterface > mInterface;
QgsRectangle mExtent;
QgsCoordinateReferenceSystem mCrs;
int mLayerWidth;
int mLayerHeight;
int mLayerWidth = 0;
int mLayerHeight = 0;
int mNbCellsXProvider = 0;
int mNbCellsYProvider = 0;
Qgis::DataType mDataType = Qgis::DataType::Float32;
const double mNoDataValue = -9999;
QgsRasterDataProvider *mDestinationRasterProvider;
QgsRasterDataProvider *mDestinationRasterProvider = nullptr;
};
@ -98,8 +98,8 @@ class QgsFuzzifyRasterLinearMembershipAlgorithm : public QgsFuzzifyRasterAlgorit
void fuzzify( QgsProcessingFeedback *feedback ) override;
private:
double mFuzzifyLowBound;
double mFuzzifyHighBound;
double mFuzzifyLowBound = 0;
double mFuzzifyHighBound = 0;
};
@ -123,9 +123,9 @@ class QgsFuzzifyRasterPowerMembershipAlgorithm : public QgsFuzzifyRasterAlgorith
void fuzzify( QgsProcessingFeedback *feedback ) override;
private:
double mFuzzifyLowBound;
double mFuzzifyHighBound;
double mFuzzifyExponent;
double mFuzzifyLowBound = 0;
double mFuzzifyHighBound = 0;
double mFuzzifyExponent = 0;
};
@ -149,8 +149,8 @@ class QgsFuzzifyRasterLargeMembershipAlgorithm : public QgsFuzzifyRasterAlgorith
void fuzzify( QgsProcessingFeedback *feedback ) override;
private:
double mFuzzifyMidpoint;
double mFuzzifySpread;
double mFuzzifyMidpoint = 0;
double mFuzzifySpread = 0;
};
@ -174,8 +174,8 @@ class QgsFuzzifyRasterSmallMembershipAlgorithm : public QgsFuzzifyRasterAlgorith
void fuzzify( QgsProcessingFeedback *feedback ) override;
private:
double mFuzzifyMidpoint;
double mFuzzifySpread;
double mFuzzifyMidpoint = 0;
double mFuzzifySpread = 0;
};
@ -199,8 +199,8 @@ class QgsFuzzifyRasterGaussianMembershipAlgorithm : public QgsFuzzifyRasterAlgor
void fuzzify( QgsProcessingFeedback *feedback ) override;
private:
double mFuzzifyMidpoint;
double mFuzzifySpread;
double mFuzzifyMidpoint = 0;
double mFuzzifySpread = 0;
};
@ -224,8 +224,8 @@ class QgsFuzzifyRasterNearMembershipAlgorithm : public QgsFuzzifyRasterAlgorithm
void fuzzify( QgsProcessingFeedback *feedback ) override;
private:
double mFuzzifyMidpoint;
double mFuzzifySpread;
double mFuzzifyMidpoint = 0;
double mFuzzifySpread = 0;
};

View File

@ -52,7 +52,7 @@ class QgsRandomPointsInPolygonsAlgorithm : public QgsProcessingAlgorithm
QgsProcessingFeedback *feedback ) override;
private:
int mNumPoints;
int mNumPoints = 0;
bool mDynamicNumPoints = false;
QgsProperty mNumPointsProperty;

View File

@ -54,7 +54,7 @@ class QgsRandomPointsOnLinesAlgorithm : public QgsProcessingAlgorithm
private:
int mNumPoints;
int mNumPoints = 0;
bool mDynamicNumPoints = false;
QgsProperty mNumPointsProperty;

View File

@ -64,8 +64,8 @@ class QgsRandomRasterAlgorithmBase : public QgsProcessingAlgorithm
private:
QgsRectangle mExtent;
QgsCoordinateReferenceSystem mCrs;
double mPixelSize;
Qgis::DataType mRasterDataType;
double mPixelSize = 0;
Qgis::DataType mRasterDataType = Qgis::DataType::UnknownDataType;
};
@ -89,8 +89,8 @@ class QgsRandomUniformRasterAlgorithm : public QgsRandomRasterAlgorithmBase
double generateRandomDoubleValue( std::mt19937 &mersenneTwister ) final;
private:
double mRandomUpperBound;
double mRandomLowerBound;
double mRandomUpperBound = 0;
double mRandomLowerBound = 0;
std::uniform_int_distribution<long> mRandomUniformIntDistribution;
std::uniform_real_distribution<double> mRandomUniformDoubleDistribution;
};

View File

@ -43,16 +43,16 @@ class QgsRasterFrequencyByComparisonOperatorBase : public QgsProcessingAlgorithm
private:
std::unique_ptr< QgsRasterInterface > mInputValueRasterInterface;
int mInputValueRasterBand;
int mInputValueRasterBand = 1;
std::vector< QgsRasterAnalysisUtils::RasterLogicInput > mInputs;
bool mIgnoreNoData;
bool mIgnoreNoData = false;
double mNoDataValue = -9999;
int mLayerWidth;
int mLayerHeight;
int mLayerWidth = 0;
int mLayerHeight = 0;
QgsRectangle mExtent;
QgsCoordinateReferenceSystem mCrs;
double mRasterUnitsPerPixelX;
double mRasterUnitsPerPixelY;
double mRasterUnitsPerPixelX = 0;
double mRasterUnitsPerPixelY = 0;
};
class QgsRasterFrequencyByEqualOperatorAlgorithm : public QgsRasterFrequencyByComparisonOperatorBase

View File

@ -54,12 +54,12 @@ class QgsRasterLayerUniqueValuesReportAlgorithm : public QgsProcessingAlgorithm
std::unique_ptr< QgsRasterInterface > mInterface;
bool mHasNoDataValue = false;
int mBand = 1;
int mLayerWidth;
int mLayerHeight;
int mLayerWidth = 0;
int mLayerHeight = 0;
QgsRectangle mExtent;
QgsCoordinateReferenceSystem mCrs;
double mRasterUnitsPerPixelX;
double mRasterUnitsPerPixelY;
double mRasterUnitsPerPixelX = 0;
double mRasterUnitsPerPixelY = 0;
QString mSource;
};

View File

@ -55,12 +55,12 @@ class ANALYSIS_EXPORT QgsRasterBooleanLogicAlgorithmBase : public QgsProcessingA
std::vector< QgsRasterAnalysisUtils::RasterLogicInput > mInputs;
Qgis::DataType mDataType = Qgis::DataType::Float32;
double mNoDataValue = -9999;
int mLayerWidth;
int mLayerHeight;
int mLayerWidth = 0;
int mLayerHeight = 0;
QgsRectangle mExtent;
QgsCoordinateReferenceSystem mCrs;
double mRasterUnitsPerPixelX;
double mRasterUnitsPerPixelY;
double mRasterUnitsPerPixelX = 0;
double mRasterUnitsPerPixelY = 0;
bool mTreatNodataAsFalse = false;
friend class TestQgsProcessingAlgsPt1;
};

View File

@ -44,13 +44,13 @@ class QgsRasterStackPositionAlgorithmBase : public QgsProcessingAlgorithm
private:
std::vector< QgsRasterAnalysisUtils::RasterLogicInput > mInputs;
bool mIgnoreNoData;
int mLayerWidth;
int mLayerHeight;
bool mIgnoreNoData = false;
int mLayerWidth = 0;
int mLayerHeight = 0;
QgsRectangle mExtent;
QgsCoordinateReferenceSystem mCrs;
double mRasterUnitsPerPixelX;
double mRasterUnitsPerPixelY;
double mRasterUnitsPerPixelX = 0;
double mRasterUnitsPerPixelY = 0;
};
class QgsRasterStackLowestPositionAlgorithm : public QgsRasterStackPositionAlgorithmBase

View File

@ -63,15 +63,15 @@ class QgsRasterSurfaceVolumeAlgorithm : public QgsProcessingAlgorithm
std::unique_ptr< QgsRasterInterface > mInterface;
bool mHasNoDataValue = false;
int mBand = 1;
int mLayerWidth;
int mLayerHeight;
int mLayerWidth = 0;
int mLayerHeight = 0;
QgsRectangle mExtent;
QgsCoordinateReferenceSystem mCrs;
double mRasterUnitsPerPixelX;
double mRasterUnitsPerPixelY;
double mRasterUnitsPerPixelX = 0;
double mRasterUnitsPerPixelY = 0;
double mLevel = 0;
QString mSource;
Method mMethod;
Method mMethod = Method::CountOnlyAboveBaseLevel;
};

View File

@ -69,12 +69,12 @@ class QgsRasterLayerZonalStatsAlgorithm : public QgsProcessingAlgorithm
bool mZonesHasNoDataValue = false;
int mBand = 1;
int mZonesBand = 1;
int mLayerWidth;
int mLayerHeight;
int mLayerWidth = 0;
int mLayerHeight = 0;
QgsRectangle mExtent;
QgsCoordinateReferenceSystem mCrs;
double mRasterUnitsPerPixelX;
double mRasterUnitsPerPixelY;
double mRasterUnitsPerPixelX = 0;
double mRasterUnitsPerPixelY = 0;
RefLayer mRefLayer = Source;
};

View File

@ -57,9 +57,9 @@ class QgsRescaleRasterAlgorithm : public QgsProcessingAlgorithm
int mLayerHeight = 0;
int mXSize = 0;
int mYSize = 0;
double mNoData;
double mMinimum;
double mMaximum;
double mNoData = 0;
double mMinimum = 0;
double mMaximum = 0;
QgsRectangle mExtent;
QgsCoordinateReferenceSystem mCrs;

View File

@ -64,20 +64,20 @@ class QgsRoundRasterValuesAlgorithm : public QgsProcessingAlgorithm
int mDecimalPrecision = 2;
int mBaseN = 10;
double mScaleFactor;
int mMultipleOfBaseN;
int mBand;
int mRoundingDirection;
double mScaleFactor = 0;
int mMultipleOfBaseN = 0;
int mBand = 1;
int mRoundingDirection = 0;
std::unique_ptr< QgsRasterInterface > mInterface;
Qgis::DataType mDataType;
bool mIsInteger;
Qgis::DataType mDataType = Qgis::DataType::UnknownDataType;
bool mIsInteger = false;
QgsRectangle mExtent;
QgsCoordinateReferenceSystem mCrs;
int mLayerWidth;
int mLayerHeight;
int mLayerWidth = 0;
int mLayerHeight = 0;
int mNbCellsXProvider = 0;
int mNbCellsYProvider = 0;
double mInputNoDataValue;
double mInputNoDataValue = 0;
};
///@endcond PRIVATE

View File

@ -52,15 +52,15 @@ class QgsZonalHistogramAlgorithm : public QgsProcessingAlgorithm
private:
std::unique_ptr< QgsRasterInterface > mRasterInterface;
int mRasterBand;
int mRasterBand = 1;
bool mHasNoDataValue = false;
float mNodataValue = -1;
QgsRectangle mRasterExtent;
QgsCoordinateReferenceSystem mCrs;
double mCellSizeX;
double mCellSizeY;
double mNbCellsXProvider;
double mNbCellsYProvider;
double mCellSizeX = 0;
double mCellSizeY = 0;
double mNbCellsXProvider = 0;
double mNbCellsYProvider = 0;
};

View File

@ -54,12 +54,12 @@ class QgsZonalStatisticsAlgorithm : public QgsProcessingAlgorithm
private:
std::unique_ptr< QgsRasterInterface > mInterface;
int mBand;
int mBand = 1;
QString mPrefix;
QgsZonalStatistics::Statistics mStats = QgsZonalStatistics::All;
QgsCoordinateReferenceSystem mCrs;
double mPixelSizeX;
double mPixelSizeY;
double mPixelSizeX = 0;
double mPixelSizeY = 0;
};
///@endcond PRIVATE

View File

@ -58,14 +58,14 @@ class QgsZonalStatisticsFeatureBasedAlgorithm : public QgsProcessingFeatureBased
private:
std::unique_ptr< QgsRasterInterface > mRaster;
int mBand;
int mBand = 1;
QString mPrefix;
QgsZonalStatistics::Statistics mStats = QgsZonalStatistics::All;
QgsCoordinateReferenceSystem mCrs;
bool mCreatedTransform = false;
QgsCoordinateTransform mFeatureToRasterTransform;
double mPixelSizeX;
double mPixelSizeY;
double mPixelSizeX = 0;
double mPixelSizeY = 0;
QgsFields mOutputFields;
QMap<QgsZonalStatistics::Statistic, int> mStatFieldsMapping;
};

View File

@ -189,12 +189,12 @@ class ANALYSIS_EXPORT QgsGeometryCheck
/**
* What level this change affects.
*/
QgsGeometryCheck::ChangeWhat what;
QgsGeometryCheck::ChangeWhat what = QgsGeometryCheck::ChangeWhat::ChangeFeature;
/**
* What action this change performs.
*/
QgsGeometryCheck::ChangeType type;
QgsGeometryCheck::ChangeType type = QgsGeometryCheck::ChangeType::ChangeAdded;
/**
* The index of the part / ring / vertex, depending on \see what.

View File

@ -235,7 +235,7 @@ class CORE_EXPORT QgsPointCloudExpressionNode
/**
* Contains the static, precalculated value for the node if mHasCachedValue is TRUE.
*/
mutable double mCachedStaticValue;
mutable double mCachedStaticValue = 0;
private:

View File

@ -128,7 +128,7 @@ class CORE_EXPORT QgsPointCloudAttribute
QString mName;
int mSize = 0;
DataType mType;
DataType mType = DataType::Char;
};
/**

View File

@ -148,7 +148,12 @@ class CORE_EXPORT QgsPointCloudDataBounds
QgsDoubleRange zRange( const QgsVector3D &offset, const QgsVector3D &scale ) const;
private:
qint32 mXMin, mYMin, mZMin, mXMax, mYMax, mZMax;
qint32 mXMin = 0;
qint32 mYMin = 0;
qint32 mZMin = 0;
qint32 mXMax = 0;
qint32 mYMax = 0;
qint32 mZMax = 0;
};
/**
@ -341,7 +346,7 @@ class CORE_EXPORT QgsPointCloudIndex: public QObject
QgsVector3D mOffset; //!< Offset of our int32 coordinates compared to CRS coords
QgsPointCloudDataBounds mRootBounds; //!< Bounds of the root node's cube (in int32 coordinates)
QgsPointCloudAttributeCollection mAttributes; //! All native attributes stored in the file
int mSpan; //!< Number of points in one direction in a single node
int mSpan = 0; //!< Number of points in one direction in a single node
QgsPointCloudExpression mFilterExpression; //!< The filter expression to be evaluated when fetching node data
QString mError;

View File

@ -285,7 +285,7 @@ class QgsOgrDataset
friend class QgsOgrProviderUtils;
friend class QgsOgrTransaction;
QgsOgrProviderUtils::DatasetIdentification mIdent;
QgsOgrProviderUtils::DatasetWithLayers *mDs;
QgsOgrProviderUtils::DatasetWithLayers *mDs = nullptr;
QgsOgrDataset() = default;
~QgsOgrDataset() = default;

View File

@ -143,7 +143,7 @@ class CORE_EXPORT QgsBookmark
QString mName;
QString mGroup;
QgsReferencedRectangle mExtent;
double mRotation;
double mRotation = 0;
};