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)
switch( i_query )
{
case STREAM_IS_DIRECTORY:
{
bool *pb_canreaddir = va_arg( args, bool * );
bool *pb_dirsorted = va_arg( args, bool * );
bool *pb_dircanloop = va_arg( args, bool * );
*pb_canreaddir = true;
if (pb_dirsorted)
*pb_dirsorted = false;
if (pb_dircanloop)
pb_dircanloop = false;
*va_arg( args, bool * ) = true;
*va_arg( args, bool * ) = false;
*va_arg( args, bool * ) = false;
break;
}
case STREAM_CAN_SEEK:
case STREAM_CAN_FASTSEEK:
......
......@@ -84,9 +84,10 @@ bool CheckContentType( stream_t * p_stream, const char * psz_ctype );
#define CHECK_FILE() \
do { \
bool b_is_dir; \
bool b_is_dir, b_sorted, b_loop; \
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; \
} while(0)
......
......@@ -311,18 +311,10 @@ static int AStreamControl(stream_t *s, int cmd, va_list args)
return access_vaControl(access, cmd, args);
case STREAM_IS_DIRECTORY:
{
bool *b;
*va_arg(args, bool *) = access->pf_readdir != NULL;
b = va_arg(args, bool *);
if (b != NULL)
*b = access->info.b_dir_sorted;
b = va_arg(args, bool *);
if (b != NULL)
*b = access->info.b_dir_can_loop;
*va_arg(args, bool *) = access->info.b_dir_sorted;
*va_arg(args, bool *) = access->info.b_dir_can_loop;
break;
}
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