[geos-commits] r2168 - trunk/source/geom/util

svn_geos at osgeo.org svn_geos at osgeo.org
Tue Aug 19 13:00:43 EDT 2008


Author: mloskot
Date: 2008-08-19 13:00:43 -0400 (Tue, 19 Aug 2008)
New Revision: 2168

Modified:
   trunk/source/geom/util/CoordinateOperation.cpp
   trunk/source/geom/util/GeometryEditor.cpp
Log:
geos/geom/util: Prefer strict static_cast than C-style cast. Commented ownership transfer of coordinates object.

Modified: trunk/source/geom/util/CoordinateOperation.cpp
===================================================================
--- trunk/source/geom/util/CoordinateOperation.cpp	2008-08-19 00:18:04 UTC (rev 2167)
+++ trunk/source/geom/util/CoordinateOperation.cpp	2008-08-19 17:00:43 UTC (rev 2168)
@@ -37,6 +37,7 @@
 		if (ring) {
 			const CoordinateSequence *coords = ring->getCoordinatesRO();
 			CoordinateSequence *newCoords = edit(coords,geometry);
+            // LinearRing instance takes over ownership of newCoords instance
 			return factory->createLinearRing(newCoords);
 		}
 		const LineString *line = dynamic_cast<const LineString *>(geometry);

Modified: trunk/source/geom/util/GeometryEditor.cpp
===================================================================
--- trunk/source/geom/util/GeometryEditor.cpp	2008-08-19 00:18:04 UTC (rev 2167)
+++ trunk/source/geom/util/GeometryEditor.cpp	2008-08-19 17:00:43 UTC (rev 2168)
@@ -90,8 +90,9 @@
 		return operation->edit(geometry, factory);
 	}
 
-	assert(0); // Unsupported Geometry classes should be caught in the GeometryEditorOperation.
-	return NULL;
+    // Unsupported Geometry classes should be caught in the GeometryEditorOperation.
+    assert(!"SHOULD NEVER GET HERE");
+    return NULL;
 }
 
 Polygon*
@@ -102,7 +103,10 @@
 		//RemoveSelectedPlugIn relies on this behaviour. [Jon Aquino]
 		return newPolygon;
 	}
-	LinearRing* shell = (LinearRing*) edit(newPolygon->getExteriorRing(),operation);
+
+	Geometry* editResult = edit(newPolygon->getExteriorRing(),operation);
+
+	LinearRing* shell = static_cast<LinearRing*>(editResult);
 	if (shell->isEmpty()) {
 		//RemoveSelectedPlugIn relies on this behaviour. [Jon Aquino]
 		delete shell;



More information about the geos-commits mailing list