[vlc-commits] pls: expand macro and simplify logic

Rémi Denis-Courmont git at videolan.org
Tue Apr 18 20:40:49 CEST 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Apr 17 20:05:01 2017 +0300| [31e0accd6ff934704f087904fc222c153e249a67] | committer: Rémi Denis-Courmont

pls: expand macro and simplify logic

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

 modules/demux/playlist/playlist.h |  3 ---
 modules/demux/playlist/pls.c      | 11 +++++------
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/modules/demux/playlist/playlist.h b/modules/demux/playlist/playlist.h
index 9a51e504e9..6a0a5d9720 100644
--- a/modules/demux/playlist/playlist.h
+++ b/modules/demux/playlist/playlist.h
@@ -89,6 +89,3 @@ do { \
 #define STANDARD_DEMUX_INIT_MSG( msg ) do { \
     DEMUX_INIT_COMMON();                    \
     msg_Dbg( p_demux, "%s", msg ); } while(0)
-
-#define POKE( peek, stuff, size ) (strncasecmp( (const char *)peek, stuff, size )==0)
-
diff --git a/modules/demux/playlist/pls.c b/modules/demux/playlist/pls.c
index 5de0b67165..9419a22a88 100644
--- a/modules/demux/playlist/pls.c
+++ b/modules/demux/playlist/pls.c
@@ -53,12 +53,11 @@ int Import_PLS( vlc_object_t *p_this )
         return VLC_EGENERIC;
     }
 
-    if( POKE( p_peek, "[playlist]", 10 ) || POKE( p_peek, "[Reference]", 10 ) ||
-        demux_IsPathExtension( p_demux, ".pls" )   || demux_IsForced( p_demux, "pls" ) )
-    {
-        ;
-    }
-    else return VLC_EGENERIC;
+    if( strncasecmp( (const char *)p_peek, "[playlist]", 10 )
+     && strncasecmp( (const char *)p_peek, "[Reference]", 10 )
+     && !demux_IsPathExtension( p_demux, ".pls" )
+     && !demux_IsForced( p_demux, "pls" ) )
+        return VLC_EGENERIC;
 
     msg_Dbg( p_demux, "found valid PLS playlist file");
     p_demux->pf_demux = Demux;



More information about the vlc-commits mailing list