static int gui_input_cursong_seek_validator ( const char *  str,
char  c 
) [static]

Approve input string format for the seeking option.

Definition at line 317 of file gui_input.c.

00318 {
00319         const char *s;
00320 
00321         if (c == '+' || c == '-') {
00322                 /* Only allow + and - at the beginning of the statement */
00323                 if (str[0] != '\0')
00324                         return (-1);
00325         } else if (c == ':') {
00326                 /* Don't allow : before a digit has been inserted */
00327                 if (strpbrk(str, "0123456789") == NULL)
00328                         return (-1);
00329 
00330                 s = strrchr(str, ':');
00331                 if (s != NULL) {
00332                         /* Only allow colon after two decimals */
00333                         if (strlen(s + 1) != 2)
00334                                 return (-1);
00335                         /* Only allow two : characters in the string */
00336                         if (s - strchr(str, ':') == 3)
00337                                 return (-1);
00338                 }
00339         } else if (g_ascii_isdigit(c)) {
00340                 s = strrchr(str, ':');
00341                 if (s != NULL) {
00342                         /* Only allow up to two decimals after a colon */
00343                         if (strlen(s + 1) == 2)
00344                                 return (-1);
00345                         /* Only allow '0' to '5' as the first digit */
00346                         if (s[1] == '\0' && c > '5')
00347                                 return (-1);
00348                 }
00349         } else {
00350                 /* Don't allow any other characters */
00351                 return (-1);
00352         }
00353 
00354         return (0);
00355 }

Here is the caller graph for this function:

 All Data Structures Files Functions Variables Defines
Generated on Mon Mar 15 04:45:17 2010 for herrie by  doxygen 1.6.3