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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -189,12 +189,12 @@ class ANALYSIS_EXPORT QgsGeometryCheck
/** /**
* What level this change affects. * What level this change affects.
*/ */
QgsGeometryCheck::ChangeWhat what; QgsGeometryCheck::ChangeWhat what = QgsGeometryCheck::ChangeWhat::ChangeFeature;
/** /**
* What action this change performs. * 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. * 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. * Contains the static, precalculated value for the node if mHasCachedValue is TRUE.
*/ */
mutable double mCachedStaticValue; mutable double mCachedStaticValue = 0;
private: private:

View File

@ -128,7 +128,7 @@ class CORE_EXPORT QgsPointCloudAttribute
QString mName; QString mName;
int mSize = 0; 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; QgsDoubleRange zRange( const QgsVector3D &offset, const QgsVector3D &scale ) const;
private: 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 QgsVector3D mOffset; //!< Offset of our int32 coordinates compared to CRS coords
QgsPointCloudDataBounds mRootBounds; //!< Bounds of the root node's cube (in int32 coordinates) QgsPointCloudDataBounds mRootBounds; //!< Bounds of the root node's cube (in int32 coordinates)
QgsPointCloudAttributeCollection mAttributes; //! All native attributes stored in the file 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 QgsPointCloudExpression mFilterExpression; //!< The filter expression to be evaluated when fetching node data
QString mError; QString mError;

View File

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

View File

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