Commit d80b925e authored by Christophe Massiot's avatar Christophe Massiot

* src/extras/libc.c: Implemented a vlc_readdir_wrapper under Win32. This

   allows to call vlc_readdir_wrapper("\\") and get a list of Windows drives.
   This is a bit kludgy but so convenient to change drives under Windows.
 * modules/control/http: Adapted to use vlc_readdir_wrapper in foreach
   directory. Thou shalt escape all exported functions with E_() to avoid
   potential namespace collisions !
 * po: Re-run make update-po since POTFILES.in has changed.
parent de875432
......@@ -932,6 +932,16 @@ static inline void _SetQWBE( uint8_t *p, uint64_t i_qw )
# endif
#endif
#if defined(WIN32) || defined(UNDER_CE)
VLC_EXPORT( void *, vlc_opendir_wrapper, ( const char * ) );
VLC_EXPORT( struct dirent *, vlc_readdir_wrapper, ( void * ) );
VLC_EXPORT( int, vlc_closedir_wrapper, ( void * ) );
#else
# define vlc_opendir_wrapper opendir
# define vlc_readdir_wrapper readdir
# define vlc_closedir_wrapper closedir
#endif
/* Format type specifiers for 64 bits numbers */
#if defined(__CYGWIN32__) || (!defined(WIN32) && !defined(UNDER_CE))
# if defined(__WORDSIZE) && __WORDSIZE == 64
......
......@@ -10,7 +10,7 @@
/*
* In an ideal world, plugins would include all the headers they need.
* But of course, many, if not all, of them don't, so we have to make sure
* the while libvlc API is defined here in any case when included from a
* the whole libvlc API is defined here in any case when included from a
* plugin.
*/
# ifdef __PLUGIN__
......@@ -193,9 +193,11 @@ void __msg_Warn (vlc_object_t *, const char *, ... ) ATTRIBUTE_FORMAT( 2, 3);
httpd_host_t * httpd_TLSHostNew (vlc_object_t *, const char *, int, const char *, const char *, const char *, const char *);
int vlc_scandir (const char *name, struct dirent ***namelist, int (*filter) ( const struct dirent * ), int (*compar) ( const struct dirent **, const struct dirent ** ));
int sout_AccessOutWrite (sout_access_out_t *, block_t *);
struct dirent * vlc_readdir_wrapper (void *);
void config_UnsetCallbacks (module_config_t *);
void vout_SynchroRelease (vout_synchro_t *);
void __msg_Generic (vlc_object_t *, int, const char *, const char *, ... ) ATTRIBUTE_FORMAT( 4, 5);
int vlc_closedir_wrapper (void *);
int playlist_ServicesDiscoveryAdd (playlist_t *, const char *);
char * vlc_strndup (const char *s, size_t n);
void vout_PlacePicture (vout_thread_t *, unsigned int, unsigned int, unsigned int *, unsigned int *, unsigned int *, unsigned int *);
......@@ -336,6 +338,7 @@ void block_FifoEmpty (block_fifo_t *);
int playlist_ItemAddOption (playlist_item_t *, const char *);
void aout_VolumeNoneInit (aout_instance_t *);
void aout_DateInit (audio_date_t *, uint32_t);
void * vlc_opendir_wrapper (const char *);
void vlc_list_release (vlc_list_t *);
subpicture_t * spu_SortSubpictures (spu_t *, mtime_t);
playlist_item_t * playlist_LockItemGetByInput (playlist_t *,input_item_t *);
......@@ -830,6 +833,9 @@ struct module_symbols_t
const char * (*VLC_Version_inner) (void);
const char * (*VLC_CompileTime_inner) (void);
int (*playlist_PreparseEnqueueItem_inner) (playlist_t *, playlist_item_t *);
struct dirent * (*vlc_readdir_wrapper_inner) (void *);
int (*vlc_closedir_wrapper_inner) (void *);
void * (*vlc_opendir_wrapper_inner) (const char *);
};
# if defined (__PLUGIN__)
# define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner
......@@ -1229,6 +1235,9 @@ struct module_symbols_t
# define VLC_Version (p_symbols)->VLC_Version_inner
# define VLC_CompileTime (p_symbols)->VLC_CompileTime_inner
# define playlist_PreparseEnqueueItem (p_symbols)->playlist_PreparseEnqueueItem_inner
# define vlc_readdir_wrapper (p_symbols)->vlc_readdir_wrapper_inner
# define vlc_closedir_wrapper (p_symbols)->vlc_closedir_wrapper_inner
# define vlc_opendir_wrapper (p_symbols)->vlc_opendir_wrapper_inner
# elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)
/******************************************************************
* STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.
......@@ -1631,6 +1640,9 @@ struct module_symbols_t
((p_symbols)->VLC_Version_inner) = VLC_Version; \
((p_symbols)->VLC_CompileTime_inner) = VLC_CompileTime; \
((p_symbols)->playlist_PreparseEnqueueItem_inner) = playlist_PreparseEnqueueItem; \
((p_symbols)->vlc_readdir_wrapper_inner) = vlc_readdir_wrapper; \
((p_symbols)->vlc_closedir_wrapper_inner) = vlc_closedir_wrapper; \
((p_symbols)->vlc_opendir_wrapper_inner) = vlc_opendir_wrapper; \
(p_symbols)->net_ConvertIPv4_deprecated = NULL; \
(p_symbols)->vlc_fix_readdir_charset_deprecated = NULL; \
(p_symbols)->__osd_VolumeDown_deprecated = NULL; \
......
......@@ -473,28 +473,28 @@ int E_(HttpCallback)( httpd_file_sys_t *p_args,
aout_VolumeGet( p_args->p_intf , &i_volume );
sprintf( volume , "%d" , (int)i_volume );
p_args->vars = mvar_New( "variables", "" );
mvar_AppendNewVar( p_args->vars, "url_param",
p_args->vars = E_(mvar_New)( "variables", "" );
E_(mvar_AppendNewVar)( p_args->vars, "url_param",
i_request > 0 ? "1" : "0" );
mvar_AppendNewVar( p_args->vars, "url_value", p_request );
mvar_AppendNewVar( p_args->vars, "version", VLC_Version() );
mvar_AppendNewVar( p_args->vars, "copyright", COPYRIGHT_MESSAGE );
mvar_AppendNewVar( p_args->vars, "vlc_compile_time",
E_(mvar_AppendNewVar)( p_args->vars, "url_value", p_request );
E_(mvar_AppendNewVar)( p_args->vars, "version", VLC_Version() );
E_(mvar_AppendNewVar)( p_args->vars, "copyright", COPYRIGHT_MESSAGE );
E_(mvar_AppendNewVar)( p_args->vars, "vlc_compile_time",
VLC_CompileTime() );
mvar_AppendNewVar( p_args->vars, "vlc_compile_by", VLC_CompileBy() );
mvar_AppendNewVar( p_args->vars, "vlc_compile_host",
E_(mvar_AppendNewVar)( p_args->vars, "vlc_compile_by", VLC_CompileBy() );
E_(mvar_AppendNewVar)( p_args->vars, "vlc_compile_host",
VLC_CompileHost() );
mvar_AppendNewVar( p_args->vars, "vlc_compile_domain",
E_(mvar_AppendNewVar)( p_args->vars, "vlc_compile_domain",
VLC_CompileDomain() );
mvar_AppendNewVar( p_args->vars, "vlc_compiler", VLC_Compiler() );
mvar_AppendNewVar( p_args->vars, "vlc_changeset", VLC_Changeset() );
mvar_AppendNewVar( p_args->vars, "stream_position", position );
mvar_AppendNewVar( p_args->vars, "stream_time", time );
mvar_AppendNewVar( p_args->vars, "stream_length", length );
mvar_AppendNewVar( p_args->vars, "volume", volume );
mvar_AppendNewVar( p_args->vars, "stream_state", state );
E_(mvar_AppendNewVar)( p_args->vars, "vlc_compiler", VLC_Compiler() );
E_(mvar_AppendNewVar)( p_args->vars, "vlc_changeset", VLC_Changeset() );
E_(mvar_AppendNewVar)( p_args->vars, "stream_position", position );
E_(mvar_AppendNewVar)( p_args->vars, "stream_time", time );
E_(mvar_AppendNewVar)( p_args->vars, "stream_length", length );
E_(mvar_AppendNewVar)( p_args->vars, "volume", volume );
E_(mvar_AppendNewVar)( p_args->vars, "stream_state", state );
SSInit( &p_args->stack );
E_(SSInit)( &p_args->stack );
/* first we load in a temporary buffer */
E_(FileLoad)( f, &p_buffer, &i_buffer );
......@@ -510,8 +510,8 @@ int E_(HttpCallback)( httpd_file_sys_t *p_args,
*dst = '\0';
*pi_data = dst - *pp_data;
SSClean( &p_args->stack );
mvar_Delete( p_args->vars );
E_(SSClean)( &p_args->stack );
E_(mvar_Delete)( p_args->vars );
free( p_buffer );
}
......
......@@ -167,28 +167,28 @@ typedef struct mvar_s
/** This function creates a new variable */
mvar_t *mvar_New( const char *name, const char *value );
mvar_t *E_(mvar_New)( const char *name, const char *value );
/** This function deletes a variable */
void mvar_Delete( mvar_t *v );
void E_(mvar_Delete)( mvar_t *v );
/** This function adds f to the children variables of v, at last position */
void mvar_AppendVar( mvar_t *v, mvar_t *f );
void E_(mvar_AppendVar)( mvar_t *v, mvar_t *f );
/** This function duplicates a variable */
mvar_t *mvar_Duplicate( const mvar_t *v );
mvar_t *E_(mvar_Duplicate)( const mvar_t *v );
/** This function adds f to the children variables of v, at fist position */
void mvar_PushVar( mvar_t *v, mvar_t *f );
void E_(mvar_PushVar)( mvar_t *v, mvar_t *f );
/** This function removes f from the children variables of v */
void mvar_RemoveVar( mvar_t *v, mvar_t *f );
void E_(mvar_RemoveVar)( mvar_t *v, mvar_t *f );
/** This function retrieves the child variable named "name" */
mvar_t *mvar_GetVar( mvar_t *s, const char *name );
mvar_t *E_(mvar_GetVar)( mvar_t *s, const char *name );
/** This function retrieves the value of the child variable named "field" */
char *mvar_GetValue( mvar_t *v, char *field );
char *E_(mvar_GetValue)( mvar_t *v, char *field );
/** This function creates a variable with the given name and value and
* adds it as first child of vars */
void mvar_PushNewVar( mvar_t *vars, const char *name,
void E_(mvar_PushNewVar)( mvar_t *vars, const char *name,
const char *value );
/** This function creates a variable with the given name and value and
* adds it as last child of vars */
void mvar_AppendNewVar( mvar_t *vars, const char *name,
void E_(mvar_AppendNewVar)( mvar_t *vars, const char *name,
const char *value );
/** @} */
......@@ -202,25 +202,25 @@ void mvar_AppendNewVar( mvar_t *vars, const char *name,
/** This function creates a set variable which represents a series of integer
* The arg parameter must be of the form "start[:stop[:step]]" */
mvar_t *mvar_IntegerSetNew( const char *name, const char *arg );
mvar_t *E_(mvar_IntegerSetNew)( const char *name, const char *arg );
/** This function creates a set variable with the contents of the playlist */
mvar_t *mvar_PlaylistSetNew( intf_thread_t *p_intf, char *name,
mvar_t *E_(mvar_PlaylistSetNew)( intf_thread_t *p_intf, char *name,
playlist_t *p_pl );
/** This function creates a set variable with the contents of the Stream
* and media info box */
mvar_t *mvar_InfoSetNew( intf_thread_t *p_intf, char *name,
mvar_t *E_(mvar_InfoSetNew)( intf_thread_t *p_intf, char *name,
input_thread_t *p_input );
/** This function creates a set variable with the input parameters */
mvar_t *mvar_InputVarSetNew( intf_thread_t *p_intf, char *name,
mvar_t *E_(mvar_InputVarSetNew)( intf_thread_t *p_intf, char *name,
input_thread_t *p_input,
const char *psz_variable );
/** This function creates a set variable representing the files of the psz_dir
* directory */
mvar_t *mvar_FileSetNew( intf_thread_t *p_intf, char *name,
mvar_t *E_(mvar_FileSetNew)( intf_thread_t *p_intf, char *name,
char *psz_dir );
/** This function creates a set variable representing the VLM streams */
mvar_t *mvar_VlmSetNew( char *name, vlm_t *vlm );
mvar_t *E_(mvar_VlmSetNew)( char *name, vlm_t *vlm );
/** This function converts the listing of a playlist node into a mvar set */
void E_(PlaylistListNode)( intf_thread_t *p_intf, playlist_t *p_pl,
......@@ -250,21 +250,21 @@ typedef struct
} rpn_stack_t;
/** This function creates the RPN evaluator stack */
void SSInit( rpn_stack_t * );
void E_(SSInit)( rpn_stack_t * );
/** This function cleans the evaluator stack */
void SSClean( rpn_stack_t * );
void E_(SSClean)( rpn_stack_t * );
/* Evaluate and execute the RPN Stack */
void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars,
void E_(EvaluateRPN)( intf_thread_t *p_intf, mvar_t *vars,
rpn_stack_t *st, char *exp );
/* Push an operand on top of the RPN stack */
void SSPush ( rpn_stack_t *, const char * );
void E_(SSPush) ( rpn_stack_t *, const char * );
/* Remove the first operand from the RPN Stack */
char *SSPop ( rpn_stack_t * );
char *E_(SSPop) ( rpn_stack_t * );
/* Pushes an operand at a given position in the stack */
void SSPushN ( rpn_stack_t *, int );
void E_(SSPushN) ( rpn_stack_t *, int );
/* Removes an operand at the given position in the stack */
int SSPopN ( rpn_stack_t *, mvar_t * );
int E_(SSPopN) ( rpn_stack_t *, mvar_t * );
/**@}*/
......@@ -294,19 +294,19 @@ typedef struct
} macro_t;
/** This function creates a macro from a <vlc ....> tag */
int MacroParse( macro_t *m, char *psz_src );
int E_(MacroParse)( macro_t *m, char *psz_src );
/** This function cleans a macro */
void MacroClean( macro_t *m );
void E_(MacroClean)( macro_t *m );
/** This function returns the macro type identifier from its id= string value
* It uses the StrToMacroTypeTab mapping array for this */
int StrToMacroType( char *name );
int E_(StrToMacroType)( char *name );
/** This function actually executes the macro */
void MacroDo( httpd_file_sys_t *p_args, macro_t *m,
void E_(MacroDo)( httpd_file_sys_t *p_args, macro_t *m,
char *p_request, int i_request, char **pp_data,
int *pi_data, char **pp_dst );
/** This function looks for macros in a string */
char *MacroSearch( char *src, char *end,
char *E_(MacroSearch)( char *src, char *end,
int i_mvlc, vlc_bool_t b_after );
/** This function parses a file for macros */
......
......@@ -26,7 +26,7 @@
#include "http.h"
#include "macros.h"
int MacroParse( macro_t *m, char *psz_src )
int E_(MacroParse)( macro_t *m, char *psz_src )
{
char *dup = strdup( (char *)psz_src );
char *src = dup;
......@@ -106,14 +106,14 @@ int MacroParse( macro_t *m, char *psz_src )
#undef EXTRACT
}
void MacroClean( macro_t *m )
void E_(MacroClean)( macro_t *m )
{
free( m->id );
free( m->param1 );
free( m->param2 );
}
int StrToMacroType( char *name )
int E_(StrToMacroType)( char *name )
{
int i;
......@@ -131,7 +131,7 @@ int StrToMacroType( char *name )
return MVLC_UNKNOWN;
}
void MacroDo( httpd_file_sys_t *p_args,
void E_(MacroDo)( httpd_file_sys_t *p_args,
macro_t *m,
char *p_request, int i_request,
char **pp_data, int *pi_data,
......@@ -166,7 +166,7 @@ void MacroDo( httpd_file_sys_t *p_args,
} \
}
switch( StrToMacroType( m->id ) )
switch( E_(StrToMacroType)( m->id ) )
{
case MVLC_CONTROL:
if( i_request <= 0 )
......@@ -179,7 +179,7 @@ void MacroDo( httpd_file_sys_t *p_args,
msg_Warn( p_intf, "unauthorized control=%s", control );
break;
}
switch( StrToMacroType( control ) )
switch( E_(StrToMacroType)( control ) )
{
case MVLC_PLAY:
{
......@@ -514,7 +514,7 @@ void MacroDo( httpd_file_sys_t *p_args,
if( p_intf->p_sys->p_vlm == NULL ) break;
E_(ExtractURIValue)( p_request, "name", name, 512 );
if( StrToMacroType( control ) == MVLC_VLM_NEW )
if( E_(StrToMacroType)( control ) == MVLC_VLM_NEW )
{
char type[20];
E_(ExtractURIValue)( p_request, "type", type, 20 );
......@@ -554,7 +554,7 @@ void MacroDo( httpd_file_sys_t *p_args,
vlm_answer->psz_value );
}
mvar_AppendNewVar( p_args->vars, "vlm_error", vlm_error );
E_(mvar_AppendNewVar)( p_args->vars, "vlm_error", vlm_error );
vlm_MessageDelete( vlm_answer );
free( vlm_error );
......@@ -595,13 +595,13 @@ void MacroDo( httpd_file_sys_t *p_args,
if( p_intf->p_sys->p_vlm == NULL ) break;
E_(ExtractURIValue)( p_request, "name", name, 512 );
if( StrToMacroType( control ) == MVLC_VLM_PLAY )
if( E_(StrToMacroType)( control ) == MVLC_VLM_PLAY )
sprintf( psz, "control %s play", name );
else if( StrToMacroType( control ) == MVLC_VLM_PAUSE )
else if( E_(StrToMacroType)( control ) == MVLC_VLM_PAUSE )
sprintf( psz, "control %s pause", name );
else if( StrToMacroType( control ) == MVLC_VLM_STOP )
else if( E_(StrToMacroType)( control ) == MVLC_VLM_STOP )
sprintf( psz, "control %s stop", name );
else if( StrToMacroType( control ) == MVLC_VLM_SEEK )
else if( E_(StrToMacroType)( control ) == MVLC_VLM_SEEK )
{
char percent[20];
E_(ExtractURIValue)( p_request, "percent", percent, 512 );
......@@ -628,7 +628,7 @@ void MacroDo( httpd_file_sys_t *p_args,
E_(ExtractURIValue)( p_request, "file", file, 512 );
E_(DecodeEncodedURI)( file );
if( StrToMacroType( control ) == MVLC_VLM_LOAD )
if( E_(StrToMacroType)( control ) == MVLC_VLM_LOAD )
sprintf( psz, "load %s", file );
else
sprintf( psz, "save %s", file );
......@@ -663,7 +663,7 @@ void MacroDo( httpd_file_sys_t *p_args,
E_(ExtractURIValue)( p_request, m->param1, value, 512 );
E_(DecodeEncodedURI)( value );
switch( StrToMacroType( m->param2 ) )
switch( E_(StrToMacroType)( m->param2 ) )
{
case MVLC_INT:
i = atoi( value );
......@@ -693,7 +693,7 @@ void MacroDo( httpd_file_sys_t *p_args,
break;
}
switch( StrToMacroType( m->param2 ) )
switch( E_(StrToMacroType)( m->param2 ) )
{
case MVLC_INT:
i = config_GetInt( p_intf, m->param1 );
......@@ -730,13 +730,13 @@ void MacroDo( httpd_file_sys_t *p_args,
if( m->param1 )
{
EvaluateRPN( p_intf, p_args->vars, &p_args->stack, m->param1 );
s = SSPop( &p_args->stack );
v = mvar_GetValue( p_args->vars, s );
E_(EvaluateRPN)( p_intf, p_args->vars, &p_args->stack, m->param1 );
s = E_(SSPop)( &p_args->stack );
v = E_(mvar_GetValue)( p_args->vars, s );
}
else
{
v = s = SSPop( &p_args->stack );
v = s = E_(SSPop)( &p_args->stack );
}
PRINTS( "%s", v );
......@@ -744,7 +744,7 @@ void MacroDo( httpd_file_sys_t *p_args,
break;
}
case MVLC_RPN:
EvaluateRPN( p_intf, p_args->vars, &p_args->stack, m->param1 );
E_(EvaluateRPN)( p_intf, p_args->vars, &p_args->stack, m->param1 );
break;
/* Useful to learn stack management */
......@@ -768,7 +768,7 @@ void MacroDo( httpd_file_sys_t *p_args,
#undef ALLOC
}
char *MacroSearch( char *src, char *end, int i_mvlc, vlc_bool_t b_after )
char *E_(MacroSearch)( char *src, char *end, int i_mvlc, vlc_bool_t b_after )
{
int i_id;
int i_level = 0;
......@@ -780,9 +780,9 @@ char *MacroSearch( char *src, char *end, int i_mvlc, vlc_bool_t b_after )
int i_skip;
macro_t m;
i_skip = MacroParse( &m, src );
i_skip = E_(MacroParse)( &m, src );
i_id = StrToMacroType( m.id );
i_id = E_(StrToMacroType)( m.id );
switch( i_id )
{
......@@ -797,7 +797,7 @@ char *MacroSearch( char *src, char *end, int i_mvlc, vlc_bool_t b_after )
break;
}
MacroClean( &m );
E_(MacroClean)( &m );
if( ( i_mvlc == MVLC_END && i_level == -1 ) ||
( i_mvlc != MVLC_END && i_level == 0 && i_mvlc == i_id ) )
......@@ -848,11 +848,11 @@ void E_(Execute)( httpd_file_sys_t *p_args,
{
macro_t m;
src += MacroParse( &m, src );
src += E_(MacroParse)( &m, src );
//msg_Dbg( p_intf, "macro_id=%s", m.id );
switch( StrToMacroType( m.id ) )
switch( E_(StrToMacroType)( m.id ) )
{
case MVLC_INCLUDE:
{
......@@ -906,8 +906,8 @@ void E_(Execute)( httpd_file_sys_t *p_args,
vlc_bool_t i_test;
char *endif;
EvaluateRPN( p_intf, p_args->vars, &p_args->stack, m.param1 );
if( SSPopN( &p_args->stack, p_args->vars ) )
E_(EvaluateRPN)( p_intf, p_args->vars, &p_args->stack, m.param1 );
if( E_(SSPopN)( &p_args->stack, p_args->vars ) )
{
i_test = 1;
}
......@@ -915,15 +915,15 @@ void E_(Execute)( httpd_file_sys_t *p_args,
{
i_test = 0;
}
endif = MacroSearch( src, end, MVLC_END, VLC_TRUE );
endif = E_(MacroSearch)( src, end, MVLC_END, VLC_TRUE );
if( i_test == 0 )
{
char *start = MacroSearch( src, endif, MVLC_ELSE, VLC_TRUE );
char *start = E_(MacroSearch)( src, endif, MVLC_ELSE, VLC_TRUE );
if( start )
{
char *stop = MacroSearch( start, endif, MVLC_END, VLC_FALSE );
char *stop = E_(MacroSearch)( start, endif, MVLC_END, VLC_FALSE );
if( stop )
{
E_(Execute)( p_args, p_request, i_request,
......@@ -934,9 +934,9 @@ void E_(Execute)( httpd_file_sys_t *p_args,
else if( i_test == 1 )
{
char *stop;
if( ( stop = MacroSearch( src, endif, MVLC_ELSE, VLC_FALSE ) ) == NULL )
if( ( stop = E_(MacroSearch)( src, endif, MVLC_ELSE, VLC_FALSE ) ) == NULL )
{
stop = MacroSearch( src, endif, MVLC_END, VLC_FALSE );
stop = E_(MacroSearch)( src, endif, MVLC_END, VLC_FALSE );
}
if( stop )
{
......@@ -950,9 +950,9 @@ void E_(Execute)( httpd_file_sys_t *p_args,
}
case MVLC_FOREACH:
{
char *endfor = MacroSearch( src, end, MVLC_END, VLC_TRUE );
char *endfor = E_(MacroSearch)( src, end, MVLC_END, VLC_TRUE );
char *start = src;
char *stop = MacroSearch( src, end, MVLC_END, VLC_FALSE );
char *stop = E_(MacroSearch)( src, end, MVLC_END, VLC_FALSE );
if( stop )
{
......@@ -961,24 +961,24 @@ void E_(Execute)( httpd_file_sys_t *p_args,
mvar_t *v;
if( !strcmp( m.param2, "integer" ) )
{
char *arg = SSPop( &p_args->stack );
index = mvar_IntegerSetNew( m.param1, arg );
char *arg = E_(SSPop)( &p_args->stack );
index = E_(mvar_IntegerSetNew)( m.param1, arg );
free( arg );
}
else if( !strcmp( m.param2, "directory" ) )
{
char *arg = SSPop( &p_args->stack );
index = mvar_FileSetNew( p_intf, m.param1, arg );
char *arg = E_(SSPop)( &p_args->stack );
index = E_(mvar_FileSetNew)( p_intf, m.param1, arg );
free( arg );
}
else if( !strcmp( m.param2, "playlist" ) )
{
index = mvar_PlaylistSetNew( p_intf, m.param1,
index = E_(mvar_PlaylistSetNew)( p_intf, m.param1,
p_intf->p_sys->p_playlist );
}
else if( !strcmp( m.param2, "information" ) )
{
index = mvar_InfoSetNew( p_intf, m.param1,
index = E_(mvar_InfoSetNew)( p_intf, m.param1,
p_intf->p_sys->p_input );
}
else if( !strcmp( m.param2, "program" )
......@@ -988,7 +988,7 @@ void E_(Execute)( httpd_file_sys_t *p_args,
|| !strcmp( m.param2, "video-es" )
|| !strcmp( m.param2, "spu-es" ) )
{
index = mvar_InputVarSetNew( p_intf, m.param1,
index = E_(mvar_InputVarSetNew)( p_intf, m.param1,
p_intf->p_sys->p_input,
m.param2 );
}
......@@ -996,25 +996,25 @@ void E_(Execute)( httpd_file_sys_t *p_args,
{
if( p_intf->p_sys->p_vlm == NULL )
p_intf->p_sys->p_vlm = vlm_New( p_intf );
index = mvar_VlmSetNew( m.param1, p_intf->p_sys->p_vlm );
index = E_(mvar_VlmSetNew)( m.param1, p_intf->p_sys->p_vlm );
}
#if 0
else if( !strcmp( m.param2, "hosts" ) )
{
index = mvar_HttpdInfoSetNew( m.param1, p_intf->p_sys->p_httpd, HTTPD_GET_HOSTS );
index = E_(mvar_HttpdInfoSetNew)( m.param1, p_intf->p_sys->p_httpd, HTTPD_GET_HOSTS );
}
else if( !strcmp( m.param2, "urls" ) )
{
index = mvar_HttpdInfoSetNew( m.param1, p_intf->p_sys->p_httpd, HTTPD_GET_URLS );
index = E_(mvar_HttpdInfoSetNew)( m.param1, p_intf->p_sys->p_httpd, HTTPD_GET_URLS );
}
else if( !strcmp( m.param2, "connections" ) )
{
index = mvar_HttpdInfoSetNew(m.param1, p_intf->p_sys->p_httpd, HTTPD_GET_CONNECTIONS);
index = E_(mvar_HttpdInfoSetNew)(m.param1, p_intf->p_sys->p_httpd, HTTPD_GET_CONNECTIONS);
}
#endif
else if( ( v = mvar_GetVar( p_args->vars, m.param2 ) ) )
else if( ( v = E_(mvar_GetVar)( p_args->vars, m.param2 ) ) )
{
index = mvar_Duplicate( v );
index = E_(mvar_Duplicate)( v );
}
else
{
......@@ -1025,7 +1025,7 @@ void E_(Execute)( httpd_file_sys_t *p_args,
for( i_idx = 0; i_idx < index->i_field; i_idx++ )
{
mvar_t *f = mvar_Duplicate( index->field[i_idx] );
mvar_t *f = E_(mvar_Duplicate)( index->field[i_idx] );
//msg_Dbg( p_intf, "foreach field[%d] name=%s value=%s", i_idx, f->name, f->value );
......@@ -1033,26 +1033,26 @@ void E_(Execute)( httpd_file_sys_t *p_args,
f->name = strdup( m.param1 );
mvar_PushVar( p_args->vars, f );
E_(mvar_PushVar)( p_args->vars, f );
E_(Execute)( p_args, p_request, i_request,
pp_data, pi_data, &dst, start, stop );
mvar_RemoveVar( p_args->vars, f );
E_(mvar_RemoveVar)( p_args->vars, f );
mvar_Delete( f );
E_(mvar_Delete)( f );
}
mvar_Delete( index );
E_(mvar_Delete)( index );
src = endfor;
}
break;
}
default:
MacroDo( p_args, &m, p_request, i_request,
E_(MacroDo)( p_args, &m, p_request, i_request,
pp_data, pi_data, &dst );
break;
}
MacroClean( &m );
E_(MacroClean)( &m );
continue;
}
......
......@@ -39,7 +39,7 @@ static int InsensitiveAlphasort( const struct dirent **foo1,
mvar_t *mvar_New( const char *name, const char *value )
mvar_t *E_(mvar_New)( const char *name, const char *value )
{
mvar_t *v = malloc( sizeof( mvar_t ) );
......@@ -54,7 +54,7 @@ mvar_t *mvar_New( const char *name, const char *value )
return v;
}
void mvar_Delete( mvar_t *v )
void E_(mvar_Delete)( mvar_t *v )
{
int i;
......@@ -63,34 +63,34 @@ void mvar_Delete( mvar_t *v )
for( i = 0; i < v->i_field; i++ )
{
mvar_Delete( v->field[i] );
E_(mvar_Delete)( v->field[i] );
}
free( v->field );
free( v );
}
void mvar_AppendVar( mvar_t *v, mvar_t *f )
void E_(mvar_AppendVar)( mvar_t *v, mvar_t *f )
{
v->field = realloc( v->field, sizeof( mvar_t * ) * ( v->i_field + 2 ) );
v->field[v->i_field] = f;
v->i_field++;
}
mvar_t *mvar_Duplicate( const mvar_t *v )
mvar_t *E_(mvar_Duplicate)( const mvar_t *v )
{
int i;
mvar_t *n;
n = mvar_New( v->name, v->value );
n = E_(mvar_New)( v->name, v->value );
for( i = 0; i < v->i_field; i++ )
{
mvar_AppendVar( n, mvar_Duplicate( v->field[i] ) );
E_(mvar_AppendVar)( n, E_(mvar_Duplicate)( v->field[i] ) );
}
return n;
}
void mvar_PushVar( mvar_t *v, mvar_t *f )
void E_(mvar_PushVar)( mvar_t *v, mvar_t *f )
{
v->field = realloc( v->field, sizeof( mvar_t * ) * ( v->i_field + 2 ) );
if( v->i_field > 0 )
......@@ -101,7 +101,7 @@ void mvar_PushVar( mvar_t *v, mvar_t *f )
v->i_field++;
}
void mvar_RemoveVar( mvar_t *v, mvar_t *f )
void E_(mvar_RemoveVar)( mvar_t *v, mvar_t *f )
{
int i;
for( i = 0; i < v->i_field; i++ )
......@@ -124,7 +124,7 @@ void mvar_RemoveVar( mvar_t *v, mvar_t *f )
/* FIXME should do a realloc */
}
mvar_t *mvar_GetVar( mvar_t *s, const char *name )
mvar_t *E_(mvar_GetVar)( mvar_t *s, const char *name )
{
int i;
char base[512], *field, *p;
......@@ -171,7 +171,7 @@ mvar_t *mvar_GetVar( mvar_t *s, const char *name )
{
if( field )
{
return mvar_GetVar( s->field[i], field );
return E_(mvar_GetVar)( s->field[i], field );
}
else
{
......@@ -183,7 +183,7 @@ mvar_t *mvar_GetVar( mvar_t *s, const char *name )
return NULL;
}
char *mvar_GetValue( mvar_t *v, char *field )
char *E_(mvar_GetValue)( mvar_t *v, char *field )
{
if( *field == '\0' )
{
......@@ -191,7 +191,7 @@ char *mvar_GetValue( mvar_t *v, char *field )
}
else
{
mvar_t *f = mvar_GetVar( v, field );
mvar_t *f = E_(mvar_GetVar)( v, field );
if( f )
{
return f->value;
......@@ -203,27 +203,27 @@ char *mvar_GetValue( mvar_t *v, char *field )
}
}
void mvar_PushNewVar( mvar_t *vars, const char *name,
void E_(mvar_PushNewVar)( mvar_t *vars, const char *name,
const char *value )
{
mvar_t *f = mvar_New( name, value );
mvar_PushVar( vars, f );
mvar_t *f = E_(mvar_New)( name, value );
E_(mvar_PushVar)( vars, f );
}
void mvar_AppendNewVar( mvar_t *vars, const char *name,
void E_(mvar_AppendNewVar)( mvar_t *vars, const char *name,
const char *value )
{
mvar_t *f = mvar_New( name, value );
mvar_AppendVar( vars, f );
mvar_t *f = E_(mvar_New)( name, value );
E_(mvar_AppendVar)( vars, f );
}
/* arg= start[:stop[:step]],.. */
mvar_t *mvar_IntegerSetNew( const char *name, const char *arg )
mvar_t *E_(mvar_IntegerSetNew)( const char *name, const char *arg )
{
char *dup = strdup( arg );
char *str = dup;
mvar_t *s = mvar_New( name, "set" );
mvar_t *s = E_(mvar_New)( name, "set" );
while( str )
{
......@@ -269,7 +269,7 @@ mvar_t *mvar_IntegerSetNew( const char *name, const char *arg )
sprintf( value, "%d", i );
mvar_PushNewVar( s, name, value );
E_(mvar_PushNewVar)( s, name, value );
}
}
}
......@@ -284,11 +284,11 @@ mvar_t *mvar_IntegerSetNew( const char *name, const char *arg )
* Special sets handling
********************************************************************/
mvar_t *mvar_PlaylistSetNew( intf_thread_t *p_intf, char *name,
mvar_t *E_(mvar_PlaylistSetNew)( intf_thread_t *p_intf, char *name,
playlist_t *p_pl )
{
playlist_view_t *p_view;
mvar_t *s = mvar_New( name, "set" );
mvar_t *s = E_(mvar_New)( name, "set" );
vlc_mutex_lock( &p_pl->object_lock );
......@@ -303,10 +303,10 @@ mvar_t *mvar_PlaylistSetNew( intf_thread_t *p_intf, char *name,
return s;
}
mvar_t *mvar_InfoSetNew( intf_thread_t *p_intf, char *name,
mvar_t *E_(mvar_InfoSetNew)( intf_thread_t *p_intf, char *name,
input_thread_t *p_input )
{
mvar_t *s = mvar_New( name, "set" );
mvar_t *s = E_(mvar_New)( name, "set" );
int i, j;
if( p_input == NULL )
......@@ -320,42 +320,42 @@ mvar_t *mvar_InfoSetNew( intf_thread_t *p_intf, char *name,
info_category_t *p_category = p_input->input.p_item->pp_categories[i];
char *psz;
mvar_t *cat = mvar_New( name, "set" );
mvar_t *iset = mvar_New( "info", "set" );
mvar_t *cat = E_(mvar_New)( name, "set" );
mvar_t *iset = E_(mvar_New)( "info", "set" );
psz = E_(FromUTF8)( p_intf, p_category->psz_name );
mvar_AppendNewVar( cat, "name", psz );
E_(mvar_AppendNewVar)( cat, "name", psz );
free( psz );
mvar_AppendVar( cat, iset );
E_(mvar_AppendVar)( cat, iset );
for ( j = 0; j < p_category->i_infos; j++ )
{
info_t *p_info = p_category->pp_infos[j];
mvar_t *info = mvar_New( "info", "" );
mvar_t *info = E_(mvar_New)( "info", "" );
char *psz_name = E_(FromUTF8)( p_intf, p_info->psz_name );
char *psz_value = E_(FromUTF8)( p_intf, p_info->psz_value );
msg_Dbg( p_input, "adding info name=%s value=%s",
psz_name, psz_value );
mvar_AppendNewVar( info, "name", psz_name );
mvar_AppendNewVar( info, "value", psz_value );
E_(mvar_AppendNewVar)( info, "name", psz_name );
E_(mvar_AppendNewVar)( info, "value", psz_value );
free( psz_name );
free( psz_value );
mvar_AppendVar( iset, info );
E_(mvar_AppendVar)( iset, info );
}
mvar_AppendVar( s, cat );
E_(mvar_AppendVar)( s, cat );
}
vlc_mutex_unlock( &p_input->input.p_item->lock );
return s;
}
mvar_t *mvar_InputVarSetNew( intf_thread_t *p_intf, char *name,
mvar_t *E_(mvar_InputVarSetNew)( intf_thread_t *p_intf, char *name,
input_thread_t *p_input,
const char *psz_variable )
{
intf_sys_t *p_sys = p_intf->p_sys;
mvar_t *s = mvar_New( name, "set" );
mvar_t *s = E_(mvar_New)( name, "set" );
vlc_value_t val, val_list, text_list;
int i_type, i;
......@@ -413,32 +413,32 @@ mvar_t *mvar_InputVarSetNew( intf_thread_t *p_intf, char *name,
switch( i_type & VLC_VAR_TYPE )
{
case VLC_VAR_STRING:
itm = mvar_New( name, "set" );
itm = E_(mvar_New)( name, "set" );
psz = E_(FromUTF8)( p_intf, text_list.p_list->p_values[i].psz_string );
mvar_AppendNewVar( itm, "name", psz );
E_(mvar_AppendNewVar)( itm, "name", psz );
psz = E_(FromUTF8)( p_intf, val_list.p_list->p_values[i].psz_string );
mvar_AppendNewVar( itm, "id", psz );
E_(mvar_AppendNewVar)( itm, "id", psz );
free( psz );
snprintf( psz_int, sizeof(psz_int), "%d",
( !strcmp( val.psz_string,
val_list.p_list->p_values[i].psz_string )
&& !( i_type & VLC_VAR_ISCOMMAND ) ) );
mvar_AppendNewVar( itm, "selected", psz_int );
mvar_AppendVar( s, itm );
E_(mvar_AppendNewVar)( itm, "selected", psz_int );
E_(mvar_AppendVar)( s, itm );
break;
case VLC_VAR_INTEGER:
itm = mvar_New( name, "set" );
itm = E_(mvar_New)( name, "set" );
psz = E_(FromUTF8)( p_intf, text_list.p_list->p_values[i].psz_string );
mvar_AppendNewVar( itm, "name", psz );
E_(mvar_AppendNewVar)( itm, "name", psz );
snprintf( psz_int, sizeof(psz_int), "%d",
val_list.p_list->p_values[i].i_int );
mvar_AppendNewVar( itm, "id", psz_int );
E_(mvar_AppendNewVar)( itm, "id", psz_int );
snprintf( psz_int, sizeof(psz_int), "%d",
( val.i_int == val_list.p_list->p_values[i].i_int )
&& !( i_type & VLC_VAR_ISCOMMAND ) );
mvar_AppendNewVar( itm, "selected", psz_int );
mvar_AppendVar( s, itm );
E_(mvar_AppendNewVar)( itm, "selected", psz_int );
E_(mvar_AppendVar)( s, itm );
break;
default:
......@@ -453,9 +453,9 @@ mvar_t *mvar_InputVarSetNew( intf_thread_t *p_intf, char *name,
}
#if 0
mvar_t *mvar_HttpdInfoSetNew( char *name, httpd_t *p_httpd, int i_type )
mvar_t *E_(mvar_HttpdInfoSetNew)( char *name, httpd_t *p_httpd, int i_type )
{
mvar_t *s = mvar_New( name, "set" );
mvar_t *s = E_(mvar_New)( name, "set" );
httpd_info_t info;
int i;
......@@ -465,17 +465,17 @@ mvar_t *mvar_HttpdInfoSetNew( char *name, httpd_t *p_httpd, int i_type )
{
mvar_t *inf;
inf = mvar_New( name, "set" );
inf = E_(mvar_New)( name, "set" );
do
{
/* fprintf( stderr," mvar_HttpdInfoSetNew: append name=`%s' value=`%s'\n",
info.info[i].psz_name, info.info[i].psz_value ); */
mvar_AppendNewVar( inf,
E_(mvar_AppendNewVar)( inf,
info.info[i].psz_name,
info.info[i].psz_value );
i++;
} while( i < info.i_count && strcmp( info.info[i].psz_name, "id" ) );
mvar_AppendVar( s, inf );
E_(mvar_AppendVar)( s, inf );
}
}
......@@ -494,10 +494,10 @@ mvar_t *mvar_HttpdInfoSetNew( char *name, httpd_t *p_httpd, int i_type )
}
#endif
mvar_t *mvar_FileSetNew( intf_thread_t *p_intf, char *name,
mvar_t *E_(mvar_FileSetNew)( intf_thread_t *p_intf, char *name,
char *psz_dir )
{
mvar_t *s = mvar_New( name, "set" );
mvar_t *s = E_(mvar_New)( name, "set" );
char tmp[MAX_DIR_SIZE];
#ifdef HAVE_SYS_STAT_H
struct stat stat_info;
......@@ -516,7 +516,11 @@ mvar_t *mvar_FileSetNew( intf_thread_t *p_intf, char *name,
psz_dir = E_(RealPath)( p_intf, psz_dir );
#ifdef HAVE_SYS_STAT_H
if( stat( psz_dir, &stat_info ) == -1 || !S_ISDIR( stat_info.st_mode ) )
if( (stat( psz_dir, &stat_info ) == -1 || !S_ISDIR( stat_info.st_mode ))
# if defined( WIN32 )
&& psz_dir[0] != '\0' && (psz_dir[0] != '\\' || psz_dir[1] != '\0')
# endif
)
{
free( psz_dir );
return s;
......@@ -545,6 +549,11 @@ mvar_t *mvar_FileSetNew( intf_thread_t *p_intf, char *name,
continue;
}
#if defined( WIN32 )
if( psz_dir[0] == '\0' || (psz_dir[0] == '\\' && psz_dir[1] == '\0') )
snprintf( tmp, sizeof(tmp), "%s", p_dir_content->d_name );
else
#endif
snprintf( tmp, sizeof(tmp), "%s%c%s", psz_dir, sep,
p_dir_content->d_name );
......@@ -554,61 +563,73 @@ mvar_t *mvar_FileSetNew( intf_thread_t *p_intf, char *name,
continue;
}
#endif
f = mvar_New( name, "set" );
f = E_(mvar_New)( name, "set" );
psz_tmp = vlc_fix_readdir_charset( p_intf, p_dir_content->d_name );
psz_name = E_(FromUTF8)( p_intf, psz_tmp );
free( psz_tmp );
#if defined( WIN32 )
if( psz_dir[0] == '\0' || (psz_dir[0] == '\\' && psz_dir[1] == '\0') )
{
snprintf( tmp, sizeof(tmp), "%c:", psz_name[0] );
E_(mvar_AppendNewVar)( f, "name", psz_name );
E_(mvar_AppendNewVar)( f, "basename", tmp );
}
else
#endif
{
snprintf( tmp, sizeof(tmp), "%s%c%s", psz_dir, sep, psz_name );
mvar_AppendNewVar( f, "name", tmp );
mvar_AppendNewVar( f, "basename", psz_name );
E_(mvar_AppendNewVar)( f, "name", tmp );
E_(mvar_AppendNewVar)( f, "basename", psz_name );
}
/* put file extension in 'ext' */
psz_ext = strrchr( psz_name, '.' );
mvar_AppendNewVar( f, "ext", psz_ext != NULL ? psz_ext + 1 : "" );
E_(mvar_AppendNewVar)( f, "ext", psz_ext != NULL ? psz_ext + 1 : "" );
free( psz_name );
#ifdef HAVE_SYS_STAT_H
if( S_ISDIR( stat_info.st_mode ) )
{
mvar_AppendNewVar( f, "type", "directory" );
E_(mvar_AppendNewVar)( f, "type", "directory" );
}
else if( S_ISREG( stat_info.st_mode ) )
{
mvar_AppendNewVar( f, "type", "file" );
E_(mvar_AppendNewVar)( f, "type", "file" );
}
else
{
mvar_AppendNewVar( f, "type", "unknown" );
E_(mvar_AppendNewVar)( f, "type", "unknown" );
}
sprintf( tmp, I64Fd, (int64_t)stat_info.st_size );
mvar_AppendNewVar( f, "size", tmp );
E_(mvar_AppendNewVar)( f, "size", tmp );
/* FIXME memory leak FIXME */
#ifdef HAVE_CTIME_R
# ifdef HAVE_CTIME_R
ctime_r( &stat_info.st_mtime, tmp );
mvar_AppendNewVar( f, "date", tmp );
#else
mvar_AppendNewVar( f, "date", ctime( &stat_info.st_mtime ) );
#endif
E_(mvar_AppendNewVar)( f, "date", tmp );
# else
E_(mvar_AppendNewVar)( f, "date", ctime( &stat_info.st_mtime ) );
# endif
#else
mvar_AppendNewVar( f, "type", "unknown" );
mvar_AppendNewVar( f, "size", "unknown" );
mvar_AppendNewVar( f, "date", "unknown" );
E_(mvar_AppendNewVar)( f, "type", "unknown" );
E_(mvar_AppendNewVar)( f, "size", "unknown" );
E_(mvar_AppendNewVar)( f, "date", "unknown" );
#endif
mvar_AppendVar( s, f );
E_(mvar_AppendVar)( s, f );
}
free( psz_dir );
return s;
}
mvar_t *mvar_VlmSetNew( char *name, vlm_t *vlm )
mvar_t *E_(mvar_VlmSetNew)( char *name, vlm_t *vlm )
{
mvar_t *s = mvar_New( name, "set" );
mvar_t *s = E_(mvar_New)( name, "set" );
vlm_message_t *msg;
int i;
......@@ -640,8 +661,8 @@ mvar_t *mvar_VlmSetNew( char *name, vlm_t *vlm )
desc = inf->child[0];
/* Add a node with name and info */
set = mvar_New( name, "set" );
mvar_AppendNewVar( set, "name", el->psz_name );
set = E_(mvar_New)( name, "set" );
E_(mvar_AppendNewVar)( set, "name", el->psz_name );
for( k = 0; k < desc->i_child; k++ )
{
......@@ -649,30 +670,30 @@ mvar_t *mvar_VlmSetNew( char *name, vlm_t *vlm )
if( ch->i_child > 0 )
{
int c;
mvar_t *n = mvar_New( ch->psz_name, "set" );
mvar_t *n = E_(mvar_New)( ch->psz_name, "set" );
for( c = 0; c < ch->i_child; c++ )
{
if( ch->child[c]->psz_value )
{
mvar_AppendNewVar( n, ch->child[c]->psz_name, ch->child[c]->psz_value );
E_(mvar_AppendNewVar)( n, ch->child[c]->psz_name, ch->child[c]->psz_value );
}
else
{
mvar_t *in = mvar_New( ch->psz_name, ch->child[c]->psz_name );
mvar_AppendVar( n, in );
mvar_t *in = E_(mvar_New)( ch->psz_name, ch->child[c]->psz_name );
E_(mvar_AppendVar)( n, in );
}
}
mvar_AppendVar( set, n );
E_(mvar_AppendVar)( set, n );
}
else
{
mvar_AppendNewVar( set, ch->psz_name, ch->psz_value );
E_(mvar_AppendNewVar)( set, ch->psz_name, ch->psz_value );
}
}
vlm_MessageDelete( inf );
mvar_AppendVar( s, set );
E_(mvar_AppendVar)( s, set );
}
}
vlm_MessageDelete( msg );
......
......@@ -62,12 +62,12 @@ static vlc_object_t *GetVLCObject( intf_thread_t *p_intf,
return p_object;
}
void SSInit( rpn_stack_t *st )
void E_(SSInit)( rpn_stack_t *st )
{
st->i_stack = 0;
}
void SSClean( rpn_stack_t *st )
void E_(SSClean)( rpn_stack_t *st )
{
while( st->i_stack > 0 )
{
......@@ -75,7 +75,7 @@ void SSClean( rpn_stack_t *st )
}
}
void SSPush( rpn_stack_t *st, const char *s )
void E_(SSPush)( rpn_stack_t *st, const char *s )
{
if( st->i_stack < STACK_MAX )
{
......@@ -83,7 +83,7 @@ void SSPush( rpn_stack_t *st, const char *s )
}
}
char * SSPop( rpn_stack_t *st )
char *E_(SSPop)( rpn_stack_t *st )
{
if( st->i_stack <= 0 )
{
......@@ -95,7 +95,7 @@ char * SSPop( rpn_stack_t *st )
}
}
int SSPopN( rpn_stack_t *st, mvar_t *vars )
int E_(SSPopN)( rpn_stack_t *st, mvar_t *vars )
{
char *name;
char *value;
......@@ -103,11 +103,11 @@ int SSPopN( rpn_stack_t *st, mvar_t *vars )
char *end;
int i;
name = SSPop( st );
name = E_(SSPop)( st );
i = strtol( name, &end, 0 );
if( end == name )
{
value = mvar_GetValue( vars, name );
value = E_(mvar_GetValue)( vars, name );
i = atoi( value );
}
free( name );
......@@ -115,15 +115,15 @@ int SSPopN( rpn_stack_t *st, mvar_t *vars )
return( i );
}
void SSPushN( rpn_stack_t *st, int i )
void E_(SSPushN)( rpn_stack_t *st, int i )
{
char v[512];
sprintf( v, "%d", i );
SSPush( st, v );
E_(SSPush)( st, v );
}
void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars,
void E_(EvaluateRPN)( intf_thread_t *p_intf, mvar_t *vars,
rpn_stack_t *st, char *exp )
{
intf_sys_t *p_sys = p_intf->p_sys;
......@@ -142,7 +142,7 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars,
{
/* extract string */
p = E_(FirstWord)( exp, exp );
SSPush( st, exp );
E_(SSPush)( st, exp );
exp = p;
continue;
}
......@@ -167,129 +167,129 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars,
/* 1. Integer function */
if( !strcmp( s, "!" ) )
{
SSPushN( st, ~SSPopN( st, vars ) );
E_(SSPushN)( st, ~E_(SSPopN)( st, vars ) );
}
else if( !strcmp( s, "^" ) )
{
SSPushN( st, SSPopN( st, vars ) ^ SSPopN( st, vars ) );
E_(SSPushN)( st, E_(SSPopN)( st, vars ) ^ E_(SSPopN)( st, vars ) );
}
else if( !strcmp( s, "&" ) )
{
SSPushN( st, SSPopN( st, vars ) & SSPopN( st, vars ) );
E_(SSPushN)( st, E_(SSPopN)( st, vars ) & E_(SSPopN)( st, vars ) );
}
else if( !strcmp( s, "|" ) )
{
SSPushN( st, SSPopN( st, vars ) | SSPopN( st, vars ) );
E_(SSPushN)( st, E_(SSPopN)( st, vars ) | E_(SSPopN)( st, vars ) );
}
else if( !strcmp( s, "+" ) )
{
SSPushN( st, SSPopN( st, vars ) + SSPopN( st, vars ) );
E_(SSPushN)( st, E_(SSPopN)( st, vars ) + E_(SSPopN)( st, vars ) );
}
else if( !strcmp( s, "-" ) )
{
int j = SSPopN( st, vars );
int i = SSPopN( st, vars );
SSPushN( st, i - j );
int j = E_(SSPopN)( st, vars );
int i = E_(SSPopN)( st, vars );
E_(SSPushN)( st, i - j );
}
else if( !strcmp( s, "*" ) )
{
SSPushN( st, SSPopN( st, vars ) * SSPopN( st, vars ) );
E_(SSPushN)( st, E_(SSPopN)( st, vars ) * E_(SSPopN)( st, vars ) );
}
else if( !strcmp( s, "/" ) )
{
int i, j;
j = SSPopN( st, vars );
i = SSPopN( st, vars );
j = E_(SSPopN)( st, vars );
i = E_(SSPopN)( st, vars );
SSPushN( st, j != 0 ? i / j : 0 );
E_(SSPushN)( st, j != 0 ? i / j : 0 );
}
else if( !strcmp( s, "%" ) )
{
int i, j;
j = SSPopN( st, vars );
i = SSPopN( st, vars );
j = E_(SSPopN)( st, vars );
i = E_(SSPopN)( st, vars );
SSPushN( st, j != 0 ? i % j : 0 );
E_(SSPushN)( st, j != 0 ? i % j : 0 );
}
/* 2. integer tests */
else if( !strcmp( s, "=" ) )
{
SSPushN( st, SSPopN( st, vars ) == SSPopN( st, vars ) ? -1 : 0 );
E_(SSPushN)( st, E_(SSPopN)( st, vars ) == E_(SSPopN)( st, vars ) ? -1 : 0 );
}
else if( !strcmp( s, "!=" ) )
{
SSPushN( st, SSPopN( st, vars ) != SSPopN( st, vars ) ? -1 : 0 );
E_(SSPushN)( st, E_(SSPopN)( st, vars ) != E_(SSPopN)( st, vars ) ? -1 : 0 );
}
else if( !strcmp( s, "<" ) )
{
int j = SSPopN( st, vars );
int i = SSPopN( st, vars );
int j = E_(SSPopN)( st, vars );
int i = E_(SSPopN)( st, vars );
SSPushN( st, i < j ? -1 : 0 );
E_(SSPushN)( st, i < j ? -1 : 0 );
}
else if( !strcmp( s, ">" ) )
{
int j = SSPopN( st, vars );
int i = SSPopN( st, vars );
int j = E_(SSPopN)( st, vars );
int i = E_(SSPopN)( st, vars );
SSPushN( st, i > j ? -1 : 0 );
E_(SSPushN)( st, i > j ? -1 : 0 );
}
else if( !strcmp( s, "<=" ) )
{
int j = SSPopN( st, vars );
int i = SSPopN( st, vars );
int j = E_(SSPopN)( st, vars );
int i = E_(SSPopN)( st, vars );
SSPushN( st, i <= j ? -1 : 0 );
E_(SSPushN)( st, i <= j ? -1 : 0 );
}
else if( !strcmp( s, ">=" ) )
{
int j = SSPopN( st, vars );
int i = SSPopN( st, vars );
int j = E_(SSPopN)( st, vars );
int i = E_(SSPopN)( st, vars );
SSPushN( st, i >= j ? -1 : 0 );
E_(SSPushN)( st, i >= j ? -1 : 0 );
}
/* 3. string functions */
else if( !strcmp( s, "strcat" ) )
{
char *s2 = SSPop( st );
char *s1 = SSPop( st );
char *s2 = E_(SSPop)( st );
char *s1 = E_(SSPop)( st );
char *str = malloc( strlen( s1 ) + strlen( s2 ) + 1 );
strcpy( str, s1 );
strcat( str, s2 );
SSPush( st, str );
E_(SSPush)( st, str );
free( s1 );
free( s2 );
free( str );
}
else if( !strcmp( s, "strcmp" ) )
{
char *s2 = SSPop( st );
char *s1 = SSPop( st );
char *s2 = E_(SSPop)( st );
char *s1 = E_(SSPop)( st );
SSPushN( st, strcmp( s1, s2 ) );
E_(SSPushN)( st, strcmp( s1, s2 ) );
free( s1 );
free( s2 );
}
else if( !strcmp( s, "strncmp" ) )
{
int n = SSPopN( st, vars );
char *s2 = SSPop( st );
char *s1 = SSPop( st );
int n = E_(SSPopN)( st, vars );
char *s2 = E_(SSPop)( st );
char *s1 = E_(SSPop)( st );
SSPushN( st, strncmp( s1, s2 , n ) );
E_(SSPushN)( st, strncmp( s1, s2 , n ) );
free( s1 );
free( s2 );
}
else if( !strcmp( s, "strsub" ) )
{
int n = SSPopN( st, vars );
int m = SSPopN( st, vars );
int n = E_(SSPopN)( st, vars );
int m = E_(SSPopN)( st, vars );
int i_len;
char *s = SSPop( st );
char *s = E_(SSPop)( st );
char *str;
if( n >= m )
......@@ -306,22 +306,22 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars,
memcpy( str, s + m - 1, i_len );
str[ i_len ] = '\0';
SSPush( st, str );
E_(SSPush)( st, str );
free( s );
free( str );
}
else if( !strcmp( s, "strlen" ) )
{
char *str = SSPop( st );
char *str = E_(SSPop)( st );
SSPushN( st, strlen( str ) );
E_(SSPushN)( st, strlen( str ) );
free( str );
}
else if( !strcmp( s, "str_replace" ) )
{
char *psz_to = SSPop( st );
char *psz_from = SSPop( st );
char *psz_in = SSPop( st );
char *psz_to = E_(SSPop)( st );
char *psz_from = E_(SSPop)( st );
char *psz_in = E_(SSPop)( st );
char *psz_in_current = psz_in;
char *psz_out = malloc( strlen(psz_in) * strlen(psz_to) + 1 );
char *psz_out_current = psz_out;
......@@ -338,7 +338,7 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars,
psz_out_current += strlen(psz_in_current);
*psz_out_current = '\0';
SSPush( st, psz_out );
E_(SSPush)( st, psz_out );
free( psz_to );
free( psz_from );
free( psz_in );
......@@ -346,21 +346,21 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars,
}
else if( !strcmp( s, "url_extract" ) )
{
char *url = mvar_GetValue( vars, "url_value" );
char *name = SSPop( st );
char *url = E_(mvar_GetValue)( vars, "url_value" );
char *name = E_(SSPop)( st );
char value[512];
char *tmp;
E_(ExtractURIValue)( url, name, value, 512 );
E_(DecodeEncodedURI)( value );
tmp = E_(FromUTF8)( p_intf, value );
SSPush( st, tmp );
E_(SSPush)( st, tmp );
free( tmp );
free( name );
}
else if( !strcmp( s, "url_encode" ) )
{
char *url = SSPop( st );
char *url = E_(SSPop)( st );
char *value;
value = E_(ToUTF8)( p_intf, url );
......@@ -368,12 +368,12 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars,
url = value;
value = vlc_UrlEncode( url );
free( url );
SSPush( st, value );
E_(SSPush)( st, value );
free( value );
}
else if( !strcmp( s, "addslashes" ) )
{
char *psz_src = SSPop( st );
char *psz_src = E_(SSPop)( st );
char *psz_dest;
char *str = psz_src;
......@@ -390,13 +390,13 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars,
}
*p = '\0';
SSPush( st, psz_dest );
E_(SSPush)( st, psz_dest );
free( psz_src );
free( psz_dest );
}
else if( !strcmp( s, "stripslashes" ) )
{
char *psz_src = SSPop( st );
char *psz_src = E_(SSPop)( st );
char *psz_dest;
p = psz_dest = strdup( psz_src );
......@@ -412,13 +412,13 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars,
}
*p = '\0';
SSPush( st, psz_dest );
E_(SSPush)( st, psz_dest );
free( psz_src );
free( psz_dest );
}
else if( !strcmp( s, "htmlspecialchars" ) )
{
char *psz_src = SSPop( st );
char *psz_src = E_(SSPop)( st );
char *psz_dest;
char *str = psz_src;
......@@ -459,77 +459,76 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars,
}
*p = '\0';
SSPush( st, psz_dest );
E_(SSPush)( st, psz_dest );
free( psz_src );
free( psz_dest );
}
else if( !strcmp( s, "realpath" ) )
{
char *psz_src = SSPop( st );
char *psz_src = E_(SSPop)( st );
char *psz_dir = E_(RealPath)( p_intf, psz_src );
char sep;
SSPush( st, psz_dir );
E_(SSPush)( st, psz_dir );
free( psz_src );
free( psz_dir );
}
/* 4. stack functions */
else if( !strcmp( s, "dup" ) )
{
char *str = SSPop( st );
SSPush( st, str );
SSPush( st, str );
char *str = E_(SSPop)( st );
E_(SSPush)( st, str );
E_(SSPush)( st, str );
free( str );
}
else if( !strcmp( s, "drop" ) )
{
char *str = SSPop( st );
char *str = E_(SSPop)( st );
free( str );
}
else if( !strcmp( s, "swap" ) )
{
char *s1 = SSPop( st );
char *s2 = SSPop( st );
char *s1 = E_(SSPop)( st );
char *s2 = E_(SSPop)( st );
SSPush( st, s1 );
SSPush( st, s2 );
E_(SSPush)( st, s1 );
E_(SSPush)( st, s2 );
free( s1 );
free( s2 );
}
else if( !strcmp( s, "flush" ) )
{
SSClean( st );
SSInit( st );
E_(SSClean)( st );
E_(SSInit)( st );
}
else if( !strcmp( s, "store" ) )
{
char *value = SSPop( st );
char *name = SSPop( st );
char *value = E_(SSPop)( st );
char *name = E_(SSPop)( st );
mvar_PushNewVar( vars, name, value );
E_(mvar_PushNewVar)( vars, name, value );
free( name );
free( value );
}
else if( !strcmp( s, "value" ) )
{
char *name = SSPop( st );
char *value = mvar_GetValue( vars, name );
char *name = E_(SSPop)( st );
char *value = E_(mvar_GetValue)( vars, name );
SSPush( st, value );
E_(SSPush)( st, value );
free( name );
}
/* 5. player control */
else if( !strcmp( s, "vlc_play" ) )
{
int i_id = SSPopN( st, vars );
int i_id = E_(SSPopN)( st, vars );
int i_ret;
i_ret = playlist_Control( p_sys->p_playlist, PLAYLIST_ITEMPLAY,
playlist_ItemGetById( p_sys->p_playlist,
i_id ) );
msg_Dbg( p_intf, "requested playlist item: %i", i_id );
SSPushN( st, i_ret );
E_(SSPushN)( st, i_ret );
}
else if( !strcmp( s, "vlc_stop" ) )
{
......@@ -553,7 +552,7 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars,
}
else if( !strcmp( s, "vlc_seek" ) )
{
char *psz_value = SSPop( st );
char *psz_value = E_(SSPop)( st );
E_(HandleSeek)( p_intf, psz_value );
msg_Dbg( p_intf, "requested playlist seek: %s", psz_value );
free( psz_value );
......@@ -567,8 +566,8 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars,
if( !strcmp( s, "vlc_var_type" ) )
{
char *psz_object = SSPop( st );
char *psz_variable = SSPop( st );
char *psz_object = E_(SSPop)( st );
char *psz_variable = E_(SSPop)( st );
vlc_bool_t b_need_release;
p_object = GetVLCObject( p_intf, psz_object, &b_need_release );
......@@ -582,7 +581,7 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars,
}
else
{
char *psz_variable = SSPop( st );
char *psz_variable = E_(SSPop)( st );
p_object = VLC_OBJECT(p_intf);
i_type = config_GetType( p_object, psz_variable );
free( psz_variable );
......@@ -626,12 +625,12 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars,
else
psz_type = "INVALID";
SSPush( st, psz_type );
E_(SSPush)( st, psz_type );
}
else if( !strcmp( s, "vlc_var_set" ) )
{
char *psz_object = SSPop( st );
char *psz_variable = SSPop( st );
char *psz_object = E_(SSPop)( st );
char *psz_variable = E_(SSPop)( st );
vlc_bool_t b_need_release;
vlc_object_t *p_object = GetVLCObject( p_intf, psz_object,
......@@ -649,13 +648,13 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars,
switch( i_type & VLC_VAR_TYPE )
{
case VLC_VAR_BOOL:
val.b_bool = SSPopN( st, vars );
val.b_bool = E_(SSPopN)( st, vars );
msg_Dbg( p_intf, "requested %s var change: %s->%d",
psz_object, psz_variable, val.b_bool );
break;
case VLC_VAR_INTEGER:
case VLC_VAR_HOTKEY:
val.i_int = SSPopN( st, vars );
val.i_int = E_(SSPopN)( st, vars );
msg_Dbg( p_intf, "requested %s var change: %s->%d",
psz_object, psz_variable, val.i_int );
break;
......@@ -664,18 +663,18 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars,
case VLC_VAR_FILE:
case VLC_VAR_DIRECTORY:
case VLC_VAR_VARIABLE:
val.psz_string = psz_value = SSPop( st );
val.psz_string = psz_value = E_(SSPop)( st );
msg_Dbg( p_intf, "requested %s var change: %s->%s",
psz_object, psz_variable, psz_value );
break;
case VLC_VAR_FLOAT:
psz_value = SSPop( st );
psz_value = E_(SSPop)( st );
val.f_float = atof( psz_value );
msg_Dbg( p_intf, "requested %s var change: %s->%f",
psz_object, psz_variable, val.f_float );
break;
default:
SSPopN( st, vars );
E_(SSPopN)( st, vars );
msg_Warn( p_intf, "invalid %s variable type %d (%s)",
psz_object, i_type & VLC_VAR_TYPE, psz_variable );
b_error = VLC_TRUE;
......@@ -696,8 +695,8 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars,
}
else if( !strcmp( s, "vlc_var_get" ) )
{
char *psz_object = SSPop( st );
char *psz_variable = SSPop( st );
char *psz_object = E_(SSPop)( st );
char *psz_variable = E_(SSPop)( st );
vlc_bool_t b_need_release;
vlc_object_t *p_object = GetVLCObject( p_intf, psz_object,
......@@ -714,37 +713,37 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars,
switch( i_type & VLC_VAR_TYPE )
{
case VLC_VAR_BOOL:
SSPushN( st, val.b_bool );
E_(SSPushN)( st, val.b_bool );
break;
case VLC_VAR_INTEGER:
case VLC_VAR_HOTKEY:
SSPushN( st, val.i_int );
E_(SSPushN)( st, val.i_int );
break;
case VLC_VAR_STRING:
case VLC_VAR_MODULE:
case VLC_VAR_FILE:
case VLC_VAR_DIRECTORY:
case VLC_VAR_VARIABLE:
SSPush( st, val.psz_string );
E_(SSPush)( st, val.psz_string );
free( val.psz_string );
break;
case VLC_VAR_FLOAT:
{
char psz_value[20];
snprintf( psz_value, sizeof(psz_value), "%f", val.f_float );
SSPush( st, psz_value );
E_(SSPush)( st, psz_value );
break;
}
default:
msg_Warn( p_intf, "invalid %s variable type %d (%s)",
psz_object, i_type & VLC_VAR_TYPE, psz_variable );
SSPush( st, "" );
E_(SSPush)( st, "" );
}
}
else
{
msg_Warn( p_intf, "vlc_var_get called without an object" );
SSPush( st, "" );
E_(SSPush)( st, "" );
}
free( psz_variable );
free( psz_object );
......@@ -754,28 +753,28 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars,
}
else if( !strcmp( s, "vlc_config_set" ) )
{
char *psz_variable = SSPop( st );
char *psz_variable = E_(SSPop)( st );
int i_type = config_GetType( p_intf, psz_variable );
switch( i_type & VLC_VAR_TYPE )
{
case VLC_VAR_BOOL:
case VLC_VAR_INTEGER:
config_PutInt( p_intf, psz_variable, SSPopN( st, vars ) );
config_PutInt( p_intf, psz_variable, E_(SSPopN)( st, vars ) );
break;
case VLC_VAR_STRING:
case VLC_VAR_MODULE:
case VLC_VAR_FILE:
case VLC_VAR_DIRECTORY:
{
char *psz_string = SSPop( st );
char *psz_string = E_(SSPop)( st );
config_PutPsz( p_intf, psz_variable, psz_string );
free( psz_string );
break;
}
case VLC_VAR_FLOAT:
{
char *psz_string = SSPop( st );
char *psz_string = E_(SSPop)( st );
config_PutFloat( p_intf, psz_variable, atof(psz_string) );
free( psz_string );
break;
......@@ -788,14 +787,14 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars,
}
else if( !strcmp( s, "vlc_config_get" ) )
{
char *psz_variable = SSPop( st );
char *psz_variable = E_(SSPop)( st );
int i_type = config_GetType( p_intf, psz_variable );
switch( i_type & VLC_VAR_TYPE )
{
case VLC_VAR_BOOL:
case VLC_VAR_INTEGER:
SSPushN( st, config_GetInt( p_intf, psz_variable ) );
E_(SSPushN)( st, config_GetInt( p_intf, psz_variable ) );
break;
case VLC_VAR_STRING:
case VLC_VAR_MODULE:
......@@ -803,7 +802,7 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars,
case VLC_VAR_DIRECTORY:
{
char *psz_string = config_GetPsz( p_intf, psz_variable );
SSPush( st, psz_string );
E_(SSPush)( st, psz_string );
free( psz_string );
break;
}
......@@ -812,7 +811,7 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars,
char psz_string[20];
snprintf( psz_string, sizeof(psz_string), "%f",
config_GetFloat( p_intf, psz_variable ) );
SSPush( st, psz_string );
E_(SSPush)( st, psz_string );
break;
}
default:
......@@ -823,7 +822,7 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars,
}
else if( !strcmp( s, "vlc_config_save" ) )
{
char *psz_module = SSPop( st );
char *psz_module = E_(SSPop)( st );
int i_result;
if( !*psz_module )
......@@ -835,7 +834,7 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars,
if( psz_module != NULL )
free( psz_module );
SSPushN( st, i_result );
E_(SSPushN)( st, i_result );
}
else if( !strcmp( s, "vlc_config_reset" ) )
{
......@@ -844,8 +843,8 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars,
/* 6. playlist functions */
else if( !strcmp( s, "playlist_add" ) )
{
char *psz_name = SSPop( st );
char *mrl = SSPop( st );
char *psz_name = E_(SSPop)( st );
char *mrl = E_(SSPop)( st );
char *tmp;
playlist_item_t *p_item;
int i_id;
......@@ -878,7 +877,7 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars,
PLAYLIST_APPEND, PLAYLIST_END );
msg_Dbg( p_intf, "requested mrl add: %s", mrl );
}
SSPushN( st, i_id );
E_(SSPushN)( st, i_id );
free( mrl );
free( psz_name );
......@@ -890,14 +889,14 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars,
}
else if( !strcmp( s, "playlist_delete" ) )
{
int i_id = SSPopN( st, vars );
int i_id = E_(SSPopN)( st, vars );
playlist_LockDelete( p_sys->p_playlist, i_id );
msg_Dbg( p_intf, "requested playlist delete: %d", i_id );
}
else if( !strcmp( s, "playlist_move" ) )
{
int i_newpos = SSPopN( st, vars );
int i_pos = SSPopN( st, vars );
int i_newpos = E_(SSPopN)( st, vars );
int i_pos = E_(SSPopN)( st, vars );
if ( i_pos < i_newpos )
{
playlist_Move( p_sys->p_playlist, i_pos, i_newpos + 1 );
......@@ -911,7 +910,7 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars,
}
else
{
SSPush( st, s );
E_(SSPush)( st, s );
}
}
}
......@@ -361,55 +361,55 @@ void E_(PlaylistListNode)( intf_thread_t *p_intf, playlist_t *p_pl,
{
char value[512];
char *psz;
mvar_t *itm = mvar_New( name, "set" );
mvar_t *itm = E_(mvar_New)( name, "set" );
sprintf( value, "%d", ( p_pl->status.p_item == p_node )? 1 : 0 );
mvar_AppendNewVar( itm, "current", value );
E_(mvar_AppendNewVar)( itm, "current", value );
sprintf( value, "%d", p_node->input.i_id );
mvar_AppendNewVar( itm, "index", value );
E_(mvar_AppendNewVar)( itm, "index", value );
psz = E_(FromUTF8)( p_intf, p_node->input.psz_name );
mvar_AppendNewVar( itm, "name", psz );
E_(mvar_AppendNewVar)( itm, "name", psz );
free( psz );
psz = E_(FromUTF8)( p_intf, p_node->input.psz_uri );
mvar_AppendNewVar( itm, "uri", psz );
E_(mvar_AppendNewVar)( itm, "uri", psz );
free( psz );
sprintf( value, "Item");
mvar_AppendNewVar( itm, "type", value );
E_(mvar_AppendNewVar)( itm, "type", value );
sprintf( value, "%d", i_depth );
mvar_AppendNewVar( itm, "depth", value );
E_(mvar_AppendNewVar)( itm, "depth", value );
mvar_AppendVar( s, itm );
E_(mvar_AppendVar)( s, itm );
}
else
{
char value[512];
char *psz;
int i_child;
mvar_t *itm = mvar_New( name, "set" );
mvar_t *itm = E_(mvar_New)( name, "set" );
psz = E_(FromUTF8)( p_intf, p_node->input.psz_name );
mvar_AppendNewVar( itm, "name", psz );
mvar_AppendNewVar( itm, "uri", psz );
E_(mvar_AppendNewVar)( itm, "name", psz );
E_(mvar_AppendNewVar)( itm, "uri", psz );
free( psz );
sprintf( value, "Node" );
mvar_AppendNewVar( itm, "type", value );
E_(mvar_AppendNewVar)( itm, "type", value );
sprintf( value, "%d", p_node->input.i_id );
mvar_AppendNewVar( itm, "index", value );
E_(mvar_AppendNewVar)( itm, "index", value );
sprintf( value, "%d", p_node->i_children);
mvar_AppendNewVar( itm, "i_children", value );
E_(mvar_AppendNewVar)( itm, "i_children", value );
sprintf( value, "%d", i_depth );
mvar_AppendNewVar( itm, "depth", value );
E_(mvar_AppendNewVar)( itm, "depth", value );
mvar_AppendVar( s, itm );
E_(mvar_AppendVar)( s, itm );
for (i_child = 0 ; i_child < p_node->i_children ; i_child++)
E_(PlaylistListNode)( p_intf, p_pl,
......@@ -871,7 +871,7 @@ char *E_(RealPath)( intf_thread_t *p_intf, const char *psz_src )
}
else
{
memmove( psz_dir, p + 1, strlen(p + 1) + 1 );
memmove( psz_dir, p, strlen(p) + 1 );
p = psz_dir + 3;
}
}
......
......@@ -16,25 +16,30 @@ include/modules.h
include/modules_inner.h
include/mtime.h
include/network.h
include/osd.h
include/os_specific.h
include/osd.h
include/snapshot.h
include/stream_output.h
include/variables.h
include/video_output.h
include/vlc/aout.h
include/vlc/control.h
include/vlc/decoder.h
include/vlc/input.h
include/vlc/intf.h
include/vlc/sout.h
include/vlc/vlc.h
include/vlc/vout.h
include/vlc_access.h
include/vlc_acl.h
include/vlc/aout.h
include/vlc_bits.h
include/vlc_block.h
include/vlc_block_helper.h
include/vlc_codec.h
include/vlc_common.h
include/vlc_config_cat.h
include/vlc_config.h
include/vlc/control.h
include/vlc_config_cat.h
include/vlc_cpu.h
include/vlc/decoder.h
include/vlc_demux.h
include/vlc_error.h
include/vlc_es.h
......@@ -43,9 +48,7 @@ include/vlc_filter.h
include/vlc_httpd.h
include/vlc_image.h
include/vlc_input.h
include/vlc/input.h
include/vlc_interface.h
include/vlc/intf.h
include/vlc_keys.h
include/vlc_md5.h
include/vlc_messages.h
......@@ -53,17 +56,14 @@ include/vlc_meta.h
include/vlc_objects.h
include/vlc_osd.h
include/vlc_playlist.h
include/vlc/sout.h
include/vlc_spu.h
include/vlc_stream.h
include/vlc_threads_funcs.h
include/vlc_threads.h
include/vlc_threads_funcs.h
include/vlc_tls.h
include/vlc_video.h
include/vlc/vlc.h
include/vlc_vlm.h
include/vlc_vod.h
include/vlc/vout.h
include/vlc_xml.h
include/vout_synchro.h
include/win32_specific.h
......@@ -80,9 +80,9 @@ src/control/init.c
src/control/plugin.c
src/control/util.c
src/extras/dirent.c
src/extras/getopt1.c
src/extras/getopt.c
src/extras/getopt.h
src/extras/getopt1.c
src/extras/libc.c
src/input/access.c
src/input/clock.c
......@@ -128,8 +128,8 @@ src/misc/xml.c
src/osd/osd.c
src/osd/osd_parser.c
src/osd/osd_widgets.c
src/playlist/item.c
src/playlist/item-ext.c
src/playlist/item.c
src/playlist/loadsave.c
src/playlist/playlist.c
src/playlist/services_discovery.c
......@@ -150,9 +150,9 @@ src/video_output/vout_synchro.c
src/vlc.c
# modules
modules/access/cdda.c
modules/access/cdda/access.c
modules/access/cdda/access.h
modules/access/cdda.c
modules/access/cdda/callback.c
modules/access/cdda/callback.h
modules/access/cdda/cdda.c
......@@ -173,8 +173,6 @@ modules/access/dvdnav.c
modules/access/dvdread.c
modules/access/fake.c
modules/access/file.c
modules/access_filter/record.c
modules/access_filter/timeshift.c
modules/access/ftp.c
modules/access/http.c
modules/access/mms/asf.c
......@@ -187,10 +185,6 @@ modules/access/mms/mmsh.c
modules/access/mms/mmsh.h
modules/access/mms/mmstu.c
modules/access/mms/mmstu.h
modules/access_output/dummy.c
modules/access_output/file.c
modules/access_output/http.c
modules/access_output/udp.c
modules/access/pvr/pvr.c
modules/access/pvr/videodev2.h
modules/access/screen/beos.cpp
......@@ -218,6 +212,12 @@ modules/access/vcdx/vcd.c
modules/access/vcdx/vcd.h
modules/access/vcdx/vcdplayer.c
modules/access/vcdx/vcdplayer.h
modules/access_filter/record.c
modules/access_filter/timeshift.c
modules/access_output/dummy.c
modules/access_output/file.c
modules/access_output/http.c
modules/access_output/udp.c
modules/audio_filter/channel_mixer/headphone.c
modules/audio_filter/channel_mixer/simple.c
modules/audio_filter/channel_mixer/trivial.c
......@@ -327,7 +327,13 @@ modules/control/corba/mediacontrol-init.c
modules/control/corba/mediacontrol-plugin.c
modules/control/gestures.c
modules/control/hotkeys.c
modules/control/http.c
modules/control/http/http.c
modules/control/http/http.h
modules/control/http/macro.c
modules/control/http/macros.h
modules/control/http/mvar.c
modules/control/http/rpn.c
modules/control/http/util.c
modules/control/lirc.c
modules/control/netsync.c
modules/control/ntservice.c
......@@ -366,6 +372,7 @@ modules/demux/nsv.c
modules/demux/nuv.c
modules/demux/ogg.c
modules/demux/playlist/b4s.c
modules/demux/playlist/dvb.c
modules/demux/playlist/m3u.c
modules/demux/playlist/old.c
modules/demux/playlist/playlist.c
......@@ -431,24 +438,26 @@ modules/gui/macosx/open.m
modules/gui/macosx/output.h
modules/gui/macosx/output.m
modules/gui/macosx/playlist.h
modules/gui/macosx/playlist.m
modules/gui/macosx/playlistinfo.h
modules/gui/macosx/playlistinfo.m
modules/gui/macosx/playlist.m
modules/gui/macosx/prefs.h
modules/gui/macosx/prefs.m
modules/gui/macosx/prefs_widgets.h
modules/gui/macosx/prefs_widgets.m
modules/gui/macosx/voutgl.m
modules/gui/macosx/update.h
modules/gui/macosx/update.m
modules/gui/macosx/vout.h
modules/gui/macosx/vout.m
modules/gui/macosx/voutgl.m
modules/gui/macosx/voutqt.m
modules/gui/macosx/wizard.h
modules/gui/macosx/wizard.m
modules/gui/ncurses.c
modules/gui/pda/pda.c
modules/gui/pda/pda.h
modules/gui/pda/pda_callbacks.c
modules/gui/pda/pda_callbacks.h
modules/gui/pda/pda.h
modules/gui/pda/pda_interface.c
modules/gui/pda/pda_interface.h
modules/gui/pda/pda_support.c
......@@ -479,6 +488,8 @@ modules/gui/skins2/commands/cmd_on_top.cpp
modules/gui/skins2/commands/cmd_on_top.hpp
modules/gui/skins2/commands/cmd_playlist.cpp
modules/gui/skins2/commands/cmd_playlist.hpp
modules/gui/skins2/commands/cmd_playtree.cpp
modules/gui/skins2/commands/cmd_playtree.hpp
modules/gui/skins2/commands/cmd_quit.cpp
modules/gui/skins2/commands/cmd_quit.hpp
modules/gui/skins2/commands/cmd_resize.cpp
......@@ -507,6 +518,8 @@ modules/gui/skins2/controls/ctrl_slider.cpp
modules/gui/skins2/controls/ctrl_slider.hpp
modules/gui/skins2/controls/ctrl_text.cpp
modules/gui/skins2/controls/ctrl_text.hpp
modules/gui/skins2/controls/ctrl_tree.cpp
modules/gui/skins2/controls/ctrl_tree.hpp
modules/gui/skins2/controls/ctrl_video.cpp
modules/gui/skins2/controls/ctrl_video.hpp
modules/gui/skins2/events/evt_enter.hpp
......@@ -540,8 +553,8 @@ modules/gui/skins2/macosx/macosx_tooltip.hpp
modules/gui/skins2/macosx/macosx_window.cpp
modules/gui/skins2/macosx/macosx_window.hpp
modules/gui/skins2/parser/builder.cpp
modules/gui/skins2/parser/builder_data.hpp
modules/gui/skins2/parser/builder.hpp
modules/gui/skins2/parser/builder_data.hpp
modules/gui/skins2/parser/expr_evaluator.cpp
modules/gui/skins2/parser/expr_evaluator.hpp
modules/gui/skins2/parser/interpreter.cpp
......@@ -612,15 +625,19 @@ modules/gui/skins2/utils/ustring.cpp
modules/gui/skins2/utils/ustring.hpp
modules/gui/skins2/utils/var_bool.cpp
modules/gui/skins2/utils/var_bool.hpp
modules/gui/skins2/utils/variable.hpp
modules/gui/skins2/utils/var_list.cpp
modules/gui/skins2/utils/var_list.hpp
modules/gui/skins2/utils/var_percent.cpp
modules/gui/skins2/utils/var_percent.hpp
modules/gui/skins2/utils/var_text.cpp
modules/gui/skins2/utils/var_text.hpp
modules/gui/skins2/utils/var_tree.cpp
modules/gui/skins2/utils/var_tree.hpp
modules/gui/skins2/utils/variable.hpp
modules/gui/skins2/vars/playlist.cpp
modules/gui/skins2/vars/playlist.hpp
modules/gui/skins2/vars/playtree.cpp
modules/gui/skins2/vars/playtree.hpp
modules/gui/skins2/vars/time.cpp
modules/gui/skins2/vars/time.hpp
modules/gui/skins2/vars/volume.cpp
......@@ -707,8 +724,8 @@ modules/misc/gnutls.c
modules/misc/gtk_main.c
modules/misc/logger.c
modules/misc/memcpy/fastmemcpy.h
modules/misc/memcpy/memcpyaltivec.c
modules/misc/memcpy/memcpy.c
modules/misc/memcpy/memcpyaltivec.c
modules/misc/network/ipv4.c
modules/misc/network/ipv6.c
modules/misc/playlist/export.c
......@@ -770,11 +787,11 @@ modules/stream_out/transrate/getvlc.h
modules/stream_out/transrate/putvlc.h
modules/stream_out/transrate/transrate.c
modules/stream_out/transrate/transrate.h
modules/video_chroma/i420_rgb.c
modules/video_chroma/i420_rgb.h
modules/video_chroma/i420_rgb16.c
modules/video_chroma/i420_rgb8.c
modules/video_chroma/i420_rgb.c
modules/video_chroma/i420_rgb_c.h
modules/video_chroma/i420_rgb.h
modules/video_chroma/i420_rgb_mmx.h
modules/video_chroma/i420_ymga.c
modules/video_chroma/i420_yuy2.c
......@@ -804,13 +821,13 @@ modules/video_filter/swscale/filter.c
modules/video_filter/swscale/rgb2rgb.c
modules/video_filter/swscale/rgb2rgb.h
modules/video_filter/swscale/rgb2rgb_template.c
modules/video_filter/swscale/swscale_altivec_template.c
modules/video_filter/swscale/swscale.c
modules/video_filter/swscale/swscale.h
modules/video_filter/swscale/swscale_altivec_template.c
modules/video_filter/swscale/swscale_internal.h
modules/video_filter/swscale/swscale_template.c
modules/video_filter/swscale/yuv2rgb_altivec.c
modules/video_filter/swscale/yuv2rgb.c
modules/video_filter/swscale/yuv2rgb_altivec.c
modules/video_filter/swscale/yuv2rgb_mlib.c
modules/video_filter/swscale/yuv2rgb_template.c
modules/video_filter/time.c
......@@ -840,6 +857,8 @@ modules/video_output/x11/x11.c
modules/video_output/x11/xcommon.c
modules/video_output/x11/xcommon.h
modules/video_output/x11/xvideo.c
modules/visualization/galaktos/PCM.c
modules/visualization/galaktos/PCM.h
modules/visualization/galaktos/beat_detect.c
modules/visualization/galaktos/beat_detect.h
modules/visualization/galaktos/builtin_funcs.c
......@@ -874,8 +893,6 @@ modules/visualization/galaktos/param.h
modules/visualization/galaktos/param_types.h
modules/visualization/galaktos/parser.c
modules/visualization/galaktos/parser.h
modules/visualization/galaktos/PCM.c
modules/visualization/galaktos/PCM.h
modules/visualization/galaktos/per_frame_eqn.c
modules/visualization/galaktos/per_frame_eqn.h
modules/visualization/galaktos/per_frame_eqn_types.h
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -8,6 +8,7 @@
* Samuel Hocevar <sam@zoy.org>
* Gildas Bazin <gbazin@videolan.org>
* Derk-Jan Hartman <hartman at videolan dot org>
* Christophe Massiot <massiot@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -326,6 +327,103 @@ int64_t vlc_atoll( const char *nptr )
}
#endif
/*****************************************************************************
* vlc_*dir_wrapper: wrapper under Windows to return the list of drive letters
* when called with an empty argument or just '\'
*****************************************************************************/
#if defined(WIN32) || defined(UNDER_CE)
#define WIN32_LEAN_AND_MEAN
#include <windows.h> /* for GetLogicalDrives */
typedef struct vlc_DIR
{
DIR *p_real_dir;
int i_drives;
struct dirent dd_dir;
vlc_bool_t b_insert_back;
} vlc_DIR;
void *vlc_opendir_wrapper( const char *psz_path )
{
vlc_DIR *p_dir;
DIR *p_real_dir;
if ( psz_path == NULL || psz_path[0] == '\0'
|| (psz_path[0] == '\\' && psz_path[1] == '\0') )
{
/* Special mode to list drive letters */
p_dir = malloc( sizeof(vlc_DIR) );
p_dir->p_real_dir = NULL;
p_dir->i_drives = GetLogicalDrives();
return (void *)p_dir;
}
p_real_dir = opendir( psz_path );
if ( p_real_dir == NULL )
return NULL;
p_dir = malloc( sizeof(vlc_DIR) );
p_dir->p_real_dir = p_real_dir;
p_dir->b_insert_back = ( psz_path[1] == ':' && psz_path[2] == '\\'
&& psz_path[3] =='\0' );
return (void *)p_dir;
}
struct dirent *vlc_readdir_wrapper( void *_p_dir )
{
vlc_DIR *p_dir = (vlc_DIR *)_p_dir;
unsigned int i;
DWORD i_drives;
if ( p_dir->p_real_dir != NULL )
{
if ( p_dir->b_insert_back )
{
p_dir->dd_dir.d_ino = 0;
p_dir->dd_dir.d_reclen = 0;
p_dir->dd_dir.d_namlen = 2;
strcpy( p_dir->dd_dir.d_name, ".." );
p_dir->b_insert_back = VLC_FALSE;
return &p_dir->dd_dir;
}
return readdir( p_dir->p_real_dir );
}
/* Drive letters mode */
i_drives = p_dir->i_drives;
if ( !i_drives )
return NULL; /* end */
for ( i = 0; i < sizeof(DWORD)*8; i++, i_drives >>= 1 )
if ( i_drives & 1 ) break;
if ( i >= 26 )
return NULL; /* this should not happen */
sprintf( p_dir->dd_dir.d_name, "%c:\\", 'A' + i );
p_dir->dd_dir.d_namlen = strlen(p_dir->dd_dir.d_name);
p_dir->i_drives &= ~(1UL << i);
return &p_dir->dd_dir;
}
int vlc_closedir_wrapper( void *_p_dir )
{
vlc_DIR *p_dir = (vlc_DIR *)_p_dir;
if ( p_dir->p_real_dir != NULL )
{
int i_ret = closedir( p_dir->p_real_dir );
free( p_dir );
return i_ret;
}
free( p_dir );
return 0;
}
#endif
/*****************************************************************************
* scandir: scan a directory alpha-sorted
*****************************************************************************/
......@@ -345,11 +443,11 @@ int vlc_scandir( const char *name, struct dirent ***namelist,
struct dirent ** pp_list;
int ret, size;
if( !namelist || !( p_dir = opendir( name ) ) ) return -1;
if( !namelist || !( p_dir = vlc_opendir_wrapper( name ) ) ) return -1;
ret = 0;
pp_list = NULL;
while( ( p_content = readdir( p_dir ) ) )
while( ( p_content = vlc_readdir_wrapper( p_dir ) ) )
{
if( filter && !filter( p_content ) )
{
......@@ -362,7 +460,7 @@ int vlc_scandir( const char *name, struct dirent ***namelist,
ret++;
}
closedir( p_dir );
vlc_closedir_wrapper( p_dir );
if( compar )
{
......
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