diff --git a/applications/present3D/ReaderWriterP3D.cpp b/applications/present3D/ReaderWriterP3D.cpp index 2bb8c35f6..d0cd168e2 100644 --- a/applications/present3D/ReaderWriterP3D.cpp +++ b/applications/present3D/ReaderWriterP3D.cpp @@ -1126,7 +1126,7 @@ void ReaderWriterP3DXML::parseLayer(osgPresentation::SlideShowConstructor& const } else if (cur->name == "duration") { - constructor.setLayerDuration(atof(cur->contents.c_str())); + constructor.setLayerDuration(osg::asciiToDouble(cur->contents.c_str())); } else if (getKeyPosition(cur, keyPosition)) { @@ -1370,7 +1370,7 @@ void ReaderWriterP3DXML::parseSlide (osgPresentation::SlideShowConstructor& cons } else if (cur->name == "duration") { - constructor.setSlideDuration(atof(cur->contents.c_str())); + constructor.setSlideDuration(osg::asciiToDouble(cur->contents.c_str())); } else if (getKeyPosition(cur, keyPosition)) { @@ -1892,7 +1892,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterP3DXML::readNode(osgDB::XmlNode::Inp } else if (cur->name == "duration") { - constructor.setPresentationDuration(atof(cur->contents.c_str())); + constructor.setPresentationDuration(osg::asciiToDouble(cur->contents.c_str())); } else if (getKeyPosition(cur, keyPosition)) { diff --git a/src/osg/ArgumentParser.cpp b/src/osg/ArgumentParser.cpp index 1c39daac6..7d18693b5 100644 --- a/src/osg/ArgumentParser.cpp +++ b/src/osg/ArgumentParser.cpp @@ -16,6 +16,7 @@ #include #include +#include #include #include @@ -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; diff --git a/src/osg/CullSettings.cpp b/src/osg/CullSettings.cpp index b9adeed58..de5992abf 100644 --- a/src/osg/CullSettings.cpp +++ b/src/osg/CullSettings.cpp @@ -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< #include #include +#include #include #include @@ -268,22 +269,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) diff --git a/src/osgDB/DatabasePager.cpp b/src/osgDB/DatabasePager.cpp index e7245fe3b..b10c3b5ec 100644 --- a/src/osgDB/DatabasePager.cpp +++ b/src/osgDB/DatabasePager.cpp @@ -1,4 +1,4 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or @@ -907,7 +907,7 @@ DatabasePager::DatabasePager() _expiryDelay = 10.0; if( (ptr = getenv("OSG_EXPIRY_DELAY")) != 0) { - _expiryDelay = atof(ptr); + _expiryDelay = osg::asciiToDouble(ptr); osg::notify(osg::NOTICE)<<"Expiry delay = "<<_expiryDelay< start) && (start != std::string::npos)) - x = atof(str.substr(start, end-start).c_str()); + x = osg::asciiToFloat(str.substr(start, end-start).c_str()); else return Vec3f(); @@ -201,7 +201,7 @@ Vec3f VBSPEntity::getVector(std::string str) end = str.find_first_of(" \t\r\n", start); if ((end > start) && (start != std::string::npos)) - y = atof(str.substr(start, end-start).c_str()); + y = osg::asciiToFloat(str.substr(start, end-start).c_str()); else return Vec3f(); @@ -214,7 +214,7 @@ Vec3f VBSPEntity::getVector(std::string str) end = str.length(); if ((end > start) && (start != std::string::npos)) - z = atof(str.substr(start, end-start).c_str()); + z = osg::asciiToFloat(str.substr(start, end-start).c_str()); else return Vec3f(); diff --git a/src/osgPlugins/cfg/ConfigParser.cpp b/src/osgPlugins/cfg/ConfigParser.cpp index 001e08246..fc6d6bb76 100644 --- a/src/osgPlugins/cfg/ConfigParser.cpp +++ b/src/osgPlugins/cfg/ConfigParser.cpp @@ -1932,21 +1932,21 @@ yyreduce: case 114: { - yyval.real = atof(flexer->YYText()); + yyval.real = osg::asciiToFloat(flexer->YYText()); ;} break; case 115: { - yyval.real = atof(flexer->YYText()); + yyval.real = osg::asciiToFloat(flexer->YYText()); ;} break; case 116: { - yyval.real = atof(flexer->YYText()); + yyval.real = osg::asciiToFloat(flexer->YYText()); ;} break; diff --git a/src/osgPlugins/cfg/ConfigParser.y b/src/osgPlugins/cfg/ConfigParser.y index f25cf6e24..cf9adf507 100644 --- a/src/osgPlugins/cfg/ConfigParser.y +++ b/src/osgPlugins/cfg/ConfigParser.y @@ -518,18 +518,18 @@ input_area_entry : real : PRTOKEN_FLOAT { - $$ = atof(flexer->YYText()); + $$ = osg::asciiToFloat(flexer->YYText()); } | PRTOKEN_INTEGER { - $$ = atof(flexer->YYText()); + $$ = osg::asciiToFloat(flexer->YYText()); } ; floatparam : PRTOKEN_FLOAT { - $$ = atof(flexer->YYText()); + $$ = osg::asciiToFloat(flexer->YYText()); } ; diff --git a/src/osgPlugins/dw/ReaderWriterDW.cpp b/src/osgPlugins/dw/ReaderWriterDW.cpp index c56132434..4ecddb127 100644 --- a/src/osgPlugins/dw/ReaderWriterDW.cpp +++ b/src/osgPlugins/dw/ReaderWriterDW.cpp @@ -858,33 +858,33 @@ class ReaderWriterDW : public osgDB::ReaderWriter } else if (strncmp(buff, "CurrPhase:",10)==0) { } else if (strncmp(buff, "numPhases:",10)==0) { } else if (strncmp(buff, "Opacity:",8)==0) { - float opacity=atof(buff+8); + float opacity=osg::asciiToFloat(buff+8); matpalet[nmat].setopacity(opacity); } else if (strncmp(buff, "FallOff:",8)==0) { - float fo=atof(buff+8); + float fo=osg::asciiToFloat(buff+8); matpalet[nmat].setFallOff(fo); } else if (strncmp(buff, "InnerHalfAngle:",15)==0) { - float ha=atof(buff+15); + float ha=osg::asciiToFloat(buff+15); matpalet[nmat].setHalfAngleIn(ha); } else if (strncmp(buff, "OuterHalfAngle:",15)==0) { - float ha=atof(buff+15); + float ha=osg::asciiToFloat(buff+15); matpalet[nmat].setHalfAngleOut(ha); } else if (strncmp(buff, "Brightness:",11)==0) { - float br=atof(buff+11); + float br=osg::asciiToFloat(buff+11); matpalet[nmat].setBright(br); } else if (strncmp(buff, "Attentuation:",13)==0) { // oops - they can't spell matpalet[nmat].setAtten(buff+13); } else if (strncmp(buff, "MaterialType:",13)==0) { matpalet[nmat].setType(buff+14); } else if (strncmp(buff, "SpecularReflectivity:",21)==0) { - float spec=atof(buff+21); + float spec=osg::asciiToFloat(buff+21); matpalet[nmat].setspecular(spec); } else if (strncmp(buff, "SmoothnessExponent:",19)==0) { - float spec=atof(buff+19); + float spec=osg::asciiToFloat(buff+19); matpalet[nmat].setspecexp(spec*128.0f/100.0f); // convert to 0-128 range from percent } else if (strncmp(buff, "TextureWidthAndHeight:",22)==0) { char *ct=strchr(buff+22,','); - float repx=atof(buff+23), repy=atof(ct+1); + float repx=osg::asciiToFloat(buff+23), repy=osg::asciiToFloat(ct+1); matpalet[nmat].settxrep(repx, repy); } else if (strncmp(buff, "PictureFile:",12)==0) { char *end=strchr(buff,'\n'); // end of line diff --git a/src/osgPlugins/ive/DataOutputStream.cpp b/src/osgPlugins/ive/DataOutputStream.cpp index 52cc272c6..219e66d09 100644 --- a/src/osgPlugins/ive/DataOutputStream.cpp +++ b/src/osgPlugins/ive/DataOutputStream.cpp @@ -183,7 +183,7 @@ DataOutputStream::DataOutputStream(std::ostream * ostream, const osgDB::ReaderWr if (numOfCharInNumber>0) { std::string numberString = optionsString.substr(endOfToken+1, numOfCharInNumber); - _maximumErrorToSizeRatio = atof(numberString.c_str()); + _maximumErrorToSizeRatio = osg::asciiToDouble(numberString.c_str()); osg::notify(osg::DEBUG_INFO)<<"TerrainMaximumErrorToSizeRatio = "<<_maximumErrorToSizeRatio<name == "duration") { - constructor.setLayerDuration(atof(cur->contents.c_str())); + constructor.setLayerDuration(osg::asciiToDouble(cur->contents.c_str())); } else if (getKeyPosition(cur, keyPosition)) { @@ -1370,7 +1370,7 @@ void ReaderWriterP3DXML::parseSlide (osgPresentation::SlideShowConstructor& cons } else if (cur->name == "duration") { - constructor.setSlideDuration(atof(cur->contents.c_str())); + constructor.setSlideDuration(osg::asciiToDouble(cur->contents.c_str())); } else if (getKeyPosition(cur, keyPosition)) { @@ -1891,7 +1891,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterP3DXML::readNode(osgDB::XmlNode::Inp } else if (cur->name == "duration") { - constructor.setPresentationDuration(atof(cur->contents.c_str())); + constructor.setPresentationDuration(osg::asciiToDouble(cur->contents.c_str())); } else if (getKeyPosition(cur, keyPosition)) { diff --git a/src/osgPlugins/ply/plyfile.cpp b/src/osgPlugins/ply/plyfile.cpp index b899e1a67..979cc94fd 100644 --- a/src/osgPlugins/ply/plyfile.cpp +++ b/src/osgPlugins/ply/plyfile.cpp @@ -46,6 +46,8 @@ WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. #include #include +#include + #if defined(_MSC_VER) && defined(OSG_DISABLE_MSVC_WARNINGS) #pragma warning( disable : 4996 ) #endif @@ -857,7 +859,7 @@ PlyFile *ply_read(FILE *fp, int *nelems, char ***elem_names) free (words); return (NULL); } - plyfile->version = atof (words[2]); + plyfile->version = osg::asciiToDouble (words[2]); } else if (equal_strings (words[0], "element")) add_element (plyfile, words, nwords); @@ -2483,7 +2485,7 @@ void get_ascii_item( case PLY_FLOAT: case PLY_FLOAT32: case PLY_DOUBLE: - *double_val = atof (word); + *double_val = osg::asciiToDouble(word); *int_val = (int) *double_val; *uint_val = (unsigned int) *double_val; break; diff --git a/src/osgPlugins/txp/ReaderWriterTXP.cpp b/src/osgPlugins/txp/ReaderWriterTXP.cpp index 0b4a4f85c..a42fad360 100644 --- a/src/osgPlugins/txp/ReaderWriterTXP.cpp +++ b/src/osgPlugins/txp/ReaderWriterTXP.cpp @@ -539,14 +539,14 @@ bool ReaderWriterTXP::extractChildrenLocations(const std::string& name, int pare token = strtok(0, "_"); if(!token) break; - locs[idx].zmin = (float)atof(token); + locs[idx].zmin = osg::asciiToFloat(token); nbTokenRead++; // ZMAX token = strtok(0, "_"); if(!token) break; - locs[idx].zmax= (float)atof(token); + locs[idx].zmax = osg::asciiToFloat(token); nbTokenRead++; locs[idx].lod = parentLod+1; diff --git a/src/osgPlugins/txp/TXPParser.cpp b/src/osgPlugins/txp/TXPParser.cpp index b32679961..f3715147a 100644 --- a/src/osgPlugins/txp/TXPParser.cpp +++ b/src/osgPlugins/txp/TXPParser.cpp @@ -102,7 +102,7 @@ TXPParser::TXPParser(): if (getenv("OSG_TXP_DEFAULT_MAX_ANISOTROPY")) { - _defaultMaxAnisotropy = atof(getenv("OSG_TXP_DEFAULT_MAX_ANISOTROPY")); + _defaultMaxAnisotropy = osg::asciiToFloat(getenv("OSG_TXP_DEFAULT_MAX_ANISOTROPY")); } } diff --git a/src/osgUtil/IncrementalCompileOperation.cpp b/src/osgUtil/IncrementalCompileOperation.cpp index f3b9a886e..263f469fa 100644 --- a/src/osgUtil/IncrementalCompileOperation.cpp +++ b/src/osgUtil/IncrementalCompileOperation.cpp @@ -35,7 +35,7 @@ IncrementalCompileOperation::IncrementalCompileOperation(): const char* ptr = 0; if( (ptr = getenv("OSG_MINIMUM_COMPILE_TIME_PER_FRAME")) != 0) { - _minimumTimeAvailableForGLCompileAndDeletePerFrame = atof(ptr); + _minimumTimeAvailableForGLCompileAndDeletePerFrame = osg::asciiToDouble(ptr); } if( (ptr = getenv("OSG_MAXIMUM_OBJECTS_TO_COMPILE_PER_FRAME")) != 0) diff --git a/src/osgViewer/ViewerBase.cpp b/src/osgViewer/ViewerBase.cpp index 3c6233985..0bd32c396 100644 --- a/src/osgViewer/ViewerBase.cpp +++ b/src/osgViewer/ViewerBase.cpp @@ -76,7 +76,7 @@ void ViewerBase::viewerBaseInit() str = getenv("OSG_RUN_MAX_FRAME_RATE"); if (str) { - _runMaxFrameRate = atof(str); + _runMaxFrameRate = osg::asciiToDouble(str); } } diff --git a/src/osgViewer/ViewerEventHandlers.cpp b/src/osgViewer/ViewerEventHandlers.cpp index ed727c527..f840ad003 100644 --- a/src/osgViewer/ViewerEventHandlers.cpp +++ b/src/osgViewer/ViewerEventHandlers.cpp @@ -400,7 +400,7 @@ RecordCameraPathHandler::RecordCameraPathHandler(const std::string& filename, fl const char* str = getenv("OSG_RECORD_CAMERA_PATH_FPS"); if (str) { - _interval = 1.0f / atof(str); + _interval = 1.0f / osg::asciiToDouble(str); } else {