[mapserver-commits] r11821 - branches/branch-6-0/mapserver
svn at osgeo.org
svn at osgeo.org
Tue Jun 14 16:49:10 EDT 2011
Author: warmerdam
Date: 2011-06-14 13:49:10 -0700 (Tue, 14 Jun 2011)
New Revision: 11821
Modified:
branches/branch-6-0/mapserver/HISTORY.TXT
branches/branch-6-0/mapserver/mapwcs.c
Log:
Reimplement msWCSValidateRangeSetParam() so that we can validate
something like bands=1,2,3 instead of only rangeset items with a
single value. Note that we still can't check fancy syntax
like bands=1/3/1 (from 1 to 3 by 1's). (#3919)
Modified: branches/branch-6-0/mapserver/HISTORY.TXT
===================================================================
--- branches/branch-6-0/mapserver/HISTORY.TXT 2011-06-14 20:45:57 UTC (rev 11820)
+++ branches/branch-6-0/mapserver/HISTORY.TXT 2011-06-14 20:49:10 UTC (rev 11821)
@@ -45,6 +45,9 @@
- Union layer: Fixed the crash when styling source layers using attributes (#3870)
+- Improve rangeset item checking so that Bands=1,2,3 is supported with WCS 1.0
+ (#3919).
+
Version 6.0.0 (2011-05-11)
--------------------------
Modified: branches/branch-6-0/mapserver/mapwcs.c
===================================================================
--- branches/branch-6-0/mapserver/mapwcs.c 2011-06-14 20:45:57 UTC (rev 11820)
+++ branches/branch-6-0/mapserver/mapwcs.c 2011-06-14 20:49:10 UTC (rev 11821)
@@ -48,41 +48,51 @@
/* msWCSValidateRangeSetParam() */
/************************************************************************/
static int msWCSValidateRangeSetParam(layerObj *lp, char *name, const char *value) {
- char **tokens;
- int numtokens, i, match = 0;
- char *tmpname = NULL;
- const char *tmpvalue = NULL;
+ char **allowed_ri_values;
+ char **client_ri_values;
+ int allowed_count, client_count;
+ int i_client, i, all_match = 1;
+ char *tmpname = NULL;
+ const char *ri_values_list;
- if (name) {
+ if( name == NULL )
+ return MS_FAILURE;
+
+ /* Fetch the available values list for the rangeset item and tokenize */
tmpname = (char *)msSmallMalloc(sizeof(char)*strlen(name) + 10);
-
- /* set %s_values */
sprintf(tmpname,"%s_values", name);
+ ri_values_list = msOWSLookupMetadata(&(lp->metadata), "CO", tmpname);
+ msFree( tmpname );
+
+ if (ri_values_list == NULL)
+ return MS_FAILURE;
- /* fetch value of tmpname (%s_values)*/
- tmpvalue = msOWSLookupMetadata(&(lp->metadata), "CO", tmpname);
+ allowed_ri_values = msStringSplit( ri_values_list, ',', &allowed_count);
- if (tmpvalue == NULL)
- return MS_FAILURE;
+ /* Parse the client value list into tokens. */
+ client_ri_values = msStringSplit( value, ',', &client_count );
+
+ /* test each client value against the allowed list. */
- /* split tmpvalue and loop through to find match */
- tokens = msStringSplit(tmpvalue, ',', &numtokens);
- if(tokens && numtokens > 0) {
- for(i=0; i<numtokens; i++) {
- if(strcasecmp(tokens[i], value) == 0) { /* we have a match */
- match = 1;
- break;
- }
- }
- msFreeCharArray(tokens, numtokens);
+ for( i_client = 0; all_match && i_client < client_count; i_client++ )
+ {
+ for( i = 0;
+ i < allowed_count
+ && strcasecmp(client_ri_values[i_client],
+ allowed_ri_values[i]) != 0;
+ i++ ) {}
+
+ if( i == allowed_count )
+ all_match = 0;
}
- }
- if (tmpname) free(tmpname);
+ msFreeCharArray(allowed_ri_values, allowed_count );
+ msFreeCharArray(client_ri_values, client_count );
- if (match == 0) return MS_FAILURE;
-
- return MS_SUCCESS;
+ if (all_match == 0)
+ return MS_FAILURE;
+ else
+ return MS_SUCCESS;
}
/************************************************************************/
More information about the mapserver-commits
mailing list