return MS_TRUE if the time string matchs the timeformat. else return MS_FALSE. */
| 150 | else return MS_FALSE. |
| 151 | */ |
| 152 | int msTimeMatchPattern(char *timestring, char *timeformat) |
| 153 | { |
| 154 | int i =-1; |
| 155 | |
| 156 | /* match the pattern format first and then check if the time string */ |
| 157 | /* matchs the pattern. If it is the case retrurn the MS_TRUE */ |
| 158 | for (i=0; i<MS_NUMTIMEFORMATS; i++) |
| 159 | { |
| 160 | if (strcasecmp(ms_timeFormats[i].userformat, timeformat) == 0) |
| 161 | break; |
| 162 | } |
| 163 | |
| 164 | if (i >= 0 && i < MS_NUMTIMEFORMATS) |
| 165 | { |
| 166 | if(!ms_timeFormats[i].regex) |
| 167 | { |
| 168 | ms_timeFormats[i].regex = (ms_regex_t *) msSmallMalloc(sizeof(ms_regex_t)); |
| 169 | ms_regcomp(ms_timeFormats[i].regex, |
| 170 | ms_timeFormats[i].pattern, MS_REG_EXTENDED|MS_REG_NOSUB); |
| 171 | } |
| 172 | if (ms_regexec(ms_timeFormats[i].regex, timestring, 0,NULL, 0) == 0) |
| 173 | return MS_TRUE; |
| 174 | |
| 175 | } |
| 176 | return MS_FALSE; |
| 177 | } |
| 178 | |
| 179 | |
| 180 | void msUnsetLimitedPatternToUse() |
no test coverage detected