[geos-commits] r2302 - trunk/capi

svn_geos at osgeo.org svn_geos at osgeo.org
Mon Mar 23 20:48:48 EDT 2009


Author: mloskot
Date: 2009-03-23 20:48:48 -0400 (Mon, 23 Mar 2009)
New Revision: 2302

Modified:
   trunk/capi/geos_c.cpp
   trunk/capi/geos_c.h.in
   trunk/capi/geos_ts_c.cpp
Log:
capi/geos_ts_c.cpp: refactoring,  assert() to test against nullptr where it is forbidden.

Modified: trunk/capi/geos_c.cpp
===================================================================
--- trunk/capi/geos_c.cpp	2009-03-24 00:30:58 UTC (rev 2301)
+++ trunk/capi/geos_c.cpp	2009-03-24 00:48:48 UTC (rev 2302)
@@ -455,9 +455,9 @@
 }
 
 int
-GEOSGetSRID(const Geometry *g1)
+GEOSGetSRID(const Geometry *g)
 {
-    return GEOSGetSRID_r( handle, g1 );
+    return GEOSGetSRID_r( handle, g );
 }
 
 char 

Modified: trunk/capi/geos_c.h.in
===================================================================
--- trunk/capi/geos_c.h.in	2009-03-24 00:30:58 UTC (rev 2301)
+++ trunk/capi/geos_c.h.in	2009-03-24 00:48:48 UTC (rev 2302)
@@ -589,12 +589,12 @@
                                      const GEOSGeometry* g1);
 
 /* Return 0 on exception */
-extern int GEOS_DLL GEOSGetSRID(const GEOSGeometry* g1);
+extern int GEOS_DLL GEOSGetSRID(const GEOSGeometry* g);
 
 extern void GEOS_DLL GEOSSetSRID(GEOSGeometry* g, int SRID);
 
 extern int GEOS_DLL GEOSGetSRID_r(GEOSContextHandle_t handle,
-                                  const GEOSGeometry* g1);
+                                  const GEOSGeometry* g);
 
 extern void GEOS_DLL GEOSSetSRID(GEOSGeometry* g, int SRID);
 
@@ -604,10 +604,10 @@
  * when feeded simple geometries, so beware if you need compatibility with
  * old GEOS versions.
  */
-extern int GEOS_DLL GEOSGetNumGeometries(const GEOSGeometry* g1);
+extern int GEOS_DLL GEOSGetNumGeometries(const GEOSGeometry* g);
 
 extern int GEOS_DLL GEOSGetNumGeometries_r(GEOSContextHandle_t handle,
-                                           const GEOSGeometry* g1);
+                                           const GEOSGeometry* g);
 
 /*
  * Return NULL on exception, Geometry must be a Collection.

Modified: trunk/capi/geos_ts_c.cpp
===================================================================
--- trunk/capi/geos_ts_c.cpp	2009-03-24 00:30:58 UTC (rev 2301)
+++ trunk/capi/geos_ts_c.cpp	2009-03-24 00:48:48 UTC (rev 2302)
@@ -1579,19 +1579,21 @@
 }
 
 void
-GEOSSetSRID(Geometry *g, int SRID)
+GEOSSetSRID(Geometry *g, int srid)
 {
     assert(0 != g);
     if (0 != g)
     {
-        g->setSRID(SRID);
+        g->setSRID(srid);
     }
 }
 
 
 int
-GEOSGetNumCoordinates_r(GEOSContextHandle_t extHandle, const Geometry *g1)
+GEOSGetNumCoordinates_r(GEOSContextHandle_t extHandle, const Geometry *g)
 {
+    assert(0 != g);
+
     if ( 0 == extHandle )
     {
         return -1;
@@ -1606,7 +1608,7 @@
 
     try
     {
-        return static_cast<int>(g1->getNumPoints());
+        return static_cast<int>(g->getNumPoints());
     }
     catch (const std::exception &e)
     {
@@ -1625,8 +1627,10 @@
  * Converts Geometry to normal form (or canonical form).
  */
 int
-GEOSNormalize_r(GEOSContextHandle_t extHandle, Geometry *g1)
+GEOSNormalize_r(GEOSContextHandle_t extHandle, Geometry *g)
 {
+    assert(0 != g);
+
     if ( 0 == extHandle )
     {
         return -1;
@@ -1641,7 +1645,7 @@
 
     try
     {
-        g1->normalize();
+        g->normalize();
         return 0; // SUCCESS
     }
     catch (const std::exception &e)
@@ -2151,8 +2155,10 @@
 }
 
 int
-GEOSGetSRID_r(GEOSContextHandle_t extHandle, const Geometry *g1)
+GEOSGetSRID_r(GEOSContextHandle_t extHandle, const Geometry *g)
 {
+    assert(0 != g);
+
     if ( 0 == extHandle )
     {
         return 0;
@@ -2167,7 +2173,7 @@
 
     try
     {
-        return g1->getSRID();
+        return g->getSRID();
     }
     catch (const std::exception &e)
     {



More information about the geos-commits mailing list