Skip to content
Permalink
Browse files

Fix style in previous commit regarding comparisons against nullptr

  • Loading branch information
rouault committed Apr 26, 2016
1 parent dc18b5b commit ed08ffb2aa945dcb0c103aa3fbe3120c0cd0337b
Showing with 11 additions and 11 deletions.
  1. +5 −5 src/providers/ogr/qgsogrfeatureiterator.cpp
  2. +6 −6 src/providers/ogr/qgsogrprovider.cpp
@@ -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;
}
@@ -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;
}
@@ -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 )
@@ -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 );
@@ -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 )
@@ -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 )
@@ -2828,7 +2828,7 @@ bool QgsOgrProvider::syncToDisc()

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

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

0 comments on commit ed08ffb

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