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

Make a bunch of HTTP macro functions static

parent b99c670c
...@@ -299,22 +299,6 @@ typedef struct ...@@ -299,22 +299,6 @@ typedef struct
char *param2; ///< Second parameter char *param2; ///< Second parameter
} macro_t; } macro_t;
/** This function creates a macro from a <vlc ....> tag */
int E_(MacroParse)( macro_t *m, char *psz_src );
/** This function cleans a macro */
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 E_(StrToMacroType)( char *name );
/** This function actually executes the macro */
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 *E_(MacroSearch)( char *src, char *end,
int i_mvlc, vlc_bool_t b_after );
/** This function parses a file for macros */ /** This function parses a file for macros */
void E_(Execute)( httpd_file_sys_t *p_args, void E_(Execute)( httpd_file_sys_t *p_args,
char *p_request, int i_request, char *p_request, int i_request,
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "macros.h" #include "macros.h"
#include "vlc_url.h" #include "vlc_url.h"
int E_(MacroParse)( macro_t *m, char *psz_src ) static int MacroParse( macro_t *m, char *psz_src )
{ {
char *dup = strdup( (char *)psz_src ); char *dup = strdup( (char *)psz_src );
char *src = dup; char *src = dup;
...@@ -107,14 +107,14 @@ int E_(MacroParse)( macro_t *m, char *psz_src ) ...@@ -107,14 +107,14 @@ int E_(MacroParse)( macro_t *m, char *psz_src )
#undef EXTRACT #undef EXTRACT
} }
void E_(MacroClean)( macro_t *m ) static void MacroClean( macro_t *m )
{ {
free( m->id ); free( m->id );
free( m->param1 ); free( m->param1 );
free( m->param2 ); free( m->param2 );
} }
int E_(StrToMacroType)( char *name ) static int StrToMacroType( const char *name )
{ {
int i; int i;
...@@ -132,7 +132,7 @@ int E_(StrToMacroType)( char *name ) ...@@ -132,7 +132,7 @@ int E_(StrToMacroType)( char *name )
return MVLC_UNKNOWN; return MVLC_UNKNOWN;
} }
void E_(MacroDo)( httpd_file_sys_t *p_args, static void MacroDo( httpd_file_sys_t *p_args,
macro_t *m, macro_t *m,
char *p_request, int i_request, char *p_request, int i_request,
char **pp_data, int *pi_data, char **pp_data, int *pi_data,
...@@ -167,7 +167,7 @@ void E_(MacroDo)( httpd_file_sys_t *p_args, ...@@ -167,7 +167,7 @@ void E_(MacroDo)( httpd_file_sys_t *p_args,
} \ } \
} }
switch( E_(StrToMacroType)( m->id ) ) switch( StrToMacroType( m->id ) )
{ {
case MVLC_CONTROL: case MVLC_CONTROL:
if( i_request <= 0 ) if( i_request <= 0 )
...@@ -180,7 +180,7 @@ void E_(MacroDo)( httpd_file_sys_t *p_args, ...@@ -180,7 +180,7 @@ void E_(MacroDo)( httpd_file_sys_t *p_args,
msg_Warn( p_intf, "unauthorized control=%s", control ); msg_Warn( p_intf, "unauthorized control=%s", control );
break; break;
} }
switch( E_(StrToMacroType)( control ) ) switch( StrToMacroType( control ) )
{ {
case MVLC_PLAY: case MVLC_PLAY:
{ {
...@@ -546,7 +546,7 @@ void E_(MacroDo)( httpd_file_sys_t *p_args, ...@@ -546,7 +546,7 @@ void E_(MacroDo)( httpd_file_sys_t *p_args,
if( p_intf->p_sys->p_vlm == NULL ) break; if( p_intf->p_sys->p_vlm == NULL ) break;
E_(ExtractURIValue)( p_request, "name", name, 512 ); E_(ExtractURIValue)( p_request, "name", name, 512 );
if( E_(StrToMacroType)( control ) == MVLC_VLM_NEW ) if( StrToMacroType( control ) == MVLC_VLM_NEW )
{ {
char type[20]; char type[20];
E_(ExtractURIValue)( p_request, "type", type, 20 ); E_(ExtractURIValue)( p_request, "type", type, 20 );
...@@ -627,13 +627,13 @@ void E_(MacroDo)( httpd_file_sys_t *p_args, ...@@ -627,13 +627,13 @@ void E_(MacroDo)( httpd_file_sys_t *p_args,
if( p_intf->p_sys->p_vlm == NULL ) break; if( p_intf->p_sys->p_vlm == NULL ) break;
E_(ExtractURIValue)( p_request, "name", name, 512 ); E_(ExtractURIValue)( p_request, "name", name, 512 );
if( E_(StrToMacroType)( control ) == MVLC_VLM_PLAY ) if( StrToMacroType( control ) == MVLC_VLM_PLAY )
sprintf( psz, "control %s play", name ); sprintf( psz, "control %s play", name );
else if( E_(StrToMacroType)( control ) == MVLC_VLM_PAUSE ) else if( StrToMacroType( control ) == MVLC_VLM_PAUSE )
sprintf( psz, "control %s pause", name ); sprintf( psz, "control %s pause", name );
else if( E_(StrToMacroType)( control ) == MVLC_VLM_STOP ) else if( StrToMacroType( control ) == MVLC_VLM_STOP )
sprintf( psz, "control %s stop", name ); sprintf( psz, "control %s stop", name );
else if( E_(StrToMacroType)( control ) == MVLC_VLM_SEEK ) else if( StrToMacroType( control ) == MVLC_VLM_SEEK )
{ {
char percent[20]; char percent[20];
E_(ExtractURIValue)( p_request, "percent", percent, 512 ); E_(ExtractURIValue)( p_request, "percent", percent, 512 );
...@@ -660,7 +660,7 @@ void E_(MacroDo)( httpd_file_sys_t *p_args, ...@@ -660,7 +660,7 @@ void E_(MacroDo)( httpd_file_sys_t *p_args,
E_(ExtractURIValue)( p_request, "file", file, 512 ); E_(ExtractURIValue)( p_request, "file", file, 512 );
decode_URI( file ); decode_URI( file );
if( E_(StrToMacroType)( control ) == MVLC_VLM_LOAD ) if( StrToMacroType( control ) == MVLC_VLM_LOAD )
sprintf( psz, "load %s", file ); sprintf( psz, "load %s", file );
else else
sprintf( psz, "save %s", file ); sprintf( psz, "save %s", file );
...@@ -695,7 +695,7 @@ void E_(MacroDo)( httpd_file_sys_t *p_args, ...@@ -695,7 +695,7 @@ void E_(MacroDo)( httpd_file_sys_t *p_args,
E_(ExtractURIValue)( p_request, m->param1, value, 512 ); E_(ExtractURIValue)( p_request, m->param1, value, 512 );
decode_URI( value ); decode_URI( value );
switch( E_(StrToMacroType)( m->param2 ) ) switch( StrToMacroType( m->param2 ) )
{ {
case MVLC_INT: case MVLC_INT:
i = atoi( value ); i = atoi( value );
...@@ -726,7 +726,7 @@ void E_(MacroDo)( httpd_file_sys_t *p_args, ...@@ -726,7 +726,7 @@ void E_(MacroDo)( httpd_file_sys_t *p_args,
break; break;
} }
switch( E_(StrToMacroType)( m->param2 ) ) switch( StrToMacroType( m->param2 ) )
{ {
case MVLC_INT: case MVLC_INT:
i = config_GetInt( p_intf, m->param1 ); i = config_GetInt( p_intf, m->param1 );
...@@ -801,7 +801,8 @@ void E_(MacroDo)( httpd_file_sys_t *p_args, ...@@ -801,7 +801,8 @@ void E_(MacroDo)( httpd_file_sys_t *p_args,
#undef ALLOC #undef ALLOC
} }
char *E_(MacroSearch)( char *src, char *end, int i_mvlc, vlc_bool_t b_after ) static
char *MacroSearch( char *src, char *end, int i_mvlc, vlc_bool_t b_after )
{ {
int i_id; int i_id;
int i_level = 0; int i_level = 0;
...@@ -813,9 +814,9 @@ char *E_(MacroSearch)( char *src, char *end, int i_mvlc, vlc_bool_t b_after ) ...@@ -813,9 +814,9 @@ char *E_(MacroSearch)( char *src, char *end, int i_mvlc, vlc_bool_t b_after )
int i_skip; int i_skip;
macro_t m; macro_t m;
i_skip = E_(MacroParse)( &m, src ); i_skip = MacroParse( &m, src );
i_id = E_(StrToMacroType)( m.id ); i_id = StrToMacroType( m.id );
switch( i_id ) switch( i_id )
{ {
...@@ -830,7 +831,7 @@ char *E_(MacroSearch)( char *src, char *end, int i_mvlc, vlc_bool_t b_after ) ...@@ -830,7 +831,7 @@ char *E_(MacroSearch)( char *src, char *end, int i_mvlc, vlc_bool_t b_after )
break; break;
} }
E_(MacroClean)( &m ); MacroClean( &m );
if( ( i_mvlc == MVLC_END && i_level == -1 ) || if( ( i_mvlc == MVLC_END && i_level == -1 ) ||
( i_mvlc != MVLC_END && i_level == 0 && i_mvlc == i_id ) ) ( i_mvlc != MVLC_END && i_level == 0 && i_mvlc == i_id ) )
...@@ -881,11 +882,11 @@ void E_(Execute)( httpd_file_sys_t *p_args, ...@@ -881,11 +882,11 @@ void E_(Execute)( httpd_file_sys_t *p_args,
{ {
macro_t m; macro_t m;
src += E_(MacroParse)( &m, src ); src += MacroParse( &m, src );
//msg_Dbg( p_intf, "macro_id=%s", m.id ); //msg_Dbg( p_intf, "macro_id=%s", m.id );
switch( E_(StrToMacroType)( m.id ) ) switch( StrToMacroType( m.id ) )
{ {
case MVLC_INCLUDE: case MVLC_INCLUDE:
{ {
...@@ -950,15 +951,15 @@ void E_(Execute)( httpd_file_sys_t *p_args, ...@@ -950,15 +951,15 @@ void E_(Execute)( httpd_file_sys_t *p_args,
{ {
i_test = 0; i_test = 0;
} }
endif = E_(MacroSearch)( src, end, MVLC_END, VLC_TRUE ); endif = MacroSearch( src, end, MVLC_END, VLC_TRUE );
if( i_test == 0 ) if( i_test == 0 )
{ {
char *start = E_(MacroSearch)( src, endif, MVLC_ELSE, VLC_TRUE ); char *start = MacroSearch( src, endif, MVLC_ELSE, VLC_TRUE );
if( start ) if( start )
{ {
char *stop = E_(MacroSearch)( start, endif, MVLC_END, VLC_FALSE ); char *stop = MacroSearch( start, endif, MVLC_END, VLC_FALSE );
if( stop ) if( stop )
{ {
E_(Execute)( p_args, p_request, i_request, E_(Execute)( p_args, p_request, i_request,
...@@ -969,9 +970,9 @@ void E_(Execute)( httpd_file_sys_t *p_args, ...@@ -969,9 +970,9 @@ void E_(Execute)( httpd_file_sys_t *p_args,
else if( i_test == 1 ) else if( i_test == 1 )
{ {
char *stop; char *stop;
if( ( stop = E_(MacroSearch)( src, endif, MVLC_ELSE, VLC_FALSE ) ) == NULL ) if( ( stop = MacroSearch( src, endif, MVLC_ELSE, VLC_FALSE ) ) == NULL )
{ {
stop = E_(MacroSearch)( src, endif, MVLC_END, VLC_FALSE ); stop = MacroSearch( src, endif, MVLC_END, VLC_FALSE );
} }
if( stop ) if( stop )
{ {
...@@ -985,9 +986,9 @@ void E_(Execute)( httpd_file_sys_t *p_args, ...@@ -985,9 +986,9 @@ void E_(Execute)( httpd_file_sys_t *p_args,
} }
case MVLC_FOREACH: case MVLC_FOREACH:
{ {
char *endfor = E_(MacroSearch)( src, end, MVLC_END, VLC_TRUE ); char *endfor = MacroSearch( src, end, MVLC_END, VLC_TRUE );
char *start = src; char *start = src;
char *stop = E_(MacroSearch)( src, end, MVLC_END, VLC_FALSE ); char *stop = MacroSearch( src, end, MVLC_END, VLC_FALSE );
if( stop ) if( stop )
{ {
...@@ -1088,12 +1089,12 @@ void E_(Execute)( httpd_file_sys_t *p_args, ...@@ -1088,12 +1089,12 @@ void E_(Execute)( httpd_file_sys_t *p_args,
break; break;
} }
default: default:
E_(MacroDo)( p_args, &m, p_request, i_request, MacroDo( p_args, &m, p_request, i_request,
pp_data, pi_data, &dst ); pp_data, pi_data, &dst );
break; break;
} }
E_(MacroClean)( &m ); MacroClean( &m );
continue; continue;
} }
......
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