[vlc-devel] commit: Always print numbers (floats) in American format in vlcrc ( Rémi Denis-Courmont )

git version control git at videolan.org
Wed May 21 20:40:25 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rem at videolan.org> | Wed May 21 21:41:52 2008 +0300| [2b58a805b907efafbc5ef03347b6c086023806f0]

Always print numbers (floats) in American format in vlcrc

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

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

diff --git a/src/config/file.c b/src/config/file.c
index 08848dd..8c0f30c 100644
--- a/src/config/file.c
+++ b/src/config/file.c
@@ -33,6 +33,7 @@
 #include <errno.h>                                                  /* errno */
 #include <assert.h>
 #include <limits.h>
+#include <locale.h>
 
 #include "configuration.h"
 #include "modules/modules.h"
@@ -521,6 +522,10 @@ static int SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name,
     fprintf( file, "\xEF\xBB\xBF###\n###  " COPYRIGHT_MESSAGE "\n###\n\n"
        "###\n### lines beginning with a '#' character are comments\n###\n\n" );
 
+    /* Ensure consistent number formatting... */
+    locale_t loc = newlocale (LC_NUMERIC_MASK, "C", NULL);
+    locale_t baseloc = uselocale (loc);
+
     /* Look for the selected module, if NULL then save everything */
     for( i_index = 0; i_index < p_list->i_count; i_index++ )
     {
@@ -627,6 +632,11 @@ static int SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name,
     }
 
     vlc_list_release( p_list );
+    if (loc != (locale_t)0)
+    {
+        uselocale (baseloc);
+        freelocale (loc);
+    }
 
     /*
      * Restore old settings from the config in file




More information about the vlc-devel mailing list