Skip to content

Commit

Permalink
Fix coverity mixed enum warning, switch 0 -> nullptr
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed May 11, 2016
1 parent f4b63c6 commit ab288c6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion python/core/qgsvectordataprovider.sip
Expand Up @@ -363,6 +363,6 @@ class QgsVectorDataProvider : QgsDataProvider
void pushError( const QString& msg );

/** Converts the geometry to the provider type if possible / necessary
@return the converted geometry or 0 if no conversion was necessary or possible*/
@return the converted geometry or nullptr if no conversion was necessary or possible*/
QgsGeometry* convertToProviderType( const QgsGeometry* geom ) const /Factory/;
};
14 changes: 7 additions & 7 deletions src/core/qgsvectordataprovider.cpp
Expand Up @@ -581,24 +581,24 @@ QgsGeometry* QgsVectorDataProvider::convertToProviderType( const QgsGeometry* ge
{
if ( !geom )
{
return 0;
return nullptr;
}

QgsAbstractGeometryV2* geometry = geom->geometry();
if ( !geometry )
{
return 0;
return nullptr;
}

QgsWKBTypes::Type providerGeomType = QgsWKBTypes::Type( geometryType() );
QgsWKBTypes::Type providerGeomType = QGis::fromOldWkbType( geometryType() );

//geom is already in the provider geometry type
if ( geometry->wkbType() == providerGeomType )
{
return 0;
return nullptr;
}

QgsAbstractGeometryV2* outputGeom = 0;
QgsAbstractGeometryV2* outputGeom = nullptr;

//convert compoundcurve to circularstring (possible if compoundcurve consists of one circular string)
if ( QgsWKBTypes::flatType( providerGeomType ) == QgsWKBTypes::CircularString && QgsWKBTypes::flatType( geometry->wkbType() ) == QgsWKBTypes::CompoundCurve )
Expand Down Expand Up @@ -642,7 +642,7 @@ QgsGeometry* QgsVectorDataProvider::convertToProviderType( const QgsGeometry* ge
//convert to linear type from curved type
if ( QgsWKBTypes::isCurvedType( geometry->wkbType() ) && !QgsWKBTypes::isCurvedType( providerGeomType ) )
{
QgsAbstractGeometryV2* segmentizedGeom = 0;
QgsAbstractGeometryV2* segmentizedGeom = nullptr;
segmentizedGeom = outputGeom ? outputGeom->segmentize() : geometry->segmentize();
if ( segmentizedGeom )
{
Expand Down Expand Up @@ -673,7 +673,7 @@ QgsGeometry* QgsVectorDataProvider::convertToProviderType( const QgsGeometry* ge
{
return new QgsGeometry( outputGeom );
}
return 0;
return nullptr;
}

QStringList QgsVectorDataProvider::smEncodings;
2 changes: 1 addition & 1 deletion src/core/qgsvectordataprovider.h
Expand Up @@ -437,7 +437,7 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
QgsAttrPalIndexNameHash mAttrPalIndexName;

/** Converts the geometry to the provider type if possible / necessary
@return the converted geometry or 0 if no conversion was necessary or possible*/
@return the converted geometry or nullptr if no conversion was necessary or possible*/
QgsGeometry* convertToProviderType( const QgsGeometry* geom ) const;

private:
Expand Down

0 comments on commit ab288c6

Please sign in to comment.