| 186 | } |
| 187 | |
| 188 | void msSetLimitedPattersToUse(char *patternstring) |
| 189 | { |
| 190 | int *limitedpatternindice = NULL; |
| 191 | int numpatterns=0, i=0, j=0, ntmp=0; |
| 192 | char **patterns = NULL; |
| 193 | |
| 194 | limitedpatternindice = (int *)msSmallMalloc(sizeof(int)*MS_NUMTIMEFORMATS); |
| 195 | |
| 196 | /* free previous setting */ |
| 197 | msUnsetLimitedPatternToUse(); |
| 198 | |
| 199 | if (patternstring) |
| 200 | { |
| 201 | patterns = msStringSplit(patternstring, ',', &ntmp); |
| 202 | if (patterns && ntmp >= 1) |
| 203 | { |
| 204 | |
| 205 | for (i=0; i<ntmp; i++) |
| 206 | { |
| 207 | for (j=0; j<MS_NUMTIMEFORMATS; j++) |
| 208 | { |
| 209 | if (strcasecmp( ms_timeFormats[j].userformat, patterns[i]) ==0) |
| 210 | { |
| 211 | limitedpatternindice[numpatterns] = j; |
| 212 | numpatterns++; |
| 213 | break; |
| 214 | } |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | msFreeCharArray(patterns, ntmp); |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | if (numpatterns > 0) |
| 223 | { |
| 224 | ms_limited_pattern = (int *)msSmallMalloc(sizeof(int)*numpatterns); |
| 225 | for (i=0; i<numpatterns; i++) |
| 226 | ms_limited_pattern[i] = limitedpatternindice[i]; |
| 227 | |
| 228 | ms_num_limited_pattern = numpatterns; |
| 229 | free (limitedpatternindice); |
| 230 | } |
| 231 | |
| 232 | } |
| 233 | |
| 234 | |
| 235 |
no test coverage detected