[vlc-commits] Xiph metadata: fix bug causing redudant "extra" metadata

Filip Roséen git at videolan.org
Wed May 25 00:10:49 CEST 2016


vlc | branch: master | Filip Roséen <filip at videolabs.io> | Tue May 17 20:18:49 2016 +0200| [9c38070a4c117122600dc5a605bcc1a159d0ea90] | committer: Jean-Baptiste Kempf

Xiph metadata: fix bug causing redudant "extra" metadata

The IF_EXTRACT_FMT macro is to be used in a if-else-tree, the usage of
IF_EXTRACT prior to the following if-statement did however cause the
single if-else-tree to be split up into two (causing the fallback-else
at the end to be unconditionally hit, even if another branch had already
handled the data).

If "TITLE=" metadata was found, we would still end up inside the
fallback since the previous implementation of IF_EXTRACT_FMT would start
a new if-else-tree.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9c38070a4c117122600dc5a605bcc1a159d0ea90
---

 modules/demux/xiph_metadata.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/modules/demux/xiph_metadata.c b/modules/demux/xiph_metadata.c
index 2e9ecba..1b9d943 100644
--- a/modules/demux/xiph_metadata.c
+++ b/modules/demux/xiph_metadata.c
@@ -389,12 +389,15 @@ void vorbis_ParseComment( es_format_t *p_fmt, vlc_meta_t **pp_meta,
     }
 
 #define IF_EXTRACT_FMT(txt,var,fmt,target) \
-    IF_EXTRACT(txt,var)\
-    if( fmt && !strncasecmp(psz_comment, txt, strlen(txt)) )\
+    if( !strncasecmp(psz_comment, txt, strlen(txt)) ) \
+    { \
+        IF_EXTRACT(txt,var)\
+        if( fmt )\
         {\
-            if ( fmt->target ) free( fmt->target );\
+            free( fmt->target );\
             fmt->target = strdup(&psz_comment[strlen(txt)]);\
-        }
+        }\
+    }
 
         IF_EXTRACT("TITLE=", Title )
         else IF_EXTRACT("ARTIST=", Artist )



More information about the vlc-commits mailing list