Skip to content
Permalink
Browse files

Fix clazy "detaching-temporary" warnings

From the clazy docs:

Finds places where you're calling non-const member functions on
temporaries. For example getList().first(), which would detach
if the container is shared.
  • Loading branch information
nyalldawson committed Oct 22, 2016
1 parent 06cf59a commit 368a04a4d170a447aef2607d3cb1733c0a365733
@@ -3356,7 +3356,8 @@ QDomElement QgsOgcUtilsSQLStatementToFilter::toOgcFilter( const QgsSQLStatement:
}

// Process JOIN conditions
QString leftTable = node->tables().last()->name();
QList< QgsSQLStatement::NodeTableDef*> nodeTables = node->tables();
QString leftTable = nodeTables.at( nodeTables.length() - 1 )->name();
Q_FOREACH ( QgsSQLStatement::NodeJoin* join, node->joins() )
{
QDomElement joinElem = toOgcFilter( join, leftTable );
@@ -387,7 +387,7 @@ QgsRasterIdentifyResult QgsAmsProvider::identify( const QgsPoint & thePoint, Qgs
queryUrl.addQueryItem( "imageDisplay", QString( "%1,%2,%3" ).arg( theWidth ).arg( theHeight ).arg( theDpi ) );
queryUrl.addQueryItem( "mapExtent", QString( "%1,%2,%3,%4" ).arg( theExtent.xMinimum(), 0, 'f' ).arg( theExtent.yMinimum(), 0, 'f' ).arg( theExtent.xMaximum(), 0, 'f' ).arg( theExtent.yMaximum(), 0, 'f' ) );
queryUrl.addQueryItem( "tolerance", "10" );
QVariantList queryResults = QgsArcGisRestUtils::queryServiceJSON( queryUrl, mErrorTitle, mError )["results"].toList();
QVariantList queryResults = QgsArcGisRestUtils::queryServiceJSON( queryUrl, mErrorTitle, mError ).value( "results" ).toList();

QMap<int, QVariant> entries;

@@ -942,7 +942,7 @@ QString QgsGrass::openMapset( const QString& gisdbase,
QString processResult = QString( "exitStatus=%1, exitCode=%2, errorCode=%3, error=%4 stdout=%5, stderr=%6" )
.arg( process.exitStatus() ).arg( process.exitCode() )
.arg( process.error() ).arg( process.errorString(),
process.readAllStandardOutput().data(), process.readAllStandardError().data() );
process.readAllStandardOutput().constData(), process.readAllStandardError().constData() );
QgsDebugMsg( "processResult: " + processResult );

// lock exit code:
@@ -435,8 +435,8 @@ bool QgsGrassRasterImport::import()
// TODO: best timeout?
mProcess->waitForFinished( 30000 );

QString stdoutString = mProcess->readAllStandardOutput().data();
QString stderrString = mProcess->readAllStandardError().data();
QString stdoutString = mProcess->readAllStandardOutput().constData();
QString stderrString = mProcess->readAllStandardError().constData();

QString processResult = QString( "exitStatus=%1, exitCode=%2, error=%3, errorString=%4 stdout=%5, stderr=%6" )
.arg( mProcess->exitStatus() ).arg( mProcess->exitCode() )
@@ -713,8 +713,8 @@ bool QgsGrassVectorImport::import()
QgsDebugMsg( "waitForFinished" );
mProcess->waitForFinished( 30000 );

QString stdoutString = mProcess->readAllStandardOutput().data();
QString stderrString = mProcess->readAllStandardError().data();
QString stdoutString = mProcess->readAllStandardOutput().constData();
QString stderrString = mProcess->readAllStandardError().constData();

QString processResult = QString( "exitStatus=%1, exitCode=%2, error=%3, errorString=%4 stdout=%5, stderr=%6" )
.arg( mProcess->exitStatus() ).arg( mProcess->exitCode() )
@@ -1229,7 +1229,7 @@ bool QgsOgrProvider::addFeature( QgsFeature& f )
QgsDebugMsg( QString( "Writing string attribute %1 with %2, encoding %3" )
.arg( qgisAttId )
.arg( attrVal.toString(),
mEncoding->name().data() ) );
mEncoding->name().constData() ) );
OGR_F_SetFieldString( feature, ogrAttId, mEncoding->fromUnicode( attrVal.toString() ).constData() );
break;

@@ -498,7 +498,7 @@ bool QgsSpatiaLiteFeatureIterator::getFeature( sqlite3_stmt *stmt, QgsFeature &f
{
if ( ic <= mRequest.subsetOfAttributes().size() )
{
const int attrIndex = mRequest.subsetOfAttributes()[ic-1];
const int attrIndex = mRequest.subsetOfAttributes().at( ic - 1 );
const QgsField field = mSource->mFields.at( attrIndex );
feature.setAttribute( attrIndex, getFeatureAttribute( stmt, ic, field.type(), field.subType() ) );
}

0 comments on commit 368a04a

Please sign in to comment.
You can’t perform that action at this time.