]> git.sesse.net Git - vlc/blobdiff - modules/demux/playlist/asx.c
Fix duplicate definitions of FREE
[vlc] / modules / demux / playlist / asx.c
index 4e73551efb2120938b68cd5b23aca6c1c5f9890b..680ebf8a6caa26c0bd9e2d2a35df0805b7ce5d24 100644 (file)
@@ -37,8 +37,6 @@
 #include "playlist.h"
 #include "vlc_meta.h"
 
-#define FREE( p ) if( p ) { free( p ); (p) = NULL; }
-
 struct demux_sys_t
 {
     char    *psz_prefix;
@@ -86,23 +84,19 @@ static int StoreString( demux_t *p_demux, char **ppsz_string, char *psz_source_s
 int E_(Import_ASX)( vlc_object_t *p_this )
 {
     demux_t *p_demux = (demux_t *)p_this;
-
-    char    *psz_ext;
-
-    psz_ext = strrchr ( p_demux->psz_path, '.' );
-
-    if( ( psz_ext && !strcasecmp( psz_ext, ".asx") ) ||
-        ( psz_ext && !strcasecmp( psz_ext, ".wax") ) ||
-        ( psz_ext && !strcasecmp( psz_ext, ".wvx") ) ||
+    uint8_t *p_peek;
+    CHECK_PEEK( p_peek, 10 );
+    
+    if( POKE( p_peek, "<asx", 4 ) || isExtension( p_demux, ".asx" ) ||
+        isExtension( p_demux, ".wax" ) || isExtension( p_demux, ".wvx" ) ||
         isDemux( p_demux, "asx-open" ) )
     {
         ;
     }
     else
-    {
         return VLC_EGENERIC;
-    }
-    STANDARD_DEMUX_INIT_MSG( "using ASX playlist reader" );
+    
+    STANDARD_DEMUX_INIT_MSG( "found valid ASX playlist" );
     p_demux->p_sys->psz_prefix = E_(FindPrefix)( p_demux );
     p_demux->p_sys->psz_data = NULL;
     p_demux->p_sys->i_data_len = -1;
@@ -377,12 +371,12 @@ static int Demux( demux_t *p_demux )
                     continue;
                 }
                 /* cleanup entry */
-                FREE( psz_title_entry )
-                FREE( psz_base_entry )
-                FREE( psz_author_entry )
-                FREE( psz_copyright_entry )
-                FREE( psz_moreinfo_entry )
-                FREE( psz_abstract_entry )
+                FREENULL( psz_title_entry )
+                FREENULL( psz_base_entry )
+                FREENULL( psz_author_entry )
+                FREENULL( psz_copyright_entry )
+                FREENULL( psz_moreinfo_entry )
+                FREENULL( psz_abstract_entry )
                 b_entry = VLC_FALSE;
             }
             else if( !strncasecmp( psz_parse, "<Entry>", 7 ) )
@@ -423,7 +417,7 @@ static int Demux( demux_t *p_demux )
                             /* create the new entry */
                             asprintf( &psz_name, "%d %s", i_entry_count, ( psz_title_entry ? psz_title_entry : p_current->p_input->psz_name ) );
                             p_entry = input_ItemNew( p_playlist, psz_string, psz_name );
-                            FREE( psz_name );
+                            FREENULL( psz_name );
                             
                             vlc_input_item_CopyOptions( p_current->p_input, p_entry );
                             p_entry->p_meta = vlc_meta_New();
@@ -456,12 +450,12 @@ static int Demux( demux_t *p_demux )
                 if( psz_moreinfo_asx ) vlc_meta_SetURL( p_current->p_input->p_meta, psz_moreinfo_asx );
                 if( psz_abstract_asx ) vlc_meta_SetDescription( p_current->p_input->p_meta, psz_abstract_asx );
                 vlc_mutex_unlock( &p_current->p_input->lock );
-                FREE( psz_base_asx );
-                FREE( psz_title_asx );
-                FREE( psz_author_asx );
-                FREE( psz_copyright_asx );
-                FREE( psz_moreinfo_asx );
-                FREE( psz_abstract_asx );
+                FREENULL( psz_base_asx );
+                FREENULL( psz_title_asx );
+                FREENULL( psz_author_asx );
+                FREENULL( psz_copyright_asx );
+                FREENULL( psz_moreinfo_asx );
+                FREENULL( psz_abstract_asx );
                 psz_parse++;
             }
             else psz_parse++;