[vlc-devel] commit: Parse vlcrc following American standards for numbers ( Rémi Denis-Courmont )

git version control git at videolan.org
Wed May 21 20:57:47 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rem at videolan.org> | Wed May 21 21:55:15 2008 +0300| [6d85ab85a3f785b8eb86f8f98a58725d9c577e4f]

Parse vlcrc following American standards for numbers

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6d85ab85a3f785b8eb86f8f98a58725d9c577e4f
---

 src/config/file.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/src/config/file.c b/src/config/file.c
index 8c0f30c..b6ce5ef 100644
--- a/src/config/file.c
+++ b/src/config/file.c
@@ -182,6 +182,10 @@ int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name )
     char line[1024], section[1022];
     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)
     {
         /* Ignore comments and empty lines */
@@ -273,7 +277,7 @@ int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name )
                 case CONFIG_ITEM_FLOAT:
                     if( !*psz_option_value )
                         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;
                     break;
 
@@ -310,6 +314,11 @@ int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name )
     fclose (file);
 
     vlc_list_release( p_list );
+    if (loc != (locale_t)0)
+    {
+        uselocale (baseloc);
+        freelocale (loc);
+    }
 
     vlc_mutex_unlock( &priv->config_lock );
     return 0;




More information about the vlc-devel mailing list