X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmodules%2Fconfiguration.c;h=3d8eb51a7f15384302241f7f44983526a203e1ae;hb=8f9a875552bb69ba4ecf5e075bf127aa96ff7511;hp=fb5fcc6208e2c8c90d6efb1a68c0461bab1b65da;hpb=575b4f3993e8b4aa5e0ac2788e978f07da7c388a;p=vlc diff --git a/src/modules/configuration.c b/src/modules/configuration.c index fb5fcc6208..3d8eb51a7f 100644 --- a/src/modules/configuration.c +++ b/src/modules/configuration.c @@ -22,6 +22,7 @@ *****************************************************************************/ #include +#include "../libvlc.h" #include "vlc_keys.h" #include "vlc_charset.h" @@ -89,7 +90,7 @@ int IsConfigStringType (int type) static const unsigned char config_types[] = { CONFIG_ITEM_STRING, CONFIG_ITEM_FILE, CONFIG_ITEM_MODULE, - CONFIG_ITEM_DIRECTORY, CONFIG_ITEM_MODULE_CAT, + CONFIG_ITEM_DIRECTORY, CONFIG_ITEM_MODULE_CAT, CONFIG_ITEM_PASSWORD, CONFIG_ITEM_MODULE_LIST, CONFIG_ITEM_MODULE_LIST_CAT }; @@ -160,6 +161,10 @@ int __config_GetType( vlc_object_t *p_this, const char *psz_name ) i_type = VLC_VAR_STRING; break; + case CONFIG_ITEM_PASSWORD: + i_type = VLC_VAR_STRING; + break; + case CONFIG_ITEM_FILE: i_type = VLC_VAR_FILE; break; @@ -238,7 +243,7 @@ float __config_GetFloat( vlc_object_t *p_this, const char *psz_name ) ***************************************************************************** * This function is used to get the value of variables which are internally * represented by a string (CONFIG_ITEM_STRING, CONFIG_ITEM_FILE, - * CONFIG_ITEM_DIRECTORY, and CONFIG_ITEM_MODULE). + * CONFIG_ITEM_DIRECTORY, CONFIG_ITEM_PASSWORD, and CONFIG_ITEM_MODULE). * * Important note: remember to free() the returned char* because it's a * duplicate of the actual value. It isn't safe to return a pointer to the @@ -276,7 +281,7 @@ char * __config_GetPsz( vlc_object_t *p_this, const char *psz_name ) ***************************************************************************** * This function is used to set the value of variables which are internally * represented by a string (CONFIG_ITEM_STRING, CONFIG_ITEM_FILE, - * CONFIG_ITEM_DIRECTORY, and CONFIG_ITEM_MODULE). + * CONFIG_ITEM_DIRECTORY, CONFIG_ITEM_PASSWORD, and CONFIG_ITEM_MODULE). *****************************************************************************/ void __config_PutPsz( vlc_object_t *p_this, const char *psz_name, const char *psz_value ) @@ -1555,37 +1560,29 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[], /* Check if the option is deprecated */ if( p_conf->psz_current ) { - if( !strcmp(p_conf->psz_current,"SUPPRESSED") ) + if( p_conf->b_strict ) { - if( !b_ignore_errors ) - { - fprintf(stderr, - "Warning: option --%s is no longer used.\n", - p_conf->psz_name); - } + fprintf(stderr, + "Warning: option --%s no longer exists.\n", + p_conf->psz_name); continue; } + + fprintf( stderr, + "%s: option --%s is deprecated. Use --%s instead.\n", + b_ignore_errors ? "Warning" : "Error", + p_conf->psz_name, p_conf->psz_current); if( !b_ignore_errors ) { - if( p_conf->b_strict ) - { - fprintf( stderr, - "Error: option --%s is deprecated. " - "Use --%s instead.\n", - p_conf->psz_name, p_conf->psz_current); - /*free */ - for( i_index = 0; p_longopts[i_index].name; i_index++ ) - free( (char *)p_longopts[i_index].name ); - - free( p_longopts ); - free( psz_shortopts ); - return -1; - } - fprintf(stderr, - "Warning: option --%s is deprecated. " - "You should use --%s instead.\n", - p_conf->psz_name, p_conf->psz_current); + /*free */ + for( i_index = 0; p_longopts[i_index].name; i_index++ ) + free( (char *)p_longopts[i_index].name ); + + free( p_longopts ); + free( psz_shortopts ); + return -1; } + psz_name = (char *)p_conf->psz_current; p_conf = config_FindConfig( p_this, psz_name ); } @@ -1593,6 +1590,7 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[], switch( p_conf->i_type ) { case CONFIG_ITEM_STRING: + case CONFIG_ITEM_PASSWORD: case CONFIG_ITEM_FILE: case CONFIG_ITEM_DIRECTORY: case CONFIG_ITEM_MODULE: @@ -1624,6 +1622,7 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[], switch( pp_shortopts[i_cmd]->i_type ) { case CONFIG_ITEM_STRING: + case CONFIG_ITEM_PASSWORD: case CONFIG_ITEM_FILE: case CONFIG_ITEM_DIRECTORY: case CONFIG_ITEM_MODULE: @@ -1712,22 +1711,21 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[], * * @return a string (always succeeds). */ -const char *config_GetDataDir( const vlc_object_t *p_this ) +const char *config_GetDataDir( void ) { #if defined (WIN32) || defined (UNDER_CE) - return vlc_global( p_this )->psz_vlcpath; + return vlc_global()->psz_vlcpath; #elif defined(__APPLE__) || defined (SYS_BEOS) static char path[PATH_MAX] = ""; if( *path == '\0' ) { snprintf( path, sizeof( path ), "%s/share", - vlc_global( p_this )->psz_vlcpath ); + vlc_global()->psz_vlcpath ); path[sizeof( path ) - 1] = '\0'; } return path; #else - (void)p_this; return DATA_PATH; #endif }