From: Stefano Sabatini <[email protected]>

According to POSIX, strptime() should consume whitespaces in the date
string everytime a whitespace conversion specification is found in the
date format specification. Make av_small_strptime() conform with this
behavior.

In particular, should fix trac ticket #1739.

(cherry picked from commit 85c93d90dfae17d2ccff21aec5a55ca3029be83c)

Conflicts:
        libavutil/version.h
---
 libavutil/parseutils.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c
index c03f1a2..fd3ffd1 100644
--- a/libavutil/parseutils.c
+++ b/libavutil/parseutils.c
@@ -405,6 +405,12 @@ const 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++;
+        }
         c = *fmt++;
         if (c == '\0') {
             return p;
-- 
2.1.0

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to