[vlc-commits] stream: remove first parameter to STREAM_IS_DIRECTORY

Rémi Denis-Courmont git at videolan.org
Wed Sep 2 21:54:14 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Sep  2 21:43:47 2015 +0300| [8368744397abc110a76a7f7b5a67c5ea9acccd2e] | committer: Rémi Denis-Courmont

stream: remove first parameter to STREAM_IS_DIRECTORY

Return an error code if the stream is not a directory (similar to
STREAM_GET_SIZE).

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

 include/vlc_stream.h               |    2 +-
 modules/access/archive/stream.c    |    1 -
 modules/demux/playlist/directory.c |    6 +++---
 modules/demux/playlist/playlist.h  |    5 ++---
 src/input/access.c                 |    3 ++-
 5 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/include/vlc_stream.h b/include/vlc_stream.h
index 1eb748b..d3715d2 100644
--- a/include/vlc_stream.h
+++ b/include/vlc_stream.h
@@ -83,7 +83,7 @@ enum stream_query_e
     STREAM_CAN_CONTROL_PACE,    /**< arg1= bool *   res=cannot fail*/
     /* */
     STREAM_GET_SIZE=6,          /**< arg1= uint64_t *     res=can fail */
-    STREAM_IS_DIRECTORY,        /**< arg1= bool *, arg2= bool *, arg3=bool *, res=can fail*/
+    STREAM_IS_DIRECTORY,        /**< arg1= bool *, arg2= bool *, res=can fail*/
 
     /* */
     STREAM_GET_PTS_DELAY = 0x101,/**< arg1= int64_t* res=cannot fail */
diff --git a/modules/access/archive/stream.c b/modules/access/archive/stream.c
index 36ead12..2d3a6f5 100644
--- a/modules/access/archive/stream.c
+++ b/modules/access/archive/stream.c
@@ -39,7 +39,6 @@ static int Control(stream_t *p_stream, int i_query, va_list args)
     switch( i_query )
     {
         case STREAM_IS_DIRECTORY:
-            *va_arg( args, bool * ) = true;
             *va_arg( args, bool * ) = false;
             *va_arg( args, bool * ) = false;
             break;
diff --git a/modules/demux/playlist/directory.c b/modules/demux/playlist/directory.c
index 6e394dc..e43aa6d 100644
--- a/modules/demux/playlist/directory.c
+++ b/modules/demux/playlist/directory.c
@@ -48,10 +48,10 @@ static int Demux( demux_t *p_demux );
 int Import_Dir ( vlc_object_t *p_this)
 {
     demux_t  *p_demux = (demux_t *)p_this;
-    bool b_is_dir, b_dir_sorted, b_dir_can_loop;
+    bool b_dir_sorted, b_dir_can_loop;
 
-    if( stream_Control( p_demux->s, STREAM_IS_DIRECTORY, &b_is_dir,
-                        &b_dir_sorted, &b_dir_can_loop ) || !b_is_dir )
+    if( stream_Control( p_demux->s, STREAM_IS_DIRECTORY,
+                        &b_dir_sorted, &b_dir_can_loop ) )
         return VLC_EGENERIC;
 
     STANDARD_DEMUX_INIT_MSG( "reading directory content" );
diff --git a/modules/demux/playlist/playlist.h b/modules/demux/playlist/playlist.h
index 1456cf2..7483903 100644
--- a/modules/demux/playlist/playlist.h
+++ b/modules/demux/playlist/playlist.h
@@ -84,10 +84,9 @@ bool CheckContentType( stream_t * p_stream, const char * psz_ctype );
 
 #define CHECK_FILE() \
 do { \
-    bool b_is_dir, b_sorted, b_loop; \
+    bool b_sorted, b_loop; \
     if( stream_Control( ((demux_t *)p_this)->s, STREAM_IS_DIRECTORY, \
-                        &b_is_dir, &b_sorted, &b_loop ) == VLC_SUCCESS && \
-        b_is_dir ) \
+                        &b_sorted, &b_loop ) == VLC_SUCCESS ) \
         return VLC_EGENERIC; \
 } while(0)
 
diff --git a/src/input/access.c b/src/input/access.c
index c2dd3d7..468602d 100644
--- a/src/input/access.c
+++ b/src/input/access.c
@@ -311,7 +311,8 @@ static int AStreamControl(stream_t *s, int cmd, va_list args)
             return access_vaControl(access, cmd, args);
 
         case STREAM_IS_DIRECTORY:
-            *va_arg(args, bool *) = access->pf_readdir != NULL;
+            if (access->pf_readdir == NULL)
+                return VLC_EGENERIC;
             *va_arg(args, bool *) = access->info.b_dir_sorted;
             *va_arg(args, bool *) = access->info.b_dir_can_loop;
             break;



More information about the vlc-commits mailing list