Commit 2867bb65 authored by Gildas Bazin's avatar Gildas Bazin

* modified the gtk interface to save an empty <string> option as a NULL pointer
* modified config_LoadConfigFile to consider an empty <string> option as a
   NULL pointer.
parent 09b7f775
...@@ -2,9 +2,10 @@ ...@@ -2,9 +2,10 @@
* gtk_preferences.c: functions to handle the preferences dialog box. * gtk_preferences.c: functions to handle the preferences dialog box.
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: gtk_preferences.c,v 1.17 2002/03/26 17:33:37 lool Exp $ * $Id: gtk_preferences.c,v 1.18 2002/03/26 22:30:09 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* Loc Minier <lool@via.ecp.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -684,7 +685,8 @@ static void GtkSaveHashValue( gpointer key, gpointer value, gpointer user_data) ...@@ -684,7 +685,8 @@ static void GtkSaveHashValue( gpointer key, gpointer value, gpointer user_data)
case MODULE_CONFIG_ITEM_STRING: case MODULE_CONFIG_ITEM_STRING:
case MODULE_CONFIG_ITEM_FILE: case MODULE_CONFIG_ITEM_FILE:
case MODULE_CONFIG_ITEM_PLUGIN: case MODULE_CONFIG_ITEM_PLUGIN:
config_PutPszVariable( p_config->psz_name, p_config->psz_value ); config_PutPszVariable( p_config->psz_name,
*p_config->psz_value? p_config->psz_value : NULL );
break; break;
case MODULE_CONFIG_ITEM_INTEGER: case MODULE_CONFIG_ITEM_INTEGER:
case MODULE_CONFIG_ITEM_BOOL: case MODULE_CONFIG_ITEM_BOOL:
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* configuration.c management of the modules configuration * configuration.c management of the modules configuration
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: configuration.c,v 1.9 2002/03/26 22:02:32 gbazin Exp $ * $Id: configuration.c,v 1.10 2002/03/26 22:30:09 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -384,17 +384,14 @@ int config_LoadConfigFile( const char *psz_module_name ) ...@@ -384,17 +384,14 @@ int config_LoadConfigFile( const char *psz_module_name )
break; break;
default: default:
if( !*psz_option_value )
break; /* ignore empty option */
vlc_mutex_lock( p_module->p_config[i].p_lock ); vlc_mutex_lock( p_module->p_config[i].p_lock );
/* free old string */ /* free old string */
if( p_module->p_config[i].psz_value ) if( p_module->p_config[i].psz_value )
free( p_module->p_config[i].psz_value ); free( p_module->p_config[i].psz_value );
p_module->p_config[i].psz_value = p_module->p_config[i].psz_value = *psz_option_value ?
strdup( psz_option_value ); strdup( psz_option_value ) : NULL;
vlc_mutex_unlock( p_module->p_config[i].p_lock ); vlc_mutex_unlock( p_module->p_config[i].p_lock );
...@@ -641,7 +638,7 @@ int config_SaveConfigFile( const char *psz_module_name ) ...@@ -641,7 +638,7 @@ int config_SaveConfigFile( const char *psz_module_name )
* options used (ie. exported) by each module. * options used (ie. exported) by each module.
*****************************************************************************/ *****************************************************************************/
int config_LoadCmdLine( int *pi_argc, char *ppsz_argv[], int config_LoadCmdLine( int *pi_argc, char *ppsz_argv[],
boolean_t b_ignore_errors ) boolean_t b_ignore_errors )
{ {
int i_cmd, i, i_index, i_longopts_size; int i_cmd, i, i_index, i_longopts_size;
module_t *p_module; module_t *p_module;
...@@ -830,7 +827,7 @@ char *config_GetHomeDir( void ) ...@@ -830,7 +827,7 @@ char *config_GetHomeDir( void )
if( ( p_tmp = getenv( "TMP" ) ) == NULL ) if( ( p_tmp = getenv( "TMP" ) ) == NULL )
{ {
p_homedir = strdup( "/tmp" ); p_homedir = strdup( "/tmp" );
} }
else p_homedir = strdup( p_tmp ); else p_homedir = strdup( p_tmp );
intf_ErrMsg( "config error: unable to get home directory, " intf_ErrMsg( "config error: unable to get home directory, "
......
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