[FFmpeg-devel] [PATCH] avformat/img2dec: fix glob pattern detection.

Benoit Fouet benoit.fouet at free.fr
Tue Sep 30 13:03:47 CEST 2014


Hi,

----- Mail original -----
> The is_glob() function was not working with unescaped glob patterns,
> which is the way only glob_sequence (which is deprecated) works.
> Fixes ticket #3948
> ---
>  libavformat/img2dec.c | 14 +-------------
>  1 file changed, 1 insertion(+), 13 deletions(-)
> 
> diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
> index a21429f..64ebc31 100644
> --- a/libavformat/img2dec.c
> +++ b/libavformat/img2dec.c
> @@ -75,19 +75,7 @@ static int infer_size(int *width_ptr, int
> *height_ptr, int size)
>  static int is_glob(const char *path)
>  {
>  #if HAVE_GLOB
> -    size_t span = 0;
> -    const char *p = path;
> -
> -    while (p = strchr(p, '%')) {
> -        if (*(++p) == '%') {
> -            ++p;
> -            continue;
> -        }
> -        if (span = strspn(p, "*?[]{}"))
> -            break;
> -    }
> -    /* Did we hit a glob char or get to the end? */
> -    return span != 0;
> +    return strspn(path, "%*?[]{}") != 0;
>  #else
>      return 0;
>  #endif
> 

Any opinion on this one?

-- 
Ben


More information about the ffmpeg-devel mailing list