mirror of
https://gitee.com/openharmony/third_party_ffmpeg
synced 2024-11-24 03:39:45 +00:00
parseutils: Extend small_strptime to be used in avformat
The strptime implementation is supposed to support whitespace and %T.
This commit is contained in:
parent
249796e256
commit
108f2f381a
@ -404,11 +404,16 @@ static const char *small_strptime(const char *p, const char *fmt, struct tm *dt)
|
||||
{
|
||||
int c, val;
|
||||
|
||||
for(;;) {
|
||||
c = *fmt++;
|
||||
if (c == '\0') {
|
||||
return p;
|
||||
} else if (c == '%') {
|
||||
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++;
|
||||
switch(c) {
|
||||
case 'H':
|
||||
@ -447,18 +452,21 @@ static const char *small_strptime(const char *p, const char *fmt, struct tm *dt)
|
||||
return NULL;
|
||||
dt->tm_mday = val;
|
||||
break;
|
||||
case 'T':
|
||||
p = small_strptime(p, "%H:%M:%S", dt);
|
||||
if (!p)
|
||||
return NULL;
|
||||
break;
|
||||
case '%':
|
||||
goto match;
|
||||
if (*p++ != '%')
|
||||
return NULL;
|
||||
break;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
match:
|
||||
if (c != *p)
|
||||
return NULL;
|
||||
p++;
|
||||
}
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
time_t av_timegm(struct tm *tm)
|
||||
|
Loading…
Reference in New Issue
Block a user