[vlc-devel] [PATCH 2/2] stream_filter: remove redundant tests
RĂ©mi Denis-Courmont
remi at remlab.net
Thu Sep 24 19:07:14 CEST 2020
Those checks are redundant as of the previous patch.
---
modules/demux/playlist/asx.c | 3 ---
modules/demux/playlist/b4s.c | 1 -
modules/demux/playlist/bdmv.c | 2 --
modules/demux/playlist/dvb.c | 1 -
modules/demux/playlist/ifo.c | 2 --
modules/demux/playlist/itml.c | 2 +-
modules/demux/playlist/m3u.c | 1 -
modules/demux/playlist/playlist.h | 6 ------
modules/demux/playlist/pls.c | 2 --
modules/demux/playlist/podcast.c | 1 -
modules/demux/playlist/qtl.c | 1 -
modules/demux/playlist/ram.c | 1 -
modules/demux/playlist/sgimb.c | 1 -
modules/demux/playlist/wms.c | 2 --
modules/demux/playlist/wpl.c | 1 -
modules/demux/playlist/xspf.c | 2 --
modules/lua/stream_filter.c | 6 ++----
modules/stream_filter/record.c | 3 ---
modules/stream_filter/ytdl.c | 2 +-
19 files changed, 4 insertions(+), 36 deletions(-)
diff --git a/modules/demux/playlist/asx.c b/modules/demux/playlist/asx.c
index e17be85e96..1dc691736c 100644
--- a/modules/demux/playlist/asx.c
+++ b/modules/demux/playlist/asx.c
@@ -155,9 +155,6 @@ static bool PeekASX( stream_t *s )
int Import_ASX( vlc_object_t *p_this )
{
stream_t *p_demux = (stream_t *)p_this;
-
- CHECK_FILE(p_demux);
-
char *type = stream_MimeType( p_demux->s );
if( stream_HasExtension( p_demux, ".asx" )
diff --git a/modules/demux/playlist/b4s.c b/modules/demux/playlist/b4s.c
index cf6af71c3d..74f0f88e89 100644
--- a/modules/demux/playlist/b4s.c
+++ b/modules/demux/playlist/b4s.c
@@ -48,7 +48,6 @@ int Import_B4S( vlc_object_t *p_this )
{
stream_t *demux = (stream_t *)p_this;
- CHECK_FILE(demux);
if( !stream_HasExtension( demux, ".b4s" ) )
return VLC_EGENERIC;
diff --git a/modules/demux/playlist/bdmv.c b/modules/demux/playlist/bdmv.c
index ab1f283838..762ac6cfbc 100644
--- a/modules/demux/playlist/bdmv.c
+++ b/modules/demux/playlist/bdmv.c
@@ -51,8 +51,6 @@ int Import_BDMV( vlc_object_t *p_this )
{
stream_t *p_stream = (stream_t *)p_this;
- CHECK_FILE(p_stream);
-
if( !stream_HasExtension( p_stream, ".BDMV" ) )
return VLC_EGENERIC;
diff --git a/modules/demux/playlist/dvb.c b/modules/demux/playlist/dvb.c
index 5dc6220203..ebbc46950f 100644
--- a/modules/demux/playlist/dvb.c
+++ b/modules/demux/playlist/dvb.c
@@ -45,7 +45,6 @@ int Import_DVB(vlc_object_t *p_this)
{
stream_t *demux = (stream_t *)p_this;
- CHECK_FILE(demux);
if (!stream_HasExtension(demux, ".conf" ) && !demux->obj.force )
return VLC_EGENERIC;
diff --git a/modules/demux/playlist/ifo.c b/modules/demux/playlist/ifo.c
index b62837f2fb..9468e133b4 100644
--- a/modules/demux/playlist/ifo.c
+++ b/modules/demux/playlist/ifo.c
@@ -52,8 +52,6 @@ int Import_IFO( vlc_object_t *p_this )
{
stream_t *p_stream = (stream_t *)p_this;
- CHECK_FILE(p_stream);
-
if( !stream_HasExtension( p_stream, ".IFO" ) )
return VLC_EGENERIC;
diff --git a/modules/demux/playlist/itml.c b/modules/demux/playlist/itml.c
index 0e4daccce7..66a4a2fd4e 100644
--- a/modules/demux/playlist/itml.c
+++ b/modules/demux/playlist/itml.c
@@ -45,7 +45,7 @@ static int ReadDir( stream_t *, input_item_node_t * );
int Import_iTML( vlc_object_t *p_this )
{
stream_t *p_demux = (stream_t *)p_this;
- CHECK_FILE(p_demux);
+
if( !stream_HasExtension( p_demux, ".xml" )
&& !p_demux->obj.force )
return VLC_EGENERIC;
diff --git a/modules/demux/playlist/m3u.c b/modules/demux/playlist/m3u.c
index 2cf71fd8d8..73156cf3ed 100644
--- a/modules/demux/playlist/m3u.c
+++ b/modules/demux/playlist/m3u.c
@@ -80,7 +80,6 @@ int Import_M3U( vlc_object_t *p_this )
ssize_t i_peek;
int offset = 0;
- CHECK_FILE(p_stream);
i_peek = vlc_stream_Peek( p_stream->s, &p_peek, 1024 );
if( i_peek < 8 )
return VLC_EGENERIC;
diff --git a/modules/demux/playlist/playlist.h b/modules/demux/playlist/playlist.h
index da7fa2affc..4d35a8e20c 100644
--- a/modules/demux/playlist/playlist.h
+++ b/modules/demux/playlist/playlist.h
@@ -65,9 +65,3 @@ void Close_WPL ( vlc_object_t * );
#define GetCurrentItem(obj) ((obj)->p_input_item)
#define GetSource(obj) ((obj)->s)
-
-#define CHECK_FILE(obj) \
-do { \
- if( GetSource(obj)->pf_readdir != NULL ) \
- return VLC_EGENERIC; \
-} while(0)
diff --git a/modules/demux/playlist/pls.c b/modules/demux/playlist/pls.c
index 7ad7fad29a..5e885f7d75 100644
--- a/modules/demux/playlist/pls.c
+++ b/modules/demux/playlist/pls.c
@@ -47,8 +47,6 @@ int Import_PLS( vlc_object_t *p_this )
stream_t *p_demux = (stream_t *)p_this;
const uint8_t *p_peek;
- CHECK_FILE(p_demux);
-
if( vlc_stream_Peek( p_demux->s, &p_peek, 10 ) < 10 ) {
msg_Dbg( p_demux, "not enough data" );
return VLC_EGENERIC;
diff --git a/modules/demux/playlist/podcast.c b/modules/demux/playlist/podcast.c
index 9fb5181fb4..49a0066c81 100644
--- a/modules/demux/playlist/podcast.c
+++ b/modules/demux/playlist/podcast.c
@@ -47,7 +47,6 @@ int Import_podcast( vlc_object_t *p_this )
{
stream_t *p_demux = (stream_t *)p_this;
- CHECK_FILE(p_demux);
if( stream_IsMimeType( p_demux->s, "text/xml" )
|| stream_IsMimeType( p_demux->s, "application/xml" ) )
{
diff --git a/modules/demux/playlist/qtl.c b/modules/demux/playlist/qtl.c
index 9c8032787d..e340ba71f1 100644
--- a/modules/demux/playlist/qtl.c
+++ b/modules/demux/playlist/qtl.c
@@ -83,7 +83,6 @@ int Import_QTL( vlc_object_t *p_this )
{
stream_t *p_demux = (stream_t *)p_this;
- CHECK_FILE(p_demux);
if( !stream_HasExtension( p_demux, ".qtl" ) )
return VLC_EGENERIC;
diff --git a/modules/demux/playlist/ram.c b/modules/demux/playlist/ram.c
index 5a37d4745c..5889110bd3 100644
--- a/modules/demux/playlist/ram.c
+++ b/modules/demux/playlist/ram.c
@@ -73,7 +73,6 @@ int Import_RAM( vlc_object_t *p_this )
stream_t *p_demux = (stream_t *)p_this;
const uint8_t *p_peek;
- CHECK_FILE(p_demux);
if( !stream_HasExtension( p_demux, ".ram" )
&& !stream_HasExtension( p_demux, ".rm" ) )
return VLC_EGENERIC;
diff --git a/modules/demux/playlist/sgimb.c b/modules/demux/playlist/sgimb.c
index f5a9d6a36e..167cc413bc 100644
--- a/modules/demux/playlist/sgimb.c
+++ b/modules/demux/playlist/sgimb.c
@@ -139,7 +139,6 @@ int Import_SGIMB( vlc_object_t * p_this )
const uint8_t *p_peek;
int i_size;
- CHECK_FILE(p_demux);
/* Lets check the content to see if this is a sgi mediabase file */
i_size = vlc_stream_Peek( p_demux->s, &p_peek, MAX_LINE );
i_size -= sizeof("sgiNameServerHost=") - 1;
diff --git a/modules/demux/playlist/wms.c b/modules/demux/playlist/wms.c
index 6f14fd09e0..8a8bdd3be2 100644
--- a/modules/demux/playlist/wms.c
+++ b/modules/demux/playlist/wms.c
@@ -73,8 +73,6 @@ int Import_WMS(vlc_object_t *obj)
stream_t *demux = (stream_t *)obj;
const uint8_t *peek;
- CHECK_FILE(demux);
-
if (vlc_stream_Peek(demux->s, &peek, 10) < 10
|| strncmp((const char *)peek, "[Reference]", 11))
return VLC_EGENERIC;
diff --git a/modules/demux/playlist/wpl.c b/modules/demux/playlist/wpl.c
index f8d8b7a004..85b14864be 100644
--- a/modules/demux/playlist/wpl.c
+++ b/modules/demux/playlist/wpl.c
@@ -279,7 +279,6 @@ int Import_WPL( vlc_object_t* p_this )
{
stream_t* p_demux = (stream_t*)p_this;
- CHECK_FILE(p_demux);
if( !stream_HasExtension( p_demux, ".wpl" ) &&
!stream_HasExtension( p_demux, ".zpl" ) )
return VLC_EGENERIC;
diff --git a/modules/demux/playlist/xspf.c b/modules/demux/playlist/xspf.c
index 5c054f89eb..85b36c1fe7 100644
--- a/modules/demux/playlist/xspf.c
+++ b/modules/demux/playlist/xspf.c
@@ -89,8 +89,6 @@ int Import_xspf(vlc_object_t *p_this)
{
stream_t *p_stream = (stream_t *)p_this;
- CHECK_FILE(p_stream);
-
if( !stream_HasExtension( p_stream, ".xspf" )
&& !stream_IsMimeType( p_stream->s, "application/xspf+xml" ) )
return VLC_EGENERIC;
diff --git a/modules/lua/stream_filter.c b/modules/lua/stream_filter.c
index cc4bd29ef5..ecd4326ec2 100644
--- a/modules/lua/stream_filter.c
+++ b/modules/lua/stream_filter.c
@@ -274,11 +274,9 @@ static int ReadDir(stream_t *s, input_item_node_t *node)
*****************************************************************************/
int Import_LuaPlaylist(vlc_object_t *obj)
{
- if( lua_Disabled( obj ) )
- return VLC_EGENERIC;
-
stream_t *s = (stream_t *)obj;
- if( s->s->pf_readdir != NULL )
+
+ if( lua_Disabled( obj ) )
return VLC_EGENERIC;
struct vlclua_playlist *sys = malloc(sizeof (*sys));
diff --git a/modules/stream_filter/record.c b/modules/stream_filter/record.c
index 18479ecd39..b6bc9151c4 100644
--- a/modules/stream_filter/record.c
+++ b/modules/stream_filter/record.c
@@ -79,9 +79,6 @@ static int Open ( vlc_object_t *p_this )
stream_t *s = (stream_t*)p_this;
stream_sys_t *p_sys;
- if( s->s->pf_readdir != NULL )
- return VLC_EGENERIC;
-
/* */
s->p_sys = p_sys = malloc( sizeof( *p_sys ) );
if( !p_sys )
diff --git a/modules/stream_filter/ytdl.c b/modules/stream_filter/ytdl.c
index f13b5d13fd..85c9fad19e 100644
--- a/modules/stream_filter/ytdl.c
+++ b/modules/stream_filter/ytdl.c
@@ -270,7 +270,7 @@ static int OpenFilter(vlc_object_t *obj)
{
stream_t *s = (stream_t *)obj;
- if (s->s->pf_readdir != NULL || s->psz_url == NULL)
+ if (s->psz_url == NULL)
return VLC_EGENERIC;
if (strncasecmp(s->psz_url, "http:", 5)
&& strncasecmp(s->psz_url, "https:", 6))
--
2.28.0
More information about the vlc-devel
mailing list