1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-15 14:13:16 +02:00

Merge commit '108f2f381acb93827fb4add0517eeae859afa3bf'

* commit '108f2f381acb93827fb4add0517eeae859afa3bf':
  parseutils: Extend small_strptime to be used in avformat

Conflicts:
	libavutil/parseutils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer
2015-04-07 19:58:31 +02:00

View File

@@ -465,22 +465,22 @@ char *av_small_strptime(const char *p, const char *fmt, struct tm *dt)
{ {
int c, val; int c, val;
for(;;) { while((c = *fmt++)) {
/* consume time string until a non whitespace char is found */ if (c != '%') {
while (av_isspace(*fmt)) { if (av_isspace(c))
while (av_isspace(*p)) for (; *p && av_isspace(*p); p++);
p++; else if (*p != c)
fmt++; return NULL;
else p++;
continue;
} }
c = *fmt++;
if (c == '\0') {
return (char *)p;
} else if (c == '%') {
c = *fmt++; c = *fmt++;
switch(c) { switch(c) {
case 'H': case 'H':
case 'J': case 'J':
val = date_get_num(&p, 0, c == 'H' ? 23 : INT_MAX, 2); val = date_get_num(&p, 0, c == 'H' ? 23 : INT_MAX, 2);
if (val == -1) if (val == -1)
return NULL; return NULL;
dt->tm_hour = val; dt->tm_hour = val;
@@ -515,18 +515,21 @@ char *av_small_strptime(const char *p, const char *fmt, struct tm *dt)
return NULL; return NULL;
dt->tm_mday = val; dt->tm_mday = val;
break; break;
case 'T':
p = av_small_strptime(p, "%H:%M:%S", dt);
if (!p)
return NULL;
break;
case '%': case '%':
goto match; if (*p++ != '%')
return NULL;
break;
default: default:
return NULL; return NULL;
} }
} else {
match:
if (c != *p)
return NULL;
p++;
}
} }
return (char*)p;
} }
time_t av_timegm(struct tm *tm) time_t av_timegm(struct tm *tm)