]> git.sesse.net Git - vlc/commitdiff
Fix parsing of float-typed variables
authorPierre Ynard <linkfanel@yahoo.fr>
Wed, 16 Sep 2009 12:31:25 +0000 (14:31 +0200)
committerPierre Ynard <linkfanel@yahoo.fr>
Wed, 16 Sep 2009 12:31:25 +0000 (14:31 +0200)
Apparently, since 'setlocale( LC_NUMERIC, "C" );' was removed from
libvlc initialization 3 years ago, the syntax to set configuration
variables of floating point types has changed and become dependent
on the current locale ("0.5" vs. "0,5" etc). Some places have been
converted to the use of us_atof() which is locale-independent; fix
all the remaining ones too.

modules/access/v4l.c
modules/access/v4l2.c
modules/codec/x264.c
src/config/chain.c
src/misc/variables.c
src/video_output/vout_intf.c

index bc89025fdbe015ba1f5ad6ed3aaf81115a8ccd01..1a73ef5a9e70decd5e98de9e0d8f899f5c4f4a2a 100644 (file)
@@ -38,6 +38,7 @@
 #include <vlc_demux.h>
 #include <vlc_access.h>
 #include <vlc_picture.h>
+#include <vlc_charset.h>
 
 #include <sys/ioctl.h>
 #include <sys/mman.h>
@@ -631,8 +632,8 @@ static void ParseMRL( demux_t *p_demux )
             }
             else if( !strncmp( psz_parser, "fps=", strlen( "fps=" ) ) )
             {
-                p_sys->f_fps = strtof( psz_parser + strlen( "fps=" ),
-                                       &psz_parser );
+                p_sys->f_fps = us_strtof( psz_parser + strlen( "fps=" ),
+                                          &psz_parser );
             }
             else if( !strncmp( psz_parser, "adev=", strlen( "adev=" ) )
              || !strncmp( psz_parser, "samplerate=", strlen( "samplerate=" ) )
index 0d85e84d639fb786333b6aedd469df5eebf557ef..864333b7042b374256a603404a5f9a97071ca613 100644 (file)
@@ -40,6 +40,7 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_access.h>
+#include <vlc_charset.h>
 #include <vlc_demux.h>
 #include <vlc_input.h>
 
@@ -790,8 +791,8 @@ static void ParseMRL( demux_sys_t *p_sys, char *psz_path, vlc_object_t *p_obj )
             }
             else if( !strncmp( psz_parser, "fps=", strlen( "fps=" ) ) )
             {
-                p_sys->f_fps = strtof( psz_parser + strlen( "fps=" ),
-                                       &psz_parser );
+                p_sys->f_fps = us_strtof( psz_parser + strlen( "fps=" ),
+                                          &psz_parser );
             }
             else if( !strncmp( psz_parser, "io=", strlen( "io=" ) ) )
             {
index dad242d5628d7a776c612ebb2601f84ef5efa3c6..9b2b6780b667884419634522f4259fcdf58a6c87 100644 (file)
@@ -32,6 +32,7 @@
 #include <vlc_plugin.h>
 #include <vlc_sout.h>
 #include <vlc_codec.h>
+#include <vlc_charset.h>
 
 #ifdef PTW32_STATIC_LIB
 #include <pthread.h>
@@ -947,8 +948,8 @@ static int  Open ( vlc_object_t *p_this )
     if( val.psz_string )
     {
         char *p = strchr( val.psz_string, ':' );
-        p_sys->param.analyse.f_psy_rd = atof( val.psz_string );
-        p_sys->param.analyse.f_psy_trellis = p ? atof( p+1 ) : 0;
+        p_sys->param.analyse.f_psy_rd = us_atof( val.psz_string );
+        p_sys->param.analyse.f_psy_trellis = p ? us_atof( p+1 ) : 0;
         free( val.psz_string );
     }
 
@@ -957,8 +958,9 @@ static int  Open ( vlc_object_t *p_this )
     var_Get( p_enc, SOUT_CFG_PREFIX "level", &val );
     if( val.psz_string )
     {
-        if( atof (val.psz_string) < 6 )
-            p_sys->param.i_level_idc = (int) ( 10 * atof (val.psz_string) + .5);
+        if( us_atof (val.psz_string) < 6 )
+            p_sys->param.i_level_idc = (int) (10 * us_atof (val.psz_string)
+                                              + .5);
         else
             p_sys->param.i_level_idc = atoi (val.psz_string);
         free( val.psz_string );
index 13661e5bdf852b2339857e23e445ea4968909fb6..2b1b6add707f02448237e179aac274c1b5689728 100644 (file)
@@ -33,6 +33,7 @@
 
 #include <vlc_common.h>
 #include "libvlc.h"
+#include <vlc_charset.h>
 
 #include "vlc_interface.h"
 
@@ -382,7 +383,7 @@ void __config_ChainParse( vlc_object_t *p_this, const char *psz_prefix,
                                     NULL, 0 );
                 break;
             case VLC_VAR_FLOAT:
-                val.f_float = atof( cfg->psz_value ? cfg->psz_value : "0" );
+                val.f_float = us_atof( cfg->psz_value ? cfg->psz_value : "0" );
                 break;
             case VLC_VAR_STRING:
             case VLC_VAR_MODULE:
index 8c4122d4834a98794be9e56fc122a9b79377807c..714ed58a09ebd397dbfc956137e123e35ee1ee66 100644 (file)
@@ -29,6 +29,7 @@
 #endif
 
 #include <vlc_common.h>
+#include <vlc_charset.h>
 #include "variables.h"
 
 #include "libvlc.h"
@@ -1122,7 +1123,7 @@ void var_OptionParse( vlc_object_t *p_obj, const char *psz_option,
         break;
 
     case VLC_VAR_FLOAT:
-        val.f_float = atof( psz_value );
+        val.f_float = us_atof( psz_value );
         break;
 
     case VLC_VAR_STRING:
@@ -1596,7 +1597,7 @@ int __var_Command( vlc_object_t *p_this, const char *psz_name,
             i_ret = var_SetInteger( p_obj, psz_cmd, atoi( psz_arg ) );
             break;
         case VLC_VAR_FLOAT:
-            i_ret = var_SetFloat( p_obj, psz_cmd, atof( psz_arg ) );
+            i_ret = var_SetFloat( p_obj, psz_cmd, us_atof( psz_arg ) );
             break;
         case VLC_VAR_STRING:
             i_ret = var_SetString( p_obj, psz_cmd, psz_arg );
index d267a4a5e58e53653f5b8ca3573342e9e7d5c122..f05ad3c2774956f0b7f0be51d1aa99666725ee6c 100644 (file)
@@ -269,7 +269,7 @@ void vout_IntfInit( vout_thread_t *p_vout )
         }
         else
         {
-            i_aspect = atof( val.psz_string );
+            i_aspect = us_atof( val.psz_string );
             vlc_ureduce( &i_aspect_num, &i_aspect_den,
                          i_aspect *VOUT_ASPECT_FACTOR, VOUT_ASPECT_FACTOR, 0 );
         }