Skip to content

Commit

Permalink
Fix cppcheck warnings about uninitialized member variables
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault authored and nyalldawson committed May 18, 2020
1 parent b4eca08 commit 9cc37a1
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 19 deletions.
2 changes: 2 additions & 0 deletions src/3d/qgs3dmapsettings.cpp
Expand Up @@ -35,6 +35,7 @@ Qgs3DMapSettings::Qgs3DMapSettings( const Qgs3DMapSettings &other )
, mOrigin( other.mOrigin )
, mCrs( other.mCrs )
, mBackgroundColor( other.mBackgroundColor )
, mSelectionColor( other.mSelectionColor )
, mTerrainVerticalScale( other.mTerrainVerticalScale )
, mTerrainGenerator( other.mTerrainGenerator ? other.mTerrainGenerator->clone() : nullptr )
, mMapTileResolution( other.mMapTileResolution )
Expand All @@ -50,6 +51,7 @@ Qgs3DMapSettings::Qgs3DMapSettings( const Qgs3DMapSettings &other )
, mPointLights( other.mPointLights )
, mFieldOfView( other.mFieldOfView )
, mLayers( other.mLayers )
, mRenderers() // initialized in body
, mSkyboxEnabled( other.mSkyboxEnabled )
, mSkyboxFileBase( other.mSkyboxFileBase )
, mSkyboxFileExtension( other.mSkyboxFileExtension )
Expand Down
1 change: 1 addition & 0 deletions src/core/mesh/qgsmeshtracerenderer.cpp
Expand Up @@ -956,6 +956,7 @@ QgsMeshParticleTracesField::QgsMeshParticleTracesField( const QgsTriangularMesh
QgsMeshParticleTracesField::QgsMeshParticleTracesField( const QgsMeshParticleTracesField &other ):
QgsMeshStreamField( other ),
mTimeField( other.mTimeField ),
mMagnitudeField( other.mMagnitudeField ),
mDirectionField( other.mDirectionField ),
mParticles( other.mParticles ),
mStumpImage( other.mStumpImage ),
Expand Down
4 changes: 2 additions & 2 deletions src/gui/editorwidgets/qgstexteditwrapper.h
Expand Up @@ -87,8 +87,8 @@ class GUI_EXPORT QgsTextEditWrapper : public QgsEditorWidgetWrapper
void textChanged( const QString &text );

private:
bool mutable mInvalidJSON;
QgsAttributeForm *mForm;
bool mutable mInvalidJSON = false;
QgsAttributeForm *mForm = nullptr;
void updateValues( const QVariant &val, const QVariantList & = QVariantList() ) override;

QTextBrowser *mTextBrowser = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/georeferencer/qgsgeoreftransform.cpp
Expand Up @@ -325,7 +325,7 @@ bool QgsGeorefTransform::gdal_transform( const QgsPointXY &src, QgsPointXY &dst,
double x = src.x();
double y = src.y();
double z = 0.0;
int success;
int success = 0;

// Call GDAL transform function
( *t )( GDALTransformerArgs(), dstToSrc, 1, &x, &y, &z, &success );
Expand Down
7 changes: 2 additions & 5 deletions src/plugins/grass/qtermwidget/BlockArray.h
Expand Up @@ -33,11 +33,8 @@
namespace Konsole {

struct Block {
Block() {
size = 0;
}
unsigned char data[ENTRIES];
size_t size;
unsigned char data[ENTRIES] = {};
size_t size = 0;
};


Expand Down
2 changes: 1 addition & 1 deletion src/plugins/grass/qtermwidget/History.h
Expand Up @@ -75,7 +75,7 @@ class HistoryFile
//'get' is called.
//this is used to detect when a large number of lines are being read and processed from the history
//and automatically mmap the file for better performance (saves the overhead of many lseek-read calls).
int readWriteBalance;
int readWriteBalance = 0;

//when readWriteBalance goes below this threshold, the file will be mmap'ed automatically
static const int MAP_THRESHOLD = -1000;
Expand Down
1 change: 1 addition & 0 deletions src/plugins/grass/qtermwidget/ScreenWindow.cpp
Expand Up @@ -30,6 +30,7 @@ using namespace Konsole;

ScreenWindow::ScreenWindow(QObject* parent)
: QObject(parent)
, _screen(0)
, _windowBuffer(0)
, _windowBufferSize(0)
, _bufferNeedsUpdate(true)
Expand Down
11 changes: 6 additions & 5 deletions src/providers/grass/qgsgrassgislib.h
Expand Up @@ -148,18 +148,19 @@ class GRASS_LIB_EXPORT QgsGrassGisLib
//! Current region extent
QgsRectangle mExtent;
//! Current region rows
int mRows;
int mRows = 0;
//! Current region columns
int mColumns;
int mColumns = 0;
//! X resolution
double mXRes;
double mXRes = 0;
//! Y resolution
double mYRes;
double mYRes = 0;
//! Current coordinate reference system
QgsCoordinateReferenceSystem mCrs;
QgsDistanceArea mDistanceArea;
//! Lat1, lat2 used for geodesic distance calculation
double mLat1, mLat2;
double mLat1 = 0;
double mLat2 = 0;
};

#endif // QGSGRASSGISLIB_H
9 changes: 4 additions & 5 deletions src/providers/wcs/qgswcscapabilities.cpp
Expand Up @@ -68,11 +68,10 @@ QgsWcsCapabilities::QgsWcsCapabilities( const QgsWcsCapabilities &other )
, mServiceExceptionReportDom( other.mServiceExceptionReportDom )
, mCapabilities( other.mCapabilities )
, mCoveragesSupported( other.mCoveragesSupported )
// intentionally omitted:
// - mCapabilitiesReply
// - mErrorTitle
// - mError
// - mErrorFormat
, mCapabilitiesReply( nullptr ) // not copied from other
, mErrorTitle() // not copied from other
, mError() // not copied from other
, mErrorFormat() // not copied from other
, mCoverageCount( other.mCoverageCount )
, mCoverageParents( other.mCoverageParents )
, mCoverageParentIdentifiers( other.mCoverageParentIdentifiers )
Expand Down

0 comments on commit 9cc37a1

Please sign in to comment.