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

svn at osgeo.org svn at osgeo.org
Fri Aug 26 07:28:48 EDT 2011


Author: tbonfort
Date: 2011-08-26 04:28:48 -0700 (Fri, 26 Aug 2011)
New Revision: 12465

Modified:
   trunk/mapserver/mapcache/src/geocache_seed.c
Log:


Modified: trunk/mapserver/mapcache/src/geocache_seed.c
===================================================================
--- trunk/mapserver/mapcache/src/geocache_seed.c	2011-08-26 11:28:44 UTC (rev 12464)
+++ trunk/mapserver/mapcache/src/geocache_seed.c	2011-08-26 11:28:48 UTC (rev 12465)
@@ -371,7 +371,7 @@
     seededtiles=seededtilestot=queuedtilestot=0;
     gettimeofday(&starttime,NULL);
     lastlogtime=starttime;
-    apr_table_t *dimensions = apr_table_make(ctx.pool,3);
+    apr_table_t *argdimensions = apr_table_make(ctx.pool,3);
     char *dimkey = NULL,*dimvalue = NULL,*key,*last,*optargcpy = NULL;
     int keyidx;
 
@@ -429,7 +429,7 @@
                 if(keyidx!=2 || !dimkey || !dimvalue || !*dimkey || !*dimvalue) {
                    return usage(argv[0], "failed to parse dimension, expecting DIMNAME=DIMVALUE");
                 }
-                apr_table_set(dimensions,dimkey,dimvalue);
+                apr_table_set(argdimensions,dimkey,dimvalue);
                 break;
 #ifdef USE_CLIPPERS
             case 'd':
@@ -458,6 +458,9 @@
         geocache_configuration_parse(&ctx,configfile,cfg);
         if(ctx.get_error(&ctx))
             return usage(argv[0],ctx.get_error_message(&ctx));
+        geocache_configuration_post_config(&ctx,cfg);
+        if(ctx.get_error(&ctx))
+            return usage(argv[0],ctx.get_error_message(&ctx));
     }
 
 #ifdef USE_CLIPPERS
@@ -616,26 +619,26 @@
     }
     
     /* validate the supplied dimensions */
-    if (!apr_is_empty_table(dimensions)) {
+    if (!apr_is_empty_array(tileset->dimensions)) {
+
+       dimensions = apr_table_make(ctx.pool,3);
        int i;
        for(i=0;i<tileset->dimensions->nelts;i++) {
           geocache_dimension *dimension = APR_ARRAY_IDX(tileset->dimensions,i,geocache_dimension*);
           const char *value;
-          if((value = (char*)apr_table_get(dimensions,dimension->name)) != NULL) {
+          if((value = (char*)apr_table_get(argdimensions,dimension->name)) != NULL) {
              char *tmpval = apr_pstrdup(ctx.pool,value);
              int ok = dimension->validate(&ctx,dimension,&tmpval);
-             if(GC_HAS_ERROR(&ctx)) {
+             if(GC_HAS_ERROR(&ctx) || ok != GEOCACHE_SUCCESS ) {
+                return usage(argv[0],"failed to validate dimension");
                return 1;
-             }
-             if(ok == GEOCACHE_SUCCESS) {
-                /* validate may have changed the dimension value, so set it back into the dimensions table */
+             } else {
+                /* validate may have changed the dimension value, so set that value into the dimensions table */
                 apr_table_setn(dimensions,dimension->name,tmpval);
              }
-             else {
-                ctx.set_error(&ctx,500,"dimension \"%s\" value \"%s\" fails to validate",
-                      dimension->name, value);
-                return 1;
-             }
+          } else {
+             /* a dimension was not specified on the command line, add the default value */
+             apr_table_setn(dimensions, dimension->name, dimension->default_value);
           }
        }
 



More information about the mapserver-commits mailing list