@@ -3238,7 +3238,7 @@ static void CutGeometryOnDateLineAndAddToMulti(OGRGeometryCollection *poMulti,
32383238/* RemovePoint() */
32393239/* ***********************************************************************/
32403240
3241- static void RemovePoint (OGRGeometry *poGeom, OGRPoint *poPoint)
3241+ static void RemovePoint (OGRGeometry *poGeom, const OGRPoint *poPoint)
32423242{
32433243 const OGRwkbGeometryType eType = wkbFlatten (poGeom->getGeometryType ());
32443244 switch (eType)
@@ -3275,14 +3275,11 @@ static void RemovePoint(OGRGeometry *poGeom, OGRPoint *poPoint)
32753275 case wkbPolygon:
32763276 {
32773277 OGRPolygon *poPoly = poGeom->toPolygon ();
3278- if (poPoly-> getExteriorRing () != nullptr )
3278+ for ( auto *poRing : *poPoly )
32793279 {
3280- RemovePoint (poPoly->getExteriorRing (), poPoint);
3281- for (int i = 0 ; i < poPoly->getNumInteriorRings (); ++i)
3282- {
3283- RemovePoint (poPoly->getInteriorRing (i), poPoint);
3284- }
3280+ RemovePoint (poRing, poPoint);
32853281 }
3282+ poPoly->closeRings ();
32863283 break ;
32873284 }
32883285
@@ -3291,9 +3288,9 @@ static void RemovePoint(OGRGeometry *poGeom, OGRPoint *poPoint)
32913288 case wkbGeometryCollection:
32923289 {
32933290 OGRGeometryCollection *poGC = poGeom->toGeometryCollection ();
3294- for (int i = 0 ; i < poGC-> getNumGeometries (); ++i )
3291+ for (auto *poPart : * poGC)
32953292 {
3296- RemovePoint (poGC-> getGeometryRef (i) , poPoint);
3293+ RemovePoint (poPart , poPoint);
32973294 }
32983295 break ;
32993296 }
0 commit comments