Skip to content

Commit b60221a

Browse files
committed
Coverity fixes (uninitialized members)
1 parent 76b0bcf commit b60221a

31 files changed

+212
-64
lines changed

src/analysis/vector/qgstransectsample.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ QgsTransectSample::QgsTransectSample( QgsVectorLayer* strataLayer, QString strat
2222
}
2323

2424
QgsTransectSample::QgsTransectSample()
25+
: mStrataLayer( NULL )
26+
, mBaselineLayer( NULL )
27+
, mShareBaseline( false )
28+
, mMinDistanceUnits( Meters )
29+
, mMinTransectLength( 0.0 )
2530
{
2631
}
2732

src/app/composer/qgsattributeselectiondialog.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ QgsAttributeSelectionDialog::QgsAttributeSelectionDialog( QgsComposerAttributeTa
336336
, mAvailableSortProxyModel( NULL )
337337
, mAvailableSortProxyModelV1( NULL )
338338
, mColumnAlignmentDelegate( NULL )
339+
, mColumnSourceDelegate( NULL )
339340
, mColumnSortOrderDelegate( NULL )
340341
, mColumnWidthDelegate( NULL )
341342
{

src/app/nodetool/qgsmaptoolnodetool.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,14 @@ struct QgsFeatureIdFilter : public QgsPointLocator::MatchFilter
4949
QgsMapToolNodeTool::QgsMapToolNodeTool( QgsMapCanvas* canvas )
5050
: QgsMapToolEdit( canvas )
5151
, mSelectedFeature( 0 )
52+
, mSelectionRectangle( false )
5253
, mMoving( true )
5354
, mClicked( false )
5455
, mCtrl( false )
5556
, mSelectAnother( false )
57+
, mAnother( 0 )
5658
, mSelectionRubberBand( 0 )
59+
, mRect( NULL )
5760
, mIsPoint( false )
5861
, mDeselectOnRelease( -1 )
5962
{
@@ -63,6 +66,8 @@ QgsMapToolNodeTool::QgsMapToolNodeTool( QgsMapCanvas* canvas )
6366
QgsMapToolNodeTool::~QgsMapToolNodeTool()
6467
{
6568
cleanTool();
69+
delete mRect;
70+
delete mSelectionRubberBand;
6671
}
6772

6873
void QgsMapToolNodeTool::createMovingRubberBands()
@@ -513,6 +518,12 @@ void QgsMapToolNodeTool::canvasReleaseEvent( QMouseEvent * e )
513518
mSelectionRubberBand = 0;
514519
}
515520

521+
if ( mRect )
522+
{
523+
delete mRect;
524+
mRect = 0;
525+
}
526+
516527
if ( mPressCoordinates == e->pos() )
517528
{
518529
if ( mSelectAnother )
@@ -605,7 +616,9 @@ void QgsMapToolNodeTool::canvasReleaseEvent( QMouseEvent * e )
605616
void QgsMapToolNodeTool::deactivate()
606617
{
607618
cleanTool();
608-
619+
delete mRect;
620+
mRect = 0;
621+
delete mSelectionRubberBand;
609622
mSelectionRubberBand = 0;
610623
mSelectAnother = false;
611624
mCtrl = false;

src/app/qgisapp.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,13 +820,37 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
820820

821821
QgisApp::QgisApp()
822822
: QMainWindow( 0, 0 )
823+
, mMapLayerOrder( 0 )
823824
, mOverviewMapCursor( 0 )
825+
, mMapWindow( 0 )
824826
, mQgisInterface( 0 )
827+
, mSplash( 0 )
828+
, mMousePrecisionDecimalPlaces( 0 )
825829
, mInternalClipboard( 0 )
830+
, mShowProjectionTab( false )
831+
, mpMapTipsTimer( 0 )
832+
, mDizzyTimer( 0 )
826833
, mpMaptip( 0 )
834+
, mMapTipsVisible( false )
835+
, mFullScreenMode( false )
836+
, mPrevScreenModeMaximized( false )
837+
, mSaveRollbackInProgress( false )
827838
, mPythonUtils( 0 )
839+
, mBrowserWidget( 0 )
840+
, mBrowserWidget2( 0 )
841+
, mAdvancedDigitizingDockWidget( 0 )
842+
, mSnappingDialog( 0 )
843+
, mPluginManager( 0 )
828844
, mComposerManager( 0 )
845+
, mpTileScaleWidget( 0 )
846+
, mLastComposerId( 0 )
829847
, mpGpsWidget( 0 )
848+
, mLastMapToolMessage( 0 )
849+
, mLogViewer( 0 )
850+
, mTrustedMacros( false )
851+
, mMacrosWarn( 0 )
852+
, mVectorLayerTools( 0 )
853+
, mBtnFilterLegend( 0 )
830854
, mSnappingUtils( 0 )
831855
{
832856
smInstance = this;

src/app/qgisapp.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1494,8 +1494,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
14941494
QgsCustomLayerOrderWidget* mMapLayerOrder;
14951495
//! Cursor for the overview map
14961496
QCursor *mOverviewMapCursor;
1497-
//! scale factor
1498-
double mScaleFactor;
14991497
//! Current map window extent in real-world coordinates
15001498
QRect *mMapWindow;
15011499
//! The previously selected non zoom map tool.

src/app/qgsmergeattributesdialog.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ QgsMergeAttributesDialog::QgsMergeAttributesDialog( const QgsFeatureList &featur
5757

5858
QgsMergeAttributesDialog::QgsMergeAttributesDialog()
5959
: QDialog()
60+
, mVectorLayer( NULL )
61+
, mMapCanvas( NULL )
62+
, mSelectionRubberBand( NULL )
6063
{
6164
setupUi( this );
6265

src/app/qgssnappingdialog.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ QgsSnappingDialog::QgsSnappingDialog( QWidget* parent, QgsMapCanvas* canvas )
107107
}
108108

109109
QgsSnappingDialog::QgsSnappingDialog()
110+
: mMapCanvas( NULL )
111+
, mDock( NULL )
110112
{
111113
}
112114

src/core/composer/qgscomposermapgrid.cpp

Lines changed: 52 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -145,47 +145,59 @@ double QgsComposerMapGridStack::maxGridExtension() const
145145

146146
QgsComposerMapGrid::QgsComposerMapGrid( const QString& name, QgsComposerMap* map )
147147
: QgsComposerMapItem( name, map )
148-
, mTransformDirty( true )
149-
, mGridStyle( QgsComposerMapGrid::Solid )
150-
, mGridIntervalX( 0.0 )
151-
, mGridIntervalY( 0.0 )
152-
, mGridOffsetX( 0.0 )
153-
, mGridOffsetY( 0.0 )
154-
, mGridAnnotationFontColor( Qt::black )
155-
, mGridAnnotationPrecision( 3 )
156-
, mShowGridAnnotation( false )
157-
, mLeftGridAnnotationDisplay( QgsComposerMapGrid::ShowAll )
158-
, mRightGridAnnotationDisplay( QgsComposerMapGrid::ShowAll )
159-
, mTopGridAnnotationDisplay( QgsComposerMapGrid::ShowAll )
160-
, mBottomGridAnnotationDisplay( QgsComposerMapGrid::ShowAll )
161-
, mLeftGridAnnotationPosition( QgsComposerMapGrid::OutsideMapFrame )
162-
, mRightGridAnnotationPosition( QgsComposerMapGrid::OutsideMapFrame )
163-
, mTopGridAnnotationPosition( QgsComposerMapGrid::OutsideMapFrame )
164-
, mBottomGridAnnotationPosition( QgsComposerMapGrid::OutsideMapFrame )
165-
, mAnnotationFrameDistance( 1.0 )
166-
, mLeftGridAnnotationDirection( QgsComposerMapGrid::Horizontal )
167-
, mRightGridAnnotationDirection( QgsComposerMapGrid::Horizontal )
168-
, mTopGridAnnotationDirection( QgsComposerMapGrid::Horizontal )
169-
, mBottomGridAnnotationDirection( QgsComposerMapGrid::Horizontal )
170-
, mGridAnnotationFormat( QgsComposerMapGrid::Decimal )
171-
, mGridFrameStyle( QgsComposerMapGrid::NoFrame )
172-
, mGridFrameSides( QgsComposerMapGrid::FrameLeft | QgsComposerMapGrid::FrameRight |
173-
QgsComposerMapGrid::FrameTop | QgsComposerMapGrid::FrameBottom )
174-
, mGridFrameWidth( 2.0 )
175-
, mGridFramePenThickness( 0.3 )
176-
, mGridFramePenColor( QColor( 0, 0, 0 ) )
177-
, mGridFrameFillColor1( Qt::white )
178-
, mGridFrameFillColor2( Qt::black )
179-
, mCrossLength( 3 )
180-
, mLeftFrameDivisions( QgsComposerMapGrid::ShowAll )
181-
, mRightFrameDivisions( QgsComposerMapGrid::ShowAll )
182-
, mTopFrameDivisions( QgsComposerMapGrid::ShowAll )
183-
, mBottomFrameDivisions( QgsComposerMapGrid::ShowAll )
184-
, mGridLineSymbol( 0 )
185-
, mGridMarkerSymbol( 0 )
186-
, mGridUnit( MapUnit )
187-
, mBlendMode( QPainter::CompositionMode_SourceOver )
188148
{
149+
init();
150+
}
151+
152+
QgsComposerMapGrid::QgsComposerMapGrid()
153+
: QgsComposerMapItem( QString(), 0 )
154+
{
155+
init();
156+
}
157+
158+
void QgsComposerMapGrid::init()
159+
{
160+
mTransformDirty = true;
161+
mGridStyle = QgsComposerMapGrid::Solid;
162+
mGridIntervalX = 0.0;
163+
mGridIntervalY = 0.0;
164+
mGridOffsetX = 0.0;
165+
mGridOffsetY = 0.0;
166+
mGridAnnotationFontColor = Qt::black;
167+
mGridAnnotationPrecision = 3;
168+
mShowGridAnnotation = false;
169+
mLeftGridAnnotationDisplay = QgsComposerMapGrid::ShowAll;
170+
mRightGridAnnotationDisplay = QgsComposerMapGrid::ShowAll;
171+
mTopGridAnnotationDisplay = QgsComposerMapGrid::ShowAll;
172+
mBottomGridAnnotationDisplay = QgsComposerMapGrid::ShowAll;
173+
mLeftGridAnnotationPosition = QgsComposerMapGrid::OutsideMapFrame;
174+
mRightGridAnnotationPosition = QgsComposerMapGrid::OutsideMapFrame;
175+
mTopGridAnnotationPosition = QgsComposerMapGrid::OutsideMapFrame;
176+
mBottomGridAnnotationPosition = QgsComposerMapGrid::OutsideMapFrame;
177+
mAnnotationFrameDistance = 1.0;
178+
mLeftGridAnnotationDirection = QgsComposerMapGrid::Horizontal;
179+
mRightGridAnnotationDirection = QgsComposerMapGrid::Horizontal;
180+
mTopGridAnnotationDirection = QgsComposerMapGrid::Horizontal;
181+
mBottomGridAnnotationDirection = QgsComposerMapGrid::Horizontal;
182+
mGridAnnotationFormat = QgsComposerMapGrid::Decimal;
183+
mGridFrameStyle = QgsComposerMapGrid::NoFrame;
184+
mGridFrameSides = QgsComposerMapGrid::FrameLeft | QgsComposerMapGrid::FrameRight |
185+
QgsComposerMapGrid::FrameTop | QgsComposerMapGrid::FrameBottom;
186+
mGridFrameWidth = 2.0;
187+
mGridFramePenThickness = 0.3;
188+
mGridFramePenColor = QColor( 0, 0, 0 );
189+
mGridFrameFillColor1 = Qt::white;
190+
mGridFrameFillColor2 = Qt::black;
191+
mCrossLength = 3;
192+
mLeftFrameDivisions = QgsComposerMapGrid::ShowAll;
193+
mRightFrameDivisions = QgsComposerMapGrid::ShowAll;
194+
mTopFrameDivisions = QgsComposerMapGrid::ShowAll;
195+
mBottomFrameDivisions = QgsComposerMapGrid::ShowAll;
196+
mGridLineSymbol = 0;
197+
mGridMarkerSymbol = 0;
198+
mGridUnit = MapUnit;
199+
mBlendMode = QPainter::CompositionMode_SourceOver;
200+
189201
//get default composer font from settings
190202
QSettings settings;
191203
QString defaultFontString = settings.value( "/Composer/defaultFont" ).toString();
@@ -198,11 +210,6 @@ QgsComposerMapGrid::QgsComposerMapGrid( const QString& name, QgsComposerMap* map
198210
createDefaultGridMarkerSymbol();
199211
}
200212

201-
QgsComposerMapGrid::QgsComposerMapGrid()
202-
: QgsComposerMapItem( QString(), 0 )
203-
{
204-
}
205-
206213
QgsComposerMapGrid::~QgsComposerMapGrid()
207214
{
208215
delete mGridLineSymbol;

src/core/composer/qgscomposermapgrid.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -881,6 +881,8 @@ class CORE_EXPORT QgsComposerMapGrid : public QgsComposerMapItem
881881
QgsComposerMapGrid::AnnotationCoordinate coordinateType;
882882
};
883883

884+
void init();
885+
884886
/**Draws the map grid*/
885887
void drawGridFrame( QPainter* p, const QList< QPair< double, QLineF > >& hLines, const QList< QPair< double, QLineF > >& vLines ) const;
886888

@@ -962,4 +964,6 @@ class CORE_EXPORT QgsComposerMapGrid : public QgsComposerMapItem
962964
friend class TestQgsComposerMapGrid;
963965
};
964966

967+
Q_DECLARE_OPERATORS_FOR_FLAGS( QgsComposerMapGrid::FrameSideFlags )
968+
965969
#endif // QGSCOMPOSERMAPGRID_H

src/core/pal/pointset.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ namespace pal
5353

5454

5555
PointSet::PointSet()
56+
: holeOf( NULL )
57+
, parent( NULL )
58+
, xmin( DBL_MAX )
59+
, xmax( -DBL_MAX )
60+
, ymin( DBL_MAX )
61+
, ymax( -DBL_MAX )
5662
{
5763
nbPoints = cHullSize = 0;
5864
x = NULL;
@@ -62,6 +68,13 @@ namespace pal
6268
}
6369

6470
PointSet::PointSet( int nbPoints, double *x, double *y )
71+
: cHullSize( 0 )
72+
, holeOf( NULL )
73+
, parent( NULL )
74+
, xmin( DBL_MAX )
75+
, xmax( -DBL_MAX )
76+
, ymin( DBL_MAX )
77+
, ymax( -DBL_MAX )
6578
{
6679
this->nbPoints = nbPoints;
6780
this->x = new double[nbPoints];

0 commit comments

Comments
 (0)