Skip to content

Commit 9fb0065

Browse files
committedFeb 9, 2015
more coverity fixes
1 parent 0593ef6 commit 9fb0065

24 files changed

+152
-124
lines changed
 

‎src/analysis/interpolation/DualEdgeTriangulation.h

Lines changed: 46 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ class ANALYSIS_EXPORT DualEdgeTriangulation: public Triangulation
6666
/**Returns a pointer to a value list with the information of the triangles surrounding (counterclockwise) a point. Four integer values describe a triangle, the first three are the number of the half edges of the triangle and the fourth is -10, if the third (and most counterclockwise) edge is a breakline, and -20 otherwise. The value list has to be deleted by the code which called the method*/
6767
QList<int>* getSurroundingTriangles( int pointno ) override;
6868
/**Returns the largest x-coordinate value of the bounding box*/
69-
virtual double getXMax() const override;
69+
virtual double getXMax() const override { return xMax; }
7070
/**Returns the smallest x-coordinate value of the bounding box*/
71-
virtual double getXMin() const override;
71+
virtual double getXMin() const override { return xMin; }
7272
/**Returns the largest y-coordinate value of the bounding box*/
73-
virtual double getYMax() const override;
73+
virtual double getYMax() const override { return yMax; }
7474
/**Returns the smallest x-coordinate value of the bounding box*/
75-
virtual double getYMin() const override;
75+
virtual double getYMin() const override { return yMin; }
7676
/**Returns the number of points*/
7777
virtual int getNumberOfPoints() const override;
7878
/**Removes the line with number i from the triangulation*/
@@ -180,40 +180,46 @@ class ANALYSIS_EXPORT DualEdgeTriangulation: public Triangulation
180180
void evaluateInfluenceRegion( Point3D* point, int edge, QSet<int> &set );
181181
};
182182

183-
inline DualEdgeTriangulation::DualEdgeTriangulation() : xMax( 0 ), xMin( 0 ), yMax( 0 ), yMin( 0 ), mTriangleInterpolator( 0 ), mForcedCrossBehaviour( Triangulation::DELETE_FIRST ), mEdgeColor( 0, 255, 0 ), mForcedEdgeColor( 0, 0, 255 ), mBreakEdgeColor( 100, 100, 0 ), mDecorator( this )
183+
inline DualEdgeTriangulation::DualEdgeTriangulation()
184+
: xMax( 0 )
185+
, xMin( 0 )
186+
, yMax( 0 )
187+
, yMin( 0 )
188+
, mTriangleInterpolator( 0 )
189+
, mForcedCrossBehaviour( Triangulation::DELETE_FIRST )
190+
, mEdgeColor( 0, 255, 0 )
191+
, mForcedEdgeColor( 0, 0, 255 )
192+
, mBreakEdgeColor( 100, 100, 0 )
193+
, mDecorator( this )
194+
, mEdgeInside( 0 )
195+
, mEdgeOutside( 0 )
196+
, mEdgeWithPoint( 0 )
197+
, mUnstableEdge( 0 )
198+
, mTwiceInsPoint( 0 )
184199
{
185200
mPointVector.reserve( mDefaultStorageForPoints );
186201
mHalfEdge.reserve( mDefaultStorageForHalfEdges );
187202
}
188203

189-
inline DualEdgeTriangulation::DualEdgeTriangulation( int nop, Triangulation* decorator ): xMax( 0 ), xMin( 0 ), yMax( 0 ), yMin( 0 ), mTriangleInterpolator( 0 ), mForcedCrossBehaviour( Triangulation::DELETE_FIRST ), mEdgeColor( 0, 255, 0 ), mForcedEdgeColor( 0, 0, 255 ), mBreakEdgeColor( 100, 100, 0 ), mDecorator( decorator )
204+
inline DualEdgeTriangulation::DualEdgeTriangulation( int nop, Triangulation* decorator )
205+
: xMax( 0 )
206+
, xMin( 0 )
207+
, yMax( 0 )
208+
, yMin( 0 )
209+
, mTriangleInterpolator( 0 )
210+
, mForcedCrossBehaviour( Triangulation::DELETE_FIRST )
211+
, mEdgeColor( 0, 255, 0 )
212+
, mForcedEdgeColor( 0, 0, 255 )
213+
, mBreakEdgeColor( 100, 100, 0 )
214+
, mDecorator( decorator ? decorator : this )
215+
, mEdgeInside( 0 )
216+
, mEdgeOutside( 0 )
217+
, mEdgeWithPoint( 0 )
218+
, mUnstableEdge( 0 )
219+
, mTwiceInsPoint( 0 )
190220
{
191221
mPointVector.reserve( nop );
192222
mHalfEdge.reserve( nop );
193-
if ( !mDecorator )
194-
{
195-
mDecorator = this;
196-
}
197-
}
198-
199-
inline double DualEdgeTriangulation::getXMax() const
200-
{
201-
return xMax;
202-
}
203-
204-
inline double DualEdgeTriangulation::getXMin() const
205-
{
206-
return xMin;
207-
}
208-
209-
inline double DualEdgeTriangulation::getYMax() const
210-
{
211-
return yMax;
212-
}
213-
214-
inline double DualEdgeTriangulation::getYMin() const
215-
{
216-
return yMin;
217223
}
218224

219225
inline int DualEdgeTriangulation::getNumberOfPoints() const
@@ -228,7 +234,16 @@ inline Point3D* DualEdgeTriangulation::getPoint( unsigned int i ) const
228234

229235
inline bool DualEdgeTriangulation::halfEdgeBBoxTest( int edge, double xlowleft, double ylowleft, double xupright, double yupright ) const
230236
{
231-
return (( getPoint( mHalfEdge[edge]->getPoint() )->getX() >= xlowleft && getPoint( mHalfEdge[edge]->getPoint() )->getX() <= xupright && getPoint( mHalfEdge[edge]->getPoint() )->getY() >= ylowleft && getPoint( mHalfEdge[edge]->getPoint() )->getY() <= yupright ) || ( getPoint( mHalfEdge[mHalfEdge[edge]->getDual()]->getPoint() )->getX() >= xlowleft && getPoint( mHalfEdge[mHalfEdge[edge]->getDual()]->getPoint() )->getX() <= xupright && getPoint( mHalfEdge[mHalfEdge[edge]->getDual()]->getPoint() )->getY() >= ylowleft && getPoint( mHalfEdge[mHalfEdge[edge]->getDual()]->getPoint() )->getY() <= yupright ) );
237+
return (
238+
( getPoint( mHalfEdge[edge]->getPoint() )->getX() >= xlowleft &&
239+
getPoint( mHalfEdge[edge]->getPoint() )->getX() <= xupright &&
240+
getPoint( mHalfEdge[edge]->getPoint() )->getY() >= ylowleft &&
241+
getPoint( mHalfEdge[edge]->getPoint() )->getY() <= yupright ) ||
242+
( getPoint( mHalfEdge[mHalfEdge[edge]->getDual()]->getPoint() )->getX() >= xlowleft &&
243+
getPoint( mHalfEdge[mHalfEdge[edge]->getDual()]->getPoint() )->getX() <= xupright &&
244+
getPoint( mHalfEdge[mHalfEdge[edge]->getDual()]->getPoint() )->getY() >= ylowleft &&
245+
getPoint( mHalfEdge[mHalfEdge[edge]->getDual()]->getPoint() )->getY() <= yupright )
246+
);
232247
}
233248

234249
#endif

‎src/analysis/raster/qgsrastercalcnode.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
#include <cfloat>
1717

1818
QgsRasterCalcNode::QgsRasterCalcNode()
19-
: mLeft( 0 )
19+
: mType( tNumber )
20+
, mLeft( 0 )
2021
, mRight( 0 )
2122
, mNumber( 0 )
2223
{

‎src/app/qgisapp.cpp

Lines changed: 27 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -10122,7 +10122,7 @@ void QgisApp::namAuthenticationRequired( QNetworkReply *reply, QAuthenticator *a
1012210122
{
1012310123
QMutexLocker lock( QgsCredentials::instance()->mutex() );
1012410124

10125-
do
10125+
for ( ;; )
1012610126
{
1012710127
bool ok = QgsCredentials::instance()->get(
1012810128
QString( "%1 at %2" ).arg( auth->realm() ).arg( reply->url().host() ),
@@ -10134,27 +10134,20 @@ void QgisApp::namAuthenticationRequired( QNetworkReply *reply, QAuthenticator *a
1013410134
if ( reply->isFinished() )
1013510135
return;
1013610136

10137-
if ( auth->user() == username && password == auth->password() )
10138-
{
10139-
if ( !password.isNull() )
10140-
{
10141-
// credentials didn't change - stored ones probably wrong? clear password and retry
10142-
QgsCredentials::instance()->put(
10143-
QString( "%1 at %2" ).arg( auth->realm() ).arg( reply->url().host() ),
10144-
username, QString::null );
10145-
continue;
10146-
}
10147-
}
10148-
else
10149-
{
10150-
// save credentials
10151-
QgsCredentials::instance()->put(
10152-
QString( "%1 at %2" ).arg( auth->realm() ).arg( reply->url().host() ),
10153-
username, password
10154-
);
10155-
}
10137+
if ( auth->user() != username || ( password != auth->password() && !password.isNull() ) )
10138+
break;
10139+
10140+
// credentials didn't change - stored ones probably wrong? clear password and retry
10141+
QgsCredentials::instance()->put(
10142+
QString( "%1 at %2" ).arg( auth->realm() ).arg( reply->url().host() ),
10143+
username, QString::null );
1015610144
}
10157-
while ( 0 );
10145+
10146+
// save credentials
10147+
QgsCredentials::instance()->put(
10148+
QString( "%1 at %2" ).arg( auth->realm() ).arg( reply->url().host() ),
10149+
username, password
10150+
);
1015810151
}
1015910152

1016010153
auth->setUser( username );
@@ -10177,7 +10170,7 @@ void QgisApp::namProxyAuthenticationRequired( const QNetworkProxy &proxy, QAuthe
1017710170
{
1017810171
QMutexLocker lock( QgsCredentials::instance()->mutex() );
1017910172

10180-
do
10173+
for ( ;; )
1018110174
{
1018210175
bool ok = QgsCredentials::instance()->get(
1018310176
QString( "proxy %1:%2 [%3]" ).arg( proxy.hostName() ).arg( proxy.port() ).arg( auth->realm() ),
@@ -10186,26 +10179,19 @@ void QgisApp::namProxyAuthenticationRequired( const QNetworkProxy &proxy, QAuthe
1018610179
if ( !ok )
1018710180
return;
1018810181

10189-
if ( auth->user() == username && password == auth->password() )
10190-
{
10191-
if ( !password.isNull() )
10192-
{
10193-
// credentials didn't change - stored ones probably wrong? clear password and retry
10194-
QgsCredentials::instance()->put(
10195-
QString( "proxy %1:%2 [%3]" ).arg( proxy.hostName() ).arg( proxy.port() ).arg( auth->realm() ),
10196-
username, QString::null );
10197-
continue;
10198-
}
10199-
}
10200-
else
10201-
{
10202-
QgsCredentials::instance()->put(
10203-
QString( "proxy %1:%2 [%3]" ).arg( proxy.hostName() ).arg( proxy.port() ).arg( auth->realm() ),
10204-
username, password
10205-
);
10206-
}
10182+
if ( auth->user() != username || ( password != auth->password() && !password.isNull() ) )
10183+
break;
10184+
10185+
// credentials didn't change - stored ones probably wrong? clear password and retry
10186+
QgsCredentials::instance()->put(
10187+
QString( "proxy %1:%2 [%3]" ).arg( proxy.hostName() ).arg( proxy.port() ).arg( auth->realm() ),
10188+
username, QString::null );
1020710189
}
10208-
while ( 0 );
10190+
10191+
QgsCredentials::instance()->put(
10192+
QString( "proxy %1:%2 [%3]" ).arg( proxy.hostName() ).arg( proxy.port() ).arg( auth->realm() ),
10193+
username, password
10194+
);
1020910195
}
1021010196

1021110197
auth->setUser( username );

‎src/app/qgsattributetypedialog.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,6 @@ class APP_EXPORT QgsAttributeTypeDialog: public QDialog, private Ui::QgsAttribut
9595
QgsVectorLayer *mLayer;
9696
int mFieldIdx;
9797

98-
bool mFieldEditable;
99-
bool mLabelOnTop;
100-
10198
QgsEditorWidgetConfig mWidgetV2Config;
10299

103100
//! Cached configuration dialog (lazy loaded)

‎src/app/qgsfieldsproperties.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -807,12 +807,15 @@ void QgsFieldsProperties::apply()
807807
*/
808808

809809
QgsFieldsProperties::FieldConfig::FieldConfig()
810-
: mButton( NULL )
810+
: mEditable( true )
811+
, mEditableEnabled( true )
812+
, mLabelOnTop( false )
813+
, mButton( 0 )
811814
{
812815
}
813816

814817
QgsFieldsProperties::FieldConfig::FieldConfig( QgsVectorLayer* layer, int idx )
815-
: mButton( NULL )
818+
: mButton( 0 )
816819
{
817820
mEditable = layer->fieldEditable( idx );
818821
mEditableEnabled = layer->pendingFields().fieldOrigin( idx ) != QgsFields::OriginJoin

‎src/app/qgsfieldsproperties.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,13 @@ class APP_EXPORT QgsFieldsProperties : public QWidget, private Ui_QgsFieldsPrope
4949
};
5050

5151
DesignerTreeItemData()
52+
: mType( Field )
5253
{}
5354

5455
DesignerTreeItemData( Type type, const QString& name )
5556
: mType( type )
56-
, mName( name ) {}
57+
, mName( name )
58+
{}
5759

5860
QString name() const { return mName; }
5961
void setName( const QString& name ) { mName = name; }

‎src/app/qgsmaptoolpinlabels.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@
3030

3131
QgsMapToolPinLabels::QgsMapToolPinLabels( QgsMapCanvas* canvas )
3232
: QgsMapToolLabel( canvas )
33+
, mDragging( false )
34+
, mShowPinned( false )
35+
, mRubberBand( 0 )
3336
{
3437
mToolName = tr( "Pin labels" );
35-
mRubberBand = 0;
36-
mShowPinned = false;
3738

3839
connect( QgisApp::instance()->actionToggleEditing(), SIGNAL( triggered() ), this, SLOT( updatePinnedLabels() ) );
3940
connect( canvas, SIGNAL( renderComplete( QPainter * ) ), this, SLOT( highlightPinnedLabels() ) );

‎src/core/composer/qgscomposermousehandles.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,20 @@
3030
#include "qgslogger.h"
3131
#include "qgsproject.h"
3232

33-
QgsComposerMouseHandles::QgsComposerMouseHandles( QgsComposition *composition ) : QObject( 0 ),
34-
QGraphicsRectItem( 0 ),
35-
mComposition( composition ),
36-
mGraphicsView( 0 ),
37-
mBeginHandleWidth( 0 ),
38-
mBeginHandleHeight( 0 ),
39-
mResizeMoveX( 0 ),
40-
mResizeMoveY( 0 ),
41-
mIsDragging( false ),
42-
mIsResizing( false ),
43-
mHAlignSnapItem( 0 ),
44-
mVAlignSnapItem( 0 )
33+
QgsComposerMouseHandles::QgsComposerMouseHandles( QgsComposition *composition )
34+
: QObject( 0 )
35+
, QGraphicsRectItem( 0 )
36+
, mComposition( composition )
37+
, mGraphicsView( 0 )
38+
, mCurrentMouseMoveAction( NoAction )
39+
, mBeginHandleWidth( 0 )
40+
, mBeginHandleHeight( 0 )
41+
, mResizeMoveX( 0 )
42+
, mResizeMoveY( 0 )
43+
, mIsDragging( false )
44+
, mIsResizing( false )
45+
, mHAlignSnapItem( 0 )
46+
, mVAlignSnapItem( 0 )
4547
{
4648
//listen for selection changes, and update handles accordingly
4749
QObject::connect( mComposition, SIGNAL( selectionChanged() ), this, SLOT( selectionChanged() ) );

‎src/core/dxf/qgsdxfexport.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ QgsDxfExport::QgsDxfExport()
311311
, mSymbolLayerCounter( 0 )
312312
, mNextHandleId( DXF_HANDSEED )
313313
, mBlockCounter( 0 )
314+
, mModelSpaceBR( 0 )
314315
{
315316
}
316317

‎src/core/pal/layer.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ namespace pal
113113
unsigned long arrangementFlags;
114114
LabelMode mode;
115115
bool mergeLines;
116-
double repeatDistance;
117116

118117
UpsideDownLabels upsidedownLabels;
119118

@@ -290,8 +289,8 @@ namespace pal
290289
void setMergeConnectedLines( bool m ) { mergeLines = m; }
291290
bool getMergeConnectedLines() const { return mergeLines; }
292291

293-
void setRepeatDistance( double distance ) { repeatDistance = distance; }
294-
double getRepeatDistance() const { return repeatDistance; }
292+
// void setRepeatDistance( double distance ) { repeatDistance = distance; }
293+
// double getRepeatDistance() const { return repeatDistance; }
295294

296295
void setUpsidedownLabels( UpsideDownLabels ud ) { upsidedownLabels = ud; }
297296
UpsideDownLabels getUpsidedownLabels() const { return upsidedownLabels; }

‎src/core/pal/pointset.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,15 @@ namespace pal
9090
cHull = NULL;
9191
}
9292

93-
PointSet::PointSet( double x, double y )
93+
PointSet::PointSet( double aX, double aY )
94+
: xmin( aX ), xmax( aY )
95+
, ymin( aX ), ymax( aY )
9496
{
95-
nbPoints = cHullSize = 1;
96-
this->x = new double[1];
97-
this->y = new double[1];
98-
this->x[0] = x;
99-
this->y[0] = y;
97+
nbPoints = cHullSize = 1;
98+
x = new double[1];
99+
y = new double[1];
100+
x[0] = aX;
101+
y[0] = aY;
100102

101103
cHull = NULL;
102104
parent = NULL;

‎src/core/qgsfeaturerequest.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ QgsFeatureRequest::QgsFeatureRequest( QgsFeatureId fid )
4040
QgsFeatureRequest::QgsFeatureRequest( const QgsRectangle& rect )
4141
: mFilter( FilterRect )
4242
, mFilterRect( rect )
43+
, mFilterFid( -1 )
4344
, mFilterExpression( 0 )
4445
, mFlags( 0 )
4546
{

‎src/core/qgspallabeling.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ using namespace pal;
7878
// -------------
7979

8080
QgsPalLayerSettings::QgsPalLayerSettings()
81-
: palLayer( NULL )
81+
: upsidedownLabels( Upright )
82+
, palLayer( NULL )
8283
, mCurFeat( 0 )
8384
, mCurFields( 0 )
8485
, xform( NULL )
@@ -87,7 +88,7 @@ QgsPalLayerSettings::QgsPalLayerSettings()
8788
, mFeaturesToLabel( 0 )
8889
, mFeatsSendingToPal( 0 )
8990
, mFeatsRegPal( 0 )
90-
, expression( NULL )
91+
, expression( 0 )
9192
{
9293
enabled = false;
9394
isExpression = false;

0 commit comments

Comments
 (0)
Please sign in to comment.