Skip to content

Commit

Permalink
Fix more cppcheck uninitialized member warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Apr 13, 2023
1 parent ee471bf commit 2ec10bf
Show file tree
Hide file tree
Showing 21 changed files with 88 additions and 83 deletions.
36 changes: 18 additions & 18 deletions src/analysis/processing/qgsalgorithmfuzzifyraster.h
Expand Up @@ -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;
};


Expand All @@ -98,8 +98,8 @@ class QgsFuzzifyRasterLinearMembershipAlgorithm : public QgsFuzzifyRasterAlgorit
void fuzzify( QgsProcessingFeedback *feedback ) override;

private:
double mFuzzifyLowBound;
double mFuzzifyHighBound;
double mFuzzifyLowBound = 0;
double mFuzzifyHighBound = 0;

};

Expand All @@ -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;

};

Expand All @@ -149,8 +149,8 @@ class QgsFuzzifyRasterLargeMembershipAlgorithm : public QgsFuzzifyRasterAlgorith
void fuzzify( QgsProcessingFeedback *feedback ) override;

private:
double mFuzzifyMidpoint;
double mFuzzifySpread;
double mFuzzifyMidpoint = 0;
double mFuzzifySpread = 0;

};

Expand All @@ -174,8 +174,8 @@ class QgsFuzzifyRasterSmallMembershipAlgorithm : public QgsFuzzifyRasterAlgorith
void fuzzify( QgsProcessingFeedback *feedback ) override;

private:
double mFuzzifyMidpoint;
double mFuzzifySpread;
double mFuzzifyMidpoint = 0;
double mFuzzifySpread = 0;

};

Expand All @@ -199,8 +199,8 @@ class QgsFuzzifyRasterGaussianMembershipAlgorithm : public QgsFuzzifyRasterAlgor
void fuzzify( QgsProcessingFeedback *feedback ) override;

private:
double mFuzzifyMidpoint;
double mFuzzifySpread;
double mFuzzifyMidpoint = 0;
double mFuzzifySpread = 0;

};

Expand All @@ -224,8 +224,8 @@ class QgsFuzzifyRasterNearMembershipAlgorithm : public QgsFuzzifyRasterAlgorithm
void fuzzify( QgsProcessingFeedback *feedback ) override;

private:
double mFuzzifyMidpoint;
double mFuzzifySpread;
double mFuzzifyMidpoint = 0;
double mFuzzifySpread = 0;

};

Expand Down
Expand Up @@ -52,7 +52,7 @@ class QgsRandomPointsInPolygonsAlgorithm : public QgsProcessingAlgorithm
QgsProcessingFeedback *feedback ) override;

private:
int mNumPoints;
int mNumPoints = 0;
bool mDynamicNumPoints = false;
QgsProperty mNumPointsProperty;

Expand Down
2 changes: 1 addition & 1 deletion src/analysis/processing/qgsalgorithmrandompointsonlines.h
Expand Up @@ -54,7 +54,7 @@ class QgsRandomPointsOnLinesAlgorithm : public QgsProcessingAlgorithm


private:
int mNumPoints;
int mNumPoints = 0;
bool mDynamicNumPoints = false;
QgsProperty mNumPointsProperty;

Expand Down
8 changes: 4 additions & 4 deletions src/analysis/processing/qgsalgorithmrandomraster.h
Expand Up @@ -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;
};


Expand All @@ -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;
};
Expand Down
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/analysis/processing/qgsalgorithmrasterlayeruniquevalues.h
Expand Up @@ -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;

};
Expand Down
8 changes: 4 additions & 4 deletions src/analysis/processing/qgsalgorithmrasterlogicalop.h
Expand Up @@ -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;
};
Expand Down
10 changes: 5 additions & 5 deletions src/analysis/processing/qgsalgorithmrasterstackposition.h
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions src/analysis/processing/qgsalgorithmrastersurfacevolume.h
Expand Up @@ -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;

};

Expand Down
8 changes: 4 additions & 4 deletions src/analysis/processing/qgsalgorithmrasterzonalstats.h
Expand Up @@ -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;

};
Expand Down
6 changes: 3 additions & 3 deletions src/analysis/processing/qgsalgorithmrescaleraster.h
Expand Up @@ -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;
Expand Down
18 changes: 9 additions & 9 deletions src/analysis/processing/qgsalgorithmroundrastervalues.h
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions src/analysis/processing/qgsalgorithmzonalhistogram.h
Expand Up @@ -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;

};

Expand Down
6 changes: 3 additions & 3 deletions src/analysis/processing/qgsalgorithmzonalstatistics.h
Expand Up @@ -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
Expand Down
Expand Up @@ -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;
};
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/vector/geometry_checker/qgsgeometrycheck.h
Expand Up @@ -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.
Expand Down
Expand Up @@ -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:

Expand Down
2 changes: 1 addition & 1 deletion src/core/pointcloud/qgspointcloudattribute.h
Expand Up @@ -128,7 +128,7 @@ class CORE_EXPORT QgsPointCloudAttribute

QString mName;
int mSize = 0;
DataType mType;
DataType mType = DataType::Char;
};

/**
Expand Down

0 comments on commit 2ec10bf

Please sign in to comment.