Commit 0739179b authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '108f2f38'

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

Conflicts:
	libavutil/parseutils.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 6fd300ac 108f2f38
...@@ -465,22 +465,22 @@ char *av_small_strptime(const char *p, const char *fmt, struct tm *dt) ...@@ -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) ...@@ -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++ != '%')
default:
return NULL; return NULL;
} break;
} else { default:
match:
if (c != *p)
return NULL; return NULL;
p++;
} }
} }
return (char*)p;
} }
time_t av_timegm(struct tm *tm) time_t av_timegm(struct tm *tm)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment