Skip to content

Commit

Permalink
Cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Mar 11, 2021
1 parent c578658 commit 59a2286
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/core/providers/ogr/qgsogrfeatureiterator.cpp
Expand Up @@ -61,7 +61,7 @@ QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource *source, bool
&& mRequest.filterType() != QgsFeatureRequest::FilterType::FilterFids ); && mRequest.filterType() != QgsFeatureRequest::FilterType::FilterFids );


QgsCPLHTTPFetchOverrider oCPLHTTPFetcher( mAuthCfg ); QgsCPLHTTPFetchOverrider oCPLHTTPFetcher( mAuthCfg );
QgsSetCPLHTTPFetchOverriderInitiatorClass( oCPLHTTPFetcher, QStringLiteral( "QgsOgrFeatureIterator" ) ); QgsSetCPLHTTPFetchOverriderInitiatorClass( oCPLHTTPFetcher, QStringLiteral( "QgsOgrFeatureIterator" ) )


for ( const auto &id : mRequest.filterFids() ) for ( const auto &id : mRequest.filterFids() )
{ {
Expand Down Expand Up @@ -155,6 +155,7 @@ QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource *source, bool
{ {
QSet<int> attributeIndexes; QSet<int> attributeIndexes;
const auto usedAttributeIndices = mRequest.orderBy().usedAttributeIndices( mSource->mFields ); const auto usedAttributeIndices = mRequest.orderBy().usedAttributeIndices( mSource->mFields );
attributeIndexes.reserve( usedAttributeIndices.size() );
for ( int attrIdx : usedAttributeIndices ) for ( int attrIdx : usedAttributeIndices )
{ {
attributeIndexes << attrIdx; attributeIndexes << attrIdx;
Expand Down Expand Up @@ -347,7 +348,7 @@ bool QgsOgrFeatureIterator::fetchFeature( QgsFeature &feature )
QMutexLocker locker( mSharedDS ? &mSharedDS->mutex() : nullptr ); QMutexLocker locker( mSharedDS ? &mSharedDS->mutex() : nullptr );


QgsCPLHTTPFetchOverrider oCPLHTTPFetcher( mAuthCfg, mInterruptionChecker ); QgsCPLHTTPFetchOverrider oCPLHTTPFetcher( mAuthCfg, mInterruptionChecker );
QgsSetCPLHTTPFetchOverriderInitiatorClass( oCPLHTTPFetcher, QStringLiteral( "QgsOgrFeatureIterator" ) ); QgsSetCPLHTTPFetchOverriderInitiatorClass( oCPLHTTPFetcher, QStringLiteral( "QgsOgrFeatureIterator" ) )


feature.setValid( false ); feature.setValid( false );


Expand Down Expand Up @@ -501,7 +502,7 @@ void QgsOgrFeatureIterator::getFeatureAttribute( OGRFeatureH ogrFet, QgsFeature
f.setAttribute( attindex, value ); f.setAttribute( attindex, value );
} }


bool QgsOgrFeatureIterator::readFeature( gdal::ogr_feature_unique_ptr fet, QgsFeature &feature ) const bool QgsOgrFeatureIterator::readFeature( const gdal::ogr_feature_unique_ptr &fet, QgsFeature &feature ) const
{ {
feature.setId( OGR_F_GetFID( fet.get() ) ); feature.setId( OGR_F_GetFID( fet.get() ) );
feature.initAttributes( mSource->mFields.count() ); feature.initAttributes( mSource->mFields.count() );
Expand Down
2 changes: 1 addition & 1 deletion src/core/providers/ogr/qgsogrfeatureiterator.h
Expand Up @@ -82,7 +82,7 @@ class QgsOgrFeatureIterator final: public QgsAbstractFeatureIteratorFromSource<Q


private: private:


bool readFeature( gdal::ogr_feature_unique_ptr fet, QgsFeature &feature ) const; bool readFeature( const gdal::ogr_feature_unique_ptr &fet, QgsFeature &feature ) const;


//! Gets an attribute associated with a feature //! Gets an attribute associated with a feature
void getFeatureAttribute( OGRFeatureH ogrFet, QgsFeature &f, int attindex ) const; void getFeatureAttribute( OGRFeatureH ogrFet, QgsFeature &f, int attindex ) const;
Expand Down

0 comments on commit 59a2286

Please sign in to comment.