Skip to content

Commit ec25df1

Browse files
authored
Merge pull request #3659 from nyalldawson/clazy3
Fix clazy level 0 checks
2 parents 6acf0f7 + 1dca938 commit ec25df1

File tree

83 files changed

+171
-178
lines changed

Some content is hidden

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

83 files changed

+171
-178
lines changed

python/gui/editorwidgets/core/qgseditorwidgetfactory.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class QgsEditorWidgetFactory
108108
* @return A map of widget type names and weight values
109109
* @note not available in Python bindings
110110
*/
111-
//virtual QMap<const char*, int> supportedWidgetTypes() { return QMap<const char*, int>(); }
111+
//virtual QHash<const char*, int> supportedWidgetTypes();
112112

113113
/**
114114
* Create a pretty String representation of the value.

src/app/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,7 @@ int main( int argc, char *argv[] )
11261126
break;
11271127
}
11281128

1129-
coords[i] = QString( myInitialExtent.mid( posOld, pos - posOld ) ).toDouble( &ok );
1129+
coords[i] = myInitialExtent.midRef( posOld, pos - posOld ).toDouble( &ok );
11301130
if ( !ok )
11311131
break;
11321132

@@ -1135,7 +1135,7 @@ int main( int argc, char *argv[] )
11351135

11361136
// parse last coordinate
11371137
if ( ok )
1138-
coords[3] = QString( myInitialExtent.mid( posOld ) ).toDouble( &ok );
1138+
coords[3] = myInitialExtent.midRef( posOld ).toDouble( &ok );
11391139

11401140
if ( !ok )
11411141
{

src/app/openstreetmap/qgsosmimportdialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void QgsOSMImportDialog::dbFileNameChanged( const QString& fileName )
8484
void QgsOSMImportDialog::onOK()
8585
{
8686
// output file exists?
87-
if ( QFileInfo( editDbFileName->text() ).exists() )
87+
if ( QFileInfo::exists( editDbFileName->text() ) )
8888
{
8989
int res = QMessageBox::question( this, tr( "OpenStreetMap import" ), tr( "Output database file exists already. Overwrite?" ), QMessageBox::Yes | QMessageBox::No );
9090
if ( res != QMessageBox::Yes )

src/app/pluginmanager/qgspluginmanager.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1240,7 +1240,6 @@ void QgsPluginManager::on_wvDetails_linkClicked( const QUrl & url )
12401240
if ( url.host() == "plugin.vote" )
12411241
{
12421242
QString params = url.path();
1243-
QString response;
12441243
sendVote( params.split( '/' )[1].toInt(), params.split( '/' )[2].toInt() );
12451244
}
12461245
}

src/app/qgisapp.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,8 +1106,9 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
11061106
QgsDebugMsg( "PROFILE TIMES" );
11071107
QgsDebugMsg( QString( "PROFILE TIMES TOTAL - %1 " ).arg( mProfiler->totalTime() ) );
11081108
#ifdef QGISDEBUG
1109-
QList<QPair<QString, double> >::const_iterator it = mProfiler->profileTimes().constBegin();
1110-
for ( ; it != mProfiler->profileTimes().constEnd(); ++it )
1109+
QList<QPair<QString, double> > profileTimes = mProfiler->profileTimes();
1110+
QList<QPair<QString, double> >::const_iterator it = profileTimes.constBegin();
1111+
for ( ; it != profileTimes.constEnd(); ++it )
11111112
{
11121113
QString name = ( *it ).first;
11131114
double time = ( *it ).second;
@@ -1765,7 +1766,7 @@ void QgisApp::createActions()
17651766
mActionReportaBug->setShortcut( QString() );
17661767
#endif
17671768

1768-
mActionHelpContents->setEnabled( QFileInfo( QgsApplication::pkgDataPath() + "/doc/index.html" ).exists() );
1769+
mActionHelpContents->setEnabled( QFileInfo::exists( QgsApplication::pkgDataPath() + "/doc/index.html" ) );
17691770

17701771
connect( mActionHelpContents, SIGNAL( triggered() ), this, SLOT( helpContents() ) );
17711772
connect( mActionHelpAPI, SIGNAL( triggered() ), this, SLOT( apiDocumentation() ) );
@@ -9185,7 +9186,7 @@ void QgisApp::helpContents()
91859186

91869187
void QgisApp::apiDocumentation()
91879188
{
9188-
if ( QFileInfo( QgsApplication::pkgDataPath() + "/doc/api/index.html" ).exists() )
9189+
if ( QFileInfo::exists( QgsApplication::pkgDataPath() + "/doc/api/index.html" ) )
91899190
{
91909191
openURL( "api/index.html" );
91919192
}

src/app/qgsbookmarks.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -442,10 +442,10 @@ bool QgsProjectBookmarksTableModel::setData( const QModelIndex& index, const QVa
442442
switch ( index.column() )
443443
{
444444
case 1:
445-
QgsProject::instance()->writeEntry( "Bookmarks", QString( "/Row-%1/Name" ).arg( index.row() ), value.value<QString>() );
445+
QgsProject::instance()->writeEntry( "Bookmarks", QString( "/Row-%1/Name" ).arg( index.row() ), value.toString() );
446446
return true;
447447
case 2:
448-
QgsProject::instance()->writeEntry( "Bookmarks", QString( "/Row-%1/Project" ).arg( index.row() ), value.value<QString>() );
448+
QgsProject::instance()->writeEntry( "Bookmarks", QString( "/Row-%1/Project" ).arg( index.row() ), value.toString() );
449449
return true;
450450
case 3:
451451
QgsProject::instance()->writeEntry( "Bookmarks", QString( "/Row-%1/MinX" ).arg( index.row() ), value.toDouble() );
@@ -674,8 +674,8 @@ void QgsMergedBookmarksTableModel::moveBookmark( QAbstractTableModel& modelFrom,
674674
" VALUES (NULL,:name,:project_name,:xmin,:xmax,:ymin,:ymax,:projection_srid)",
675675
qgisModel->database() );
676676

677-
query.bindValue( ":name", modelFrom.data( modelFrom.index( row, 1 ) ).value<QString>() );
678-
query.bindValue( ":project_name", modelFrom.data( modelFrom.index( row, 2 ) ).value<QString>() );
677+
query.bindValue( ":name", modelFrom.data( modelFrom.index( row, 1 ) ).toString() );
678+
query.bindValue( ":project_name", modelFrom.data( modelFrom.index( row, 2 ) ).toString() );
679679
query.bindValue( ":xmin", modelFrom.data( modelFrom.index( row, 3 ) ).toDouble() );
680680
query.bindValue( ":ymin", modelFrom.data( modelFrom.index( row, 4 ) ).toDouble() );
681681
query.bindValue( ":xmax", modelFrom.data( modelFrom.index( row, 5 ) ).toDouble() );

src/app/qgsfeatureaction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,4 +257,4 @@ void QgsFeatureAction::onFeatureSaved( const QgsFeature& feature )
257257
}
258258
}
259259

260-
QMap<QgsVectorLayer *, QgsAttributeMap> QgsFeatureAction::sLastUsedValues;
260+
QHash<QgsVectorLayer *, QgsAttributeMap> QgsFeatureAction::sLastUsedValues;

src/app/qgsfeatureaction.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class APP_EXPORT QgsFeatureAction : public QAction
6464

6565
bool mFeatureSaved;
6666

67-
static QMap<QgsVectorLayer *, QgsAttributeMap> sLastUsedValues;
67+
static QHash<QgsVectorLayer *, QgsAttributeMap> sLastUsedValues;
6868
};
6969

7070
#endif

src/app/qgshandlebadlayers.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ QString QgsHandleBadLayers::filename( int row )
209209

210210
void QgsHandleBadLayers::setFilename( int row, const QString& filename )
211211
{
212-
if ( !QFileInfo( filename ).exists() )
212+
if ( !QFileInfo::exists( filename ) )
213213
return;
214214

215215
QString type = mLayerList->item( row, 1 )->text();

src/app/qgsmaptoolreshape.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ void QgsMapToolReshape::cadCanvasReleaseEvent( QgsMapMouseEvent * e )
105105
if ( vlayer->geometryType() == QgsWkbTypes::PolygonGeometry )
106106
{
107107
//ignore all current layer features as they should be reshaped too
108-
QMap<QgsVectorLayer*, QSet<QgsFeatureId> > ignoreFeatures;
108+
QHash<QgsVectorLayer*, QSet<QgsFeatureId> > ignoreFeatures;
109109
ignoreFeatures.insert( vlayer, vlayer->allFeatureIds() );
110110

111111
if ( geom.avoidIntersections( ignoreFeatures ) != 0 )

src/app/qgsprojectproperties.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1908,14 +1908,14 @@ void QgsProjectProperties::populateEllipsoidList()
19081908
// Crash if no column?
19091909
para1 = ( const char * )sqlite3_column_text( myPreparedStatement, 2 );
19101910
para2 = ( const char * )sqlite3_column_text( myPreparedStatement, 3 );
1911-
myItem.semiMajor = para1.mid( 2 ).toDouble();
1911+
myItem.semiMajor = para1.midRef( 2 ).toDouble();
19121912
if ( para2.left( 2 ) == "b=" )
19131913
{
1914-
myItem.semiMinor = para2.mid( 2 ).toDouble();
1914+
myItem.semiMinor = para2.midRef( 2 ).toDouble();
19151915
}
19161916
else if ( para2.left( 3 ) == "rf=" )
19171917
{
1918-
double invFlattening = para2.mid( 3 ).toDouble();
1918+
double invFlattening = para2.midRef( 3 ).toDouble();
19191919
if ( invFlattening != 0.0 )
19201920
{
19211921
myItem.semiMinor = myItem.semiMajor - ( myItem.semiMajor / invFlattening );

src/core/geometry/qgsgeometry.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1790,7 +1790,7 @@ bool QgsGeometry::deletePart( int partNum )
17901790
return ok;
17911791
}
17921792

1793-
int QgsGeometry::avoidIntersections( const QMap<QgsVectorLayer*, QSet< QgsFeatureId > >& ignoreFeatures )
1793+
int QgsGeometry::avoidIntersections( const QHash<QgsVectorLayer *, QSet<QgsFeatureId> > &ignoreFeatures )
17941794
{
17951795
if ( !d->geometry )
17961796
{

src/core/geometry/qgsgeometry.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ class CORE_EXPORT QgsGeometry
737737
* @param ignoreFeatures possibility to give a list of features where intersections should be ignored (not available in python bindings)
738738
* @note added in 1.5
739739
*/
740-
int avoidIntersections( const QMap<QgsVectorLayer*, QSet<QgsFeatureId> >& ignoreFeatures = ( QMap<QgsVectorLayer*, QSet<QgsFeatureId> >() ) );
740+
int avoidIntersections( const QHash<QgsVectorLayer*, QSet<QgsFeatureId> >& ignoreFeatures = ( QHash<QgsVectorLayer*, QSet<QgsFeatureId> >() ) );
741741

742742
/** \ingroup core
743743
*/

src/core/geometry/qgsgeometryeditutils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ bool QgsGeometryEditUtils::deletePart( QgsAbstractGeometry* geom, int partNum )
225225
return c->removeGeometry( partNum );
226226
}
227227

228-
QgsAbstractGeometry* QgsGeometryEditUtils::avoidIntersections( const QgsAbstractGeometry& geom, QMap<QgsVectorLayer*, QSet<QgsFeatureId> > ignoreFeatures )
228+
QgsAbstractGeometry* QgsGeometryEditUtils::avoidIntersections( const QgsAbstractGeometry& geom, QHash<QgsVectorLayer *, QSet<QgsFeatureId> > ignoreFeatures )
229229
{
230230
QScopedPointer<QgsGeometryEngine> geomEngine( QgsGeometry::createGeometryEngine( &geom ) );
231231
if ( geomEngine.isNull() )
@@ -256,7 +256,7 @@ QgsAbstractGeometry* QgsGeometryEditUtils::avoidIntersections( const QgsAbstract
256256
if ( currentLayer )
257257
{
258258
QgsFeatureIds ignoreIds;
259-
QMap<QgsVectorLayer*, QSet<qint64> >::const_iterator ignoreIt = ignoreFeatures.find( currentLayer );
259+
QHash<QgsVectorLayer*, QSet<qint64> >::const_iterator ignoreIt = ignoreFeatures.find( currentLayer );
260260
if ( ignoreIt != ignoreFeatures.constEnd() )
261261
ignoreIds = ignoreIt.value();
262262

src/core/geometry/qgsgeometryeditutils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class QgsGeometryEditUtils
6060
* @param geom geometry to alter
6161
* @param ignoreFeatures map of layer to feature id of features to ignore
6262
*/
63-
static QgsAbstractGeometry* avoidIntersections( const QgsAbstractGeometry& geom, QMap<QgsVectorLayer*, QSet<QgsFeatureId> > ignoreFeatures = ( QMap<QgsVectorLayer*, QSet<QgsFeatureId> >() ) );
63+
static QgsAbstractGeometry* avoidIntersections( const QgsAbstractGeometry& geom, QHash<QgsVectorLayer*, QSet<QgsFeatureId> > ignoreFeatures = ( QHash<QgsVectorLayer*, QSet<QgsFeatureId> >() ) );
6464
};
6565

6666
#endif // QGSGEOMETRYEDITUTILS_H

src/core/gps/qgsgpsdetector.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ QList< QPair<QString, QString> > QgsGPSDetector::availablePorts()
4848
{
4949
for ( int i = 0; i < 10; ++i )
5050
{
51-
if ( QFileInfo( linuxDev.arg( i ) ).exists() )
51+
if ( QFileInfo::exists( linuxDev.arg( i ) ) )
5252
{
5353
devs << QPair<QString, QString>( linuxDev.arg( i ), linuxDev.arg( i ) );
5454
}

src/core/qgscolorramp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ QgsColorRamp* QgsGradientColorRamp::create( const QgsStringMap& props )
7272
continue;
7373

7474
QColor c = QgsSymbolLayerUtils::decodeColor( stop.mid( i + 1 ) );
75-
stops.append( QgsGradientStop( stop.left( i ).toDouble(), c ) );
75+
stops.append( QgsGradientStop( stop.leftRef( i ).toDouble(), c ) );
7676
}
7777
}
7878

src/core/qgscoordinatereferencesystem.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ bool QgsCoordinateReferenceSystem::hasAxisInverted() const
500500
{
501501
OGRSpatialReferenceH crs = OSRNewSpatialReference( nullptr );
502502

503-
if ( OSRImportFromEPSGA( crs, d->mAuthId.mid( 5 ).toInt() ) == OGRERR_NONE )
503+
if ( OSRImportFromEPSGA( crs, d->mAuthId.midRef( 5 ).toInt() ) == OGRERR_NONE )
504504
{
505505
OSRGetAxis( crs, OSRIsGeographic( crs ) ? "GEOGCS" : "PROJCS", 0, &orientation );
506506
}
@@ -1750,7 +1750,7 @@ bool QgsCoordinateReferenceSystem::loadWkts( QHash<int, QString> &wkts, const ch
17501750
return false;
17511751

17521752
bool ok;
1753-
int epsg = line.left( pos ).toInt( &ok );
1753+
int epsg = line.leftRef( pos ).toInt( &ok );
17541754
if ( !ok )
17551755
return false;
17561756

@@ -1791,7 +1791,7 @@ bool QgsCoordinateReferenceSystem::loadIds( QHash<int, QString> &wkts )
17911791
continue;
17921792

17931793
bool ok;
1794-
int epsg = line.left( pos ).toInt( &ok );
1794+
int epsg = line.leftRef( pos ).toInt( &ok );
17951795
if ( !ok )
17961796
continue;
17971797

src/core/qgsdistancearea.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ bool QgsDistanceArea::setEllipsoid( const QString& ellipsoid )
191191

192192
// get major semiaxis
193193
if ( radius.left( 2 ) == "a=" )
194-
mSemiMajor = radius.mid( 2 ).toDouble();
194+
mSemiMajor = radius.midRef( 2 ).toDouble();
195195
else
196196
{
197197
QgsDebugMsg( QString( "setEllipsoid: wrong format of radius field: '%1'" ).arg( radius ) );
@@ -203,12 +203,12 @@ bool QgsDistanceArea::setEllipsoid( const QString& ellipsoid )
203203
// second one must be computed using formula: invf = a/(a-b)
204204
if ( parameter2.left( 2 ) == "b=" )
205205
{
206-
mSemiMinor = parameter2.mid( 2 ).toDouble();
206+
mSemiMinor = parameter2.midRef( 2 ).toDouble();
207207
mInvFlattening = mSemiMajor / ( mSemiMajor - mSemiMinor );
208208
}
209209
else if ( parameter2.left( 3 ) == "rf=" )
210210
{
211-
mInvFlattening = parameter2.mid( 3 ).toDouble();
211+
mInvFlattening = parameter2.midRef( 3 ).toDouble();
212212
mSemiMinor = mSemiMajor - ( mSemiMajor / mInvFlattening );
213213
}
214214
else

src/core/qgsexpression.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3264,7 +3264,7 @@ static QVariant fcnArrayRemoveAll( const QVariantList& values, const QgsExpressi
32643264
static QVariant fcnArrayCat( const QVariantList& values, const QgsExpressionContext*, QgsExpression* parent )
32653265
{
32663266
QVariantList list;
3267-
Q_FOREACH ( QVariant cur, values )
3267+
Q_FOREACH ( const QVariant& cur, values )
32683268
{
32693269
list += getListValue( cur, parent );
32703270
}
@@ -3274,7 +3274,11 @@ static QVariant fcnArrayCat( const QVariantList& values, const QgsExpressionCont
32743274
static QVariant fcnArrayIntersect( const QVariantList& values, const QgsExpressionContext*, QgsExpression* parent )
32753275
{
32763276
const QVariantList array1 = getListValue( values.at( 0 ), parent );
3277-
Q_FOREACH ( QVariant cur, getListValue( values.at( 1 ), parent ) ) if ( array1.contains( cur ) ) return QVariant( true );
3277+
Q_FOREACH ( const QVariant& cur, getListValue( values.at( 1 ), parent ) )
3278+
{
3279+
if ( array1.contains( cur ) )
3280+
return QVariant( true );
3281+
}
32783282
return QVariant( false );
32793283
}
32803284

@@ -3315,7 +3319,7 @@ static QVariant fcnMapInsert( const QVariantList& values, const QgsExpressionCon
33153319
static QVariant fcnMapConcat( const QVariantList& values, const QgsExpressionContext*, QgsExpression* parent )
33163320
{
33173321
QVariantMap result;
3318-
Q_FOREACH ( QVariant cur, values )
3322+
Q_FOREACH ( const QVariant& cur, values )
33193323
{
33203324
const QVariantMap curMap = getMapValue( cur, parent );
33213325
for ( QVariantMap::const_iterator it = curMap.constBegin(); it != curMap.constEnd(); ++it )

src/core/qgsgml.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ QgsGmlStreamingParser::QgsGmlStreamingParser( const QList<LayerProperties>& laye
387387
if ( alreadyFoundGeometry )
388388
{
389389
QgsDebugMsg( QString( "Will ignore geometry field %1 from typename %2" ).
390-
arg( mLayerProperties[i].mGeometryAttribute ).arg( mLayerProperties[i].mName ) );
390+
arg( mLayerProperties[i].mGeometryAttribute, mLayerProperties[i].mName ) );
391391
mLayerProperties[i].mGeometryAttribute.clear();
392392
}
393393
alreadyFoundGeometry = true;

src/core/qgsjsonutils.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,15 +291,15 @@ QVariantList QgsJSONUtils::parseArray( const QString& json, QVariant::Type type
291291
QVariantList result;
292292
if ( error.error != QJsonParseError::NoError )
293293
{
294-
QgsLogger::warning( QString( "Cannot parse json (%1): %2" ).arg( error.errorString() ).arg( json ) );
294+
QgsLogger::warning( QString( "Cannot parse json (%1): %2" ).arg( error.errorString(), json ) );
295295
return result;
296296
}
297297
if ( !jsonDoc.isArray() )
298298
{
299-
QgsLogger::warning( QString( "Cannot parse json (%1) as array: %2" ).arg( error.errorString() ).arg( json ) );
299+
QgsLogger::warning( QString( "Cannot parse json (%1) as array: %2" ).arg( error.errorString(), json ) );
300300
return result;
301301
}
302-
Q_FOREACH ( const QJsonValue cur, jsonDoc.array() )
302+
Q_FOREACH ( const QJsonValue& cur, jsonDoc.array() )
303303
{
304304
QVariant curVariant = cur.toVariant();
305305
if ( curVariant.convert( type ) )
@@ -308,4 +308,4 @@ QVariantList QgsJSONUtils::parseArray( const QString& json, QVariant::Type type
308308
QgsLogger::warning( QString( "Cannot convert json array element: %1" ).arg( cur.toString() ) );
309309
}
310310
return result;
311-
}
311+
}

src/core/qgsogcutils.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2910,7 +2910,7 @@ QDomElement QgsOgcUtilsSQLStatementToFilter::toOgcFilter( const QgsSQLStatement:
29102910
static QString mapBinarySpatialToOgc( const QString& name )
29112911
{
29122912
QString nameCompare( name );
2913-
if ( name.size() > 3 && name.mid( 0, 3 ).compare( "ST_", Qt::CaseInsensitive ) == 0 )
2913+
if ( name.size() > 3 && name.midRef( 0, 3 ).compare( "ST_", Qt::CaseInsensitive ) == 0 )
29142914
nameCompare = name.mid( 3 );
29152915
QStringList spatialOps;
29162916
spatialOps << "BBOX" << "Intersects" << "Contains" << "Crosses" << "Equals"
@@ -2926,7 +2926,7 @@ static QString mapBinarySpatialToOgc( const QString& name )
29262926
static QString mapTernarySpatialToOgc( const QString& name )
29272927
{
29282928
QString nameCompare( name );
2929-
if ( name.size() > 3 && name.mid( 0, 3 ).compare( "ST_", Qt::CaseInsensitive ) == 0 )
2929+
if ( name.size() > 3 && name.midRef( 0, 3 ).compare( "ST_", Qt::CaseInsensitive ) == 0 )
29302930
nameCompare = name.mid( 3 );
29312931
if ( nameCompare.compare( "DWithin", Qt::CaseInsensitive ) == 0 )
29322932
return "DWithin";
@@ -3293,7 +3293,7 @@ QDomElement QgsOgcUtilsSQLStatementToFilter::toOgcFilter( const QgsSQLStatement:
32933293
}
32943294

32953295
QList<QDomElement> listElem;
3296-
Q_FOREACH ( QString columnName, node->usingColumns() )
3296+
Q_FOREACH ( const QString& columnName, node->usingColumns() )
32973297
{
32983298
QDomElement eqElem = mDoc.createElement( mFilterPrefix + ":PropertyIsEqualTo" );
32993299
QDomElement propElem1 = mDoc.createElement( mFilterPrefix + ":" + mPropertyName );
@@ -3312,7 +3312,7 @@ QDomElement QgsOgcUtilsSQLStatementToFilter::toOgcFilter( const QgsSQLStatement:
33123312
else if ( listElem.size() > 1 )
33133313
{
33143314
QDomElement andElem = mDoc.createElement( mFilterPrefix + ":And" );
3315-
Q_FOREACH ( QDomElement elem, listElem )
3315+
Q_FOREACH ( const QDomElement& elem, listElem )
33163316
{
33173317
andElem.appendChild( elem );
33183318
}
@@ -3356,7 +3356,8 @@ QDomElement QgsOgcUtilsSQLStatementToFilter::toOgcFilter( const QgsSQLStatement:
33563356
}
33573357

33583358
// Process JOIN conditions
3359-
QString leftTable = node->tables().last()->name();
3359+
QList< QgsSQLStatement::NodeTableDef*> nodeTables = node->tables();
3360+
QString leftTable = nodeTables.at( nodeTables.length() - 1 )->name();
33603361
Q_FOREACH ( QgsSQLStatement::NodeJoin* join, node->joins() )
33613362
{
33623363
QDomElement joinElem = toOgcFilter( join, leftTable );
@@ -3383,7 +3384,7 @@ QDomElement QgsOgcUtilsSQLStatementToFilter::toOgcFilter( const QgsSQLStatement:
33833384
else if ( listElem.size() > 1 )
33843385
{
33853386
QDomElement andElem = mDoc.createElement( mFilterPrefix + ":And" );
3386-
Q_FOREACH ( QDomElement elem, listElem )
3387+
Q_FOREACH ( const QDomElement& elem, listElem )
33873388
{
33883389
andElem.appendChild( elem );
33893390
}

src/core/qgssqlstatement.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,13 @@ bool QgsSQLStatement::doBasicValidationChecks( QString& errorMsgOut ) const
231231
QgsSQLStatementCollectTableNames v;
232232
mRootNode->accept( v );
233233

234-
Q_FOREACH ( QgsSQLStatementCollectTableNames::TableColumnPair pair, v.tableNamesReferenced )
234+
Q_FOREACH ( const QgsSQLStatementCollectTableNames::TableColumnPair& pair, v.tableNamesReferenced )
235235
{
236236
if ( !v.tableNamesDeclared.contains( pair.first ) )
237237
{
238238
if ( !errorMsgOut.isEmpty() )
239239
errorMsgOut += " ";
240-
errorMsgOut += QString( tr( "Table %1 is referenced by column %2, but not selected in FROM / JOIN." ) ).arg( pair.first ).arg( pair.second );
240+
errorMsgOut += QString( tr( "Table %1 is referenced by column %2, but not selected in FROM / JOIN." ) ).arg( pair.first, pair.second );
241241
}
242242
}
243243

0 commit comments

Comments
 (0)