Skip to content
Permalink
Browse files

Fix style in previous commit regarding comparisons against nullptr

Cherry-picked from ed08ffb
  • Loading branch information
rouault committed Apr 26, 2016
1 parent 05953cb commit 7d70f32326d7d8f4f387d8b2bc487fea5b7388e8
Showing with 11 additions and 11 deletions.
  1. +5 −5 src/providers/ogr/qgsogrfeatureiterator.cpp
  2. +6 −6 src/providers/ogr/qgsogrprovider.cpp
@@ -44,7 +44,7 @@ QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource* source, bool
mFeatureFetched = false;

mConn = QgsOgrConnPool::instance()->acquireConnection( mSource->mProvider->dataSourceUri() );
if ( mConn->ds == nullptr )
if ( !mConn->ds )
{
return;
}
@@ -57,15 +57,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 = QgsOgrUtils::setSubsetString( ogrLayer, mConn->ds, mSource->mEncoding, mSource->mSubsetString );
if ( ogrLayer == nullptr )
if ( !ogrLayer )
{
return;
}
@@ -216,7 +216,7 @@ bool QgsOgrFeatureIterator::fetchFeature( QgsFeature& feature )
{
feature.setValid( false );

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

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

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

OGR_L_ResetReading( ogrLayer );
@@ -395,7 +395,7 @@ bool QgsOgrProvider::setSubsetString( const QString& theSQL, bool updateFeatureC
{
QgsCPLErrorHandler handler;

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

if ( theSQL == mSubsetString && mFeaturesCounted >= 0 )
@@ -695,7 +695,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 )
@@ -2694,7 +2694,7 @@ bool QgsOgrProvider::syncToDisc()

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

ogrLayer = ogrOrigLayer;
}
if ( ogrLayer != nullptr )
if ( ogrLayer )
{
mValid = true;
mDynamicWriteAccess = true;
@@ -2999,7 +2999,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() ) );
@@ -3032,7 +3032,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() ) );

0 comments on commit 7d70f32

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