Skip to content

Commit

Permalink
more msvc warning fixes (followup 03e0298)
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Aug 10, 2017
1 parent eba3065 commit 7e90202
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/app/dwg/qgsdwgimporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2067,7 +2067,7 @@ void QgsDwgImporter::addSpline( const DRW_Spline *data )

size_t npts = cps.size();
size_t k = data->degree + 1;
size_t p1 = mSplineSegs * npts;
int p1 = mSplineSegs * ( int ) npts;

std::vector<double> h( npts + 1, 1. );
std::vector<QgsPointXY> p( p1, QgsPointXY( 0., 0. ) );
Expand Down
30 changes: 7 additions & 23 deletions src/core/geometry/qgsgeometrymakevalid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ static GEOSGeometry *collectFacesWithEvenAncestors( Face **faces, int nfaces )
return ret;
}

Q_NOWARN_UNREACHABLE_PUSH
static GEOSGeometry *LWGEOM_GEOS_buildArea( const GEOSGeometry *geom_in, QString &errorMessage )
{
GEOSContextHandle_t handle = QgsGeos::getGEOSHandler();
Expand All @@ -159,10 +160,8 @@ static GEOSGeometry *LWGEOM_GEOS_buildArea( const GEOSGeometry *geom_in, QString
}
catch ( GEOSException &e )
{
Q_NOWARN_UNREACHABLE_PUSH
errorMessage = QString( "GEOSPolygonize(): %1" ).arg( e.what() );
return nullptr;
Q_NOWARN_UNREACHABLE_POP
}

// We should now have a collection
Expand Down Expand Up @@ -263,8 +262,7 @@ static GEOSGeometry *LWGEOM_GEOS_buildArea( const GEOSGeometry *geom_in, QString

return shp;
}


Q_NOWARN_UNREACHABLE_POP

// Return Nth vertex in GEOSGeometry as a POINT.
// May return NULL if the geometry has NO vertexex.
Expand Down Expand Up @@ -468,6 +466,7 @@ static GEOSGeometry *LWGEOM_GEOS_nodeLines( const GEOSGeometry *lines )
}

// Will return NULL on error (expect error handler being called by then)
Q_NOWARN_UNREACHABLE_PUSH
static GEOSGeometry *LWGEOM_GEOS_makeValidPolygon( const GEOSGeometry *gin, QString &errorMessage )
{
GEOSContextHandle_t handle = QgsGeos::getGEOSHandler();
Expand Down Expand Up @@ -507,11 +506,9 @@ static GEOSGeometry *LWGEOM_GEOS_makeValidPolygon( const GEOSGeometry *gin, QStr
}
catch ( GEOSException &e )
{
Q_NOWARN_UNREACHABLE_PUSH
GEOSGeom_destroy_r( handle, geos_bound );
errorMessage = QString( "GEOSGeom_extractUniquePoints(): %1" ).arg( e.what() );
return nullptr;
Q_NOWARN_UNREACHABLE_POP
}

try
Expand All @@ -520,12 +517,10 @@ static GEOSGeometry *LWGEOM_GEOS_makeValidPolygon( const GEOSGeometry *gin, QStr
}
catch ( GEOSException &e )
{
Q_NOWARN_UNREACHABLE_PUSH
GEOSGeom_destroy_r( handle, geos_bound );
GEOSGeom_destroy_r( handle, pi );
errorMessage = QString( "GEOSGeom_extractUniquePoints(): %1" ).arg( e.what() );
return nullptr;
Q_NOWARN_UNREACHABLE_POP
}

try
Expand All @@ -534,13 +529,11 @@ static GEOSGeometry *LWGEOM_GEOS_makeValidPolygon( const GEOSGeometry *gin, QStr
}
catch ( GEOSException &e )
{
Q_NOWARN_UNREACHABLE_PUSH
GEOSGeom_destroy_r( handle, geos_bound );
GEOSGeom_destroy_r( handle, pi );
GEOSGeom_destroy_r( handle, po );
errorMessage = QString( "GEOSDifference(): %1" ).arg( e.what() );
return nullptr;
Q_NOWARN_UNREACHABLE_POP
}

GEOSGeom_destroy_r( handle, pi );
Expand All @@ -555,11 +548,9 @@ static GEOSGeometry *LWGEOM_GEOS_makeValidPolygon( const GEOSGeometry *gin, QStr
}
catch ( GEOSException &e )
{
Q_NOWARN_UNREACHABLE_PUSH
errorMessage = QString( "GEOSGeom_createEmptyPolygon(): %1" ).arg( e.what() );
GEOSGeom_destroy_r( handle, geos_cut_edges );
return nullptr;
Q_NOWARN_UNREACHABLE_POP
}

// See if an area can be build with the remaining edges
Expand Down Expand Up @@ -604,31 +595,27 @@ static GEOSGeometry *LWGEOM_GEOS_makeValidPolygon( const GEOSGeometry *gin, QStr
}
catch ( GEOSException &e )
{
Q_NOWARN_UNREACHABLE_PUSH
// We did check for empty area already so
// this must be some other error
errorMessage = QString( "GEOSBoundary() threw an error: %1" ).arg( e.what() );
GEOSGeom_destroy_r( handle, new_area );
GEOSGeom_destroy_r( handle, geos_area );
return nullptr;
Q_NOWARN_UNREACHABLE_POP
}

// Now symdif new and old area
// Now symdiff new and old area
try
{
symdif = GEOSSymDifference_r( handle, geos_area, new_area );
}
catch ( GEOSException &e )
{
Q_NOWARN_UNREACHABLE_PUSH
GEOSGeom_destroy_r( handle, geos_cut_edges );
GEOSGeom_destroy_r( handle, new_area );
GEOSGeom_destroy_r( handle, new_area_bound );
GEOSGeom_destroy_r( handle, geos_area );
errorMessage = QString( "GEOSSymDifference() threw an error: %1" ).arg( e.what() );
return nullptr;
Q_NOWARN_UNREACHABLE_POP
}

GEOSGeom_destroy_r( handle, geos_area );
Expand All @@ -650,13 +637,11 @@ static GEOSGeometry *LWGEOM_GEOS_makeValidPolygon( const GEOSGeometry *gin, QStr
}
catch ( GEOSException &e )
{
Q_NOWARN_UNREACHABLE_PUSH
GEOSGeom_destroy_r( handle, geos_cut_edges );
GEOSGeom_destroy_r( handle, new_area_bound );
GEOSGeom_destroy_r( handle, geos_area );
errorMessage = QString( "GEOSDifference() threw an error: %1" ).arg( e.what() );
return nullptr;
Q_NOWARN_UNREACHABLE_POP
}
GEOSGeom_destroy_r( handle, geos_cut_edges );
GEOSGeom_destroy_r( handle, new_area_bound );
Expand Down Expand Up @@ -704,17 +689,16 @@ static GEOSGeometry *LWGEOM_GEOS_makeValidPolygon( const GEOSGeometry *gin, QStr
}
catch ( GEOSException &e )
{
Q_NOWARN_UNREACHABLE_PUSH
errorMessage = QString( "GEOSGeom_createCollection() threw an error: %1" ).arg( e.what() );
// TODO: cleanup!
return nullptr;
Q_NOWARN_UNREACHABLE_POP
}
}

return gout;

}
Q_NOWARN_UNREACHABLE_PUSH

static GEOSGeometry *LWGEOM_GEOS_makeValidLine( const GEOSGeometry *gin, QString &errorMessage )
{
Expand Down Expand Up @@ -864,6 +848,7 @@ static GEOSGeometry *LWGEOM_GEOS_makeValid( const GEOSGeometry *gin, QString &er
GEOSContextHandle_t handle = QgsGeos::getGEOSHandler();

// return what we got so far if already valid
Q_NOWARN_UNREACHABLE_PUSH
try
{
if ( GEOSisValid_r( handle, gin ) )
Expand All @@ -874,12 +859,11 @@ static GEOSGeometry *LWGEOM_GEOS_makeValid( const GEOSGeometry *gin, QString &er
}
catch ( GEOSException &e )
{
Q_NOWARN_UNREACHABLE_PUSH
// I don't think should ever happen
errorMessage = QString( "GEOSisValid(): %1" ).arg( e.what() );
return nullptr;
Q_NOWARN_UNREACHABLE_POP
}
Q_NOWARN_UNREACHABLE_POP

// make what we got valid

Expand Down

0 comments on commit 7e90202

Please sign in to comment.