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