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

Parse vlcrc following American standards for numbers

parent 8d961ec7
...@@ -182,6 +182,10 @@ int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name ) ...@@ -182,6 +182,10 @@ int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name )
char line[1024], section[1022]; char line[1024], section[1022];
section[0] = '\0'; section[0] = '\0';
/* Ensure consistent number formatting... */
locale_t loc = newlocale (LC_NUMERIC_MASK, "C", NULL);
locale_t baseloc = uselocale (loc);
while (fgets (line, 1024, file) != NULL) while (fgets (line, 1024, file) != NULL)
{ {
/* Ignore comments and empty lines */ /* Ignore comments and empty lines */
...@@ -273,7 +277,7 @@ int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name ) ...@@ -273,7 +277,7 @@ int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name )
case CONFIG_ITEM_FLOAT: case CONFIG_ITEM_FLOAT:
if( !*psz_option_value ) if( !*psz_option_value )
break; /* ignore empty option */ break; /* ignore empty option */
p_item->value.f = (float)i18n_atof( psz_option_value); p_item->value.f = (float)atof (psz_option_value);
p_item->saved.f = p_item->value.f; p_item->saved.f = p_item->value.f;
break; break;
...@@ -310,6 +314,11 @@ int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name ) ...@@ -310,6 +314,11 @@ int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name )
fclose (file); fclose (file);
vlc_list_release( p_list ); vlc_list_release( p_list );
if (loc != (locale_t)0)
{
uselocale (baseloc);
freelocale (loc);
}
vlc_mutex_unlock( &priv->config_lock ); vlc_mutex_unlock( &priv->config_lock );
return 0; return 0;
......
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