Skip to content

Commit 9cc37a1

Browse files
rouaultnyalldawson
authored andcommittedMay 18, 2020
Fix cppcheck warnings about uninitialized member variables
1 parent b4eca08 commit 9cc37a1

File tree

9 files changed

+20
-19
lines changed

9 files changed

+20
-19
lines changed
 

‎src/3d/qgs3dmapsettings.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Qgs3DMapSettings::Qgs3DMapSettings( const Qgs3DMapSettings &other )
3535
, mOrigin( other.mOrigin )
3636
, mCrs( other.mCrs )
3737
, mBackgroundColor( other.mBackgroundColor )
38+
, mSelectionColor( other.mSelectionColor )
3839
, mTerrainVerticalScale( other.mTerrainVerticalScale )
3940
, mTerrainGenerator( other.mTerrainGenerator ? other.mTerrainGenerator->clone() : nullptr )
4041
, mMapTileResolution( other.mMapTileResolution )
@@ -50,6 +51,7 @@ Qgs3DMapSettings::Qgs3DMapSettings( const Qgs3DMapSettings &other )
5051
, mPointLights( other.mPointLights )
5152
, mFieldOfView( other.mFieldOfView )
5253
, mLayers( other.mLayers )
54+
, mRenderers() // initialized in body
5355
, mSkyboxEnabled( other.mSkyboxEnabled )
5456
, mSkyboxFileBase( other.mSkyboxFileBase )
5557
, mSkyboxFileExtension( other.mSkyboxFileExtension )

‎src/core/mesh/qgsmeshtracerenderer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,7 @@ QgsMeshParticleTracesField::QgsMeshParticleTracesField( const QgsTriangularMesh
956956
QgsMeshParticleTracesField::QgsMeshParticleTracesField( const QgsMeshParticleTracesField &other ):
957957
QgsMeshStreamField( other ),
958958
mTimeField( other.mTimeField ),
959+
mMagnitudeField( other.mMagnitudeField ),
959960
mDirectionField( other.mDirectionField ),
960961
mParticles( other.mParticles ),
961962
mStumpImage( other.mStumpImage ),

‎src/gui/editorwidgets/qgstexteditwrapper.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ class GUI_EXPORT QgsTextEditWrapper : public QgsEditorWidgetWrapper
8787
void textChanged( const QString &text );
8888

8989
private:
90-
bool mutable mInvalidJSON;
91-
QgsAttributeForm *mForm;
90+
bool mutable mInvalidJSON = false;
91+
QgsAttributeForm *mForm = nullptr;
9292
void updateValues( const QVariant &val, const QVariantList & = QVariantList() ) override;
9393

9494
QTextBrowser *mTextBrowser = nullptr;

‎src/plugins/georeferencer/qgsgeoreftransform.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ bool QgsGeorefTransform::gdal_transform( const QgsPointXY &src, QgsPointXY &dst,
325325
double x = src.x();
326326
double y = src.y();
327327
double z = 0.0;
328-
int success;
328+
int success = 0;
329329

330330
// Call GDAL transform function
331331
( *t )( GDALTransformerArgs(), dstToSrc, 1, &x, &y, &z, &success );

‎src/plugins/grass/qtermwidget/BlockArray.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,8 @@
3333
namespace Konsole {
3434

3535
struct Block {
36-
Block() {
37-
size = 0;
38-
}
39-
unsigned char data[ENTRIES];
40-
size_t size;
36+
unsigned char data[ENTRIES] = {};
37+
size_t size = 0;
4138
};
4239

4340

‎src/plugins/grass/qtermwidget/History.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class HistoryFile
7575
//'get' is called.
7676
//this is used to detect when a large number of lines are being read and processed from the history
7777
//and automatically mmap the file for better performance (saves the overhead of many lseek-read calls).
78-
int readWriteBalance;
78+
int readWriteBalance = 0;
7979

8080
//when readWriteBalance goes below this threshold, the file will be mmap'ed automatically
8181
static const int MAP_THRESHOLD = -1000;

‎src/plugins/grass/qtermwidget/ScreenWindow.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ using namespace Konsole;
3030

3131
ScreenWindow::ScreenWindow(QObject* parent)
3232
: QObject(parent)
33+
, _screen(0)
3334
, _windowBuffer(0)
3435
, _windowBufferSize(0)
3536
, _bufferNeedsUpdate(true)

‎src/providers/grass/qgsgrassgislib.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,18 +148,19 @@ class GRASS_LIB_EXPORT QgsGrassGisLib
148148
//! Current region extent
149149
QgsRectangle mExtent;
150150
//! Current region rows
151-
int mRows;
151+
int mRows = 0;
152152
//! Current region columns
153-
int mColumns;
153+
int mColumns = 0;
154154
//! X resolution
155-
double mXRes;
155+
double mXRes = 0;
156156
//! Y resolution
157-
double mYRes;
157+
double mYRes = 0;
158158
//! Current coordinate reference system
159159
QgsCoordinateReferenceSystem mCrs;
160160
QgsDistanceArea mDistanceArea;
161161
//! Lat1, lat2 used for geodesic distance calculation
162-
double mLat1, mLat2;
162+
double mLat1 = 0;
163+
double mLat2 = 0;
163164
};
164165

165166
#endif // QGSGRASSGISLIB_H

‎src/providers/wcs/qgswcscapabilities.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,10 @@ QgsWcsCapabilities::QgsWcsCapabilities( const QgsWcsCapabilities &other )
6868
, mServiceExceptionReportDom( other.mServiceExceptionReportDom )
6969
, mCapabilities( other.mCapabilities )
7070
, mCoveragesSupported( other.mCoveragesSupported )
71-
// intentionally omitted:
72-
// - mCapabilitiesReply
73-
// - mErrorTitle
74-
// - mError
75-
// - mErrorFormat
71+
, mCapabilitiesReply( nullptr ) // not copied from other
72+
, mErrorTitle() // not copied from other
73+
, mError() // not copied from other
74+
, mErrorFormat() // not copied from other
7675
, mCoverageCount( other.mCoverageCount )
7776
, mCoverageParents( other.mCoverageParents )
7877
, mCoverageParentIdentifiers( other.mCoverageParentIdentifiers )

0 commit comments

Comments
 (0)
Please sign in to comment.