X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmisc%2Fconfiguration.c;h=6e62f1fa33c539fea5678e684614a1608aaf7e48;hb=2d87367f92711a57861d40f75a4a6d075573c9bf;hp=0e2033a1c6df8ce0cea97bb277743e111c66f048;hpb=6b4fa4aac8dbea26b364b7e81b5b98daec03676a;p=vlc diff --git a/src/misc/configuration.c b/src/misc/configuration.c index 0e2033a1c6..6e62f1fa33 100644 --- a/src/misc/configuration.c +++ b/src/misc/configuration.c @@ -1,8 +1,8 @@ /***************************************************************************** * configuration.c management of the modules configuration ***************************************************************************** - * Copyright (C) 2001 VideoLAN - * $Id: configuration.c,v 1.70 2003/11/08 18:23:40 titer Exp $ + * Copyright (C) 2001-2004 VideoLAN + * $Id: configuration.c,v 1.76 2004/01/29 17:04:01 gbazin Exp $ * * Authors: Gildas Bazin * @@ -53,8 +53,11 @@ #if defined( HAVE_SYS_TYPES_H ) # include #endif -#if defined( WIN32 ) && !defined( UNDER_CE ) -# include +#if defined( WIN32 ) +# if !defined( UNDER_CE ) +# include +# endif +#include #endif @@ -499,6 +502,9 @@ void config_Duplicate( module_t *p_module, module_config_t *p_orig ) { p_module->p_config[i] = p_orig[i]; + p_module->p_config[i].i_value_orig = p_orig[i].i_value; + p_module->p_config[i].f_value_orig = p_orig[i].f_value; + p_module->p_config[i].psz_type = p_orig[i].psz_type ? strdup( p_orig[i].psz_type ) : NULL; p_module->p_config[i].psz_name = p_orig[i].psz_name ? @@ -554,6 +560,26 @@ void config_Duplicate( module_t *p_module, module_config_t *p_orig ) } } + /* duplicate the actions list */ + if( p_orig[i].i_action ) + { + int j; + + p_module->p_config[i].ppf_action = + malloc( p_orig[i].i_action * sizeof(void *) ); + p_module->p_config[i].ppsz_action_text = + malloc( p_orig[i].i_action * sizeof(char *) ); + + for( j = 0; j < p_orig[i].i_action; j++ ) + { + p_module->p_config[i].ppf_action[j] = + p_orig[i].ppf_action[j]; + p_module->p_config[i].ppsz_action_text[j] = + p_orig[i].ppsz_action_text[j] ? + strdup( p_orig[i].ppsz_action_text[j] ) : NULL; + } + } + p_module->p_config[i].pf_callback = p_orig[i].pf_callback; } } @@ -606,6 +632,17 @@ void config_Free( module_t *p_module ) if( p_item->ppsz_list_text ) free( p_item->ppsz_list_text ); if( p_item->pi_list ) free( p_item->pi_list ); } + + if( p_item->i_action ) + { + for( i = 0; i < p_item->i_action; i++ ) + { + if( p_item->ppsz_action_text[i] ) + free( p_item->ppsz_action_text[i] ); + } + if( p_item->ppf_action ) free( p_item->ppf_action ); + if( p_item->ppsz_action_text ) free( p_item->ppsz_action_text ); + } } free( p_module->p_config ); @@ -1120,12 +1157,14 @@ int __config_SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name ) if( p_item->psz_text ) fprintf( file, "# %s (%s)\n", p_item->psz_text, _("key") ); + if( p_item->i_value == p_item->i_value_orig ) + fprintf( file, "#" ); psz_key = ConfigKeyToString( p_item->i_value ); fprintf( file, "%s=%s\n", p_item->psz_name, psz_key ? psz_key : "" ); if ( psz_key ) free( psz_key ); break; - + case CONFIG_ITEM_FLOAT: if( p_item->psz_text ) fprintf( file, "# %s (%s)\n", p_item->psz_text, @@ -1503,7 +1542,7 @@ char *config_GetHomeDir( void ) #if defined(WIN32) || defined(UNDER_CE) typedef HRESULT (WINAPI *SHGETFOLDERPATH)( HWND, int, HANDLE, DWORD, - LPTSTR ); + LPSTR ); # define CSIDL_FLAG_CREATE 0x8000 # define CSIDL_APPDATA 0x1A # define SHGFP_TYPE_CURRENT 0 @@ -1512,10 +1551,10 @@ char *config_GetHomeDir( void ) SHGETFOLDERPATH SHGetFolderPath ; /* load the shfolder dll to retrieve SHGetFolderPath */ - if( ( shfolder_dll = LoadLibrary("shfolder.dll") ) != NULL ) + if( ( shfolder_dll = LoadLibrary( _T("SHFolder.dll") ) ) != NULL ) { SHGetFolderPath = (void *)GetProcAddress( shfolder_dll, - "SHGetFolderPathA" ); + _T("SHGetFolderPathA") ); if ( SHGetFolderPath != NULL ) { p_homedir = (char *)malloc( MAX_PATH );