Skip to content

Commit

Permalink
Fix style in previous commit regarding comparisons against nullptr
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed May 4, 2016
1 parent dc18b5b commit ed08ffb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions src/providers/ogr/qgsogrfeatureiterator.cpp
Expand Up @@ -46,7 +46,7 @@ QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource* source, bool
mFeatureFetched = false;

mConn = QgsOgrConnPool::instance()->acquireConnection( mSource->mProvider->dataSourceUri() );
if ( mConn->ds == nullptr )
if ( !mConn->ds )
{
return;
}
Expand All @@ -59,15 +59,15 @@ QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource* source, bool
{
ogrLayer = OGR_DS_GetLayerByName( mConn->ds, TO8( mSource->mLayerName ) );
}
if ( ogrLayer == nullptr )
if ( !ogrLayer )
{
return;
}

if ( !mSource->mSubsetString.isEmpty() )
{
ogrLayer = QgsOgrProviderUtils::setSubsetString( ogrLayer, mConn->ds, mSource->mEncoding, mSource->mSubsetString );
if ( ogrLayer == nullptr )
if ( !ogrLayer )
{
return;
}
Expand Down Expand Up @@ -224,7 +224,7 @@ bool QgsOgrFeatureIterator::fetchFeature( QgsFeature& feature )
{
feature.setValid( false );

if ( mClosed || ogrLayer == nullptr )
if ( mClosed || !ogrLayer )
return false;

if ( mRequest.filterType() == QgsFeatureRequest::FilterFid )
Expand Down Expand Up @@ -268,7 +268,7 @@ bool QgsOgrFeatureIterator::fetchFeature( QgsFeature& feature )

bool QgsOgrFeatureIterator::rewind()
{
if ( mClosed || ogrLayer == nullptr )
if ( mClosed || !ogrLayer )
return false;

OGR_L_ResetReading( ogrLayer );
Expand Down
12 changes: 6 additions & 6 deletions src/providers/ogr/qgsogrprovider.cpp
Expand Up @@ -396,7 +396,7 @@ bool QgsOgrProvider::setSubsetString( const QString& theSQL, bool updateFeatureC
{
QgsCPLErrorHandler handler;

if ( ogrDataSource == nullptr )
if ( !ogrDataSource )
return false;

if ( theSQL == mSubsetString && mFeaturesCounted >= 0 )
Expand Down Expand Up @@ -729,7 +729,7 @@ void QgsOgrProvider::loadFields()
QgsOgrConnPool::instance()->invalidateConnections( dataSourceUri() );
//the attribute fields need to be read again when the encoding changes
mAttributeFields.clear();
if ( ogrLayer == nullptr )
if ( !ogrLayer )
return;

if ( mOgrGeometryTypeFilter != wkbUnknown )
Expand Down Expand Up @@ -2828,7 +2828,7 @@ bool QgsOgrProvider::syncToDisc()

void QgsOgrProvider::recalculateFeatureCount()
{
if ( ogrLayer == nullptr )
if ( !ogrLayer )
{
mFeaturesCounted = 0;
return;
Expand Down Expand Up @@ -3061,7 +3061,7 @@ void QgsOgrProvider::open( OpenMode mode )

ogrLayer = ogrOrigLayer;
}
if ( ogrLayer != nullptr )
if ( ogrLayer )
{
mValid = true;
mDynamicWriteAccess = true;
Expand Down Expand Up @@ -3133,7 +3133,7 @@ bool QgsOgrProvider::enterUpdateMode()
QgsDebugMsg( QString( "Reopening %1 in update mode" ).arg( dataSourceUri() ) );
close();
open( OpenModeForceUpdate );
if ( ogrDataSource == nullptr || !mWriteAccess )
if ( !ogrDataSource || !mWriteAccess )
{
QgsMessageLog::logMessage( tr( "Cannot reopen datasource %1 in update mode" ).arg( dataSourceUri() ), tr( "OGR" ) );
pushError( tr( "Cannot reopen datasource %1 in update mode" ).arg( dataSourceUri() ) );
Expand Down Expand Up @@ -3166,7 +3166,7 @@ bool QgsOgrProvider::leaveUpdateMode()
QgsDebugMsg( QString( "Reopening %1 in read-only mode" ).arg( dataSourceUri() ) );
close();
open( OpenModeForceReadOnly );
if ( ogrDataSource == nullptr )
if ( !ogrDataSource )
{
QgsMessageLog::logMessage( tr( "Cannot reopen datasource %1 in read-only mode" ).arg( dataSourceUri() ), tr( "OGR" ) );
pushError( tr( "Cannot reopen datasource %1 in read-only mode" ).arg( dataSourceUri() ) );
Expand Down

0 comments on commit ed08ffb

Please sign in to comment.