get a positive number between n_min and n_max, for a maximum length of len_max. Return -1 if error. */
| 453 | /* get a positive number between n_min and n_max, for a maximum length |
| 454 | of len_max. Return -1 if error. */ |
| 455 | static int date_get_num(const char **pp, |
| 456 | int n_min, int n_max, int len_max) |
| 457 | { |
| 458 | int i, val, c; |
| 459 | const char *p; |
| 460 | |
| 461 | p = *pp; |
| 462 | val = 0; |
| 463 | for(i = 0; i < len_max; i++) { |
| 464 | c = *p; |
| 465 | if (!av_isdigit(c)) |
| 466 | break; |
| 467 | val = (val * 10) + c - '0'; |
| 468 | p++; |
| 469 | } |
| 470 | /* no number read ? */ |
| 471 | if (p == *pp) |
| 472 | return -1; |
| 473 | if (val < n_min || val > n_max) |
| 474 | return -1; |
| 475 | *pp = p; |
| 476 | return val; |
| 477 | } |
| 478 | |
| 479 | static int date_get_month(const char **pp) { |
| 480 | int i = 0; |
no test coverage detected