[mapserver-commits] r7566 - branches/branch-5-0/mapserver

svn at osgeo.org svn at osgeo.org
Wed May 7 00:13:30 EDT 2008


Author: pramsey
Date: 2008-05-07 00:13:29 -0400 (Wed, 07 May 2008)
New Revision: 7566

Modified:
   branches/branch-5-0/mapserver/HISTORY.TXT
   branches/branch-5-0/mapserver/mapshape.c
Log:
Don't ignore .qix file when DATA reference includes .shp extension (#590)


Modified: branches/branch-5-0/mapserver/HISTORY.TXT
===================================================================
--- branches/branch-5-0/mapserver/HISTORY.TXT	2008-05-07 04:08:16 UTC (rev 7565)
+++ branches/branch-5-0/mapserver/HISTORY.TXT	2008-05-07 04:13:29 UTC (rev 7566)
@@ -13,6 +13,8 @@
 Current Version (future 5.0.3, svn branch-5-0)
 ----------------------------------------------
 
+- Don't ignore .qix file when DATA reference includes .shp extension (#590)
+
 - CGI able to alter layers with space and underscores (#2516)
 
 - WFS Multipoint query with PostGIS bug fixed (#2443)

Modified: branches/branch-5-0/mapserver/mapshape.c
===================================================================
--- branches/branch-5-0/mapserver/mapshape.c	2008-05-07 04:08:16 UTC (rev 7565)
+++ branches/branch-5-0/mapserver/mapshape.c	2008-05-07 04:13:29 UTC (rev 7566)
@@ -1433,7 +1433,10 @@
   int i;
   rectObj shaperect;
   char *filename;
+  char *sourcename = 0; /* shape file source string from map file */
+  char *s = 0; /* pointer to start of '.shp' in source string */
 
+
   if(shpfile->status) {
     free(shpfile->status);
     shpfile->status = NULL;
@@ -1454,14 +1457,21 @@
     for(i=0;i<shpfile->numshapes;i++) 
       msSetBit(shpfile->status, i, 1);
   } else {
-    if((filename = (char *)malloc(strlen(shpfile->source)+strlen(MS_INDEX_EXTENSION)+1)) == NULL) {
+
+    /* deal with case where sourcename is of the form 'file.shp' */
+    sourcename = strdup(shpfile->source);
+    s = strcasestr(sourcename, ".shp");
+    if( s ) *s = '\0';
+
+    if((filename = (char *)malloc(strlen(sourcename)+strlen(MS_INDEX_EXTENSION)+1)) == NULL) {
       msSetError(MS_MEMERR, NULL, "msSHPWhichShapes()");    
       return(MS_FAILURE);
     }
-    sprintf(filename, "%s%s", shpfile->source, MS_INDEX_EXTENSION);
+    sprintf(filename, "%s%s", sourcename, MS_INDEX_EXTENSION);
     
     shpfile->status = msSearchDiskTree(filename, rect, debug);
     free(filename);
+    free(sourcename);
 
     if(shpfile->status) /* index  */
       msFilterTreeSearch(shpfile, shpfile->status, rect);



More information about the mapserver-commits mailing list