]> granicus.if.org Git - postgis/commitdiff
Do not memcpy to self in ptarray_reverse (see #1302)
authorSandro Santilli <strk@keybit.net>
Sun, 20 Nov 2011 21:19:12 +0000 (21:19 +0000)
committerSandro Santilli <strk@keybit.net>
Sun, 20 Nov 2011 21:19:12 +0000 (21:19 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@8193 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/ptarray.c

index e58b9fe98ada758cc713692f17c38c868743328f..059d95092208bdc541f20800fd797421c3071e7d 100644 (file)
@@ -281,14 +281,14 @@ void ptarray_free(POINTARRAY *pa)
 void
 ptarray_reverse(POINTARRAY *pa)
 {
-       /* TODO change this to double array operations once point array is double alligned */
+       /* TODO change this to double array operations once point array is double aligned */
        POINT4D pbuf;
        uint32_t i;
        int ptsize = ptarray_point_size(pa);
        int last = pa->npoints-1;
-       int mid = last/2;
+       int mid = pa->npoints/2;
 
-       for (i=0; i<=mid; i++)
+       for (i=0; i<mid; i++)
        {
                uint8_t *from, *to;
                from = getPoint_internal(pa, i);