From Mathias Froehlich, changes from atof to use osg::asciiToFloat() to avoid locale issues with atof

This commit is contained in:
Robert Osfield
2009-06-25 14:06:29 +00:00
parent 26e3f00882
commit 44da3958c3
13 changed files with 34 additions and 32 deletions

View File

@@ -16,6 +16,7 @@
#include <osg/ArgumentParser>
#include <osg/ApplicationUsage>
#include <osg/Math>
#include <osg/Notify>
#include <set>
@@ -163,8 +164,8 @@ bool ArgumentParser::Parameter::assign(const char* str)
*_value._bool = (strcmp(str,"True")==0 || strcmp(str,"true")==0 || strcmp(str,"TRUE")==0);
break;
}
case Parameter::FLOAT_PARAMETER: *_value._float = atof(str); break;
case Parameter::DOUBLE_PARAMETER: *_value._double = atof(str); break;
case Parameter::FLOAT_PARAMETER: *_value._float = osg::asciiToFloat(str); break;
case Parameter::DOUBLE_PARAMETER: *_value._double = osg::asciiToDouble(str); break;
case Parameter::INT_PARAMETER: *_value._int = atoi(str); break;
case Parameter::UNSIGNED_INT_PARAMETER: *_value._uint = atoi(str); break;
case Parameter::STRING_PARAMETER: *_value._string = str; break;

View File

@@ -111,7 +111,7 @@ void CullSettings::readEnvironmentalVariables()
if ((ptr = getenv("OSG_NEAR_FAR_RATIO")) != 0)
{
_nearFarRatio = atof(ptr);
_nearFarRatio = osg::asciiToDouble(ptr);
osg::notify(osg::INFO)<<"Set near/far ratio to "<<_nearFarRatio<<std::endl;
}

View File

@@ -13,6 +13,7 @@
#include <osg/DisplaySettings>
#include <osg/ArgumentParser>
#include <osg/ApplicationUsage>
#include <osg/Math>
#include <osg/Notify>
#include <osg/ref_ptr>
@@ -267,22 +268,22 @@ void DisplaySettings::readEnvironmentalVariables()
if( (ptr = getenv("OSG_EYE_SEPARATION")) != 0)
{
_eyeSeparation = atof(ptr);
_eyeSeparation = osg::asciiToFloat(ptr);
}
if( (ptr = getenv("OSG_SCREEN_WIDTH")) != 0)
{
_screenWidth = atof(ptr);
_screenWidth = osg::asciiToFloat(ptr);
}
if( (ptr = getenv("OSG_SCREEN_HEIGHT")) != 0)
{
_screenHeight = atof(ptr);
_screenHeight = osg::asciiToFloat(ptr);
}
if( (ptr = getenv("OSG_SCREEN_DISTANCE")) != 0)
{
_screenDistance = atof(ptr);
_screenDistance = osg::asciiToFloat(ptr);
}
if( (ptr = getenv("OSG_SPLIT_STEREO_HORIZONTAL_EYE_MAPPING")) != 0)