[geos-commits] r2238 - trunk/capi

svn_geos at osgeo.org svn_geos at osgeo.org
Wed Jan 14 15:25:04 EST 2009


Author: pramsey
Date: 2009-01-14 15:25:04 -0500 (Wed, 14 Jan 2009)
New Revision: 2238

Modified:
   trunk/capi/geos_ts_c.cpp
Log:
Remove strdup use from code for compilation in mingw


Modified: trunk/capi/geos_ts_c.cpp
===================================================================
--- trunk/capi/geos_ts_c.cpp	2009-01-13 20:59:17 UTC (rev 2237)
+++ trunk/capi/geos_ts_c.cpp	2009-01-14 20:25:04 UTC (rev 2238)
@@ -570,6 +570,8 @@
     IsValidOp ivo(g1);
     try {
         char *result = NULL;
+		char *validstr = "Valid Geometry";
+		int validstrlen = std::strlen(validstr) + 1;
         bool isvalid = ivo.isValid();
         if ( ! isvalid )
         {
@@ -584,7 +586,8 @@
             sprintf(result, "%s [%s]", errmsg.c_str(), errloc.c_str());
         }
         else {
-            result = strdup( "Valid Geometry" );
+			result = (char*)std::malloc(validstrlen);
+			std::memcpy(result, validstr, validstrlen);
         }
         return result;
     }



More information about the geos-commits mailing list