[mapserver-commits] r9169 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Sun Jul 12 12:57:28 EDT 2009


Author: sdlime
Date: 2009-07-12 12:57:27 -0400 (Sun, 12 Jul 2009)
New Revision: 9169

Modified:
   trunk/mapserver/mapgraticule.c
   trunk/mapserver/maplayer.c
Log:
Graticule ...Get/FreeItemInfo() functions were screwy. I'm not sure why graticules have any items at all so this could be simplified even more I imagine.

Modified: trunk/mapserver/mapgraticule.c
===================================================================
--- trunk/mapserver/mapgraticule.c	2009-07-11 20:52:26 UTC (rev 9168)
+++ trunk/mapserver/mapgraticule.c	2009-07-12 16:57:27 UTC (rev 9169)
@@ -475,7 +475,14 @@
  */
 int msGraticuleLayerGetItems(layerObj *layer)
 {
-  msGraticuleLayerInitItemInfo(layer);
+  char **ppItemName   = (char **) malloc( sizeof( char * ) );
+
+  *ppItemName = (char *) malloc( 64 ); /* why is this necessary? */
+  strcpy( *ppItemName, "Graticule" );
+
+  layer->numitems   = 1;
+  layer->items   = ppItemName;
+
   return MS_SUCCESS;
 }
 
@@ -484,14 +491,6 @@
  */
 int msGraticuleLayerInitItemInfo(layerObj *layer)
 {
-  char **ppItemName   = (char **) malloc( sizeof( char * ) );
-
-  *ppItemName = (char *) malloc( 64 );
-  strcpy( *ppItemName, "Graticule" );
-   
-  layer->numitems   = 1;
-  layer->items   = ppItemName;
-   
   return MS_SUCCESS;
 }
 
@@ -500,10 +499,6 @@
  */
 void msGraticuleLayerFreeItemInfo(layerObj *layer)
 {
-  if(layer->items) {
-    free( *((char **) layer->items) );
-    free( ((char **) layer->items)  );
-  }
   return;
 }
 
@@ -546,7 +541,7 @@
   assert(layer != NULL);
   assert(layer->vtable != NULL);
 
-  layer->vtable->LayerInitItemInfo = msGraticuleLayerInitItemInfo;
+  layer->vtable->LayerInitItemInfo = msGraticuleLayerInitItemInfo; /* should use defaults for item info functions */
   layer->vtable->LayerFreeItemInfo = msGraticuleLayerFreeItemInfo;
   layer->vtable->LayerOpen = msGraticuleLayerOpen;
   layer->vtable->LayerIsOpen = msGraticuleLayerIsOpen;

Modified: trunk/mapserver/maplayer.c
===================================================================
--- trunk/mapserver/maplayer.c	2009-07-11 20:52:26 UTC (rev 9168)
+++ trunk/mapserver/maplayer.c	2009-07-12 16:57:27 UTC (rev 9169)
@@ -344,6 +344,10 @@
     if (rv != MS_SUCCESS) return rv;
   }
 
+  /* force get_all=MS_TRUE in some cases */
+  if(layer->connectiontype == MS_INLINE)
+    get_all=MS_TRUE;
+
   /*
   ** The algorithm:
   **   1) call msLayerGetItems to get a complete list (including joins potentially)
@@ -363,7 +367,7 @@
   ** reset things (if necessary)
   **   note: if we don't reset then the items array is fully populated will ALL items
   */
-  if(!get_all || (layer->connectiontype == MS_INLINE)) {
+  if(!get_all) {
     rv = layer->vtable->LayerCreateItems(layer, numitems);
     if (rv != MS_SUCCESS) return rv;
     freeitems = MS_TRUE;



More information about the mapserver-commits mailing list