MCPcopy Index your code
hub / github.com/MapServer/MapServer / msWCSValidateRangeSetParam

Function msWCSValidateRangeSetParam

mapwcs.c:50–96  ·  view source on GitHub ↗

/ msWCSValidateRangeSetParam() */ /

Source from the content-addressed store, hash-verified

48/* msWCSValidateRangeSetParam() */
49/************************************************************************/
50static int msWCSValidateRangeSetParam(layerObj *lp, char *name, const char *value) {
51 char **allowed_ri_values;
52 char **client_ri_values;
53 int allowed_count, client_count;
54 int i_client, i, all_match = 1;
55 char *tmpname = NULL;
56 const char *ri_values_list;
57
58 if( name == NULL )
59 return MS_FAILURE;
60
61 /* Fetch the available values list for the rangeset item and tokenize */
62 tmpname = (char *)msSmallMalloc(sizeof(char)*strlen(name) + 10);
63 sprintf(tmpname,"%s_values", name);
64 ri_values_list = msOWSLookupMetadata(&(lp->metadata), "CO", tmpname);
65 msFree( tmpname );
66
67 if (ri_values_list == NULL)
68 return MS_FAILURE;
69
70 allowed_ri_values = msStringSplit( ri_values_list, ',', &allowed_count);
71
72 /* Parse the client value list into tokens. */
73 client_ri_values = msStringSplit( value, ',', &client_count );
74
75 /* test each client value against the allowed list. */
76
77 for( i_client = 0; all_match && i_client < client_count; i_client++ )
78 {
79 for( i = 0;
80 i < allowed_count
81 && strcasecmp(client_ri_values[i_client],
82 allowed_ri_values[i]) != 0;
83 i++ ) {}
84
85 if( i == allowed_count )
86 all_match = 0;
87 }
88
89 msFreeCharArray(allowed_ri_values, allowed_count );
90 msFreeCharArray(client_ri_values, client_count );
91
92 if (all_match == 0)
93 return MS_FAILURE;
94 else
95 return MS_SUCCESS;
96}
97
98/************************************************************************/
99/* msWCSConvertRangeSetToString() */

Callers 1

msWCSGetCoverageBands10Function · 0.85

Calls 6

msSmallMallocFunction · 0.85
msOWSLookupMetadataFunction · 0.85
msFreeFunction · 0.85
msStringSplitFunction · 0.85
strcasecmpFunction · 0.85
msFreeCharArrayFunction · 0.85

Tested by

no test coverage detected