Skip to content

Commit aab1834

Browse files
author
telwertowski
committedMay 22, 2007
Multi-version adjustment to r6954. To be truly pedantic, use int with GEOS 2.2 and size_t with GEOS 3.0.
git-svn-id: http://svn.osgeo.org/qgis/trunk@6958 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 1151cee commit aab1834

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed
 

‎src/core/qgsgeometry.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ mDirtyGeos( rhs.mDirtyGeos )
6565
if(multiPoly)
6666
{
6767
std::vector<GEOS_GEOM::Geometry*> polygonVector;
68-
for(unsigned int i = 0; i < multiPoly->getNumGeometries(); ++i)
68+
for(GEOS_SIZE_T i = 0; i < multiPoly->getNumGeometries(); ++i)
6969
{
7070
polygonVector.push_back((GEOS_GEOM::Geometry*)(multiPoly->getGeometryN(i)));
7171
}
@@ -187,7 +187,7 @@ QgsGeometry & QgsGeometry::operator=( QgsGeometry const & rhs )
187187
if(multiPoly)
188188
{
189189
std::vector<GEOS_GEOM::Geometry*> polygonVector;
190-
for(unsigned int i = 0; i < multiPoly->getNumGeometries(); ++i)
190+
for(GEOS_SIZE_T i = 0; i < multiPoly->getNumGeometries(); ++i)
191191
{
192192
polygonVector.push_back((GEOS_GEOM::Geometry*)(multiPoly->getGeometryN(i)));
193193
}
@@ -2009,7 +2009,7 @@ double QgsGeometry::closestVertexWithContext(const QgsPoint& point,
20092009
GEOS_GEOM::CoordinateSequence* sequence = mGeos->getCoordinates();
20102010
if(sequence)
20112011
{
2012-
for(int i = 0; i < (int) sequence->getSize(); ++i)
2012+
for(GEOS_SIZE_T i = 0; i < sequence->getSize(); ++i)
20132013
{
20142014
double testDist = point.sqrDist(sequence->getAt(i).x, sequence->getAt(i).y);
20152015
if(testDist < sqrDist)
@@ -3453,7 +3453,7 @@ bool QgsGeometry::exportGeosToWkb()
34533453
geometrySize += sizeof(int);
34543454
geometrySize += theRing->getNumPoints()*2*sizeof(double);
34553455
}
3456-
for(int i = 0; i < (int) thePolygon->getNumInteriorRing(); ++i)
3456+
for(GEOS_SIZE_T i = 0; i < thePolygon->getNumInteriorRing(); ++i)
34573457
{
34583458
geometrySize += sizeof(int); //number of points in ring
34593459
theRing = thePolygon->getInteriorRingN(i);
@@ -3487,7 +3487,7 @@ bool QgsGeometry::exportGeosToWkb()
34873487
position += sizeof(int);
34883488
const GEOS_GEOM::CoordinateSequence* ringSequence = theRing->getCoordinatesRO();
34893489
//for(int j = 0; j < nPointsInRing; ++j)
3490-
for(int j = 0; j < (int) ringSequence->getSize(); ++j)
3490+
for(GEOS_SIZE_T j = 0; j < ringSequence->getSize(); ++j)
34913491
{
34923492
//x = theRing->getPointN(j)->getX();
34933493
x = ringSequence->getAt(j).x;
@@ -3501,7 +3501,7 @@ bool QgsGeometry::exportGeosToWkb()
35013501
}
35023502

35033503
//interior rings after
3504-
for(int i = 0; i < (int) thePolygon->getNumInteriorRing(); ++i)
3504+
for(GEOS_SIZE_T i = 0; i < thePolygon->getNumInteriorRing(); ++i)
35053505
{
35063506
theRing = thePolygon->getInteriorRingN(i);
35073507
if(theRing)
@@ -3553,7 +3553,7 @@ bool QgsGeometry::exportGeosToWkb()
35533553

35543554
//first determine size of geometry
35553555
int geometrySize = 1 + (2 * sizeof(int)); //endian, type, number of polygons
3556-
for(unsigned int i = 0; i < theMultiPolygon->getNumGeometries(); ++i)
3556+
for(GEOS_SIZE_T i = 0; i < theMultiPolygon->getNumGeometries(); ++i)
35573557
{
35583558
GEOS_GEOM::Polygon* thePoly = (GEOS_GEOM::Polygon*)(theMultiPolygon->getGeometryN(i));
35593559
geometrySize += (1 + (2 * sizeof(int))); //endian, type, number of rings
@@ -3563,7 +3563,7 @@ bool QgsGeometry::exportGeosToWkb()
35633563
geometrySize += (2*sizeof(double)*exRing->getNumPoints());
35643564

35653565
const GEOS_GEOM::LineString* intRing = 0;
3566-
for(unsigned int j = 0; j < thePoly->getNumInteriorRing(); ++j)
3566+
for(GEOS_SIZE_T j = 0; j < thePoly->getNumInteriorRing(); ++j)
35673567
{
35683568
geometrySize += sizeof(int); //number of points in ring
35693569
intRing = thePoly->getInteriorRingN(j);
@@ -3585,7 +3585,7 @@ bool QgsGeometry::exportGeosToWkb()
35853585
wkbPosition += sizeof(int);
35863586

35873587
//loop over polygons
3588-
for(unsigned int i = 0; i < theMultiPolygon->getNumGeometries(); ++i)
3588+
for(GEOS_SIZE_T i = 0; i < theMultiPolygon->getNumGeometries(); ++i)
35893589
{
35903590
GEOS_GEOM::Polygon* thePoly = (GEOS_GEOM::Polygon*)(theMultiPolygon->getGeometryN(i));
35913591
memcpy(&mGeometry[wkbPosition], &byteOrder, 1);
@@ -3618,7 +3618,7 @@ bool QgsGeometry::exportGeosToWkb()
36183618
}
36193619

36203620
//interior rings
3621-
for(unsigned int j = 0; j < thePoly->getNumInteriorRing(); ++j)
3621+
for(GEOS_SIZE_T j = 0; j < thePoly->getNumInteriorRing(); ++j)
36223622
{
36233623
theRing = thePoly->getInteriorRingN(j);
36243624
nPointsInRing = theRing->getNumPoints();

‎src/core/qgsgeometry.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@ email : morb at ozemail dot com dot au
2727
#define GEOS_GEOM geos
2828
#define GEOS_IO geos
2929
#define GEOS_UTIL geos
30+
#define GEOS_SIZE_T int
3031
#define COORD_SEQ_FACTORY DefaultCoordinateSequenceFactory
3132
#else
3233
#define GEOS_GEOM geos::geom
3334
#define GEOS_IO geos::io
3435
#define GEOS_UTIL geos::util
36+
#define GEOS_SIZE_T size_t
3537
#define COORD_SEQ_FACTORY CoordinateArraySequenceFactory
3638
#endif
3739

0 commit comments

Comments
 (0)
Please sign in to comment.