Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Uninitialized variable fixes
  • Loading branch information
nyalldawson committed Feb 10, 2015
1 parent ba7f0c7 commit c253a9f
Show file tree
Hide file tree
Showing 61 changed files with 163 additions and 41 deletions.
1 change: 1 addition & 0 deletions src/app/nodetool/qgsvertexentry.cpp
Expand Up @@ -21,6 +21,7 @@ QgsVertexEntry::QgsVertexEntry( QgsMapCanvas *canvas, QgsMapLayer *layer, QgsPoi
, mEquals( -1 )
, mInRubberBand( false )
, mRubberBandNr( 0 )
, mRubberBandIndex( 0 )
, mPenWidth( penWidth )
, mToolTip( tooltip )
, mType( type )
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsdecorationnortharrow.h
Expand Up @@ -62,7 +62,7 @@ class APP_EXPORT QgsDecorationNorthArrow: public QgsDecorationItem

// The amount of rotation for the north arrow
int mRotationInt;
int pluginType;

//! enable or disable the automatic setting of the arrow direction
bool mAutomatic;
// The placement index and translated text
Expand Down
1 change: 1 addition & 0 deletions src/app/qgsdiagramproperties.cpp
Expand Up @@ -39,6 +39,7 @@

QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer* layer, QWidget* parent )
: QWidget( parent )
, mAvailableAttributes( 0 )
{
mLayer = layer;

Expand Down
4 changes: 3 additions & 1 deletion src/app/qgsdisplayangle.cpp
Expand Up @@ -21,7 +21,9 @@
#include <cmath>

QgsDisplayAngle::QgsDisplayAngle( QgsMapToolMeasureAngle * tool, Qt::WindowFlags f )
: QDialog( tool->canvas()->topLevelWidget(), f ), mTool( tool )
: QDialog( tool->canvas()->topLevelWidget(), f )
, mTool( tool )
, mValue( 0.0 )
{
setupUi( this );
}
Expand Down
2 changes: 0 additions & 2 deletions src/app/qgsfieldcalculator.h
Expand Up @@ -70,8 +70,6 @@ class APP_EXPORT QgsFieldCalculator: public QDialog, private Ui::QgsFieldCalcula

/**idx of changed attribute*/
int mAttributeId;

bool mExpressionValid;
};

#endif // QGSFIELDCALCULATOR_H
6 changes: 5 additions & 1 deletion src/app/qgslabelinggui.cpp
Expand Up @@ -46,7 +46,11 @@


QgsLabelingGui::QgsLabelingGui( QgsVectorLayer* layer, QgsMapCanvas* mapCanvas, QWidget* parent )
: QWidget( parent ), mLayer( layer ), mMapCanvas( mapCanvas )
: QWidget( parent )
, mLayer( layer )
, mMapCanvas( mapCanvas )
, mMinPixelLimit( 0 )
, mLoadSvgParams( false )
{
if ( !layer )
return;
Expand Down
1 change: 1 addition & 0 deletions src/app/qgsloadstylefromdbdialog.cpp
Expand Up @@ -16,6 +16,7 @@

QgsLoadStyleFromDBDialog::QgsLoadStyleFromDBDialog( QWidget *parent )
: QDialog( parent )
, mSectionLimit( 0 )
{
setupUi( this );
setWindowTitle( "Load style from database" );
Expand Down
1 change: 1 addition & 0 deletions src/app/qgsmaptooloffsetcurve.cpp
Expand Up @@ -29,6 +29,7 @@ QgsMapToolOffsetCurve::QgsMapToolOffsetCurve( QgsMapCanvas* canvas )
: QgsMapToolEdit( canvas )
, mRubberBand( 0 )
, mOriginalGeometry( 0 )
, mModifiedFeature( -1 )
, mGeometryModified( false )
, mDistanceItem( 0 )
, mDistanceSpinBox( 0 )
Expand Down
12 changes: 8 additions & 4 deletions src/app/qgsmaptoolrotatefeature.cpp
Expand Up @@ -29,11 +29,15 @@

#define PI 3.14159265

QgsMapToolRotateFeature::QgsMapToolRotateFeature( QgsMapCanvas* canvas ): QgsMapToolEdit( canvas ), mRubberBand( 0 )
QgsMapToolRotateFeature::QgsMapToolRotateFeature( QgsMapCanvas* canvas )
: QgsMapToolEdit( canvas )
, mRubberBand( 0 )
, mRotation( 0 )
, mRotationOffset( 0 )
, mAnchorPoint( 0 )
, mCtrl( false )
{
mRotation = 0;
mAnchorPoint = 0;
mCtrl = false;

}

QgsMapToolRotateFeature::~QgsMapToolRotateFeature()
Expand Down
9 changes: 8 additions & 1 deletion src/app/qgsmaptoolrotatelabel.cpp
Expand Up @@ -27,7 +27,14 @@
#include "qgisapp.h"
#include "qgsapplication.h"

QgsMapToolRotateLabel::QgsMapToolRotateLabel( QgsMapCanvas* canvas ): QgsMapToolLabel( canvas ), mRotationItem( 0 ), mRotationPreviewBox( 0 )
QgsMapToolRotateLabel::QgsMapToolRotateLabel( QgsMapCanvas* canvas )
: QgsMapToolLabel( canvas )
, mStartRotation( 0.0 )
, mCurrentRotation( 0.0 )
, mCurrentMouseAzimuth( 0.0 )
, mRotationItem( 0 )
, mRotationPreviewBox( 0 )
, mCtrlPressed( false )
{
}

Expand Down
1 change: 1 addition & 0 deletions src/app/qgsmaptoolselectfreehand.cpp
Expand Up @@ -25,6 +25,7 @@ email : jpalmer at linz dot govt dot nz

QgsMapToolSelectFreehand::QgsMapToolSelectFreehand( QgsMapCanvas* canvas )
: QgsMapTool( canvas )
, mDragging( false )
{
mRubberBand = 0;
mCursor = Qt::ArrowCursor;
Expand Down
1 change: 1 addition & 0 deletions src/app/qgsmaptoolshowhidelabels.cpp
Expand Up @@ -29,6 +29,7 @@

QgsMapToolShowHideLabels::QgsMapToolShowHideLabels( QgsMapCanvas* canvas )
: QgsMapToolLabel( canvas )
, mDragging( false )
{
mToolName = tr( "Show/hide labels" );
mRubberBand = 0;
Expand Down
1 change: 1 addition & 0 deletions src/app/qgsmeasuretool.cpp
Expand Up @@ -33,6 +33,7 @@

QgsMeasureTool::QgsMeasureTool( QgsMapCanvas* canvas, bool measureArea )
: QgsMapTool( canvas )
, mWrongProjectProjection( false )
{
mMeasureArea = measureArea;

Expand Down
10 changes: 8 additions & 2 deletions src/app/qgspointrotationitem.cpp
Expand Up @@ -17,14 +17,20 @@
#include <QPainter>
#include <cmath>

QgsPointRotationItem::QgsPointRotationItem( QgsMapCanvas* canvas ): QgsMapCanvasItem( canvas ), mOrientation( Clockwise ), mRotation( 0.0 )
QgsPointRotationItem::QgsPointRotationItem( QgsMapCanvas* canvas )
: QgsMapCanvasItem( canvas )
, mOrientation( Clockwise )
, mRotation( 0.0 )
{
//setup font
mFont.setPointSize( 12 );
mFont.setBold( true );
}

QgsPointRotationItem::QgsPointRotationItem(): QgsMapCanvasItem( 0 ), mRotation( 0.0 )
QgsPointRotationItem::QgsPointRotationItem()
: QgsMapCanvasItem( 0 )
, mOrientation( Clockwise )
, mRotation( 0.0 )
{

}
Expand Down
1 change: 1 addition & 0 deletions src/core/dxf/qgsdxfexport.cpp
Expand Up @@ -316,6 +316,7 @@ QgsDxfExport::QgsDxfExport()
}

QgsDxfExport::QgsDxfExport( const QgsDxfExport& dxfExport )
: mModelSpaceBR( 0 )
{
*this = dxfExport;
}
Expand Down
21 changes: 19 additions & 2 deletions src/core/pal/feature.cpp
Expand Up @@ -62,8 +62,25 @@
namespace pal
{
Feature::Feature( Layer* l, const char* geom_id, PalGeometry* userG, double lx, double ly )
: layer( l ), userGeom( userG ), label_x( lx ), label_y( ly ), distlabel( 0 ), labelInfo( NULL ), fixedPos( false ),
quadOffset( false ), offsetPos( false ), fixedRotation( false ), alwaysShow( false )
: layer( l )
, userGeom( userG )
, label_x( lx )
, label_y( ly )
, distlabel( 0 )
, labelInfo( NULL )
, fixedPos( false )
, fixedPosX( 0.0 )
, fixedPosY( 0.0 )
, quadOffset( false )
, quadOffsetX( 0.0 )
, quadOffsetY( 0.0 )
, offsetPos( false )
, offsetPosX( 0.0 )
, offsetPosY( 0.0 )
, fixedRotation( false )
, fixedAngle( 0.0 )
, repeatDist( 0.0 )
, alwaysShow( false )
{
assert( finite( lx ) && finite( ly ) );

Expand Down
3 changes: 2 additions & 1 deletion src/core/pal/labelposition.cpp
Expand Up @@ -55,7 +55,7 @@
namespace pal
{
LabelPosition::LabelPosition( int id, double x1, double y1, double w, double h, double alpha, double cost, FeaturePart *feature, bool isReversed )
: id( id ), cost( cost ), feature( feature ), nbOverlap( 0 ), alpha( alpha ), w( w ), h( h ), nextPart( NULL ), partId( -1 ), reversed( isReversed ), upsideDown( false )
: id( id ), cost( cost ), feature( feature ), probFeat( 0 ), nbOverlap( 0 ), alpha( alpha ), w( w ), h( h ), nextPart( NULL ), partId( -1 ), reversed( isReversed ), upsideDown( false )
{

// alpha take his value bw 0 and 2*pi rad
Expand Down Expand Up @@ -165,6 +165,7 @@ namespace pal
nextPart = NULL;
partId = other.partId;
upsideDown = other.upsideDown;
reversed = other.reversed;
}

bool LabelPosition::isIn( double *bbox )
Expand Down
3 changes: 0 additions & 3 deletions src/core/pal/pal.h
Expand Up @@ -133,9 +133,6 @@ namespace pal

SimpleMutex *lyrsMutex;

// TODO remove after tests !!!
clock_t tmpTime;

Units map_unit;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgserror.h
Expand Up @@ -36,7 +36,7 @@ class CORE_EXPORT QgsErrorMessage
Html
};

QgsErrorMessage() {}
QgsErrorMessage() : mLine( 0 ), mFormat( Text ) {}

/** Constructor.
* @param theMessage error message string
Expand Down
1 change: 1 addition & 0 deletions src/core/qgsfeaturerequest.cpp
Expand Up @@ -49,6 +49,7 @@ QgsFeatureRequest::QgsFeatureRequest( const QgsRectangle& rect )

QgsFeatureRequest::QgsFeatureRequest( const QgsExpression& expr )
: mFilter( FilterExpression )
, mFilterFid( -1 )
, mFilterExpression( new QgsExpression( expr.expression() ) )
, mFlags( 0 )
{
Expand Down
1 change: 1 addition & 0 deletions src/core/qgsmultirenderchecker.cpp
Expand Up @@ -18,6 +18,7 @@
#include <QDebug>

QgsMultiRenderChecker::QgsMultiRenderChecker()
: mColorTolerance( 0 )
{
}

Expand Down
10 changes: 5 additions & 5 deletions src/core/qgsprojectversion.h
Expand Up @@ -32,13 +32,13 @@ class CORE_EXPORT QgsProjectVersion

public:

QgsProjectVersion() {};
~QgsProjectVersion() {};
QgsProjectVersion() : mMajor( 0 ), mMinor( 0 ), mSub( 0 ) {}
~QgsProjectVersion() {}
QgsProjectVersion( int major, int minor, int sub, QString name = "" );
QgsProjectVersion( QString string );
int majorVersion() { return mMajor;};
int minorVersion() { return mMinor;};
int subVersion() { return mSub;};
int majorVersion() { return mMajor;}
int minorVersion() { return mMinor;}
int subVersion() { return mSub;}
QString text();

/*! Boolean equal operator
Expand Down
2 changes: 2 additions & 0 deletions src/core/qgssnapper.cpp
Expand Up @@ -27,12 +27,14 @@

QgsSnapper::QgsSnapper( QgsMapRenderer* mapRenderer )
: mMapSettings( mapRenderer->mapSettings() )
, mSnapMode( SnapWithOneResult )
{

}

QgsSnapper::QgsSnapper( const QgsMapSettings& mapSettings )
: mMapSettings( mapSettings )
, mSnapMode( SnapWithOneResult )
{
}

Expand Down
1 change: 1 addition & 0 deletions src/core/qgsvectorlayerfeatureiterator.cpp
Expand Up @@ -88,6 +88,7 @@ QgsFeatureIterator QgsVectorLayerFeatureSource::getFeatures( const QgsFeatureReq
QgsVectorLayerFeatureIterator::QgsVectorLayerFeatureIterator( QgsVectorLayerFeatureSource* source, bool ownSource, const QgsFeatureRequest& request )
: QgsAbstractFeatureIteratorFromSource<QgsVectorLayerFeatureSource>( source, ownSource, request )
, mEditGeometrySimplifier( 0 )
, mFetchedFid( false )
{

// prepare joins: may add more attributes to fetch (in order to allow join)
Expand Down
1 change: 0 additions & 1 deletion src/core/qgsvectorlayerrenderer.h
Expand Up @@ -92,7 +92,6 @@ class QgsVectorLayerRenderer : public QgsMapLayerRenderer

QgsFeatureRendererV2 *mRendererV2;

bool mCacheFeatures;
QgsGeometryCache* mCache;

bool mDrawVertexMarkers;
Expand Down
2 changes: 1 addition & 1 deletion src/core/raster/qgscolorrampshader.h
Expand Up @@ -42,7 +42,7 @@ class CORE_EXPORT QgsColorRampShader : public QgsRasterShaderFunction
struct ColorRampItem
{
//! default constructor
ColorRampItem() {}
ColorRampItem() : value( 0 ) {}
//! convenience constructor
ColorRampItem( double val, QColor col, QString lbl = QString() ) : label( lbl ), value( val ), color( col ) {}

Expand Down
1 change: 1 addition & 0 deletions src/core/raster/qgsrasterbandstats.h
Expand Up @@ -59,6 +59,7 @@ class CORE_EXPORT QgsRasterBandStats
elementCount = 0;
width = 0;
height = 0;
bandNumber = 1;
}

/*! Compares region, size etc. not collected statistics */
Expand Down
3 changes: 3 additions & 0 deletions src/core/symbology-ng/qgscategorizedsymbolrendererv2.cpp
Expand Up @@ -31,6 +31,7 @@
#include <QSettings> // for legend

QgsRendererCategoryV2::QgsRendererCategoryV2()
: mRender( true )
{
}

Expand Down Expand Up @@ -147,6 +148,8 @@ QgsCategorizedSymbolRendererV2::QgsCategorizedSymbolRendererV2( QString attrName
, mCategories( categories )
, mInvertedColorRamp( false )
, mScaleMethod( DEFAULT_SCALE_METHOD )
, mAttrNum( -1 )
, mCounting( false )
{
for ( int i = 0; i < mCategories.count(); ++i )
{
Expand Down
18 changes: 15 additions & 3 deletions src/core/symbology-ng/qgsfillsymbollayerv2.cpp
Expand Up @@ -1546,7 +1546,11 @@ QgsMapUnitScale QgsShapeburstFillSymbolLayerV2::mapUnitScale() const

//QgsImageFillSymbolLayer

QgsImageFillSymbolLayer::QgsImageFillSymbolLayer(): mOutlineWidth( 0.0 ), mOutlineWidthUnit( QgsSymbolV2::MM ), mOutline( 0 )
QgsImageFillSymbolLayer::QgsImageFillSymbolLayer()
: mNextAngle( 0.0 )
, mOutlineWidth( 0.0 )
, mOutlineWidthUnit( QgsSymbolV2::MM )
, mOutline( 0 )
{
setSubSymbol( new QgsLineSymbolV2() );
}
Expand Down Expand Up @@ -2251,8 +2255,16 @@ void QgsSVGFillSymbolLayer::setDefaultSvgParams()
}


QgsLinePatternFillSymbolLayer::QgsLinePatternFillSymbolLayer(): QgsImageFillSymbolLayer(), mDistanceUnit( QgsSymbolV2::MM ), mLineWidthUnit( QgsSymbolV2::MM ),
mOffsetUnit( QgsSymbolV2::MM ), mFillLineSymbol( 0 )
QgsLinePatternFillSymbolLayer::QgsLinePatternFillSymbolLayer()
: QgsImageFillSymbolLayer()
, mDistance( 5.0 )
, mDistanceUnit( QgsSymbolV2::MM )
, mLineWidth( 0 )
, mLineWidthUnit( QgsSymbolV2::MM )
, mLineAngle( 45.0 )
, mOffset( 0.0 )
, mOffsetUnit( QgsSymbolV2::MM )
, mFillLineSymbol( 0 )
{
setSubSymbol( new QgsLineSymbolV2() );
QgsImageFillSymbolLayer::setSubSymbol( 0 ); //no outline
Expand Down
4 changes: 4 additions & 0 deletions src/core/symbology-ng/qgsgraduatedsymbolrendererv2.cpp
Expand Up @@ -38,6 +38,7 @@ QgsRendererRangeV2::QgsRendererRangeV2()
, mUpperValue( 0 )
, mSymbol( 0 )
, mLabel()
, mRender( true )
{
}

Expand Down Expand Up @@ -284,6 +285,9 @@ QgsGraduatedSymbolRendererV2::QgsGraduatedSymbolRendererV2( QString attrName, Qg
, mMode( Custom )
, mInvertedColorRamp( false )
, mScaleMethod( DEFAULT_SCALE_METHOD )
, mAttrNum( -1 )
, mCounting( false )

{
// TODO: check ranges for sanity (NULL symbols, invalid ranges)
}
Expand Down
1 change: 1 addition & 0 deletions src/core/symbology-ng/qgsmarkersymbollayerv2.cpp
Expand Up @@ -63,6 +63,7 @@ QgsSimpleMarkerSymbolLayerV2::QgsSimpleMarkerSymbolLayerV2( QString name, QColor
mOffsetUnit = QgsSymbolV2::MM;
mAngleExpression = NULL;
mNameExpression = NULL;
mUsingCache = false;
}

QgsSymbolLayerV2* QgsSimpleMarkerSymbolLayerV2::create( const QgsStringMap& props )
Expand Down
1 change: 1 addition & 0 deletions src/core/symbology-ng/qgssinglesymbolrendererv2.cpp
Expand Up @@ -33,6 +33,7 @@ QgsSingleSymbolRendererV2::QgsSingleSymbolRendererV2( QgsSymbolV2* symbol )
: QgsFeatureRendererV2( "singleSymbol" )
, mSymbol( symbol )
, mScaleMethod( DEFAULT_SCALE_METHOD )
, mOrigSize( 0.0 )
{
Q_ASSERT( symbol );
}
Expand Down