Skip to content

Commit 7b14373

Browse files
committedJan 26, 2017
Fix some coverity uninitialized variable warnings
1 parent 8f62f83 commit 7b14373

File tree

9 files changed

+21
-22
lines changed

9 files changed

+21
-22
lines changed
 

‎src/app/dwg/qgsdwgimporter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1471,7 +1471,7 @@ void QgsDwgImporter::addLWPolyline( const DRW_LWPolyline &data )
14711471

14721472
QgsPointSequence s;
14731473
QgsCompoundCurve cc;
1474-
double width;
1474+
double width = -1.0; // width is set to correct value during first loop
14751475
bool hadBulge( false );
14761476

14771477
std::vector<DRW_Vertex2D *>::size_type n = data.flags & 1 ? vertexnum : vertexnum - 1;
@@ -1670,7 +1670,7 @@ void QgsDwgImporter::addPolyline( const DRW_Polyline &data )
16701670

16711671
QgsPointSequence s;
16721672
QgsCompoundCurve cc;
1673-
double width;
1673+
double width = -1.0; // width is set to correct value during first loop
16741674
bool hadBulge( false );
16751675

16761676
std::vector<DRW_Vertex *>::size_type n = data.flags & 1 ? vertexnum : vertexnum - 1;

‎src/app/qgisapp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1647,7 +1647,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
16471647
QgsMapTool *mCircularStringCurvePoint;
16481648
QgsMapTool *mCircularStringRadius;
16491649
QgsMapTool *mMoveFeature;
1650-
QgsMapTool *mMoveFeatureCopy;
1650+
QgsMapTool *mMoveFeatureCopy = nullptr;
16511651
QgsMapTool *mOffsetCurve;
16521652
QgsMapTool *mReshapeFeatures;
16531653
QgsMapTool *mSplitFeatures;

‎src/app/qgsselectbyformdialog.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ class APP_EXPORT QgsSelectByFormDialog : public QDialog
6767

6868
private:
6969

70-
QgsAttributeForm* mForm;
71-
QgsVectorLayer* mLayer;
72-
QgsMessageBar* mMessageBar;
73-
QgsMapCanvas* mMapCanvas;
70+
QgsAttributeForm* mForm = nullptr;
71+
QgsVectorLayer* mLayer = nullptr;
72+
QgsMessageBar* mMessageBar = nullptr;
73+
QgsMapCanvas* mMapCanvas = nullptr;
7474

7575
};
7676

‎src/core/qgsaction.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ class CORE_EXPORT QgsAction
187187
QString mShortTitle;
188188
QString mIcon;
189189
QString mCommand;
190-
bool mCaptureOutput;
190+
bool mCaptureOutput = false;
191191
QSet<QString> mActionScopes;
192192
mutable QSharedPointer<QAction> mAction;
193193
QUuid mId;

‎src/core/qgssnappingconfig.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,12 @@ class CORE_EXPORT QgsSnappingConfig
237237

238238
//! associated project for this snapping configuration
239239
QgsProject* mProject;
240-
bool mEnabled;
241-
SnappingMode mMode;
242-
SnappingType mType;
243-
double mTolerance;
244-
QgsTolerance::UnitType mUnits;
245-
bool mIntersectionSnapping;
240+
bool mEnabled = false;
241+
SnappingMode mMode = ActiveLayer;
242+
SnappingType mType = Vertex;
243+
double mTolerance = 0.0;
244+
QgsTolerance::UnitType mUnits = QgsTolerance::ProjectUnits;
245+
bool mIntersectionSnapping = false;
246246

247247
QHash<QgsVectorLayer*, IndividualLayerSettings> mIndividualLayerSettings;
248248

‎src/server/qgsmslayercache.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ QgsMSLayerCache* QgsMSLayerCache::instance()
3333
}
3434

3535
QgsMSLayerCache::QgsMSLayerCache()
36-
: mProjectMaxLayers( 100 )
3736
{
3837
QObject::connect( &mFileSystemWatcher, SIGNAL( fileChanged( const QString& ) ), this, SLOT( removeProjectFileLayers( const QString& ) ) );
3938
}

‎src/server/qgsmslayercache.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,10 @@ class QgsMSLayerCache: public QObject
111111
QFileSystemWatcher mFileSystemWatcher;
112112

113113
//! Maximum number of layers in the cache
114-
int mDefaultMaxLayers;
114+
int mDefaultMaxLayers = 100;
115115

116116
//! Maximum number of layers in the cache, overrides DEFAULT_MAX_N_LAYERS if larger
117-
int mProjectMaxLayers;
117+
int mProjectMaxLayers = 100;
118118

119119
private slots:
120120

‎src/server/qgsservicenativeloader.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,11 @@ class QgsServiceNativeModuleEntry
3636
public:
3737
QgsServiceNativeModuleEntry( const QString& location )
3838
: mLocation( location )
39-
, mModule( nullptr )
4039
{}
4140

42-
QString mLocation;
43-
QgsServiceModule* mModule;
44-
unloadHook_t* mUnloadHook;
41+
QString mLocation;
42+
QgsServiceModule* mModule = nullptr;
43+
unloadHook_t* mUnloadHook = nullptr;
4544
};
4645

4746
//! Constructor

‎tests/bench/qgsbench.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,8 @@ void QgsBench::render()
221221
mLogMap.insert( QStringLiteral( "revision" ), QGSVERSION );
222222

223223
// Calc stats: user, sys, total
224-
double min[4], max[4];
224+
double min[4] = {DBL_MAX};
225+
double max[4] = { -DBL_MAX};
225226
double stdev[4] = {0.};
226227
double maxdev[4] = {0.};
227228
double avg[4] = {0.};

0 commit comments

Comments
 (0)
Please sign in to comment.