Skip to content

Commit c253a9f

Browse files
committed
Uninitialized variable fixes
1 parent ba7f0c7 commit c253a9f

File tree

61 files changed

+163
-41
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+163
-41
lines changed

src/app/nodetool/qgsvertexentry.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ QgsVertexEntry::QgsVertexEntry( QgsMapCanvas *canvas, QgsMapLayer *layer, QgsPoi
2121
, mEquals( -1 )
2222
, mInRubberBand( false )
2323
, mRubberBandNr( 0 )
24+
, mRubberBandIndex( 0 )
2425
, mPenWidth( penWidth )
2526
, mToolTip( tooltip )
2627
, mType( type )

src/app/qgsdecorationnortharrow.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class APP_EXPORT QgsDecorationNorthArrow: public QgsDecorationItem
6262

6363
// The amount of rotation for the north arrow
6464
int mRotationInt;
65-
int pluginType;
65+
6666
//! enable or disable the automatic setting of the arrow direction
6767
bool mAutomatic;
6868
// The placement index and translated text

src/app/qgsdiagramproperties.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939

4040
QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer* layer, QWidget* parent )
4141
: QWidget( parent )
42+
, mAvailableAttributes( 0 )
4243
{
4344
mLayer = layer;
4445

src/app/qgsdisplayangle.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
#include <cmath>
2222

2323
QgsDisplayAngle::QgsDisplayAngle( QgsMapToolMeasureAngle * tool, Qt::WindowFlags f )
24-
: QDialog( tool->canvas()->topLevelWidget(), f ), mTool( tool )
24+
: QDialog( tool->canvas()->topLevelWidget(), f )
25+
, mTool( tool )
26+
, mValue( 0.0 )
2527
{
2628
setupUi( this );
2729
}

src/app/qgsfieldcalculator.h

-2
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ class APP_EXPORT QgsFieldCalculator: public QDialog, private Ui::QgsFieldCalcula
7070

7171
/**idx of changed attribute*/
7272
int mAttributeId;
73-
74-
bool mExpressionValid;
7573
};
7674

7775
#endif // QGSFIELDCALCULATOR_H

src/app/qgslabelinggui.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@
4646

4747

4848
QgsLabelingGui::QgsLabelingGui( QgsVectorLayer* layer, QgsMapCanvas* mapCanvas, QWidget* parent )
49-
: QWidget( parent ), mLayer( layer ), mMapCanvas( mapCanvas )
49+
: QWidget( parent )
50+
, mLayer( layer )
51+
, mMapCanvas( mapCanvas )
52+
, mMinPixelLimit( 0 )
53+
, mLoadSvgParams( false )
5054
{
5155
if ( !layer )
5256
return;

src/app/qgsloadstylefromdbdialog.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
QgsLoadStyleFromDBDialog::QgsLoadStyleFromDBDialog( QWidget *parent )
1818
: QDialog( parent )
19+
, mSectionLimit( 0 )
1920
{
2021
setupUi( this );
2122
setWindowTitle( "Load style from database" );

src/app/qgsmaptooloffsetcurve.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ QgsMapToolOffsetCurve::QgsMapToolOffsetCurve( QgsMapCanvas* canvas )
2929
: QgsMapToolEdit( canvas )
3030
, mRubberBand( 0 )
3131
, mOriginalGeometry( 0 )
32+
, mModifiedFeature( -1 )
3233
, mGeometryModified( false )
3334
, mDistanceItem( 0 )
3435
, mDistanceSpinBox( 0 )

src/app/qgsmaptoolrotatefeature.cpp

+8-4
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,15 @@
2929

3030
#define PI 3.14159265
3131

32-
QgsMapToolRotateFeature::QgsMapToolRotateFeature( QgsMapCanvas* canvas ): QgsMapToolEdit( canvas ), mRubberBand( 0 )
32+
QgsMapToolRotateFeature::QgsMapToolRotateFeature( QgsMapCanvas* canvas )
33+
: QgsMapToolEdit( canvas )
34+
, mRubberBand( 0 )
35+
, mRotation( 0 )
36+
, mRotationOffset( 0 )
37+
, mAnchorPoint( 0 )
38+
, mCtrl( false )
3339
{
34-
mRotation = 0;
35-
mAnchorPoint = 0;
36-
mCtrl = false;
40+
3741
}
3842

3943
QgsMapToolRotateFeature::~QgsMapToolRotateFeature()

src/app/qgsmaptoolrotatelabel.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,14 @@
2727
#include "qgisapp.h"
2828
#include "qgsapplication.h"
2929

30-
QgsMapToolRotateLabel::QgsMapToolRotateLabel( QgsMapCanvas* canvas ): QgsMapToolLabel( canvas ), mRotationItem( 0 ), mRotationPreviewBox( 0 )
30+
QgsMapToolRotateLabel::QgsMapToolRotateLabel( QgsMapCanvas* canvas )
31+
: QgsMapToolLabel( canvas )
32+
, mStartRotation( 0.0 )
33+
, mCurrentRotation( 0.0 )
34+
, mCurrentMouseAzimuth( 0.0 )
35+
, mRotationItem( 0 )
36+
, mRotationPreviewBox( 0 )
37+
, mCtrlPressed( false )
3138
{
3239
}
3340

src/app/qgsmaptoolselectfreehand.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ email : jpalmer at linz dot govt dot nz
2525

2626
QgsMapToolSelectFreehand::QgsMapToolSelectFreehand( QgsMapCanvas* canvas )
2727
: QgsMapTool( canvas )
28+
, mDragging( false )
2829
{
2930
mRubberBand = 0;
3031
mCursor = Qt::ArrowCursor;

src/app/qgsmaptoolshowhidelabels.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
QgsMapToolShowHideLabels::QgsMapToolShowHideLabels( QgsMapCanvas* canvas )
3131
: QgsMapToolLabel( canvas )
32+
, mDragging( false )
3233
{
3334
mToolName = tr( "Show/hide labels" );
3435
mRubberBand = 0;

src/app/qgsmeasuretool.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
QgsMeasureTool::QgsMeasureTool( QgsMapCanvas* canvas, bool measureArea )
3535
: QgsMapTool( canvas )
36+
, mWrongProjectProjection( false )
3637
{
3738
mMeasureArea = measureArea;
3839

src/app/qgspointrotationitem.cpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,20 @@
1717
#include <QPainter>
1818
#include <cmath>
1919

20-
QgsPointRotationItem::QgsPointRotationItem( QgsMapCanvas* canvas ): QgsMapCanvasItem( canvas ), mOrientation( Clockwise ), mRotation( 0.0 )
20+
QgsPointRotationItem::QgsPointRotationItem( QgsMapCanvas* canvas )
21+
: QgsMapCanvasItem( canvas )
22+
, mOrientation( Clockwise )
23+
, mRotation( 0.0 )
2124
{
2225
//setup font
2326
mFont.setPointSize( 12 );
2427
mFont.setBold( true );
2528
}
2629

27-
QgsPointRotationItem::QgsPointRotationItem(): QgsMapCanvasItem( 0 ), mRotation( 0.0 )
30+
QgsPointRotationItem::QgsPointRotationItem()
31+
: QgsMapCanvasItem( 0 )
32+
, mOrientation( Clockwise )
33+
, mRotation( 0.0 )
2834
{
2935

3036
}

src/core/dxf/qgsdxfexport.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ QgsDxfExport::QgsDxfExport()
316316
}
317317

318318
QgsDxfExport::QgsDxfExport( const QgsDxfExport& dxfExport )
319+
: mModelSpaceBR( 0 )
319320
{
320321
*this = dxfExport;
321322
}

src/core/pal/feature.cpp

+19-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,25 @@
6262
namespace pal
6363
{
6464
Feature::Feature( Layer* l, const char* geom_id, PalGeometry* userG, double lx, double ly )
65-
: layer( l ), userGeom( userG ), label_x( lx ), label_y( ly ), distlabel( 0 ), labelInfo( NULL ), fixedPos( false ),
66-
quadOffset( false ), offsetPos( false ), fixedRotation( false ), alwaysShow( false )
65+
: layer( l )
66+
, userGeom( userG )
67+
, label_x( lx )
68+
, label_y( ly )
69+
, distlabel( 0 )
70+
, labelInfo( NULL )
71+
, fixedPos( false )
72+
, fixedPosX( 0.0 )
73+
, fixedPosY( 0.0 )
74+
, quadOffset( false )
75+
, quadOffsetX( 0.0 )
76+
, quadOffsetY( 0.0 )
77+
, offsetPos( false )
78+
, offsetPosX( 0.0 )
79+
, offsetPosY( 0.0 )
80+
, fixedRotation( false )
81+
, fixedAngle( 0.0 )
82+
, repeatDist( 0.0 )
83+
, alwaysShow( false )
6784
{
6885
assert( finite( lx ) && finite( ly ) );
6986

src/core/pal/labelposition.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
namespace pal
5656
{
5757
LabelPosition::LabelPosition( int id, double x1, double y1, double w, double h, double alpha, double cost, FeaturePart *feature, bool isReversed )
58-
: id( id ), cost( cost ), feature( feature ), nbOverlap( 0 ), alpha( alpha ), w( w ), h( h ), nextPart( NULL ), partId( -1 ), reversed( isReversed ), upsideDown( false )
58+
: id( id ), cost( cost ), feature( feature ), probFeat( 0 ), nbOverlap( 0 ), alpha( alpha ), w( w ), h( h ), nextPart( NULL ), partId( -1 ), reversed( isReversed ), upsideDown( false )
5959
{
6060

6161
// alpha take his value bw 0 and 2*pi rad
@@ -165,6 +165,7 @@ namespace pal
165165
nextPart = NULL;
166166
partId = other.partId;
167167
upsideDown = other.upsideDown;
168+
reversed = other.reversed;
168169
}
169170

170171
bool LabelPosition::isIn( double *bbox )

src/core/pal/pal.h

-3
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,6 @@ namespace pal
133133

134134
SimpleMutex *lyrsMutex;
135135

136-
// TODO remove after tests !!!
137-
clock_t tmpTime;
138-
139136
Units map_unit;
140137

141138
/**

src/core/qgserror.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class CORE_EXPORT QgsErrorMessage
3636
Html
3737
};
3838

39-
QgsErrorMessage() {}
39+
QgsErrorMessage() : mLine( 0 ), mFormat( Text ) {}
4040

4141
/** Constructor.
4242
* @param theMessage error message string

src/core/qgsfeaturerequest.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ QgsFeatureRequest::QgsFeatureRequest( const QgsRectangle& rect )
4949

5050
QgsFeatureRequest::QgsFeatureRequest( const QgsExpression& expr )
5151
: mFilter( FilterExpression )
52+
, mFilterFid( -1 )
5253
, mFilterExpression( new QgsExpression( expr.expression() ) )
5354
, mFlags( 0 )
5455
{

src/core/qgsmultirenderchecker.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <QDebug>
1919

2020
QgsMultiRenderChecker::QgsMultiRenderChecker()
21+
: mColorTolerance( 0 )
2122
{
2223
}
2324

src/core/qgsprojectversion.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ class CORE_EXPORT QgsProjectVersion
3232

3333
public:
3434

35-
QgsProjectVersion() {};
36-
~QgsProjectVersion() {};
35+
QgsProjectVersion() : mMajor( 0 ), mMinor( 0 ), mSub( 0 ) {}
36+
~QgsProjectVersion() {}
3737
QgsProjectVersion( int major, int minor, int sub, QString name = "" );
3838
QgsProjectVersion( QString string );
39-
int majorVersion() { return mMajor;};
40-
int minorVersion() { return mMinor;};
41-
int subVersion() { return mSub;};
39+
int majorVersion() { return mMajor;}
40+
int minorVersion() { return mMinor;}
41+
int subVersion() { return mSub;}
4242
QString text();
4343

4444
/*! Boolean equal operator

src/core/qgssnapper.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,14 @@
2727

2828
QgsSnapper::QgsSnapper( QgsMapRenderer* mapRenderer )
2929
: mMapSettings( mapRenderer->mapSettings() )
30+
, mSnapMode( SnapWithOneResult )
3031
{
3132

3233
}
3334

3435
QgsSnapper::QgsSnapper( const QgsMapSettings& mapSettings )
3536
: mMapSettings( mapSettings )
37+
, mSnapMode( SnapWithOneResult )
3638
{
3739
}
3840

src/core/qgsvectorlayerfeatureiterator.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ QgsFeatureIterator QgsVectorLayerFeatureSource::getFeatures( const QgsFeatureReq
8888
QgsVectorLayerFeatureIterator::QgsVectorLayerFeatureIterator( QgsVectorLayerFeatureSource* source, bool ownSource, const QgsFeatureRequest& request )
8989
: QgsAbstractFeatureIteratorFromSource<QgsVectorLayerFeatureSource>( source, ownSource, request )
9090
, mEditGeometrySimplifier( 0 )
91+
, mFetchedFid( false )
9192
{
9293

9394
// prepare joins: may add more attributes to fetch (in order to allow join)

src/core/qgsvectorlayerrenderer.h

-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ class QgsVectorLayerRenderer : public QgsMapLayerRenderer
9292

9393
QgsFeatureRendererV2 *mRendererV2;
9494

95-
bool mCacheFeatures;
9695
QgsGeometryCache* mCache;
9796

9897
bool mDrawVertexMarkers;

src/core/raster/qgscolorrampshader.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class CORE_EXPORT QgsColorRampShader : public QgsRasterShaderFunction
4242
struct ColorRampItem
4343
{
4444
//! default constructor
45-
ColorRampItem() {}
45+
ColorRampItem() : value( 0 ) {}
4646
//! convenience constructor
4747
ColorRampItem( double val, QColor col, QString lbl = QString() ) : label( lbl ), value( val ), color( col ) {}
4848

src/core/raster/qgsrasterbandstats.h

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ class CORE_EXPORT QgsRasterBandStats
5959
elementCount = 0;
6060
width = 0;
6161
height = 0;
62+
bandNumber = 1;
6263
}
6364

6465
/*! Compares region, size etc. not collected statistics */

src/core/symbology-ng/qgscategorizedsymbolrendererv2.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <QSettings> // for legend
3232

3333
QgsRendererCategoryV2::QgsRendererCategoryV2()
34+
: mRender( true )
3435
{
3536
}
3637

@@ -147,6 +148,8 @@ QgsCategorizedSymbolRendererV2::QgsCategorizedSymbolRendererV2( QString attrName
147148
, mCategories( categories )
148149
, mInvertedColorRamp( false )
149150
, mScaleMethod( DEFAULT_SCALE_METHOD )
151+
, mAttrNum( -1 )
152+
, mCounting( false )
150153
{
151154
for ( int i = 0; i < mCategories.count(); ++i )
152155
{

src/core/symbology-ng/qgsfillsymbollayerv2.cpp

+15-3
Original file line numberDiff line numberDiff line change
@@ -1546,7 +1546,11 @@ QgsMapUnitScale QgsShapeburstFillSymbolLayerV2::mapUnitScale() const
15461546

15471547
//QgsImageFillSymbolLayer
15481548

1549-
QgsImageFillSymbolLayer::QgsImageFillSymbolLayer(): mOutlineWidth( 0.0 ), mOutlineWidthUnit( QgsSymbolV2::MM ), mOutline( 0 )
1549+
QgsImageFillSymbolLayer::QgsImageFillSymbolLayer()
1550+
: mNextAngle( 0.0 )
1551+
, mOutlineWidth( 0.0 )
1552+
, mOutlineWidthUnit( QgsSymbolV2::MM )
1553+
, mOutline( 0 )
15501554
{
15511555
setSubSymbol( new QgsLineSymbolV2() );
15521556
}
@@ -2251,8 +2255,16 @@ void QgsSVGFillSymbolLayer::setDefaultSvgParams()
22512255
}
22522256

22532257

2254-
QgsLinePatternFillSymbolLayer::QgsLinePatternFillSymbolLayer(): QgsImageFillSymbolLayer(), mDistanceUnit( QgsSymbolV2::MM ), mLineWidthUnit( QgsSymbolV2::MM ),
2255-
mOffsetUnit( QgsSymbolV2::MM ), mFillLineSymbol( 0 )
2258+
QgsLinePatternFillSymbolLayer::QgsLinePatternFillSymbolLayer()
2259+
: QgsImageFillSymbolLayer()
2260+
, mDistance( 5.0 )
2261+
, mDistanceUnit( QgsSymbolV2::MM )
2262+
, mLineWidth( 0 )
2263+
, mLineWidthUnit( QgsSymbolV2::MM )
2264+
, mLineAngle( 45.0 )
2265+
, mOffset( 0.0 )
2266+
, mOffsetUnit( QgsSymbolV2::MM )
2267+
, mFillLineSymbol( 0 )
22562268
{
22572269
setSubSymbol( new QgsLineSymbolV2() );
22582270
QgsImageFillSymbolLayer::setSubSymbol( 0 ); //no outline

src/core/symbology-ng/qgsgraduatedsymbolrendererv2.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ QgsRendererRangeV2::QgsRendererRangeV2()
3838
, mUpperValue( 0 )
3939
, mSymbol( 0 )
4040
, mLabel()
41+
, mRender( true )
4142
{
4243
}
4344

@@ -284,6 +285,9 @@ QgsGraduatedSymbolRendererV2::QgsGraduatedSymbolRendererV2( QString attrName, Qg
284285
, mMode( Custom )
285286
, mInvertedColorRamp( false )
286287
, mScaleMethod( DEFAULT_SCALE_METHOD )
288+
, mAttrNum( -1 )
289+
, mCounting( false )
290+
287291
{
288292
// TODO: check ranges for sanity (NULL symbols, invalid ranges)
289293
}

src/core/symbology-ng/qgsmarkersymbollayerv2.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ QgsSimpleMarkerSymbolLayerV2::QgsSimpleMarkerSymbolLayerV2( QString name, QColor
6363
mOffsetUnit = QgsSymbolV2::MM;
6464
mAngleExpression = NULL;
6565
mNameExpression = NULL;
66+
mUsingCache = false;
6667
}
6768

6869
QgsSymbolLayerV2* QgsSimpleMarkerSymbolLayerV2::create( const QgsStringMap& props )

src/core/symbology-ng/qgssinglesymbolrendererv2.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ QgsSingleSymbolRendererV2::QgsSingleSymbolRendererV2( QgsSymbolV2* symbol )
3333
: QgsFeatureRendererV2( "singleSymbol" )
3434
, mSymbol( symbol )
3535
, mScaleMethod( DEFAULT_SCALE_METHOD )
36+
, mOrigSize( 0.0 )
3637
{
3738
Q_ASSERT( symbol );
3839
}

0 commit comments

Comments
 (0)