Skip to content

Commit 2ec10bf

Browse files
committedApr 13, 2023
Fix more cppcheck uninitialized member warnings
1 parent ee471bf commit 2ec10bf

21 files changed

+88
-83
lines changed
 

‎src/analysis/processing/qgsalgorithmfuzzifyraster.h

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,19 @@ class QgsFuzzifyRasterAlgorithmBase : public QgsProcessingAlgorithm
6161
*/
6262
virtual void fuzzify( QgsProcessingFeedback *feedback ) = 0;
6363

64-
QgsRasterLayer *mInputRaster;
65-
int mBand;
64+
QgsRasterLayer *mInputRaster = nullptr;
65+
int mBand = 1;
6666
std::unique_ptr< QgsRasterInterface > mInterface;
6767
QgsRectangle mExtent;
6868
QgsCoordinateReferenceSystem mCrs;
69-
int mLayerWidth;
70-
int mLayerHeight;
69+
int mLayerWidth = 0;
70+
int mLayerHeight = 0;
7171
int mNbCellsXProvider = 0;
7272
int mNbCellsYProvider = 0;
7373

7474
Qgis::DataType mDataType = Qgis::DataType::Float32;
7575
const double mNoDataValue = -9999;
76-
QgsRasterDataProvider *mDestinationRasterProvider;
76+
QgsRasterDataProvider *mDestinationRasterProvider = nullptr;
7777
};
7878

7979

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

100100
private:
101-
double mFuzzifyLowBound;
102-
double mFuzzifyHighBound;
101+
double mFuzzifyLowBound = 0;
102+
double mFuzzifyHighBound = 0;
103103

104104
};
105105

@@ -123,9 +123,9 @@ class QgsFuzzifyRasterPowerMembershipAlgorithm : public QgsFuzzifyRasterAlgorith
123123
void fuzzify( QgsProcessingFeedback *feedback ) override;
124124

125125
private:
126-
double mFuzzifyLowBound;
127-
double mFuzzifyHighBound;
128-
double mFuzzifyExponent;
126+
double mFuzzifyLowBound = 0;
127+
double mFuzzifyHighBound = 0;
128+
double mFuzzifyExponent = 0;
129129

130130
};
131131

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

151151
private:
152-
double mFuzzifyMidpoint;
153-
double mFuzzifySpread;
152+
double mFuzzifyMidpoint = 0;
153+
double mFuzzifySpread = 0;
154154

155155
};
156156

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

176176
private:
177-
double mFuzzifyMidpoint;
178-
double mFuzzifySpread;
177+
double mFuzzifyMidpoint = 0;
178+
double mFuzzifySpread = 0;
179179

180180
};
181181

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

201201
private:
202-
double mFuzzifyMidpoint;
203-
double mFuzzifySpread;
202+
double mFuzzifyMidpoint = 0;
203+
double mFuzzifySpread = 0;
204204

205205
};
206206

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

226226
private:
227-
double mFuzzifyMidpoint;
228-
double mFuzzifySpread;
227+
double mFuzzifyMidpoint = 0;
228+
double mFuzzifySpread = 0;
229229

230230
};
231231

‎src/analysis/processing/qgsalgorithmrandompointsinpolygons.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class QgsRandomPointsInPolygonsAlgorithm : public QgsProcessingAlgorithm
5252
QgsProcessingFeedback *feedback ) override;
5353

5454
private:
55-
int mNumPoints;
55+
int mNumPoints = 0;
5656
bool mDynamicNumPoints = false;
5757
QgsProperty mNumPointsProperty;
5858

‎src/analysis/processing/qgsalgorithmrandompointsonlines.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class QgsRandomPointsOnLinesAlgorithm : public QgsProcessingAlgorithm
5454

5555

5656
private:
57-
int mNumPoints;
57+
int mNumPoints = 0;
5858
bool mDynamicNumPoints = false;
5959
QgsProperty mNumPointsProperty;
6060

‎src/analysis/processing/qgsalgorithmrandomraster.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ class QgsRandomRasterAlgorithmBase : public QgsProcessingAlgorithm
6464
private:
6565
QgsRectangle mExtent;
6666
QgsCoordinateReferenceSystem mCrs;
67-
double mPixelSize;
68-
Qgis::DataType mRasterDataType;
67+
double mPixelSize = 0;
68+
Qgis::DataType mRasterDataType = Qgis::DataType::UnknownDataType;
6969
};
7070

7171

@@ -89,8 +89,8 @@ class QgsRandomUniformRasterAlgorithm : public QgsRandomRasterAlgorithmBase
8989
double generateRandomDoubleValue( std::mt19937 &mersenneTwister ) final;
9090

9191
private:
92-
double mRandomUpperBound;
93-
double mRandomLowerBound;
92+
double mRandomUpperBound = 0;
93+
double mRandomLowerBound = 0;
9494
std::uniform_int_distribution<long> mRandomUniformIntDistribution;
9595
std::uniform_real_distribution<double> mRandomUniformDoubleDistribution;
9696
};

‎src/analysis/processing/qgsalgorithmrasterfrequencybycomparisonoperator.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,16 @@ class QgsRasterFrequencyByComparisonOperatorBase : public QgsProcessingAlgorithm
4343

4444
private:
4545
std::unique_ptr< QgsRasterInterface > mInputValueRasterInterface;
46-
int mInputValueRasterBand;
46+
int mInputValueRasterBand = 1;
4747
std::vector< QgsRasterAnalysisUtils::RasterLogicInput > mInputs;
48-
bool mIgnoreNoData;
48+
bool mIgnoreNoData = false;
4949
double mNoDataValue = -9999;
50-
int mLayerWidth;
51-
int mLayerHeight;
50+
int mLayerWidth = 0;
51+
int mLayerHeight = 0;
5252
QgsRectangle mExtent;
5353
QgsCoordinateReferenceSystem mCrs;
54-
double mRasterUnitsPerPixelX;
55-
double mRasterUnitsPerPixelY;
54+
double mRasterUnitsPerPixelX = 0;
55+
double mRasterUnitsPerPixelY = 0;
5656
};
5757

5858
class QgsRasterFrequencyByEqualOperatorAlgorithm : public QgsRasterFrequencyByComparisonOperatorBase

‎src/analysis/processing/qgsalgorithmrasterlayeruniquevalues.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ class QgsRasterLayerUniqueValuesReportAlgorithm : public QgsProcessingAlgorithm
5454
std::unique_ptr< QgsRasterInterface > mInterface;
5555
bool mHasNoDataValue = false;
5656
int mBand = 1;
57-
int mLayerWidth;
58-
int mLayerHeight;
57+
int mLayerWidth = 0;
58+
int mLayerHeight = 0;
5959
QgsRectangle mExtent;
6060
QgsCoordinateReferenceSystem mCrs;
61-
double mRasterUnitsPerPixelX;
62-
double mRasterUnitsPerPixelY;
61+
double mRasterUnitsPerPixelX = 0;
62+
double mRasterUnitsPerPixelY = 0;
6363
QString mSource;
6464

6565
};

‎src/analysis/processing/qgsalgorithmrasterlogicalop.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ class ANALYSIS_EXPORT QgsRasterBooleanLogicAlgorithmBase : public QgsProcessingA
5555
std::vector< QgsRasterAnalysisUtils::RasterLogicInput > mInputs;
5656
Qgis::DataType mDataType = Qgis::DataType::Float32;
5757
double mNoDataValue = -9999;
58-
int mLayerWidth;
59-
int mLayerHeight;
58+
int mLayerWidth = 0;
59+
int mLayerHeight = 0;
6060
QgsRectangle mExtent;
6161
QgsCoordinateReferenceSystem mCrs;
62-
double mRasterUnitsPerPixelX;
63-
double mRasterUnitsPerPixelY;
62+
double mRasterUnitsPerPixelX = 0;
63+
double mRasterUnitsPerPixelY = 0;
6464
bool mTreatNodataAsFalse = false;
6565
friend class TestQgsProcessingAlgsPt1;
6666
};

‎src/analysis/processing/qgsalgorithmrasterstackposition.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ class QgsRasterStackPositionAlgorithmBase : public QgsProcessingAlgorithm
4444

4545
private:
4646
std::vector< QgsRasterAnalysisUtils::RasterLogicInput > mInputs;
47-
bool mIgnoreNoData;
48-
int mLayerWidth;
49-
int mLayerHeight;
47+
bool mIgnoreNoData = false;
48+
int mLayerWidth = 0;
49+
int mLayerHeight = 0;
5050
QgsRectangle mExtent;
5151
QgsCoordinateReferenceSystem mCrs;
52-
double mRasterUnitsPerPixelX;
53-
double mRasterUnitsPerPixelY;
52+
double mRasterUnitsPerPixelX = 0;
53+
double mRasterUnitsPerPixelY = 0;
5454
};
5555

5656
class QgsRasterStackLowestPositionAlgorithm : public QgsRasterStackPositionAlgorithmBase

‎src/analysis/processing/qgsalgorithmrastersurfacevolume.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ class QgsRasterSurfaceVolumeAlgorithm : public QgsProcessingAlgorithm
6363
std::unique_ptr< QgsRasterInterface > mInterface;
6464
bool mHasNoDataValue = false;
6565
int mBand = 1;
66-
int mLayerWidth;
67-
int mLayerHeight;
66+
int mLayerWidth = 0;
67+
int mLayerHeight = 0;
6868
QgsRectangle mExtent;
6969
QgsCoordinateReferenceSystem mCrs;
70-
double mRasterUnitsPerPixelX;
71-
double mRasterUnitsPerPixelY;
70+
double mRasterUnitsPerPixelX = 0;
71+
double mRasterUnitsPerPixelY = 0;
7272
double mLevel = 0;
7373
QString mSource;
74-
Method mMethod;
74+
Method mMethod = Method::CountOnlyAboveBaseLevel;
7575

7676
};
7777

‎src/analysis/processing/qgsalgorithmrasterzonalstats.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ class QgsRasterLayerZonalStatsAlgorithm : public QgsProcessingAlgorithm
6969
bool mZonesHasNoDataValue = false;
7070
int mBand = 1;
7171
int mZonesBand = 1;
72-
int mLayerWidth;
73-
int mLayerHeight;
72+
int mLayerWidth = 0;
73+
int mLayerHeight = 0;
7474
QgsRectangle mExtent;
7575
QgsCoordinateReferenceSystem mCrs;
76-
double mRasterUnitsPerPixelX;
77-
double mRasterUnitsPerPixelY;
76+
double mRasterUnitsPerPixelX = 0;
77+
double mRasterUnitsPerPixelY = 0;
7878
RefLayer mRefLayer = Source;
7979

8080
};

‎src/analysis/processing/qgsalgorithmrescaleraster.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ class QgsRescaleRasterAlgorithm : public QgsProcessingAlgorithm
5757
int mLayerHeight = 0;
5858
int mXSize = 0;
5959
int mYSize = 0;
60-
double mNoData;
61-
double mMinimum;
62-
double mMaximum;
60+
double mNoData = 0;
61+
double mMinimum = 0;
62+
double mMaximum = 0;
6363

6464
QgsRectangle mExtent;
6565
QgsCoordinateReferenceSystem mCrs;

‎src/analysis/processing/qgsalgorithmroundrastervalues.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,20 +64,20 @@ class QgsRoundRasterValuesAlgorithm : public QgsProcessingAlgorithm
6464

6565
int mDecimalPrecision = 2;
6666
int mBaseN = 10;
67-
double mScaleFactor;
68-
int mMultipleOfBaseN;
69-
int mBand;
70-
int mRoundingDirection;
67+
double mScaleFactor = 0;
68+
int mMultipleOfBaseN = 0;
69+
int mBand = 1;
70+
int mRoundingDirection = 0;
7171
std::unique_ptr< QgsRasterInterface > mInterface;
72-
Qgis::DataType mDataType;
73-
bool mIsInteger;
72+
Qgis::DataType mDataType = Qgis::DataType::UnknownDataType;
73+
bool mIsInteger = false;
7474
QgsRectangle mExtent;
7575
QgsCoordinateReferenceSystem mCrs;
76-
int mLayerWidth;
77-
int mLayerHeight;
76+
int mLayerWidth = 0;
77+
int mLayerHeight = 0;
7878
int mNbCellsXProvider = 0;
7979
int mNbCellsYProvider = 0;
80-
double mInputNoDataValue;
80+
double mInputNoDataValue = 0;
8181
};
8282

8383
///@endcond PRIVATE

‎src/analysis/processing/qgsalgorithmzonalhistogram.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ class QgsZonalHistogramAlgorithm : public QgsProcessingAlgorithm
5252
private:
5353

5454
std::unique_ptr< QgsRasterInterface > mRasterInterface;
55-
int mRasterBand;
55+
int mRasterBand = 1;
5656
bool mHasNoDataValue = false;
5757
float mNodataValue = -1;
5858
QgsRectangle mRasterExtent;
5959
QgsCoordinateReferenceSystem mCrs;
60-
double mCellSizeX;
61-
double mCellSizeY;
62-
double mNbCellsXProvider;
63-
double mNbCellsYProvider;
60+
double mCellSizeX = 0;
61+
double mCellSizeY = 0;
62+
double mNbCellsXProvider = 0;
63+
double mNbCellsYProvider = 0;
6464

6565
};
6666

‎src/analysis/processing/qgsalgorithmzonalstatistics.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ class QgsZonalStatisticsAlgorithm : public QgsProcessingAlgorithm
5454

5555
private:
5656
std::unique_ptr< QgsRasterInterface > mInterface;
57-
int mBand;
57+
int mBand = 1;
5858
QString mPrefix;
5959
QgsZonalStatistics::Statistics mStats = QgsZonalStatistics::All;
6060
QgsCoordinateReferenceSystem mCrs;
61-
double mPixelSizeX;
62-
double mPixelSizeY;
61+
double mPixelSizeX = 0;
62+
double mPixelSizeY = 0;
6363
};
6464

6565
///@endcond PRIVATE

‎src/analysis/processing/qgsalgorithmzonalstatisticsfeaturebased.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ class QgsZonalStatisticsFeatureBasedAlgorithm : public QgsProcessingFeatureBased
5858

5959
private:
6060
std::unique_ptr< QgsRasterInterface > mRaster;
61-
int mBand;
61+
int mBand = 1;
6262
QString mPrefix;
6363
QgsZonalStatistics::Statistics mStats = QgsZonalStatistics::All;
6464
QgsCoordinateReferenceSystem mCrs;
6565
bool mCreatedTransform = false;
6666
QgsCoordinateTransform mFeatureToRasterTransform;
67-
double mPixelSizeX;
68-
double mPixelSizeY;
67+
double mPixelSizeX = 0;
68+
double mPixelSizeY = 0;
6969
QgsFields mOutputFields;
7070
QMap<QgsZonalStatistics::Statistic, int> mStatFieldsMapping;
7171
};

‎src/analysis/vector/geometry_checker/qgsgeometrycheck.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,12 @@ class ANALYSIS_EXPORT QgsGeometryCheck
189189
/**
190190
* What level this change affects.
191191
*/
192-
QgsGeometryCheck::ChangeWhat what;
192+
QgsGeometryCheck::ChangeWhat what = QgsGeometryCheck::ChangeWhat::ChangeFeature;
193193

194194
/**
195195
* What action this change performs.
196196
*/
197-
QgsGeometryCheck::ChangeType type;
197+
QgsGeometryCheck::ChangeType type = QgsGeometryCheck::ChangeType::ChangeAdded;
198198

199199
/**
200200
* The index of the part / ring / vertex, depending on \see what.

‎src/core/pointcloud/expression/qgspointcloudexpressionnode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ class CORE_EXPORT QgsPointCloudExpressionNode
235235
/**
236236
* Contains the static, precalculated value for the node if mHasCachedValue is TRUE.
237237
*/
238-
mutable double mCachedStaticValue;
238+
mutable double mCachedStaticValue = 0;
239239

240240
private:
241241

‎src/core/pointcloud/qgspointcloudattribute.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class CORE_EXPORT QgsPointCloudAttribute
128128

129129
QString mName;
130130
int mSize = 0;
131-
DataType mType;
131+
DataType mType = DataType::Char;
132132
};
133133

134134
/**

‎src/core/pointcloud/qgspointcloudindex.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,12 @@ class CORE_EXPORT QgsPointCloudDataBounds
148148
QgsDoubleRange zRange( const QgsVector3D &offset, const QgsVector3D &scale ) const;
149149

150150
private:
151-
qint32 mXMin, mYMin, mZMin, mXMax, mYMax, mZMax;
151+
qint32 mXMin = 0;
152+
qint32 mYMin = 0;
153+
qint32 mZMin = 0;
154+
qint32 mXMax = 0;
155+
qint32 mYMax = 0;
156+
qint32 mZMax = 0;
152157
};
153158

154159
/**
@@ -341,7 +346,7 @@ class CORE_EXPORT QgsPointCloudIndex: public QObject
341346
QgsVector3D mOffset; //!< Offset of our int32 coordinates compared to CRS coords
342347
QgsPointCloudDataBounds mRootBounds; //!< Bounds of the root node's cube (in int32 coordinates)
343348
QgsPointCloudAttributeCollection mAttributes; //! All native attributes stored in the file
344-
int mSpan; //!< Number of points in one direction in a single node
349+
int mSpan = 0; //!< Number of points in one direction in a single node
345350
QgsPointCloudExpression mFilterExpression; //!< The filter expression to be evaluated when fetching node data
346351

347352
QString mError;

‎src/core/providers/ogr/qgsogrproviderutils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ class QgsOgrDataset
285285
friend class QgsOgrProviderUtils;
286286
friend class QgsOgrTransaction;
287287
QgsOgrProviderUtils::DatasetIdentification mIdent;
288-
QgsOgrProviderUtils::DatasetWithLayers *mDs;
288+
QgsOgrProviderUtils::DatasetWithLayers *mDs = nullptr;
289289

290290
QgsOgrDataset() = default;
291291
~QgsOgrDataset() = default;

‎src/core/qgsbookmarkmanager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class CORE_EXPORT QgsBookmark
143143
QString mName;
144144
QString mGroup;
145145
QgsReferencedRectangle mExtent;
146-
double mRotation;
146+
double mRotation = 0;
147147

148148
};
149149

0 commit comments

Comments
 (0)
Please sign in to comment.