Skip to content

Commit 7689076

Browse files
committed
fix warnings from clang
1 parent 2708f17 commit 7689076

38 files changed

+65
-60
lines changed

python/core/qgsmaplayer.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public:
168168

169169
@returns true if successful
170170
*/
171-
bool writeXML(QDomNode & layer_node, QDomDocument & document) const;
171+
bool writeXML(QDomNode & layer_node, QDomDocument & document);
172172

173173
/** Set a custom property for layer. Properties are stored in a map and saved in project file.
174174
* @note Added in v1.4 */

src/analysis/interpolation/TriDecorator.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ class TriDecorator: public Triangulation
3636
virtual bool calcPoint( double x, double y, Point3D* result );
3737
virtual Point3D* getPoint( unsigned int i ) const;
3838
virtual int getNumberOfPoints() const;
39-
virtual bool getTriangle( double x, double y, Point3D* p1, int* n1, Point3D* p2, int* n2, Point3D* p3, int* n3 );
40-
virtual bool getTriangle( double x, double y, Point3D* p1, Point3D* p2, Point3D* p3 );
39+
bool getTriangle( double x, double y, Point3D* p1, int* n1, Point3D* p2, int* n2, Point3D* p3, int* n3 );
40+
bool getTriangle( double x, double y, Point3D* p1, Point3D* p2, Point3D* p3 );
4141
virtual int getOppositePoint( int p1, int p2 );
4242
virtual QList<int>* getSurroundingTriangles( int pointno );
4343
virtual double getXMax() const;

src/app/legend/qgslegend.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ void QgsLegend::removeAll()
210210
mDropTarget = 0;
211211
}
212212

213-
void QgsLegend::selectAll( bool select )
213+
void QgsLegend::setLayersVisible( bool visible )
214214
{
215215
if ( !mMapCanvas || mMapCanvas->isDrawing() )
216216
{
@@ -227,7 +227,7 @@ void QgsLegend::selectAll( bool select )
227227
QgsLegendItem* litem = dynamic_cast<QgsLegendItem *>( theItem );
228228
if ( litem && litem->type() == QgsLegendItem::LEGEND_LAYER )
229229
{
230-
theItem->setCheckState( 0, select ? Qt::Checked : Qt::Unchecked );
230+
theItem->setCheckState( 0, visible ? Qt::Checked : Qt::Unchecked );
231231
handleItemChange( theItem, 0 );
232232
}
233233
}

src/app/legend/qgslegend.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ class QgsLegend : public QTreeWidget
227227
* the legend, and in the map.
228228
* @return void
229229
*/
230-
void selectAll( bool select );
230+
void setLayersVisible( bool visible );
231231

232232
/*!
233233
* Slot called when user wishes to add a new empty layer group to the legend.

src/app/qgisapp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3219,7 +3219,7 @@ void QgisApp::hideAllLayers()
32193219
{
32203220
QgsDebugMsg( "hiding all layers!" );
32213221

3222-
legend()->selectAll( false );
3222+
legend()->setLayersVisible( false );
32233223
}
32243224

32253225

@@ -3228,7 +3228,7 @@ void QgisApp::showAllLayers()
32283228
{
32293229
QgsDebugMsg( "Showing all layers!" );
32303230

3231-
legend()->selectAll( true );
3231+
legend()->setLayersVisible( true );
32323232
}
32333233

32343234

src/core/pal/hashtable.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ namespace pal
230230

231231

232232
template <typename Data>
233-
bool HashTable<Data>::removeElement( const char * key )
233+
bool HashTable<Data>::removeElement( const char * )
234234
{
235235
// TODO: Remove the element that has this key from the hash table.
236236
// Return true if the entry is found or false otherwise.

src/core/qgsdataprovider.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ class CORE_EXPORT QgsDataProvider : public QObject
191191
* (in order from bottom to top)
192192
* \note layers must have been previously added.
193193
*/
194-
virtual void setLayerOrder( QStringList layers )
194+
virtual void setLayerOrder( const QStringList &layers )
195195
{
196196
//prevent unused var warnings
197197
if ( layers.count() < 1 )
@@ -205,7 +205,7 @@ class CORE_EXPORT QgsDataProvider : public QObject
205205
/**
206206
* Set the visibility of the given sublayer name
207207
*/
208-
virtual void setSubLayerVisibility( QString name, bool vis )
208+
virtual void setSubLayerVisibility( const QString &name, bool vis )
209209
{
210210
//prevent unused var warnings
211211
if ( name.isEmpty() || !vis )

src/core/qgsdiagram.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class QgsRenderContext;
1515
class CORE_EXPORT QgsDiagram
1616
{
1717
public:
18+
virtual ~QgsDiagram() {}
1819
/**Draws the diagram at the given position (in pixel coordinates)*/
1920
virtual void renderDiagram( const QgsAttributeMap& att, QgsRenderContext& c, const QgsDiagramSettings& s, const QPointF& position ) = 0;
2021
virtual QString diagramName() const = 0;

src/core/qgsexpression.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ class CORE_EXPORT QgsExpression
235235
{
236236
public:
237237
NodeList() {}
238-
~NodeList() { foreach( Node* n, mList ) delete n; }
238+
virtual ~NodeList() { foreach( Node* n, mList ) delete n; }
239239
void append( Node* node ) { mList.append( node ); }
240240
int count() { return mList.count(); }
241241
QList<Node*> list() { return mList; }
@@ -297,7 +297,7 @@ class CORE_EXPORT QgsExpression
297297
{
298298
public:
299299
NodeInOperator( Node* node, NodeList* list, bool notin = false ) : mNode( node ), mList( list ), mNotIn( notin ) {}
300-
~NodeInOperator() { delete mNode; delete mList; }
300+
virtual ~NodeInOperator() { delete mNode; delete mList; }
301301

302302
Node* node() { return mNode; }
303303
bool isNotIn() { return mNotIn; }
@@ -321,7 +321,7 @@ class CORE_EXPORT QgsExpression
321321
public:
322322
NodeFunction( int fnIndex, NodeList* args ): mFnIndex( fnIndex ), mArgs( args ) {}
323323
//NodeFunction( QString name, NodeList* args ) : mName(name), mArgs(args) {}
324-
~NodeFunction() { delete mArgs; }
324+
virtual ~NodeFunction() { delete mArgs; }
325325

326326
int fnIndex() { return mFnIndex; }
327327
NodeList* args() { return mArgs; }

src/core/qgsmaplayer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,12 +480,12 @@ float QgsMapLayer::maximumScale()
480480
}
481481

482482

483-
QStringList QgsMapLayer::subLayers()
483+
QStringList QgsMapLayer::subLayers() const
484484
{
485485
return QStringList(); // Empty
486486
}
487487

488-
void QgsMapLayer::setLayerOrder( QStringList layers )
488+
void QgsMapLayer::setLayerOrder( const QStringList &layers )
489489
{
490490
Q_UNUSED( layers );
491491
// NOOP

src/core/qgsmaplayer.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,18 +132,17 @@ class CORE_EXPORT QgsMapLayer : public QObject
132132
* Returns the sublayers of this layer
133133
* (Useful for providers that manage their own layers, such as WMS)
134134
*/
135-
virtual QStringList subLayers();
135+
virtual QStringList subLayers() const;
136136

137137
/**
138138
* Reorders the *previously selected* sublayers of this layer from bottom to top
139139
* (Useful for providers that manage their own layers, such as WMS)
140140
*/
141-
virtual void setLayerOrder( QStringList layers );
141+
virtual void setLayerOrder( const QStringList &layers );
142142

143143
/** Set the visibility of the given sublayer name */
144144
virtual void setSubLayerVisibility( QString name, bool vis );
145145

146-
147146
/** True if the layer can be edited */
148147
virtual bool isEditable() const;
149148

src/core/raster/qgsrasterlayer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2837,7 +2837,7 @@ void QgsRasterLayer::setRedBandName( QString const & theBandName )
28372837
mRedBandName = validateBandName( theBandName );
28382838
}
28392839

2840-
void QgsRasterLayer::setSubLayerVisibility( QString const & name, bool vis )
2840+
void QgsRasterLayer::setSubLayerVisibility( QString name, bool vis )
28412841
{
28422842

28432843
if ( mDataProvider )

src/core/raster/qgsrasterlayer.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer
634634
void showProgress( int theValue );
635635

636636
/** \brief Returns the sublayers of this layer - Useful for providers that manage their own layers, such as WMS */
637-
QStringList subLayers() const;
637+
virtual QStringList subLayers() const;
638638

639639
/** \brief Draws a thumbnail of the rasterlayer into the supplied pixmap pointer */
640640
void thumbnailAsPixmap( QPixmap * theQPixmap );
@@ -647,20 +647,20 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer
647647
void triggerRepaint();
648648

649649
//
650-
// Virtural methods
650+
// Virtual methods
651651
//
652652
/**
653653
* Reorders the *previously selected* sublayers of this layer from bottom to top
654654
*
655655
* (Useful for providers that manage their own layers, such as WMS)
656656
*
657657
*/
658-
virtual void setLayerOrder( const QStringList & layers );
658+
virtual void setLayerOrder( const QStringList &layers );
659659

660660
/**
661661
* Set the visibility of the given sublayer name
662662
*/
663-
virtual void setSubLayerVisibility( const QString & name, bool vis );
663+
virtual void setSubLayerVisibility( QString name, bool vis );
664664

665665
/** Time stamp of data source in the moment when data/metadata were loaded by provider */
666666
virtual QDateTime timestamp() const { return mDataProvider->timestamp() ; }

src/core/renderer/qgsgraduatedsymbolrenderer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ bool QgsGraduatedSymbolRenderer::writeXML( QDomNode & layer_node, QDomDocument &
346346
QString modeValue = "";
347347
if ( mMode == QgsGraduatedSymbolRenderer::Empty )
348348
{
349-
modeValue == "Empty";
349+
modeValue = "Empty";
350350
}
351351
else if ( QgsGraduatedSymbolRenderer::Quantile )
352352
{

src/core/spatialite/spatialite.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57581,7 +57581,7 @@ Parse (void *yyp, /* The parser */
5758157581
#define __STDC_LIMIT_MACROS 1
5758257582
#endif
5758357583

57584-
/* #include <inttypes.h> */
57584+
#include <inttypes.h>
5758557585
typedef int8_t flex_int8_t;
5758657586
typedef uint8_t flex_uint8_t;
5758757587
typedef int16_t flex_int16_t;

src/core/symbology-ng/qgsrendererv2registry.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class CORE_EXPORT QgsRendererV2AbstractMetadata
2222
public:
2323
QgsRendererV2AbstractMetadata( QString name, QString visibleName, QIcon icon = QIcon() )
2424
: mName( name ), mVisibleName( visibleName ), mIcon( icon ) {}
25+
virtual ~QgsRendererV2AbstractMetadata() {}
2526

2627
QString name() const { return mName; }
2728
QString visibleName() const { return mVisibleName; }

src/core/symbology-ng/qgsrulebasedrendererv2.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,13 @@ QgsRuleBasedRendererV2::Rule* QgsRuleBasedRendererV2::Rule::create( QDomElement&
332332
{
333333
Rule* childRule = create( childRuleElem, symbolMap );
334334
if ( childRule )
335+
{
335336
rule->appendChild( childRule );
337+
}
336338
else
339+
{
337340
QgsDebugMsg( "failed to init a child rule!" );
341+
}
338342
childRuleElem = childRuleElem.nextSiblingElement( "rule" );
339343
}
340344

src/gui/attributetable/qgsattributetablememorymodel.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,11 @@ void QgsAttributeTableMemoryModel::featureDeleted( QgsFeatureId fid )
115115
QgsAttributeTableModel::featureDeleted( fid );
116116
}
117117

118-
void QgsAttributeTableMemoryModel::featureAdded( QgsFeatureId fid )
118+
void QgsAttributeTableMemoryModel::featureAdded( QgsFeatureId fid, bool inOperation )
119119
{
120120
QgsDebugMsg( "entered." );
121121
Q_UNUSED( fid );
122+
Q_UNUSED( inOperation );
122123
loadLayer();
123124
}
124125

src/gui/attributetable/qgsattributetablememorymodel.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ class QgsAttributeTableMemoryModel : public QgsAttributeTableModel
5959
/**
6060
* Launched when a feature has been deleted
6161
* @param fid feature id
62+
* @param inOperation guard insertion with beginInsertRows() / endInsertRows()
6263
*/
63-
virtual void featureAdded( QgsFeatureId fid );
64+
virtual void featureAdded( QgsFeatureId fid, bool inOperation = true );
6465
/**
6566
* Launched when layer has been deleted
6667
*/

src/gui/symbology-ng/qgsrulebasedrendererv2widget.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,9 @@ bool QgsRuleBasedRendererV2Model::removeRows( int row, int count, const QModelIn
754754
//parentRule->takeChildAt( row );
755755
}
756756
else
757+
{
757758
QgsDebugMsg( "trying to remove invalid index - this should not happen!" );
759+
}
758760
}
759761

760762
endRemoveRows();

src/mapserver/qgswmsserver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ QImage* QgsWMSServer::getLegendGraphics()
281281
{
282282
if ( !mConfigParser || !mMapRenderer )
283283
{
284-
return false;
284+
return 0;
285285
}
286286

287287
QStringList layersList, stylesList;

src/plugins/globe/globe_plugin.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ namespace osgEarth
196196
public:
197197
virtual void onMouseDown( class Control* control, int mouseButtonMask ) { Q_UNUSED( control ); Q_UNUSED( mouseButtonMask ); }
198198
virtual void onClick( class Control* control, int mouseButtonMask, const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa ) { Q_UNUSED( control ); Q_UNUSED( mouseButtonMask ); Q_UNUSED( ea ); Q_UNUSED( aa ); }
199+
virtual void onClick( class Control* control, int mouseButtonMask ) { Q_UNUSED( control ); Q_UNUSED( mouseButtonMask ); }
199200
};
200201

201202
class NavigationControl : public ImageControl

src/plugins/globe/qgsosgearthtilesource.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ osg::Image* QgsOsgEarthTileSource::createImage( const TileKey& key, ProgressCall
8383
return 0;
8484
}
8585

86-
QImage* qImage = createImage( target_width, target_height );
86+
QImage* qImage = createQImage( target_width, target_height );
8787
if ( !qImage )
8888
{
8989
return 0;
@@ -121,7 +121,7 @@ osg::Image* QgsOsgEarthTileSource::createImage( const TileKey& key, ProgressCall
121121
return image.release();
122122
}
123123

124-
QImage* QgsOsgEarthTileSource::createImage( int width, int height ) const
124+
QImage* QgsOsgEarthTileSource::createQImage( int width, int height ) const
125125
{
126126
if ( width < 0 || height < 0 )
127127
{

src/plugins/globe/qgsosgearthtilesource.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ namespace osgEarth
2525

2626
osg::Image* createImage( const TileKey& key, ProgressCallback* progress );
2727

28-
osg::HeightField* createHeightField( const TileKey* key,
29-
ProgressCallback* progress )
28+
virtual osg::HeightField* createHeightField( const TileKey &key, ProgressCallback* progress )
3029
{
3130
Q_UNUSED( key );
3231
Q_UNUSED( progress );
@@ -48,7 +47,7 @@ namespace osgEarth
4847

4948
private:
5049

51-
QImage* createImage( int width, int height ) const;
50+
QImage* createQImage( int width, int height ) const;
5251
bool intersects( const TileKey* key );
5352

5453
//! Pointer to the QGIS interface object

src/plugins/grass/qgsgrassedit.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1437,7 +1437,7 @@ void QgsGrassEdit::checkOrphan( int field, int cat )
14371437
return;
14381438

14391439
// Delete record
1440-
error = mProvider->deleteAttributes( field, cat );
1440+
error = mProvider->deleteAttribute( field, cat );
14411441
if ( !error->isEmpty() )
14421442
{
14431443
QMessageBox::warning( 0, tr( "Warning" ), tr( "Cannot delete orphan record: " )

src/plugins/grass/qgsgrassmapcalc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1542,7 +1542,7 @@ QgsGrassMapcalcObject::~QgsGrassMapcalcObject()
15421542
QgsDebugMsg( "exited." );
15431543
}
15441544

1545-
int QgsGrassMapcalcObject::type()
1545+
int QgsGrassMapcalcObject::type() const
15461546
{
15471547
return mType;
15481548
}

src/plugins/grass/qgsgrassmapcalc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ class QgsGrassMapcalcObject: public QGraphicsRectItem, public QgsGrassMapcalcIte
363363
QgsGrassMapcalcConnector *connector = 0, int end = 0 );
364364

365365
// Object type
366-
int type();
366+
virtual int type() const;
367367

368368
// Value
369369
QString value() { return mValue; }

src/plugins/grass/qtermwidget/ShellCommand.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ ShellCommand::ShellCommand( const QString& command , const QStringList& argument
6565
_arguments = arguments;
6666

6767
if ( !_arguments.isEmpty() )
68-
_arguments[0] == command;
68+
_arguments[0] = command;
6969
}
7070
QString ShellCommand::fullCommand() const
7171
{

src/providers/grass/qgsgrassprovider.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2279,7 +2279,7 @@ QString *QgsGrassProvider::insertAttributes( int field, int cat )
22792279
return executeSql( field, query );
22802280
}
22812281

2282-
QString *QgsGrassProvider::deleteAttributes( int field, int cat )
2282+
QString *QgsGrassProvider::deleteAttribute( int field, int cat )
22832283
{
22842284
QgsDebugMsg( QString( "field = %1 cat = %2" ).arg( field ).arg( cat ) );
22852285

src/providers/grass/qgsgrassprovider.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ class GRASS_EXPORT QgsGrassProvider : public QgsVectorDataProvider
429429
* @param cat
430430
* @return empty string or error message
431431
*/
432-
QString *deleteAttributes( int field, int cat );
432+
QString *deleteAttribute( int field, int cat );
433433

434434
/** Check if a database row exists and it is orphan (no more lines with
435435
* that category)

0 commit comments

Comments
 (0)