[geos-commits] r2484 - trunk/capi

svn_geos at osgeo.org svn_geos at osgeo.org
Wed May 6 16:47:39 EDT 2009


Author: strk
Date: 2009-05-06 16:47:39 -0400 (Wed, 06 May 2009)
New Revision: 2484

Modified:
   trunk/capi/geos_c.h.in
   trunk/capi/geos_ts_c.cpp
Log:
Fix bug #135, give an hint about GEOSGeom_getDimensions being related to GEOSCoordSeq_getDimensions, fix signed vs. unsigned compiler warning.


Modified: trunk/capi/geos_c.h.in
===================================================================
--- trunk/capi/geos_c.h.in	2009-05-06 20:22:19 UTC (rev 2483)
+++ trunk/capi/geos_c.h.in	2009-05-06 20:47:39 UTC (rev 2484)
@@ -675,6 +675,7 @@
 
 /*
  * Return 0 on exception (or empty geometry)
+ * See also GEOSCoordSeq_getDimensions 
  */
 extern int GEOS_DLL GEOSGeom_getDimensions(const GEOSGeometry* g);
 

Modified: trunk/capi/geos_ts_c.cpp
===================================================================
--- trunk/capi/geos_ts_c.cpp	2009-05-06 20:22:19 UTC (rev 2483)
+++ trunk/capi/geos_ts_c.cpp	2009-05-06 20:47:39 UTC (rev 2484)
@@ -2129,7 +2129,7 @@
 #endif
 
         std::vector<Geometry *>*geoms = new std::vector<Geometry *>(lines->size());
-        for (int i = 0; i < lines->size(); ++i)
+        for (std::vector<Geometry *>::size_type i = 0; i < lines->size(); ++i)
         {
             (*geoms)[i] = (*lines)[i];
         }
@@ -2841,6 +2841,11 @@
         using geos::geom::Point;
         using geos::geom::GeometryCollection;
 
+	if ( g->isEmpty() )
+	{
+		return 0;
+	}
+
         std::size_t dim = 0;
         const LineString *ls = dynamic_cast<const LineString *>(g);
         if ( ls )
@@ -2865,10 +2870,6 @@
         const GeometryCollection *coll = dynamic_cast<const GeometryCollection *>(g);
         if ( coll )
         {
-            if ( coll->isEmpty() )
-            {
-                return 0;
-            }
             return GEOSGeom_getDimensions_r(extHandle, coll->getGeometryN(0));
         }
 



More information about the geos-commits mailing list