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

Benoit Fouet benoit.fouet at free.fr
Mon Sep 22 12:30:39 CEST 2014


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
-- 
2.1.0.127.g0c72b98



More information about the ffmpeg-devel mailing list