From: Paul Ramsey Date: Tue, 29 Nov 2011 20:22:40 +0000 (+0000) Subject: ST_AddPoint returns incorrect result on Linux (#1335) from roualt X-Git-Tag: 2.0.0alpha1~608 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=22c50e8e1bf9b75f4c7e57c4e35835437d3aa29b;p=postgis ST_AddPoint returns incorrect result on Linux (#1335) from roualt git-svn-id: http://svn.osgeo.org/postgis/trunk@8257 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/liblwgeom/ptarray.c b/liblwgeom/ptarray.c index bd2992d9a..c5f8834f1 100644 --- a/liblwgeom/ptarray.c +++ b/liblwgeom/ptarray.c @@ -107,7 +107,7 @@ ptarray_insert_point(POINTARRAY *pa, POINT4D *p, int where) if( where < pa->npoints ) { size_t copy_size = point_size * (pa->npoints - where); - memcpy(getPoint_internal(pa, where+1), getPoint_internal(pa, where), copy_size); + memmove(getPoint_internal(pa, where+1), getPoint_internal(pa, where), copy_size); LWDEBUGF(5,"copying %d bytes to start vertex %d from start vertex %d", copy_size, where+1, where); } @@ -218,7 +218,7 @@ ptarray_remove_point(POINTARRAY *pa, int where) /* If the point is any but the last, we need to copy the data back one point */ if( where < pa->npoints - 1 ) { - memcpy(getPoint_internal(pa, where), getPoint_internal(pa, where+1), ptsize * (pa->npoints - where - 1)); + memmove(getPoint_internal(pa, where), getPoint_internal(pa, where+1), ptsize * (pa->npoints - where - 1)); } /* We have one less point */