@@ -349,6 +349,7 @@ QgsPoint QgsGeometry::closestVertex(const QgsPoint& point, QgsGeometryVertexInde
349
349
ptr+=sizeof (int );
350
350
for (int index =0 ;index <*npolys;++index )
351
351
{
352
+ ptr += (1 + sizeof (int )); // skip endian and polygon type
352
353
nrings=(int *)ptr;
353
354
ptr+=sizeof (int );
354
355
for (int index2=0 ;index2<*nrings;++index2)
@@ -559,6 +560,7 @@ bool QgsGeometry::moveVertexAt(double x, double y, QgsGeometryVertexIndex atVert
559
560
560
561
for (int polynr = 0 ; polynr < *nrPolygons; ++polynr)
561
562
{
563
+ ptr += (1 + sizeof (int )); // skip endian and polygon type
562
564
nrRings = (int *)ptr;
563
565
ptr += sizeof (int );
564
566
for (int ringnr = 0 ; ringnr< *nrRings; ++ringnr)
@@ -771,6 +773,9 @@ bool QgsGeometry::deleteVertexAt(QgsGeometryVertexIndex atVertex)
771
773
772
774
for (int polynr = 0 ; polynr < *nPolys; ++polynr)
773
775
{
776
+ memcpy (newBufferPtr, ptr, (1 + sizeof (int )));
777
+ ptr += (1 + sizeof (int )); // skip endian and polygon type
778
+ newBufferPtr += (1 + sizeof (int ));
774
779
nRings = (int *)ptr;
775
780
memcpy (newBufferPtr, nRings, sizeof (int ));
776
781
newBufferPtr += sizeof (int );
@@ -994,18 +999,21 @@ bool QgsGeometry::insertVertexBefore(double x, double y, QgsGeometryVertexIndex
994
999
case QGis::WKBMultiPolygon:
995
1000
{
996
1001
int * nPolys = (int *)ptr;
997
- ptr += sizeof (int );
998
1002
int * nRings = 0 ; // number of rings in a polygon
999
1003
int * nPoints = 0 ; // number of points in a ring
1000
- memcpy (newBufferPtr, &nPolys, sizeof (int ));
1004
+ memcpy (newBufferPtr, nPolys, sizeof (int ));
1005
+ ptr += sizeof (int );
1001
1006
newBufferPtr += sizeof (int );
1002
1007
int pointindex = 0 ;
1003
1008
1004
1009
for (int polynr = 0 ; polynr < *nPolys; ++polynr)
1005
1010
{
1011
+ memcpy (newBufferPtr, ptr, (1 + sizeof (int )));
1012
+ ptr += (1 + sizeof (int ));// skip endian and polygon type
1013
+ newBufferPtr += (1 + sizeof (int ));
1006
1014
nRings = (int *)ptr;
1007
1015
ptr += sizeof (int );
1008
- memcpy (newBufferPtr, & nRings, sizeof (int ));
1016
+ memcpy (newBufferPtr, nRings, sizeof (int ));
1009
1017
newBufferPtr += sizeof (int );
1010
1018
1011
1019
for (int ringnr = 0 ; ringnr < *nRings; ++ringnr)
@@ -1198,6 +1206,7 @@ bool QgsGeometry::vertexAt(double &x, double &y,
1198
1206
ptr += sizeof (int );
1199
1207
for (int polynr = 0 ; polynr < *nPolygons; ++polynr)
1200
1208
{
1209
+ ptr += (1 + sizeof (int )); // skip endian and polygon type
1201
1210
nRings = (int *)ptr;
1202
1211
ptr += sizeof (int );
1203
1212
for (int ringnr = 0 ; ringnr < *nRings; ++ringnr)
@@ -1422,11 +1431,13 @@ QgsPoint QgsGeometry::closestSegmentWithContext(QgsPoint& point,
1422
1431
ptr += sizeof (int );
1423
1432
for (int polynr = 0 ; polynr < *nPolygons; ++polynr)
1424
1433
{
1434
+ ptr += (1 + sizeof (int ));
1425
1435
nRings = (int *)ptr;
1426
1436
ptr += sizeof (int );
1427
1437
for (int ringnr = 0 ; ringnr < *nRings; ++ringnr)
1428
1438
{
1429
1439
nPoints = (int *)ptr;
1440
+ ptr += sizeof (int );
1430
1441
prevx = 0 ;
1431
1442
prevy = 0 ;
1432
1443
for (int pointnr = 0 ; pointnr < *nPoints; ++pointnr)
0 commit comments