Skip to content

Commit

Permalink
Merge pull request #5083 from nyalldawson/clazy
Browse files Browse the repository at this point in the history
Clazy optimisations
  • Loading branch information
nyalldawson authored Aug 29, 2017
2 parents 51170ae + e4c1e1b commit f99a7a9
Show file tree
Hide file tree
Showing 156 changed files with 771 additions and 664 deletions.
2 changes: 1 addition & 1 deletion python/core/core_auto.sip
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@
%Include raster/qgsrasterfilewriter.sip
%Include raster/qgsrasterhistogram.sip
%Include raster/qgsrasteridentifyresult.sip
%Include raster/qgsrasterinterface.sip
%Include raster/qgsrasteriterator.sip
%Include raster/qgsrasterminmaxorigin.sip
%Include raster/qgsrasternuller.sip
Expand Down Expand Up @@ -377,6 +376,7 @@
%Include raster/qgsrasterfilewritertask.sip
%Include raster/qgsrasterlayer.sip
%Include raster/qgsrasterdataprovider.sip
%Include raster/qgsrasterinterface.sip
%Include geometry/qgspoint.sip
%Include gps/qgsgpsconnection.sip
%Include gps/qgsgpsdetector.sip
Expand Down
2 changes: 2 additions & 0 deletions python/core/layertree/qgslayertreemodel.sip
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,8 @@ Filter nodes from QgsMapLayerLegend according to the current filtering rules
QFlags<QgsLayerTreeModel::Flag> operator|(QgsLayerTreeModel::Flag f1, QFlags<QgsLayerTreeModel::Flag> f2);




/************************************************************************
* This file has been generated automatically from *
* *
Expand Down
1 change: 1 addition & 0 deletions python/core/qgsdataitem.sip
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class QgsDataItem : QObject
Project
};


QgsDataItem( QgsDataItem::Type type, QgsDataItem *parent /TransferThis/, const QString &name, const QString &path );
%Docstring
Create new data item.
Expand Down
1 change: 0 additions & 1 deletion python/core/qgsdataprovider.sip
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class QgsDataProvider : QObject
%End
public:


enum DataCapability
{
NoDataCapabilities,
Expand Down
1 change: 1 addition & 0 deletions python/gui/attributetable/qgsdualview.sip
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class QgsDualView : QStackedWidget
AttributeEditor
};


explicit QgsDualView( QWidget *parent /TransferThis/ = 0 );
%Docstring
Constructor
Expand Down
1 change: 1 addition & 0 deletions python/gui/qgscodeeditorsql.sip
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class QgsCodeEditorSQL : QgsCodeEditor

};


/************************************************************************
* This file has been generated automatically from *
* *
Expand Down
2 changes: 1 addition & 1 deletion python/gui/qgsfontbutton.sip
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ class QgsFontButton : QToolButton
%End
public:


enum Mode
{
ModeTextRenderer,
ModeQFont,
};


QgsFontButton( QWidget *parent /TransferThis/ = 0, const QString &dialogTitle = QString() );
%Docstring
Construct a new font button.
Expand Down
1 change: 1 addition & 0 deletions python/gui/symbology/qgsdatadefinedsizelegendwidget.sip
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Returns configuration as set up in the dialog (may be null). Ownership is passed

};


/************************************************************************
* This file has been generated automatically from *
* *
Expand Down
2 changes: 1 addition & 1 deletion scripts/sipify.pl
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ sub detect_comment_block{
next;
}
# Skip Q_OBJECT, Q_PROPERTY, Q_ENUM, Q_GADGET etc.
if ($LINE =~ m/^\s*Q_(OBJECT|ENUMS|PROPERTY|GADGET|DECLARE_METATYPE|DECLARE_TYPEINFO|DECL_DEPRECATED|NOWARN_DEPRECATED_(PUSH|POP)).*?$/){
if ($LINE =~ m/^\s*Q_(OBJECT|ENUMS|ENUM|PROPERTY|GADGET|DECLARE_METATYPE|DECLARE_TYPEINFO|DECL_DEPRECATED|NOWARN_DEPRECATED_(PUSH|POP)).*?$/){
next;
}

Expand Down
6 changes: 3 additions & 3 deletions src/analysis/interpolation/DualEdgeTriangulation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1545,18 +1545,18 @@ int DualEdgeTriangulation::insertForcedSegment( int p1, int p2, bool breakline )


//setNext and setPoint for the forced edge because this would disturb the building of 'leftpoly' and 'rightpoly' otherwise
mHalfEdge[leftPolygon.first()]->setNext( ( *( ++( leftiter = leftPolygon.begin() ) ) ) );
mHalfEdge[leftPolygon.first()]->setNext( ( *( ++( leftiter = leftPolygon.constBegin() ) ) ) );
mHalfEdge[leftPolygon.first()]->setPoint( p2 );
mHalfEdge[leftPolygon.last()]->setNext( firstedge );
mHalfEdge[rightPolygon.first()]->setNext( ( *( ++( rightiter = rightPolygon.begin() ) ) ) );
mHalfEdge[rightPolygon.first()]->setNext( ( *( ++( rightiter = rightPolygon.constBegin() ) ) ) );
mHalfEdge[rightPolygon.first()]->setPoint( p1 );
mHalfEdge[rightPolygon.last()]->setNext( dualfirstedge );

triangulatePolygon( &leftPolygon, &freelist, firstedge );
triangulatePolygon( &rightPolygon, &freelist, dualfirstedge );

//optimisation of the new edges
for ( iter = crossedEdges.begin(); iter != crossedEdges.end(); ++iter )
for ( iter = crossedEdges.constBegin(); iter != crossedEdges.constEnd(); ++iter )
{
checkSwap( ( *( iter ) ), 0 );
}
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/interpolation/qgsgridfilewriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ int QgsGridFileWriter::writeFile( QgsFeedback *feedback )

// create prj file
QgsInterpolator::LayerData ld;
ld = mInterpolator->layerData().first();
ld = mInterpolator->layerData().at( 0 );
QgsVectorLayer *vl = ld.vectorLayer;
QString crs = vl->crs().toWkt();
QFileInfo fi( mOutputFilePath );
Expand Down
6 changes: 3 additions & 3 deletions src/analysis/network/qgsvectorlayerdirector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,18 +255,18 @@ void QgsVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, const
QList< QgsNetworkStrategy * >::const_iterator it;
QgsAttributeList::const_iterator it2;

for ( it = mStrategies.begin(); it != mStrategies.end(); ++it )
for ( it = mStrategies.constBegin(); it != mStrategies.constEnd(); ++it )
{
QgsAttributeList tmp = ( *it )->requiredAttributes();
for ( it2 = tmp.begin(); it2 != tmp.end(); ++it2 )
for ( it2 = tmp.constBegin(); it2 != tmp.constEnd(); ++it2 )
{
tmpAttr.push_back( *it2 );
}
}
std::sort( tmpAttr.begin(), tmpAttr.end() );

int lastAttrId = -1;
for ( it2 = tmpAttr.begin(); it2 != tmpAttr.end(); ++it2 )
for ( it2 = tmpAttr.constBegin(); it2 != tmpAttr.constEnd(); ++it2 )
{
if ( *it2 == lastAttrId )
{
Expand Down
7 changes: 3 additions & 4 deletions src/app/composer/qgscomposer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2125,7 +2125,6 @@ void QgsComposer::exportCompositionAsImage( QgsComposer::OutputMode mode )

QgsSettings myQSettings;
QString lastUsedDir = myQSettings.value( QStringLiteral( "UI/lastSaveAtlasAsImagesDir" ), QDir::homePath() ).toString();
QString lastUsedFormat = myQSettings.value( QStringLiteral( "UI/lastSaveAtlasAsImagesFormat" ), "jpg" ).toString();

QFileDialog dlg( this, tr( "Export atlas to directory" ) );
dlg.setFileMode( QFileDialog::Directory );
Expand Down Expand Up @@ -2696,8 +2695,8 @@ void QgsComposer::exportCompositionAsSVG( QgsComposer::OutputMode mode )
&& !mComposition->gridVisible() ) items.pop_back();
QgsItemTempHider itemsHider( items );
int composerItemLayerIdx = 0;
QList<QGraphicsItem *>::const_iterator it = items.begin();
for ( unsigned svgLayerId = 1; it != items.end(); ++svgLayerId )
QList<QGraphicsItem *>::const_iterator it = items.constBegin();
for ( unsigned svgLayerId = 1; it != items.constEnd(); ++svgLayerId )
{
itemsHider.hideAll();
QgsComposerItem *composerItem = dynamic_cast<QgsComposerItem *>( *it );
Expand All @@ -2711,7 +2710,7 @@ void QgsComposer::exportCompositionAsSVG( QgsComposer::OutputMode mode )
else
{
// show all items until the next item that renders on a separate layer
for ( ; it != items.end(); ++it )
for ( ; it != items.constEnd(); ++it )
{
composerItem = dynamic_cast<QgsComposerMap *>( *it );
if ( composerItem && composerItem->numberExportLayers() )
Expand Down
2 changes: 1 addition & 1 deletion src/app/composer/qgscompositionwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ void QgsCompositionWidget::createPaperEntries()
;
mPaperSizeComboBox->addItem( tr( "Custom" ) );

for ( QList<QgsCompositionPaper>::const_iterator it = formats.begin(); it != formats.end(); ++it )
for ( QList<QgsCompositionPaper>::const_iterator it = formats.constBegin(); it != formats.constEnd(); ++it )
{
mPaperSizeComboBox->addItem( it->mName );
mPaperMap.insert( it->mName, *it );
Expand Down
7 changes: 0 additions & 7 deletions src/app/dwg/libdxfrw/drw_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,6 @@ class DRW_Coord
DRW_Coord(): x( 0 ), y( 0 ), z( 0 ) {}
DRW_Coord( double ix, double iy, double iz ): x( ix ), y( iy ), z( iz ) {}

DRW_Coord &operator = ( const DRW_Coord &data )
{
x = data.x;
y = data.y;
z = data.z;
return *this;
}
//! < convert to unitary vector
void unitize()
{
Expand Down
6 changes: 3 additions & 3 deletions src/app/dwg/qgsdwgimportdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ void QgsDwgImportDialog::on_leLayerGroup_textChanged( const QString &text )

void QgsDwgImportDialog::on_pbLoadDatabase_clicked()
{
if ( !QFileInfo( leDatabase->text() ).exists() )
if ( !QFileInfo::exists( leDatabase->text() ) )
return;

CursorOverride waitCursor;
Expand Down Expand Up @@ -269,7 +269,7 @@ void QgsDwgImportDialog::on_pbImportDrawing_clicked()

QgsVectorLayer *QgsDwgImportDialog::layer( QgsLayerTreeGroup *layerGroup, QString layerFilter, QString table )
{
QgsVectorLayer *l = new QgsVectorLayer( QString( "%1|layername=%2" ).arg( leDatabase->text() ).arg( table ), table, "ogr", false );
QgsVectorLayer *l = new QgsVectorLayer( QString( "%1|layername=%2" ).arg( leDatabase->text(), table ), table, "ogr", false );
l->setSubsetString( QString( "%1space=0 AND block=-1" ).arg( layerFilter ) );

if ( l->featureCount() == 0 )
Expand Down Expand Up @@ -471,7 +471,7 @@ void QgsDwgImportDialog::on_buttonBox_accepted()
QgsLayerTreeGroup *dwgGroup = QgisApp::instance()->layerTreeView()->layerTreeModel()->rootGroup()->addGroup( leLayerGroup->text() );
Q_ASSERT( dwgGroup );

Q_FOREACH ( QString layer, layers.keys() )
Q_FOREACH ( const QString &layer, layers.keys() )
{
createGroup( dwgGroup, layer, QStringList( layer ), layers[layer] );
}
Expand Down
39 changes: 16 additions & 23 deletions src/app/dwg/qgsdwgimporter.cpp