[mapserver-commits] r9787 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Wed Feb 10 11:43:07 EST 2010


Author: warmerdam
Date: 2010-02-10 11:43:03 -0500 (Wed, 10 Feb 2010)
New Revision: 9787

Modified:
   trunk/mapserver/mapproject.c
Log:
fix so that ProjectRect polygon is dynamically allocated, fixes recently introduced bug in fix for (#3179)

Modified: trunk/mapserver/mapproject.c
===================================================================
--- trunk/mapserver/mapproject.c	2010-02-09 18:31:01 UTC (rev 9786)
+++ trunk/mapserver/mapproject.c	2010-02-10 16:43:03 UTC (rev 9787)
@@ -756,18 +756,18 @@
 #ifdef USE_PROJ
   shapeObj polygonObj;
   lineObj  ring;
-  pointObj ringPoints[NUMBER_OF_SAMPLE_POINTS*4+4];
+//  pointObj ringPoints[NUMBER_OF_SAMPLE_POINTS*4+4];
+  pointObj *ringPoints;
   int     ix, iy;
 
   double dx, dy;
 
-  ring.point = &(ringPoints[0]);
+  ringPoints = (pointObj*) calloc(sizeof(pointObj),NUMBER_OF_SAMPLE_POINTS*4+4);
+  ring.point = ringPoints;
   ring.numpoints = 0;
 
+  msInitShape( &polygonObj );
   polygonObj.type = MS_SHAPE_POLYGON;
-  polygonObj.line = ˚
-  polygonObj.numlines = 1;
-  polygonObj.numvalues = 0;
 
 /* -------------------------------------------------------------------- */
 /*      Build polygon as steps around the source rectangle.             */
@@ -811,6 +811,8 @@
     }
   }
 
+  msAddLineDirectly( &polygonObj, &ring );
+
 /* -------------------------------------------------------------------- */
 /*      Attempt to reproject.                                           */
 /* -------------------------------------------------------------------- */
@@ -819,6 +821,7 @@
   /* If no points reprojected, try a grid sampling */
   if( ring.numpoints == 0 )
   {
+      msFreeShape( &polygonObj );
       return msProjectRectGrid( in, out, rect );
   }
 
@@ -836,6 +839,8 @@
       rect->maxy = MAX(rect->maxy,ringPoints[ix].y);
   }
 
+  msFreeShape( &polygonObj );
+
 /* -------------------------------------------------------------------- */
 /*      Special case to handle reprojection from "more than the         */
 /*      whole world" projected coordinates that sometimes produce a     */



More information about the mapserver-commits mailing list