Commit c1de0957 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

stream: disallow NULL parameters to STREAM_IS_DIRECTORY, simplify

parent 605b5cb8
...@@ -39,17 +39,10 @@ static int Control(stream_t *p_stream, int i_query, va_list args) ...@@ -39,17 +39,10 @@ static int Control(stream_t *p_stream, int i_query, va_list args)
switch( i_query ) switch( i_query )
{ {
case STREAM_IS_DIRECTORY: case STREAM_IS_DIRECTORY:
{ *va_arg( args, bool * ) = true;
bool *pb_canreaddir = va_arg( args, bool * ); *va_arg( args, bool * ) = false;
bool *pb_dirsorted = va_arg( args, bool * ); *va_arg( args, bool * ) = false;
bool *pb_dircanloop = va_arg( args, bool * );
*pb_canreaddir = true;
if (pb_dirsorted)
*pb_dirsorted = false;
if (pb_dircanloop)
pb_dircanloop = false;
break; break;
}
case STREAM_CAN_SEEK: case STREAM_CAN_SEEK:
case STREAM_CAN_FASTSEEK: case STREAM_CAN_FASTSEEK:
......
...@@ -84,9 +84,10 @@ bool CheckContentType( stream_t * p_stream, const char * psz_ctype ); ...@@ -84,9 +84,10 @@ bool CheckContentType( stream_t * p_stream, const char * psz_ctype );
#define CHECK_FILE() \ #define CHECK_FILE() \
do { \ do { \
bool b_is_dir; \ bool b_is_dir, b_sorted, b_loop; \
if( stream_Control( ((demux_t *)p_this)->s, STREAM_IS_DIRECTORY, \ if( stream_Control( ((demux_t *)p_this)->s, STREAM_IS_DIRECTORY, \
&b_is_dir, NULL, NULL ) == VLC_SUCCESS && b_is_dir ) \ &b_is_dir, &b_sorted, &b_loop ) == VLC_SUCCESS && \
b_is_dir ) \
return VLC_EGENERIC; \ return VLC_EGENERIC; \
} while(0) } while(0)
......
...@@ -311,18 +311,10 @@ static int AStreamControl(stream_t *s, int cmd, va_list args) ...@@ -311,18 +311,10 @@ static int AStreamControl(stream_t *s, int cmd, va_list args)
return access_vaControl(access, cmd, args); return access_vaControl(access, cmd, args);
case STREAM_IS_DIRECTORY: case STREAM_IS_DIRECTORY:
{
bool *b;
*va_arg(args, bool *) = access->pf_readdir != NULL; *va_arg(args, bool *) = access->pf_readdir != NULL;
b = va_arg(args, bool *); *va_arg(args, bool *) = access->info.b_dir_sorted;
if (b != NULL) *va_arg(args, bool *) = access->info.b_dir_can_loop;
*b = access->info.b_dir_sorted;
b = va_arg(args, bool *);
if (b != NULL)
*b = access->info.b_dir_can_loop;
break; break;
}
case STREAM_GET_PRIVATE_BLOCK: case STREAM_GET_PRIVATE_BLOCK:
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment