[mapserver-commits] r12389 - trunk/mapserver/mapcache/src

svn at osgeo.org svn at osgeo.org
Fri Aug 26 07:21:41 EDT 2011


Author: tbonfort
Date: 2011-08-26 04:21:41 -0700 (Fri, 26 Aug 2011)
New Revision: 12389

Modified:
   trunk/mapserver/mapcache/src/cache_disk.c
Log:
Prevent tile outlines when assembling tiles.
Currently requires twice the memory as the image data is stored twice.

New Issue
Summary: Assembling tiles requires twice the memory than it could.
When assembling tiles, we first decode the tile data (first alloc), then
copy this data into the large image (already allocated) that will be scaled 
up or down into the resulting image. In total, we allocate double the memory
of the tile data. The image decoding code needs to be updated so it can directly
populate an allocated image, rather than aloocating it itself.
thomas.bonfort | 2011-06-14 09:18:54 +0200 (Tue, 14 Jun 2011)

Modified: trunk/mapserver/mapcache/src/cache_disk.c
===================================================================
--- trunk/mapserver/mapcache/src/cache_disk.c	2011-08-26 11:21:37 UTC (rev 12388)
+++ trunk/mapserver/mapcache/src/cache_disk.c	2011-08-26 11:21:41 UTC (rev 12389)
@@ -58,23 +58,17 @@
       const apr_array_header_t *elts = apr_table_elts(tile->dimensions);
       int i = elts->nelts;
       while(i--) {
-         int lastisdot = 0;
          apr_table_entry_t *entry = &(APR_ARRAY_IDX(elts,i,apr_table_entry_t));
-         char *iter = entry->val;
+         char *dimval = apr_pstrdup(ctx->pool,entry->val);
+         char *iter = dimval;
          while(*iter) {
-            if(lastisdot) {
-               if(*iter == '.') {
-                  ctx->set_error(ctx,500,"invalid sequence .. in dimension %s",entry->key);
-                  return;
-               } else {
-                  lastisdot = 0;
-               }
-            } else if(*iter == '.') {
-               lastisdot = 1;
+            /* replace dangerous characters by '#' */
+            if(*iter == '.' || *iter == '/') {
+               *iter = '#';
             }
             iter++;
          }
-         start = apr_pstrcat(ctx->pool,start,"/",entry->key,"/",entry->val,NULL);
+         start = apr_pstrcat(ctx->pool,start,"/",entry->key,"/",dimval,NULL);
       }
    }
    *path = apr_psprintf(ctx->pool,"%s/%02d/%03d/%03d/%03d/%03d/%03d/%03d.%s",



More information about the mapserver-commits mailing list