[FFmpeg-devel] [PATCH] parseutils: accept only full "ms" and "us" prefixes
Rostislav Pehlivanov
atomnuker at gmail.com
Mon Mar 5 00:40:46 EET 2018
On 3 March 2018 at 20:19, Rostislav Pehlivanov <atomnuker at gmail.com> wrote:
> The commit which added those was pushed prematurely before anyone could
> object
> to illogical suffixes like just m for milliseconds. Without this, we'd be
> locked
> into never being able to implement the "m" suffix for minutes.
>
> Signed-off-by: Rostislav Pehlivanov <atomnuker at gmail.com>
> ---
> libavutil/parseutils.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c
> index 44c845577a..1b81757aab 100644
> --- a/libavutil/parseutils.c
> +++ b/libavutil/parseutils.c
> @@ -689,17 +689,15 @@ int av_parse_time(int64_t *timeval, const char
> *timestr, int duration)
>
> if (duration) {
> t = dt.tm_hour * 3600 + dt.tm_min * 60 + dt.tm_sec;
> - if (*q == 'm') {
> + if (q[0] == 'm' && q[1] == 's') {
> suffix = 1000;
> microseconds /= 1000;
> - q++;
> - } else if (*q == 'u') {
> + q += 2;
> + } else if (q[0] == 'u' && q[1] == 's') {
> suffix = 1;
> microseconds = 0;
> - q++;
> + q += 2;
> }
> - if (*q == 's')
> - q++;
> } else {
> int is_utc = *q == 'Z' || *q == 'z';
> int tzoffset = 0;
> --
> 2.16.2
>
>
I'll push this tomorrow if there are no objections
More information about the ffmpeg-devel
mailing list