[geos-devel] [PATCH 3/3] fix missing size_t with gcc 4.6
Sandro Santilli
strk at keybit.net
Sat Mar 26 10:29:21 EDT 2011
Commited all of them.
Extremely easy with git-am.
Too bad I felt soo comfortable that I pushed before
committing to svn, which forced me to re-import from
scratch on github :/
--strk;
On Sat, Mar 26, 2011 at 01:54:42PM +0100, mabrand at mabrand.nl wrote:
> From: Mark Brand <mabrand at mabrand.nl>
>
> ---
> include/geos/simplify/TaggedLineString.h | 12 ++++----
> src/index/chain/MonotoneChainBuilder.cpp | 26 +++++++++---------
> src/simplify/DouglasPeuckerLineSimplifier.cpp | 12 ++++----
> src/simplify/TaggedLineString.cpp | 18 ++++++------
> src/simplify/TaggedLineStringSimplifier.cpp | 34 ++++++++++++------------
> 5 files changed, 51 insertions(+), 51 deletions(-)
>
> diff --git a/include/geos/simplify/TaggedLineString.h b/include/geos/simplify/TaggedLineString.h
> index 41f7de7..451119a 100644
> --- a/include/geos/simplify/TaggedLineString.h
> +++ b/include/geos/simplify/TaggedLineString.h
> @@ -71,11 +71,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;
>
> @@ -83,11 +83,11 @@ public:
>
> CoordSeqPtr getResultCoordinates() const;
>
> - size_t getResultSize() const;
> + std::size_t getResultSize() const;
>
> - TaggedLineSegment* getSegment(std::size_t);
> + TaggedLineSegment* getSegment(std::size_t i);
>
> - const TaggedLineSegment* getSegment(std::size_t) const;
> + const TaggedLineSegment* getSegment(std::size_t i) const;
>
> std::vector<TaggedLineSegment*>& getSegments();
>
> @@ -109,7 +109,7 @@ private:
> // TaggedLineSegments owned by this object
> std::vector<TaggedLineSegment*> resultSegs;
>
> - size_t minimumSize;
> + std::size_t minimumSize;
>
> void init();
>
> diff --git a/src/index/chain/MonotoneChainBuilder.cpp b/src/index/chain/MonotoneChainBuilder.cpp
> index 599ff70..cd2d34c 100644
> --- a/src/index/chain/MonotoneChainBuilder.cpp
> +++ b/src/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/src/simplify/DouglasPeuckerLineSimplifier.cpp b/src/simplify/DouglasPeuckerLineSimplifier.cpp
> index fa1469e..7c51dda 100644
> --- a/src/simplify/DouglasPeuckerLineSimplifier.cpp
> +++ b/src/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/src/simplify/TaggedLineString.cpp b/src/simplify/TaggedLineString.cpp
> index 4ee7dc5..98e07b8 100644
> --- a/src/simplify/TaggedLineString.cpp
> +++ b/src/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/src/simplify/TaggedLineStringSimplifier.cpp b/src/simplify/TaggedLineStringSimplifier.cpp
> index 904bbd1..1b4b977 100644
> --- a/src/simplify/TaggedLineStringSimplifier.cpp
> +++ b/src/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
>
> _______________________________________________
> geos-devel mailing list
> geos-devel at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geos-devel
--
() Free GIS & Flash consultant/developer
/\ http://strk.keybit.net/services.html
More information about the geos-devel
mailing list