package geos: gcc 4.6 compatibility

pull/13/head
Mark Brand 13 years ago
parent 2766e503d0
commit 3e94630417

@ -0,0 +1,630 @@
This file is part of mingw-cross-env.
See doc/index.html for further information.
Contains ad hoc patches for cross building.
From d63201ebcc9c6e186660a70973e2fb485fb2c681 Mon Sep 17 00:00:00 2001
From: mingw-cross-env
Date: Sat, 26 Mar 2011 10:13:26 +0100
Subject: [PATCH 1/3] fix missing size_t
diff --git a/source/headers/geos/geom/CoordinateArraySequenceFactory.h b/source/headers/geos/geom/CoordinateArraySequenceFactory.h
index 1f19e09..9bcf835 100644
--- a/source/headers/geos/geom/CoordinateArraySequenceFactory.h
+++ b/source/headers/geos/geom/CoordinateArraySequenceFactory.h
@@ -51,10 +51,10 @@ public:
*/
CoordinateSequence *create(std::vector<Coordinate> *coords) const;
- CoordinateSequence *create(std::vector<Coordinate> *coords, size_t dims) const;
+ CoordinateSequence *create(std::vector<Coordinate> *coords, std::size_t dims) const;
/** @see CoordinateSequenceFactory::create(size_t, int) */
- CoordinateSequence *create(size_t size, size_t dimension=3) const;
+ CoordinateSequence *create(std::size_t size, std::size_t dimension=3) const;
/** \brief
* Returns the singleton instance of CoordinateArraySequenceFactory
diff --git a/source/headers/geos/geom/CoordinateSequence.h b/source/headers/geos/geom/CoordinateSequence.h
index fd1da03..c9f1277 100644
--- a/source/headers/geos/geom/CoordinateSequence.h
+++ b/source/headers/geos/geom/CoordinateSequence.h
@@ -95,7 +95,7 @@ public:
* Coordinate or merely a copy depends on the implementation.
*/
//virtual const Coordinate& getCoordinate(int i) const=0;
- virtual const Coordinate& getAt(size_t i) const=0;
+ virtual const Coordinate& getAt(std::size_t i) const=0;
/// Return last Coordinate in the sequence
const Coordinate& back() const {
diff --git a/source/headers/geos/geom/CoordinateSequenceFactory.h b/source/headers/geos/geom/CoordinateSequenceFactory.h
index 6441d94..50ddc48 100644
--- a/source/headers/geos/geom/CoordinateSequenceFactory.h
+++ b/source/headers/geos/geom/CoordinateSequenceFactory.h
@@ -75,8 +75,8 @@ public:
* @param dimension the dimension of the coordinates in the sequence
* (if user-specifiable, otherwise ignored)
*/
- virtual CoordinateSequence *create(size_t size,
- size_t dimension) const=0;
+ virtual CoordinateSequence *create(std::size_t size,
+ std::size_t dimension) const=0;
virtual ~CoordinateSequenceFactory();
};
diff --git a/source/headers/geos/index/chain/MonotoneChainBuilder.h b/source/headers/geos/index/chain/MonotoneChainBuilder.h
index 7c27e83..e227559 100644
--- a/source/headers/geos/index/chain/MonotoneChainBuilder.h
+++ b/source/headers/geos/index/chain/MonotoneChainBuilder.h
@@ -97,8 +97,8 @@ private:
*
* NOTE: aborts if 'start' is >= pts.getSize()
*/
- static size_t findChainEnd(const geom::CoordinateSequence& pts,
- size_t start);
+ static std::size_t findChainEnd(const geom::CoordinateSequence& pts,
+ std::size_t start);
};
} // namespace geos::index::chain
diff --git a/source/headers/geos/planargraph/DirectedEdgeStar.h b/source/headers/geos/planargraph/DirectedEdgeStar.h
index cc36ca7..c15b0a0 100644
--- a/source/headers/geos/planargraph/DirectedEdgeStar.h
+++ b/source/headers/geos/planargraph/DirectedEdgeStar.h
@@ -86,7 +86,7 @@ public:
* \brief Returns the number of edges around the Node associated
* with this DirectedEdgeStar.
*/
- size_t getDegree() const { return outEdges.size(); }
+ std::size_t getDegree() const { return outEdges.size(); }
/**
* \brief Returns the coordinate for the node at wich this
diff --git a/source/headers/geos/simplify/DouglasPeuckerLineSimplifier.h b/source/headers/geos/simplify/DouglasPeuckerLineSimplifier.h
index 5dd0412..f6fd1ef 100644
--- a/source/headers/geos/simplify/DouglasPeuckerLineSimplifier.h
+++ b/source/headers/geos/simplify/DouglasPeuckerLineSimplifier.h
@@ -81,7 +81,7 @@ private:
BoolVectAutoPtr usePt;
double distanceTolerance;
- void simplifySection(size_t i, size_t j);
+ void simplifySection(std::size_t i, std::size_t j);
// Declare type as noncopyable
DouglasPeuckerLineSimplifier(const DouglasPeuckerLineSimplifier& other);
diff --git a/source/headers/geos/simplify/TaggedLineString.h b/source/headers/geos/simplify/TaggedLineString.h
index 49af2ba..8078eb3 100644
--- a/source/headers/geos/simplify/TaggedLineString.h
+++ b/source/headers/geos/simplify/TaggedLineString.h
@@ -66,11 +66,11 @@ public:
typedef std::auto_ptr<geom::CoordinateSequence> CoordSeqPtr;
TaggedLineString(const geom::LineString* nParentLine,
- size_t minimumSize=2);
+ std::size_t minimumSize=2);
~TaggedLineString();
- size_t getMinimumSize() const;
+ std::size_t getMinimumSize() const;
const geom::LineString* getParent() const;
@@ -78,11 +78,11 @@ public:
CoordSeqPtr getResultCoordinates() const;
- size_t getResultSize() const;
+ std::size_t getResultSize() const;
- TaggedLineSegment* getSegment(size_t);
+ TaggedLineSegment* getSegment(std::size_t x);
- const TaggedLineSegment* getSegment(size_t) const;
+ const TaggedLineSegment* getSegment(std::size_t x) const;
std::vector<TaggedLineSegment*>& getSegments();
@@ -104,7 +104,7 @@ private:
// TaggedLineSegments owned by this object
std::vector<TaggedLineSegment*> resultSegs;
- size_t minimumSize;
+ std::size_t minimumSize;
void init();
diff --git a/source/headers/geos/simplify/TaggedLineStringSimplifier.h b/source/headers/geos/simplify/TaggedLineStringSimplifier.h
index 8ab8507..e54f3e5 100644
--- a/source/headers/geos/simplify/TaggedLineStringSimplifier.h
+++ b/source/headers/geos/simplify/TaggedLineStringSimplifier.h
@@ -92,20 +92,20 @@ private:
double distanceTolerance;
- void simplifySection(size_t i, size_t j,
- size_t depth);
+ void simplifySection(std::size_t i, std::size_t j,
+ std::size_t depth);
- static size_t findFurthestPoint(
+ static std::size_t findFurthestPoint(
const geom::CoordinateSequence* pts,
- size_t i, size_t j,
+ std::size_t i, std::size_t j,
double& maxDistance);
bool hasBadIntersection(const TaggedLineString* parentLine,
- const std::vector<size_t>& sectionIndex,
+ const std::vector<std::size_t>& sectionIndex,
const geom::LineSegment& candidateSeg);
bool hasBadInputIntersection(const TaggedLineString* parentLine,
- const std::vector<size_t>& sectionIndex,
+ const std::vector<std::size_t>& sectionIndex,
const geom::LineSegment& candidateSeg);
bool hasBadOutputIntersection(const geom::LineSegment& candidateSeg);
@@ -114,7 +114,7 @@ private:
const geom::LineSegment& seg1) const;
std::auto_ptr<TaggedLineSegment> flatten(
- size_t start, size_t end);
+ std::size_t start, std::size_t end);
/** \brief
* Tests whether a segment is in a section of a TaggedLineString
@@ -126,7 +126,7 @@ private:
*/
static bool isInLineSection(
const TaggedLineString* parentLine,
- const std::vector<size_t>& sectionIndex,
+ const std::vector<std::size_t>& sectionIndex,
const TaggedLineSegment* seg);
/** \brief
@@ -138,8 +138,8 @@ private:
* @param sectionEndIndex
*/
void remove(const TaggedLineString* line,
- size_t start,
- size_t end);
+ std::size_t start,
+ std::size_t end);
};
diff --git a/source/index/chain/MonotoneChainBuilder.cpp b/source/index/chain/MonotoneChainBuilder.cpp
index 8448431..4dcc571 100644
--- a/source/index/chain/MonotoneChainBuilder.cpp
+++ b/source/index/chain/MonotoneChainBuilder.cpp
@@ -56,13 +56,13 @@ void
MonotoneChainBuilder::getChains(const CoordinateSequence* pts, void* context,
vector<MonotoneChain*>& mcList)
{
- vector<size_t> startIndex;
+ vector<std::size_t> startIndex;
getChainStartIndices(*pts, startIndex);
- size_t nindexes = startIndex.size();
+ std::size_t nindexes = startIndex.size();
if (nindexes > 0)
{
- size_t n = nindexes - 1;
- for(size_t i = 0; i < n; i++)
+ std::size_t n = nindexes - 1;
+ for(std::size_t i = 0; i < n; i++)
{
MonotoneChain* mc = new MonotoneChain(*pts, startIndex[i], startIndex[i+1], context);
mcList.push_back(mc);
@@ -73,16 +73,16 @@ MonotoneChainBuilder::getChains(const CoordinateSequence* pts, void* context,
/* static public */
void
MonotoneChainBuilder::getChainStartIndices(const CoordinateSequence& pts,
- vector<size_t>& startIndexList)
+ vector<std::size_t>& startIndexList)
{
// find the startpoint (and endpoints) of all monotone chains
// in this edge
- size_t start = 0;
+ std::size_t start = 0;
startIndexList.push_back(start);
- const size_t n = pts.getSize() - 1;
+ const std::size_t n = pts.getSize() - 1;
do
{
- size_t last = findChainEnd(pts, start);
+ std::size_t last = findChainEnd(pts, start);
startIndexList.push_back(last);
start = last;
} while (start < n);
@@ -90,17 +90,17 @@ MonotoneChainBuilder::getChainStartIndices(const CoordinateSequence& pts,
}
/* private static */
-size_t
-MonotoneChainBuilder::findChainEnd(const CoordinateSequence& pts, size_t start)
+std::size_t
+MonotoneChainBuilder::findChainEnd(const CoordinateSequence& pts, std::size_t start)
{
- const size_t npts = pts.getSize(); // cache
+ const std::size_t npts = pts.getSize(); // cache
assert(start < npts);
assert(npts); // should be implied by the assertion above,
// 'start' being unsigned
- size_t safeStart = start;
+ std::size_t safeStart = start;
// skip any zero-length segments at the start of the sequence
// (since they cannot be used to establish a quadrant)
@@ -119,7 +119,7 @@ MonotoneChainBuilder::findChainEnd(const CoordinateSequence& pts, size_t start)
// (which is the starting quadrant)
int chainQuad = Quadrant::quadrant(pts[safeStart],
pts[safeStart + 1]);
- size_t last = start + 1;
+ std::size_t last = start + 1;
while (last < npts)
{
// skip zero-length segments, but include them in the chain
diff --git a/source/simplify/DouglasPeuckerLineSimplifier.cpp b/source/simplify/DouglasPeuckerLineSimplifier.cpp
index 29761c2..67cbae9 100644
--- a/source/simplify/DouglasPeuckerLineSimplifier.cpp
+++ b/source/simplify/DouglasPeuckerLineSimplifier.cpp
@@ -68,7 +68,7 @@ DouglasPeuckerLineSimplifier::simplify()
usePt = BoolVectAutoPtr(new BoolVect(pts.size(), true));
simplifySection(0, pts.size() - 1);
- for (size_t i=0, n=pts.size(); i<n; ++i)
+ for (std::size_t i=0, n=pts.size(); i<n; ++i)
{
if ( usePt->operator[](i) )
{
@@ -84,17 +84,17 @@ DouglasPeuckerLineSimplifier::simplify()
/*private*/
void
DouglasPeuckerLineSimplifier::simplifySection(
- size_t i,
- size_t j)
+ std::size_t i,
+ std::size_t j)
{
if ( (i+1) == j ) return;
geos::geom::LineSegment seg(pts[i], pts[j]);
double maxDistance = -1.0;
- size_t maxIndex = i;
+ std::size_t maxIndex = i;
- for (size_t k=i+1; k<j; k++)
+ for (std::size_t k=i+1; k<j; k++)
{
double distance = seg.distance(pts[k]);
if (distance > maxDistance) {
@@ -103,7 +103,7 @@ DouglasPeuckerLineSimplifier::simplifySection(
}
}
if (maxDistance <= distanceTolerance) {
- for(size_t k =i+1; k<j; k++)
+ for(std::size_t k =i+1; k<j; k++)
{
usePt->operator[](k) = false;
}
diff --git a/source/simplify/TaggedLineString.cpp b/source/simplify/TaggedLineString.cpp
index 3d1fcbc..bbf3c9d 100644
--- a/source/simplify/TaggedLineString.cpp
+++ b/source/simplify/TaggedLineString.cpp
@@ -44,7 +44,7 @@ namespace simplify { // geos::simplify
/*public*/
TaggedLineString::TaggedLineString(const geom::LineString* nParentLine,
- size_t nMinimumSize)
+ std::size_t nMinimumSize)
:
parentLine(nParentLine),
minimumSize(nMinimumSize)
@@ -60,10 +60,10 @@ TaggedLineString::~TaggedLineString()
<< endl;
#endif
- for (size_t i=0, n=segs.size(); i<n; i++)
+ for (std::size_t i=0, n=segs.size(); i<n; i++)
delete segs[i];
- for (size_t i=0, n=resultSegs.size(); i<n; i++)
+ for (std::size_t i=0, n=resultSegs.size(); i<n; i++)
delete resultSegs[i];
}
@@ -81,7 +81,7 @@ TaggedLineString::init()
segs.reserve(pts->size()-1);
- for (size_t i=0, n=pts->size()-1; i<n; i++)
+ for (std::size_t i=0, n=pts->size()-1; i<n; i++)
{
TaggedLineSegment* seg = new TaggedLineSegment(
pts->getAt(i),
@@ -100,7 +100,7 @@ TaggedLineString::init()
}
/*public*/
-size_t
+std::size_t
TaggedLineString::getMinimumSize() const
{
return minimumSize;
@@ -155,7 +155,7 @@ TaggedLineString::extractCoordinates(
cerr << __FUNCTION__ << " segs.size: " << segs.size() << endl;
#endif
- size_t i=0, size=segs.size();
+ std::size_t i=0, size=segs.size();
assert(size);
@@ -173,7 +173,7 @@ TaggedLineString::extractCoordinates(
}
/*public*/
-size_t
+std::size_t
TaggedLineString::getResultSize() const
{
unsigned resultSegsSize = resultSegs.size();
@@ -182,14 +182,14 @@ TaggedLineString::getResultSize() const
/*public*/
TaggedLineSegment*
-TaggedLineString::getSegment(size_t i)
+TaggedLineString::getSegment(std::size_t i)
{
return segs[i];
}
/*public*/
const TaggedLineSegment*
-TaggedLineString::getSegment(size_t i) const
+TaggedLineString::getSegment(std::size_t i) const
{
return segs[i];
}
diff --git a/source/simplify/TaggedLineStringSimplifier.cpp b/source/simplify/TaggedLineStringSimplifier.cpp
index 5981b7a..025e41d 100644
--- a/source/simplify/TaggedLineStringSimplifier.cpp
+++ b/source/simplify/TaggedLineStringSimplifier.cpp
@@ -83,8 +83,8 @@ TaggedLineStringSimplifier::simplify(TaggedLineString* nLine)
/*private*/
void
-TaggedLineStringSimplifier::simplifySection(size_t i,
- size_t j, size_t depth)
+TaggedLineStringSimplifier::simplifySection(std::size_t i,
+ std::size_t j, std::size_t depth)
{
depth += 1;
@@ -94,7 +94,7 @@ TaggedLineStringSimplifier::simplifySection(size_t i,
<< std::endl;
#endif
- vector<size_t> sectionIndex(2);
+ vector<std::size_t> sectionIndex(2);
if((i+1) == j)
{
@@ -124,7 +124,7 @@ TaggedLineStringSimplifier::simplifySection(size_t i,
*/
if (line->getResultSize() < line->getMinimumSize())
{
- size_t worstCaseSize = depth + 1;
+ std::size_t worstCaseSize = depth + 1;
if (worstCaseSize < line->getMinimumSize())
isValidToSimplify = false;
}
@@ -132,7 +132,7 @@ TaggedLineStringSimplifier::simplifySection(size_t i,
double distance;
// pass distance by ref
- size_t furthestPtIndex = findFurthestPoint(linePts, i, j, distance);
+ std::size_t furthestPtIndex = findFurthestPoint(linePts, i, j, distance);
#if GEOS_DEBUG
std::cerr << "furthest point " << furthestPtIndex
@@ -176,7 +176,7 @@ TaggedLineStringSimplifier::simplifySection(size_t i,
/*private*/
auto_ptr<TaggedLineSegment>
-TaggedLineStringSimplifier::flatten(size_t start, size_t end)
+TaggedLineStringSimplifier::flatten(std::size_t start, std::size_t end)
{
// make a new segment for the simplified geometry
const Coordinate& p0 = linePts->getAt(start);
@@ -192,7 +192,7 @@ TaggedLineStringSimplifier::flatten(size_t start, size_t end)
bool
TaggedLineStringSimplifier::hasBadIntersection(
const TaggedLineString* parentLine,
- const vector<size_t>& sectionIndex,
+ const vector<std::size_t>& sectionIndex,
const LineSegment& candidateSeg)
{
if (hasBadOutputIntersection(candidateSeg))
@@ -242,7 +242,7 @@ TaggedLineStringSimplifier::hasInteriorIntersection(
bool
TaggedLineStringSimplifier::hasBadInputIntersection(
const TaggedLineString* parentLine,
- const vector<size_t>& sectionIndex,
+ const vector<std::size_t>& sectionIndex,
const LineSegment& candidateSeg)
{
auto_ptr< vector<LineSegment*> > querySegs =
@@ -278,14 +278,14 @@ TaggedLineStringSimplifier::hasBadInputIntersection(
bool
TaggedLineStringSimplifier::isInLineSection(
const TaggedLineString* line,
- const vector<size_t>& sectionIndex,
+ const vector<std::size_t>& sectionIndex,
const TaggedLineSegment* seg)
{
// not in this line
if (seg->getParent() != line->getParent())
return false;
- size_t segIndex = seg->getIndex();
+ std::size_t segIndex = seg->getIndex();
if (segIndex >= sectionIndex[0] && segIndex < sectionIndex[1])
return true;
@@ -295,13 +295,13 @@ TaggedLineStringSimplifier::isInLineSection(
/*private*/
void
TaggedLineStringSimplifier::remove(const TaggedLineString* line,
- size_t start,
- size_t end)
+ std::size_t start,
+ std::size_t end)
{
assert(end <= line->getSegments().size() );
assert(start < end); // I'm not sure this should always be true
- for (size_t i = start; i < end; i++)
+ for (std::size_t i = start; i < end; i++)
{
const TaggedLineSegment* seg = line->getSegment(i);
inputIndex->remove(seg);
@@ -309,10 +309,10 @@ TaggedLineStringSimplifier::remove(const TaggedLineString* line,
}
/*private static*/
-size_t
+std::size_t
TaggedLineStringSimplifier::findFurthestPoint(
const geom::CoordinateSequence* pts,
- size_t i, size_t j,
+ std::size_t i, std::size_t j,
double& maxDistance)
{
LineSegment seg(pts->getAt(i), pts->getAt(j));
@@ -321,8 +321,8 @@ TaggedLineStringSimplifier::findFurthestPoint(
<< std::endl;
#endif
double maxDist = -1.0;
- size_t maxIndex = i;
- for (size_t k = i + 1; k < j; k++)
+ std::size_t maxIndex = i;
+ for (std::size_t k = i + 1; k < j; k++)
{
const Coordinate& midPt = pts->getAt(k);
double distance = seg.distance(midPt);
--
1.7.4.1
From bc687db602e42b4620ec9605db89ad49ee1951bb Mon Sep 17 00:00:00 2001
From: mingw-cross-env
Date: Sat, 26 Mar 2011 10:23:03 +0100
Subject: [PATCH 2/3] fix missing NULL
diff --git a/source/headers/geos/index/chain/MonotoneChainBuilder.h b/source/headers/geos/index/chain/MonotoneChainBuilder.h
index e227559..3cd11e6 100644
--- a/source/headers/geos/index/chain/MonotoneChainBuilder.h
+++ b/source/headers/geos/index/chain/MonotoneChainBuilder.h
@@ -22,6 +22,7 @@
#include <geos/export.h>
#include <vector>
+#include <cstddef>
// Forward declarations
namespace geos {
diff --git a/source/headers/geos/operation/valid/SimpleNestedRingTester.h b/source/headers/geos/operation/valid/SimpleNestedRingTester.h
index b8888ac..d9436ff 100644
--- a/source/headers/geos/operation/valid/SimpleNestedRingTester.h
+++ b/source/headers/geos/operation/valid/SimpleNestedRingTester.h
@@ -23,6 +23,7 @@
#include <geos/export.h>
+#include <cstddef>
#include <vector>
// Forward declarations
diff --git a/source/index/bintree/Bintree.cpp b/source/index/bintree/Bintree.cpp
index 66a5ebc..3bd9ce1 100644
--- a/source/index/bintree/Bintree.cpp
+++ b/source/index/bintree/Bintree.cpp
@@ -14,6 +14,7 @@
*
**********************************************************************/
+#include <cstddef>
#include <geos/index/bintree/Bintree.h>
#include <geos/index/bintree/Root.h>
#include <geos/index/bintree/Interval.h>
diff --git a/source/index/bintree/Node.cpp b/source/index/bintree/Node.cpp
index a879bc9..59bd95d 100644
--- a/source/index/bintree/Node.cpp
+++ b/source/index/bintree/Node.cpp
@@ -14,6 +14,7 @@
*
**********************************************************************/
+#include <cstddef>
#include <cassert>
#include <geos/index/bintree/Node.h>
diff --git a/source/index/bintree/Root.cpp b/source/index/bintree/Root.cpp
index 0f2de89..b3419c5 100644
--- a/source/index/bintree/Root.cpp
+++ b/source/index/bintree/Root.cpp
@@ -19,6 +19,7 @@
#include <geos/index/bintree/Interval.h>
#include <geos/index/quadtree/IntervalSize.h>
+#include <cstddef>
#include <cassert>
namespace geos {
diff --git a/source/index/strtree/AbstractNode.cpp b/source/index/strtree/AbstractNode.cpp
index bd07cf4..00267d0 100644
--- a/source/index/strtree/AbstractNode.cpp
+++ b/source/index/strtree/AbstractNode.cpp
@@ -17,6 +17,7 @@
#include <geos/index/strtree/AbstractNode.h>
#include <vector>
+#include <cstddef>
#include <cassert>
using namespace std;
--
1.7.4.1
From febd67da3fdf6afa19b33bf50b544b4fa911f4b9 Mon Sep 17 00:00:00 2001
From: mingw-cross-env
Date: Sat, 26 Mar 2011 10:53:53 +0100
Subject: [PATCH 3/3] fix uninitialized const caused by missing constructor
diff --git a/source/headers/geos/operation/overlay/OverlayNodeFactory.h b/source/headers/geos/operation/overlay/OverlayNodeFactory.h
index 12fb81c..186c9b2 100644
--- a/source/headers/geos/operation/overlay/OverlayNodeFactory.h
+++ b/source/headers/geos/operation/overlay/OverlayNodeFactory.h
@@ -46,6 +46,7 @@ namespace overlay { // geos::operation::overlay
*/
class GEOS_DLL OverlayNodeFactory: public geomgraph::NodeFactory {
public:
+ OverlayNodeFactory():geomgraph::NodeFactory() {}
geomgraph::Node* createNode(const geom::Coordinate &coord) const;
static const geomgraph::NodeFactory &instance();
};
--
1.7.4.1
Loading…
Cancel
Save