[postgis-commits] svn - r3278 - trunk/lwgeom

postgis-commits at postgis.refractions.net postgis-commits at postgis.refractions.net
Fri Nov 7 06:24:00 PST 2008


Author: mcayland
Date: 2008-11-07 06:23:59 -0800 (Fri, 07 Nov 2008)
New Revision: 3278

Modified:
   trunk/lwgeom/lwgeom_transform.c
Log:
After a quick sanity grep, I noticed that ST_Transform() was also susceptible to crashing on curve types in the same way as the previous two fixes. Hence I'm committing a fix now before Regina finds it and logs another bug report :)


Modified: trunk/lwgeom/lwgeom_transform.c
===================================================================
--- trunk/lwgeom/lwgeom_transform.c	2008-11-07 14:21:09 UTC (rev 3277)
+++ trunk/lwgeom/lwgeom_transform.c	2008-11-07 14:23:59 UTC (rev 3278)
@@ -662,6 +662,7 @@
 		LWLINE *line=NULL;
 		LWPOINT *point=NULL;
 		LWPOLY *poly=NULL;
+		LWCURVE *curve=NULL;
 		POINT4D p;
 		uchar *subgeom=NULL;
 
@@ -707,6 +708,20 @@
 			continue;
 		}
 
+		curve = lwgeom_getcurve_inspected(inspected, j);
+		if (curve != NULL)
+		{
+			POINTARRAY *pts = curve->points;
+			for (i=0; i<pts->npoints; i++)
+			{
+				getPoint4d_p(pts, i, &p);
+				transform_point(&p, inpj, outpj);
+				setPoint4d(pts, i, &p);
+			}
+			lwgeom_release((LWGEOM *)curve);
+			continue;
+		}
+
 		subgeom = lwgeom_getsubgeometry_inspected(inspected, j);
 		if ( subgeom != NULL )
 		{



More information about the postgis-commits mailing list