[geos-commits] r2207 - in branches/3.0: doc source/geomgraph source/headers/geos/io source/headers/geos/noding source/index/quadtree source/io source/operation/buffer source/operation/distance source/planargraph source/precision tests/bigtest tests/xmltester tests/xmltester/markup

svn_geos at osgeo.org svn_geos at osgeo.org
Wed Oct 22 14:51:10 EDT 2008


Author: pramsey
Date: 2008-10-22 14:51:09 -0400 (Wed, 22 Oct 2008)
New Revision: 2207

Modified:
   branches/3.0/doc/example.cpp
   branches/3.0/source/geomgraph/GeometryGraph.cpp
   branches/3.0/source/headers/geos/io/CLocalizer.h
   branches/3.0/source/headers/geos/noding/FastNodingValidator.h
   branches/3.0/source/headers/geos/noding/IntersectionAdder.h
   branches/3.0/source/index/quadtree/DoubleBits.cpp
   branches/3.0/source/io/ByteOrderValues.cpp
   branches/3.0/source/io/CLocalizer.cpp
   branches/3.0/source/io/StringTokenizer.cpp
   branches/3.0/source/operation/buffer/OffsetCurveSetBuilder.cpp
   branches/3.0/source/operation/distance/ConnectedElementPointFilter.cpp
   branches/3.0/source/planargraph/DirectedEdge.cpp
   branches/3.0/source/precision/SimpleGeometryPrecisionReducer.cpp
   branches/3.0/tests/bigtest/TestSweepLineSpeed.cpp
   branches/3.0/tests/xmltester/XMLTester.cpp
   branches/3.0/tests/xmltester/markup/MarkupSTL.h
Log:
Fix for GCC 4.3+ compilation from Regina Obe (#196)


Modified: branches/3.0/doc/example.cpp
===================================================================
--- branches/3.0/doc/example.cpp	2008-10-17 22:10:30 UTC (rev 2206)
+++ branches/3.0/doc/example.cpp	2008-10-22 18:51:09 UTC (rev 2207)
@@ -31,6 +31,7 @@
 #include <vector>
 #include <sstream>
 #include <iomanip>
+#include <cstdlib>
 #include <geos/geom/PrecisionModel.h>
 #include <geos/geom/GeometryFactory.h>
 #include <geos/geom/Geometry.h>

Modified: branches/3.0/source/geomgraph/GeometryGraph.cpp
===================================================================
--- branches/3.0/source/geomgraph/GeometryGraph.cpp	2008-10-17 22:10:30 UTC (rev 2206)
+++ branches/3.0/source/geomgraph/GeometryGraph.cpp	2008-10-22 18:51:09 UTC (rev 2207)
@@ -45,6 +45,7 @@
 #include <vector>
 #include <memory> // auto_ptr
 #include <cassert>
+#include <typeinfo>
 
 #ifndef GEOS_DEBUG
 #define GEOS_DEBUG 0

Modified: branches/3.0/source/headers/geos/io/CLocalizer.h
===================================================================
--- branches/3.0/source/headers/geos/io/CLocalizer.h	2008-10-17 22:10:30 UTC (rev 2206)
+++ branches/3.0/source/headers/geos/io/CLocalizer.h	2008-10-22 18:51:09 UTC (rev 2207)
@@ -1,3 +1,4 @@
+#include <string>
 
 namespace geos {
 namespace io {
@@ -5,15 +6,16 @@
 /**
  * \class CLocalizer io.h geos.h
  */
-
 class CLocalizer
 {
-private:
-    char *outer_locale;
+public:
 
-public:
     CLocalizer();
     ~CLocalizer();
+
+private:
+
+    std::string saved_locale;
 };
 
 } // namespace io

Modified: branches/3.0/source/headers/geos/noding/FastNodingValidator.h
===================================================================
--- branches/3.0/source/headers/geos/noding/FastNodingValidator.h	2008-10-17 22:10:30 UTC (rev 2206)
+++ branches/3.0/source/headers/geos/noding/FastNodingValidator.h	2008-10-22 18:51:09 UTC (rev 2207)
@@ -23,8 +23,9 @@
 #include <geos/noding/SingleInteriorIntersectionFinder.h> // for composition
 #include <geos/algorithm/LineIntersector.h> // for composition
 
+#include <memory>
+#include <string>
 #include <cassert>
-#include <string>
 
 // Forward declarations
 namespace geos {

Modified: branches/3.0/source/headers/geos/noding/IntersectionAdder.h
===================================================================
--- branches/3.0/source/headers/geos/noding/IntersectionAdder.h	2008-10-17 22:10:30 UTC (rev 2206)
+++ branches/3.0/source/headers/geos/noding/IntersectionAdder.h	2008-10-22 18:51:09 UTC (rev 2207)
@@ -18,7 +18,7 @@
 
 #include <vector>
 #include <iostream>
-#include <cmath> // for abs()
+#include <cstdlib> // for abs()
 
 #include <geos/inline.h>
 

Modified: branches/3.0/source/index/quadtree/DoubleBits.cpp
===================================================================
--- branches/3.0/source/index/quadtree/DoubleBits.cpp	2008-10-17 22:10:30 UTC (rev 2206)
+++ branches/3.0/source/index/quadtree/DoubleBits.cpp	2008-10-22 18:51:09 UTC (rev 2207)
@@ -22,6 +22,7 @@
 #include <geos/util/IllegalArgumentException.h>
 
 #include <string>
+#include <cstring>
 
 #if __STDC_IEC_559__
 #define ASSUME_IEEE_DOUBLE 1

Modified: branches/3.0/source/io/ByteOrderValues.cpp
===================================================================
--- branches/3.0/source/io/ByteOrderValues.cpp	2008-10-17 22:10:30 UTC (rev 2206)
+++ branches/3.0/source/io/ByteOrderValues.cpp	2008-10-22 18:51:09 UTC (rev 2207)
@@ -21,6 +21,7 @@
 #include <geos/platform.h>
 #include <geos/util.h>
 
+#include <cstring>
 #include <cassert>
 
 namespace geos {

Modified: branches/3.0/source/io/CLocalizer.cpp
===================================================================
--- branches/3.0/source/io/CLocalizer.cpp	2008-10-17 22:10:30 UTC (rev 2206)
+++ branches/3.0/source/io/CLocalizer.cpp	2008-10-22 18:51:09 UTC (rev 2207)
@@ -1,6 +1,7 @@
 #include <geos/io/CLocalizer.h>
 
 #include <string>
+#include <clocale>
 
 using namespace std;
 
@@ -9,25 +10,17 @@
 
 CLocalizer::CLocalizer()
 {
-    outer_locale = strdup(std::setlocale(LC_NUMERIC, NULL));
-    if (std::setlocale(LC_NUMERIC, "C") == NULL)
+    char* p = std::setlocale(LC_NUMERIC, NULL);
+    if (0 != p)
     {
-        if (outer_locale != NULL)
-        {
-            free(outer_locale);
-            outer_locale = NULL;
-        }
+        saved_locale = p;
     }
+    std::setlocale(LC_NUMERIC, "C");
 }
 
 CLocalizer::~CLocalizer()
 {
-    if (outer_locale != NULL)
-    {
-        std::setlocale(LC_NUMERIC, outer_locale);
-        free(outer_locale);
-        outer_locale = NULL;
-    }
+    std::setlocale(LC_NUMERIC, saved_locale.c_str());
 }
 
 } // namespace geos.io

Modified: branches/3.0/source/io/StringTokenizer.cpp
===================================================================
--- branches/3.0/source/io/StringTokenizer.cpp	2008-10-17 22:10:30 UTC (rev 2206)
+++ branches/3.0/source/io/StringTokenizer.cpp	2008-10-22 18:51:09 UTC (rev 2207)
@@ -17,6 +17,7 @@
 #include <geos/io/StringTokenizer.h>
 
 #include <string>
+#include <cstdlib>
 
 using namespace std;
 

Modified: branches/3.0/source/operation/buffer/OffsetCurveSetBuilder.cpp
===================================================================
--- branches/3.0/source/operation/buffer/OffsetCurveSetBuilder.cpp	2008-10-17 22:10:30 UTC (rev 2206)
+++ branches/3.0/source/operation/buffer/OffsetCurveSetBuilder.cpp	2008-10-22 18:51:09 UTC (rev 2207)
@@ -41,6 +41,7 @@
 #include <vector>
 #include <memory>
 #include <cassert>
+#include <typeinfo>
 
 #ifndef GEOS_DEBUG
 #define GEOS_DEBUG 0

Modified: branches/3.0/source/operation/distance/ConnectedElementPointFilter.cpp
===================================================================
--- branches/3.0/source/operation/distance/ConnectedElementPointFilter.cpp	2008-10-17 22:10:30 UTC (rev 2206)
+++ branches/3.0/source/operation/distance/ConnectedElementPointFilter.cpp	2008-10-22 18:51:09 UTC (rev 2207)
@@ -20,6 +20,7 @@
 #include <geos/geom/Polygon.h>
 
 #include <vector>
+#include <typeinfo>
 
 using namespace std;
 using namespace geos::geom;

Modified: branches/3.0/source/planargraph/DirectedEdge.cpp
===================================================================
--- branches/3.0/source/planargraph/DirectedEdge.cpp	2008-10-17 22:10:30 UTC (rev 2206)
+++ branches/3.0/source/planargraph/DirectedEdge.cpp	2008-10-22 18:51:09 UTC (rev 2207)
@@ -21,6 +21,7 @@
 #include <cmath>
 #include <sstream>
 #include <vector>
+#include <typeinfo>
 
 using namespace std;
 using namespace geos::geom;

Modified: branches/3.0/source/precision/SimpleGeometryPrecisionReducer.cpp
===================================================================
--- branches/3.0/source/precision/SimpleGeometryPrecisionReducer.cpp	2008-10-17 22:10:30 UTC (rev 2206)
+++ branches/3.0/source/precision/SimpleGeometryPrecisionReducer.cpp	2008-10-22 18:51:09 UTC (rev 2207)
@@ -30,6 +30,7 @@
 #include <geos/geom/LinearRing.h>
 
 #include <vector>
+#include <typeinfo>
 
 using namespace std;
 using namespace geos::geom;

Modified: branches/3.0/tests/bigtest/TestSweepLineSpeed.cpp
===================================================================
--- branches/3.0/tests/bigtest/TestSweepLineSpeed.cpp	2008-10-17 22:10:30 UTC (rev 2206)
+++ branches/3.0/tests/bigtest/TestSweepLineSpeed.cpp	2008-10-22 18:51:09 UTC (rev 2207)
@@ -88,7 +88,7 @@
 //	cout << "n Pts: " << nPts << "   Executed in " << totalTime << endl;
 }
 
-int main(int /* argC */, char* /* argV[] */) {
+int main(int /* argc */, char** /* argv[] */) {
 
 	GeometryFactory *fact=new GeometryFactory();
 

Modified: branches/3.0/tests/xmltester/XMLTester.cpp
===================================================================
--- branches/3.0/tests/xmltester/XMLTester.cpp	2008-10-17 22:10:30 UTC (rev 2206)
+++ branches/3.0/tests/xmltester/XMLTester.cpp	2008-10-22 18:51:09 UTC (rev 2207)
@@ -277,9 +277,9 @@
 		std::string offsetXStr=xml.GetChildAttrib("offsetx");
 		std::string offsetYStr=xml.GetChildAttrib("offsety");
 
-		double scale=strtod(scaleStr.c_str(),&stopstring);
-		double offsetX=strtod(offsetXStr.c_str(),&stopstring);
-		double offsetY=strtod(offsetYStr.c_str(),&stopstring);
+		double scale=std::strtod(scaleStr.c_str(),&stopstring);
+		double offsetX=std::strtod(offsetXStr.c_str(),&stopstring);
+		double offsetY=std::strtod(offsetYStr.c_str(),&stopstring);
 		pm.reset(new PrecisionModel(scale,offsetX,offsetY));
 	}
 
@@ -703,10 +703,10 @@
 			profile.start();
 
 			GeomAutoPtr gRealRes;
-			double dist = atof(opArg3.c_str());
+			double dist = std::atof(opArg3.c_str());
 
 			if ( opArg2 != "" ) {
-				gRealRes.reset(gT->buffer(dist, atoi(opArg2.c_str())));
+				gRealRes.reset(gT->buffer(dist, std::atoi(opArg2.c_str())));
 			} else {
 				gRealRes.reset(gT->buffer(dist));
 			}
@@ -806,7 +806,7 @@
 
 		else if (opName=="iswithindistance")
 		{
-			float dist=atof(opArg3.c_str());
+			float dist=std::atof(opArg3.c_str());
 			if (gA->isWithinDistance(gB, dist)) {
 				actual_result="true";
 			} else {
@@ -876,7 +876,7 @@
 		else if (opName=="areatest")
 		{
 			char* rest;
-			double toleratedDiff = strtod(opRes.c_str(), &rest);
+			double toleratedDiff = std::strtod(opRes.c_str(), &rest);
 			if ( rest == opRes.c_str() )
 			{
 				throw std::runtime_error("malformed testcase: missing tolerated area difference in 'areatest' op");
@@ -944,28 +944,28 @@
 			// ^ : intersection
 		
 			// A == ( A ^ B ) + ( A - B )
-			double diff = fabs ( areaA - areaI - areaDab );
+			double diff = std::fabs ( areaA - areaI - areaDab );
 			if ( diff > maxdiff ) {
 				maxdiffop = "A == ( A ^ B ) + ( A - B )";
 				maxdiff = diff;
 			}
 
 			// B == ( A ^ B ) + ( B - A )
-			diff = fabs ( areaB - areaI - areaDba );
+			diff = std::fabs ( areaB - areaI - areaDba );
 			if ( diff > maxdiff ) {
 				maxdiffop = "B == ( A ^ B ) + ( B - A )";
 				maxdiff = diff;
 			}
 
 			//  ( A @ B ) == ( A - B ) + ( B - A )
-			diff = fabs ( areaDab + areaDba - areaSD );
+			diff = std::fabs ( areaDab + areaDba - areaSD );
 			if ( diff > maxdiff ) {
 				maxdiffop = "( A @ B ) == ( A - B ) + ( B - A )";
 				maxdiff = diff;
 			}
 
 			//  ( A u B ) == ( A ^ B ) + ( A @ B )
-			diff = fabs ( areaI + areaSD - areaU );
+			diff = std::fabs ( areaI + areaSD - areaU );
 			if ( diff > maxdiff ) {
 				maxdiffop = "( A u B ) == ( A ^ B ) + ( A @ B )";
 				maxdiff = diff;
@@ -1052,7 +1052,7 @@
 	   << "--sql-output         Produce SQL output" << std::endl
 	   << "--wkb-output         Print Geometries as HEXWKB" << std::endl;
 
-	exit(exitcode);
+	std::exit(exitcode);
 }
 
 int
@@ -1074,30 +1074,30 @@
 	for (int i=1; i<argC; ++i)
 	{
 		// increment verbosity level
-		if ( ! strcmp(argV[i], "-v" ) )
+		if ( ! std::strcmp(argV[i], "-v" ) )
 		{
 			++verbose;
 			tester.setVerbosityLevel(verbose);
 			continue;
 		}
-		if ( ! strcmp(argV[i], "--test-valid-output" ) )
+		if ( ! std::strcmp(argV[i], "--test-valid-output" ) )
 		{
 			tester.testOutputValidity(true);
 			continue;
 		}
-		if ( ! strcmp(argV[i], "--sql-output" ) )
+		if ( ! std::strcmp(argV[i], "--sql-output" ) )
 		{
 			sql_output = true;
 			tester.setSQLOutput(sql_output);
 			continue;
 		}
-		if ( ! strcmp(argV[i], "--wkb-output" ) )
+		if ( ! std::strcmp(argV[i], "--wkb-output" ) )
 		{
 			sql_output = true;
 			tester.setHEXWKBOutput(sql_output);
 			continue;
 		}
-		if ( ! strcmp(argV[i], "--test-valid-input" ) )
+		if ( ! std::strcmp(argV[i], "--test-valid-input" ) )
 		{
 			tester.testInputValidity(true);
 			continue;

Modified: branches/3.0/tests/xmltester/markup/MarkupSTL.h
===================================================================
--- branches/3.0/tests/xmltester/markup/MarkupSTL.h	2008-10-17 22:10:30 UTC (rev 2206)
+++ branches/3.0/tests/xmltester/markup/MarkupSTL.h	2008-10-22 18:51:09 UTC (rev 2207)
@@ -62,6 +62,7 @@
 #pragma warning(disable:4786)
 #endif
 
+#include <cstring>
 #include <string>
 #include <map>
 #include <vector>
@@ -193,9 +194,9 @@
 		#ifdef MARKUP_IGNORECASE
 			return ( (strnicmp( &szDoc[nL], szName, nLen ) == 0)
 		#else
-			return ( (strncmp( &szDoc[nL], szName, nLen ) == 0)
+			return ( (std::strncmp( &szDoc[nL], szName, nLen ) == 0)
 		#endif
-				&& ( szName[nLen] == '\0' || strchr(" =/[",szName[nLen]) ) );
+				&& ( szName[nLen] == '\0' || std::strchr(" =/[",szName[nLen]) ) );
 		};
 		int nL;
 		int nR;



More information about the geos-commits mailing list