[vlc-devel] commit: Fix parsing of float-typed variables (Pierre Ynard )
git version control
git at videolan.org
Wed Sep 16 14:56:49 CEST 2009
vlc | branch: 1.0-bugfix | Pierre Ynard <linkfanel at yahoo.fr> | Wed Sep 16 14:31:25 2009 +0200| [989bb78eb585d1deba2c294468874677d1ccb657] | committer: Pierre Ynard
Fix parsing of float-typed variables
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.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=989bb78eb585d1deba2c294468874677d1ccb657
---
modules/access/v4l.c | 5 +++--
modules/access/v4l2.c | 5 +++--
modules/codec/x264.c | 6 ++++--
src/config/chain.c | 3 ++-
src/misc/variables.c | 5 +++--
src/video_output/vout_intf.c | 2 +-
6 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/modules/access/v4l.c b/modules/access/v4l.c
index 11261e7..c15e4de 100644
--- a/modules/access/v4l.c
+++ b/modules/access/v4l.c
@@ -38,6 +38,7 @@
#include <vlc_demux.h>
#include <vlc_access.h>
#include <vlc_vout.h>
+#include <vlc_charset.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
@@ -633,8 +634,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=" ) )
diff --git a/modules/access/v4l2.c b/modules/access/v4l2.c
index 7b1f3c3..4b1c67c 100644
--- a/modules/access/v4l2.c
+++ b/modules/access/v4l2.c
@@ -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>
@@ -771,8 +772,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=" ) ) )
{
diff --git a/modules/codec/x264.c b/modules/codec/x264.c
index 32f39e0..fbe32b6 100644
--- a/modules/codec/x264.c
+++ b/modules/codec/x264.c
@@ -33,6 +33,7 @@
#include <vlc_vout.h>
#include <vlc_sout.h>
#include <vlc_codec.h>
+#include <vlc_charset.h>
#ifdef PTW32_STATIC_LIB
#include <pthread.h>
@@ -899,8 +900,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 );
diff --git a/src/config/chain.c b/src/config/chain.c
index 3122c48..8e0c067 100644
--- a/src/config/chain.c
+++ b/src/config/chain.c
@@ -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:
diff --git a/src/misc/variables.c b/src/misc/variables.c
index 52a7f7e..f045a51 100644
--- a/src/misc/variables.c
+++ b/src/misc/variables.c
@@ -29,6 +29,7 @@
#endif
#include <vlc_common.h>
+#include <vlc_charset.h>
#include "variables.h"
#include "libvlc.h"
@@ -1083,7 +1084,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:
@@ -1511,7 +1512,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 );
diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c
index 04b30ae..9261bc1 100644
--- a/src/video_output/vout_intf.c
+++ b/src/video_output/vout_intf.c
@@ -350,7 +350,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 );
}
More information about the vlc-devel
mailing list