Skip to content

Commit

Permalink
Coverity fixes (uninitialized members)
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Feb 7, 2015
1 parent 76b0bcf commit b60221a
Show file tree
Hide file tree
Showing 31 changed files with 212 additions and 64 deletions.
5 changes: 5 additions & 0 deletions src/analysis/vector/qgstransectsample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ QgsTransectSample::QgsTransectSample( QgsVectorLayer* strataLayer, QString strat
}

QgsTransectSample::QgsTransectSample()
: mStrataLayer( NULL )
, mBaselineLayer( NULL )
, mShareBaseline( false )
, mMinDistanceUnits( Meters )
, mMinTransectLength( 0.0 )
{
}

Expand Down
1 change: 1 addition & 0 deletions src/app/composer/qgsattributeselectiondialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ QgsAttributeSelectionDialog::QgsAttributeSelectionDialog( QgsComposerAttributeTa
, mAvailableSortProxyModel( NULL )
, mAvailableSortProxyModelV1( NULL )
, mColumnAlignmentDelegate( NULL )
, mColumnSourceDelegate( NULL )
, mColumnSortOrderDelegate( NULL )
, mColumnWidthDelegate( NULL )
{
Expand Down
15 changes: 14 additions & 1 deletion src/app/nodetool/qgsmaptoolnodetool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,14 @@ struct QgsFeatureIdFilter : public QgsPointLocator::MatchFilter
QgsMapToolNodeTool::QgsMapToolNodeTool( QgsMapCanvas* canvas )
: QgsMapToolEdit( canvas )
, mSelectedFeature( 0 )
, mSelectionRectangle( false )
, mMoving( true )
, mClicked( false )
, mCtrl( false )
, mSelectAnother( false )
, mAnother( 0 )
, mSelectionRubberBand( 0 )
, mRect( NULL )
, mIsPoint( false )
, mDeselectOnRelease( -1 )
{
Expand All @@ -63,6 +66,8 @@ QgsMapToolNodeTool::QgsMapToolNodeTool( QgsMapCanvas* canvas )
QgsMapToolNodeTool::~QgsMapToolNodeTool()
{
cleanTool();
delete mRect;
delete mSelectionRubberBand;
}

void QgsMapToolNodeTool::createMovingRubberBands()
Expand Down Expand Up @@ -513,6 +518,12 @@ void QgsMapToolNodeTool::canvasReleaseEvent( QMouseEvent * e )
mSelectionRubberBand = 0;
}

if ( mRect )
{
delete mRect;
mRect = 0;
}

if ( mPressCoordinates == e->pos() )
{
if ( mSelectAnother )
Expand Down Expand Up @@ -605,7 +616,9 @@ void QgsMapToolNodeTool::canvasReleaseEvent( QMouseEvent * e )
void QgsMapToolNodeTool::deactivate()
{
cleanTool();

delete mRect;
mRect = 0;
delete mSelectionRubberBand;
mSelectionRubberBand = 0;
mSelectAnother = false;
mCtrl = false;
Expand Down
24 changes: 24 additions & 0 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -820,13 +820,37 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,

QgisApp::QgisApp()
: QMainWindow( 0, 0 )
, mMapLayerOrder( 0 )
, mOverviewMapCursor( 0 )
, mMapWindow( 0 )
, mQgisInterface( 0 )
, mSplash( 0 )
, mMousePrecisionDecimalPlaces( 0 )
, mInternalClipboard( 0 )
, mShowProjectionTab( false )
, mpMapTipsTimer( 0 )
, mDizzyTimer( 0 )
, mpMaptip( 0 )
, mMapTipsVisible( false )
, mFullScreenMode( false )
, mPrevScreenModeMaximized( false )
, mSaveRollbackInProgress( false )
, mPythonUtils( 0 )
, mBrowserWidget( 0 )
, mBrowserWidget2( 0 )
, mAdvancedDigitizingDockWidget( 0 )
, mSnappingDialog( 0 )
, mPluginManager( 0 )
, mComposerManager( 0 )
, mpTileScaleWidget( 0 )
, mLastComposerId( 0 )
, mpGpsWidget( 0 )
, mLastMapToolMessage( 0 )
, mLogViewer( 0 )
, mTrustedMacros( false )
, mMacrosWarn( 0 )
, mVectorLayerTools( 0 )
, mBtnFilterLegend( 0 )
, mSnappingUtils( 0 )
{
smInstance = this;
Expand Down
2 changes: 0 additions & 2 deletions src/app/qgisapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -1494,8 +1494,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
QgsCustomLayerOrderWidget* mMapLayerOrder;
//! Cursor for the overview map
QCursor *mOverviewMapCursor;
//! scale factor
double mScaleFactor;
//! Current map window extent in real-world coordinates
QRect *mMapWindow;
//! The previously selected non zoom map tool.
Expand Down
3 changes: 3 additions & 0 deletions src/app/qgsmergeattributesdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ QgsMergeAttributesDialog::QgsMergeAttributesDialog( const QgsFeatureList &featur

QgsMergeAttributesDialog::QgsMergeAttributesDialog()
: QDialog()
, mVectorLayer( NULL )
, mMapCanvas( NULL )
, mSelectionRubberBand( NULL )
{
setupUi( this );

Expand Down
2 changes: 2 additions & 0 deletions src/app/qgssnappingdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ QgsSnappingDialog::QgsSnappingDialog( QWidget* parent, QgsMapCanvas* canvas )
}

QgsSnappingDialog::QgsSnappingDialog()
: mMapCanvas( NULL )
, mDock( NULL )
{
}

Expand Down
97 changes: 52 additions & 45 deletions src/core/composer/qgscomposermapgrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,47 +145,59 @@ double QgsComposerMapGridStack::maxGridExtension() const

QgsComposerMapGrid::QgsComposerMapGrid( const QString& name, QgsComposerMap* map )
: QgsComposerMapItem( name, map )
, mTransformDirty( true )
, mGridStyle( QgsComposerMapGrid::Solid )
, mGridIntervalX( 0.0 )
, mGridIntervalY( 0.0 )
, mGridOffsetX( 0.0 )
, mGridOffsetY( 0.0 )
, mGridAnnotationFontColor( Qt::black )
, mGridAnnotationPrecision( 3 )
, mShowGridAnnotation( false )
, mLeftGridAnnotationDisplay( QgsComposerMapGrid::ShowAll )
, mRightGridAnnotationDisplay( QgsComposerMapGrid::ShowAll )
, mTopGridAnnotationDisplay( QgsComposerMapGrid::ShowAll )
, mBottomGridAnnotationDisplay( QgsComposerMapGrid::ShowAll )
, mLeftGridAnnotationPosition( QgsComposerMapGrid::OutsideMapFrame )
, mRightGridAnnotationPosition( QgsComposerMapGrid::OutsideMapFrame )
, mTopGridAnnotationPosition( QgsComposerMapGrid::OutsideMapFrame )
, mBottomGridAnnotationPosition( QgsComposerMapGrid::OutsideMapFrame )
, mAnnotationFrameDistance( 1.0 )
, mLeftGridAnnotationDirection( QgsComposerMapGrid::Horizontal )
, mRightGridAnnotationDirection( QgsComposerMapGrid::Horizontal )
, mTopGridAnnotationDirection( QgsComposerMapGrid::Horizontal )
, mBottomGridAnnotationDirection( QgsComposerMapGrid::Horizontal )
, mGridAnnotationFormat( QgsComposerMapGrid::Decimal )
, mGridFrameStyle( QgsComposerMapGrid::NoFrame )
, mGridFrameSides( QgsComposerMapGrid::FrameLeft | QgsComposerMapGrid::FrameRight |
QgsComposerMapGrid::FrameTop | QgsComposerMapGrid::FrameBottom )
, mGridFrameWidth( 2.0 )
, mGridFramePenThickness( 0.3 )
, mGridFramePenColor( QColor( 0, 0, 0 ) )
, mGridFrameFillColor1( Qt::white )
, mGridFrameFillColor2( Qt::black )
, mCrossLength( 3 )
, mLeftFrameDivisions( QgsComposerMapGrid::ShowAll )
, mRightFrameDivisions( QgsComposerMapGrid::ShowAll )
, mTopFrameDivisions( QgsComposerMapGrid::ShowAll )
, mBottomFrameDivisions( QgsComposerMapGrid::ShowAll )
, mGridLineSymbol( 0 )
, mGridMarkerSymbol( 0 )
, mGridUnit( MapUnit )
, mBlendMode( QPainter::CompositionMode_SourceOver )
{
init();
}

QgsComposerMapGrid::QgsComposerMapGrid()
: QgsComposerMapItem( QString(), 0 )
{
init();
}

void QgsComposerMapGrid::init()
{
mTransformDirty = true;
mGridStyle = QgsComposerMapGrid::Solid;
mGridIntervalX = 0.0;
mGridIntervalY = 0.0;
mGridOffsetX = 0.0;
mGridOffsetY = 0.0;
mGridAnnotationFontColor = Qt::black;
mGridAnnotationPrecision = 3;
mShowGridAnnotation = false;
mLeftGridAnnotationDisplay = QgsComposerMapGrid::ShowAll;
mRightGridAnnotationDisplay = QgsComposerMapGrid::ShowAll;
mTopGridAnnotationDisplay = QgsComposerMapGrid::ShowAll;
mBottomGridAnnotationDisplay = QgsComposerMapGrid::ShowAll;
mLeftGridAnnotationPosition = QgsComposerMapGrid::OutsideMapFrame;
mRightGridAnnotationPosition = QgsComposerMapGrid::OutsideMapFrame;
mTopGridAnnotationPosition = QgsComposerMapGrid::OutsideMapFrame;
mBottomGridAnnotationPosition = QgsComposerMapGrid::OutsideMapFrame;
mAnnotationFrameDistance = 1.0;
mLeftGridAnnotationDirection = QgsComposerMapGrid::Horizontal;
mRightGridAnnotationDirection = QgsComposerMapGrid::Horizontal;
mTopGridAnnotationDirection = QgsComposerMapGrid::Horizontal;
mBottomGridAnnotationDirection = QgsComposerMapGrid::Horizontal;
mGridAnnotationFormat = QgsComposerMapGrid::Decimal;
mGridFrameStyle = QgsComposerMapGrid::NoFrame;
mGridFrameSides = QgsComposerMapGrid::FrameLeft | QgsComposerMapGrid::FrameRight |
QgsComposerMapGrid::FrameTop | QgsComposerMapGrid::FrameBottom;
mGridFrameWidth = 2.0;
mGridFramePenThickness = 0.3;
mGridFramePenColor = QColor( 0, 0, 0 );
mGridFrameFillColor1 = Qt::white;
mGridFrameFillColor2 = Qt::black;
mCrossLength = 3;
mLeftFrameDivisions = QgsComposerMapGrid::ShowAll;
mRightFrameDivisions = QgsComposerMapGrid::ShowAll;
mTopFrameDivisions = QgsComposerMapGrid::ShowAll;
mBottomFrameDivisions = QgsComposerMapGrid::ShowAll;
mGridLineSymbol = 0;
mGridMarkerSymbol = 0;
mGridUnit = MapUnit;
mBlendMode = QPainter::CompositionMode_SourceOver;

//get default composer font from settings
QSettings settings;
QString defaultFontString = settings.value( "/Composer/defaultFont" ).toString();
Expand All @@ -198,11 +210,6 @@ QgsComposerMapGrid::QgsComposerMapGrid( const QString& name, QgsComposerMap* map
createDefaultGridMarkerSymbol();
}

QgsComposerMapGrid::QgsComposerMapGrid()
: QgsComposerMapItem( QString(), 0 )
{
}

QgsComposerMapGrid::~QgsComposerMapGrid()
{
delete mGridLineSymbol;
Expand Down
4 changes: 4 additions & 0 deletions src/core/composer/qgscomposermapgrid.h
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,8 @@ class CORE_EXPORT QgsComposerMapGrid : public QgsComposerMapItem
QgsComposerMapGrid::AnnotationCoordinate coordinateType;
};

void init();

/**Draws the map grid*/
void drawGridFrame( QPainter* p, const QList< QPair< double, QLineF > >& hLines, const QList< QPair< double, QLineF > >& vLines ) const;

Expand Down Expand Up @@ -962,4 +964,6 @@ class CORE_EXPORT QgsComposerMapGrid : public QgsComposerMapItem
friend class TestQgsComposerMapGrid;
};

Q_DECLARE_OPERATORS_FOR_FLAGS( QgsComposerMapGrid::FrameSideFlags )

#endif // QGSCOMPOSERMAPGRID_H
13 changes: 13 additions & 0 deletions src/core/pal/pointset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ namespace pal


PointSet::PointSet()
: holeOf( NULL )
, parent( NULL )
, xmin( DBL_MAX )
, xmax( -DBL_MAX )
, ymin( DBL_MAX )
, ymax( -DBL_MAX )
{
nbPoints = cHullSize = 0;
x = NULL;
Expand All @@ -62,6 +68,13 @@ namespace pal
}

PointSet::PointSet( int nbPoints, double *x, double *y )
: cHullSize( 0 )
, holeOf( NULL )
, parent( NULL )
, xmin( DBL_MAX )
, xmax( -DBL_MAX )
, ymin( DBL_MAX )
, ymax( -DBL_MAX )
{
this->nbPoints = nbPoints;
this->x = new double[nbPoints];
Expand Down
5 changes: 4 additions & 1 deletion src/core/pal/problem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ namespace pal
}
}

Problem::Problem() : nblp( 0 ), all_nblp( 0 ), nbft( 0 ), displayAll( 0 ), labelpositions( NULL ), featStartId( NULL ), featNbLp( NULL ), inactiveCost( NULL ), sol( NULL )
Problem::Problem() : nbLabelledLayers( 0 ), labelledLayersName( NULL ), nblp( 0 ), all_nblp( 0 ), nbft( 0 ), displayAll( false ),
scale( 0 ), labelPositionCost( NULL ), nbOlap( NULL ),
labelpositions( NULL ), featStartId( NULL ), featNbLp( NULL ), inactiveCost( NULL ), sol( NULL ), nbActive( 0 ), nbOverlap( 0.0 ),
pal( NULL )
{
bbox[0] = 0;
bbox[1] = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/core/pal/problem.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ namespace pal
private:

/**
* How many layers are lebelled ?
* How many layers are labelled ?
*/
int nbLabelledLayers;

Expand Down
10 changes: 7 additions & 3 deletions src/core/qgshttptransaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,10 @@ QgsHttpTransaction::QgsHttpTransaction( QString uri,
: http( NULL )
, httpid( 0 )
, httpactive( false )
, httpresponsecontenttype( "" )
, httpurl( uri )
, httphost( proxyHost )
, httpredirections( 0 )
, mWatchdogTimer( NULL )
, mError( "" )
{
Q_UNUSED( proxyPort );
Q_UNUSED( proxyUser );
Expand All @@ -64,8 +62,14 @@ QgsHttpTransaction::QgsHttpTransaction( QString uri,
}

QgsHttpTransaction::QgsHttpTransaction()
: http( NULL )
, httpid( 0 )
, httpactive( false )
, httpredirections( 0 )
, mWatchdogTimer( NULL )
{

QSettings s;
mNetworkTimeoutMsec = s.value( "/qgis/networkAndProxy/networkTimeout", "20000" ).toInt();
}

QgsHttpTransaction::~QgsHttpTransaction()
Expand Down
18 changes: 18 additions & 0 deletions src/core/raster/qgsrasterprojector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ QgsRasterProjector::QgsRasterProjector()

QgsRasterProjector::QgsRasterProjector( const QgsRasterProjector &projector )
: QgsRasterInterface( 0 )
, pHelperTop( NULL )
, pHelperBottom( NULL )
, mHelperTopRow( 0 )
, mCPCols( 0 )
, mCPRows( 0 )
, mSqrTolerance( 0 )
, mApproximate( false )
{
mSrcCRS = projector.mSrcCRS;
mDestCRS = projector.mDestCRS;
Expand All @@ -104,6 +111,17 @@ QgsRasterProjector::QgsRasterProjector( const QgsRasterProjector &projector )
mMaxSrcXRes = projector.mMaxSrcXRes;
mMaxSrcYRes = projector.mMaxSrcYRes;
mExtent = projector.mExtent;
mDestRows = projector.mDestRows;
mDestCols = projector.mDestCols;
mDestXRes = projector.mDestXRes;
mDestYRes = projector.mDestYRes;
mSrcRows = projector.mSrcRows;
mSrcCols = projector.mSrcCols;
mSrcXRes = projector.mSrcXRes;
mSrcYRes = projector.mSrcYRes;
mDestRowsPerMatrixRow = projector.mDestRowsPerMatrixRow;
mDestColsPerMatrixCol = projector.mDestColsPerMatrixCol;

}

QgsRasterProjector & QgsRasterProjector::operator=( const QgsRasterProjector & projector )
Expand Down
1 change: 0 additions & 1 deletion src/gui/attributetable/qgsdualview.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ class GUI_EXPORT QgsDualView : public QStackedWidget, private Ui::QgsDualViewBas
QgsAttributeTableFilterModel* mFilterModel;
QgsFeatureListModel* mFeatureListModel;
QgsAttributeForm* mAttributeForm;
QgsCachedFeatureIterator* mFeatureCache;
QSignalMapper* mPreviewActionMapper;
QMenu* mPreviewColumnsMenu;
QgsVectorLayerCache* mLayerCache;
Expand Down
5 changes: 4 additions & 1 deletion src/gui/editorwidgets/qgsfilenamewidgetwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
#include <QGridLayout>

QgsFileNameWidgetWrapper::QgsFileNameWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent )
: QgsEditorWidgetWrapper( vl, fieldIdx, editor, parent )
: QgsEditorWidgetWrapper( vl, fieldIdx, editor, parent )
, mLineEdit( NULL )
, mPushButton( NULL )
, mLabel( NULL )
{
}

Expand Down
Loading

0 comments on commit b60221a

Please sign in to comment.