From 8d2db7bc8580bd84fab7bdf91067368921488fa7 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 19 Jul 2014 11:14:38 +0200 Subject: [PATCH] Changed: Replaced atof by NLMISC::fromString --- code/nel/tools/3d/build_clod_bank/build_clod_bank.cpp | 2 +- code/nel/tools/3d/object_viewer/edit_ex.cpp | 4 +++- code/nel/tools/3d/object_viewer/main_frame.cpp | 6 +++--- code/nel/tools/3d/object_viewer/vegetable_density_page.cpp | 6 ++++-- code/nel/tools/3d/plugin_max/nel_export/nel_export.cpp | 6 +++--- code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp | 7 ++++--- 6 files changed, 18 insertions(+), 13 deletions(-) diff --git a/code/nel/tools/3d/build_clod_bank/build_clod_bank.cpp b/code/nel/tools/3d/build_clod_bank/build_clod_bank.cpp index 9938eb486..b5cd89f76 100644 --- a/code/nel/tools/3d/build_clod_bank/build_clod_bank.cpp +++ b/code/nel/tools/3d/build_clod_bank/build_clod_bank.cpp @@ -62,7 +62,7 @@ int main(int argc, char *argv[]) float bakeFrameRate= 20; if(argc>=5) { - bakeFrameRate= (float)atof(argv[4]); + NLMISC::fromString(argv[4], bakeFrameRate); if(bakeFrameRate<=1) { nlwarning("bad bakeFrameRate value, use a default of 20"); diff --git a/code/nel/tools/3d/object_viewer/edit_ex.cpp b/code/nel/tools/3d/object_viewer/edit_ex.cpp index c600334b0..71d5b8907 100644 --- a/code/nel/tools/3d/object_viewer/edit_ex.cpp +++ b/code/nel/tools/3d/object_viewer/edit_ex.cpp @@ -67,7 +67,9 @@ uint CEditEx::getUInt() const float CEditEx::getFloat() const { nlassert(_Type == FloatType); - return (float) ::atof(getString().c_str()); + float val; + NLMISC::fromString(getString(), val); + return val; } std::string CEditEx::getString() const diff --git a/code/nel/tools/3d/object_viewer/main_frame.cpp b/code/nel/tools/3d/object_viewer/main_frame.cpp index d063e202d..83ba4ef7b 100644 --- a/code/nel/tools/3d/object_viewer/main_frame.cpp +++ b/code/nel/tools/3d/object_viewer/main_frame.cpp @@ -1392,9 +1392,9 @@ void CMainFrame::OnViewSetSceneRotation() if (sceneRotDlg.DoModal() == IDOK) { // read value. - _LastSceneRotX= (float)atof(sceneRotDlg.RotX); - _LastSceneRotY= (float)atof(sceneRotDlg.RotY); - _LastSceneRotZ= (float)atof(sceneRotDlg.RotZ); + NLMISC::fromString(sceneRotDlg.RotX, _LastSceneRotX); + NLMISC::fromString(sceneRotDlg.RotY, _LastSceneRotY); + NLMISC::fromString(sceneRotDlg.RotZ, _LastSceneRotZ); float rotx= degToRad(_LastSceneRotX); float roty= degToRad(_LastSceneRotY); float rotz= degToRad(_LastSceneRotZ); diff --git a/code/nel/tools/3d/object_viewer/vegetable_density_page.cpp b/code/nel/tools/3d/object_viewer/vegetable_density_page.cpp index 72e53756b..2db682bcd 100644 --- a/code/nel/tools/3d/object_viewer/vegetable_density_page.cpp +++ b/code/nel/tools/3d/object_viewer/vegetable_density_page.cpp @@ -225,7 +225,8 @@ void CVegetableDensityPage::updateAngleMinFromEditText() // get angles edited. char stmp[256]; AngleMinEdit.GetWindowText(stmp, 256); - float angleMin= (float)atof(stmp); + float angleMin; + NLMISC::fromString(stmp, angleMin); NLMISC::clamp(angleMin, -90, 90); // make a sinus, because 90 => 1, and -90 =>-1 float cosAngleMin= (float)sin(angleMin*NLMISC::Pi/180.f); @@ -248,7 +249,8 @@ void CVegetableDensityPage::updateAngleMaxFromEditText() // get angles edited. char stmp[256]; AngleMaxEdit.GetWindowText(stmp, 256); - float angleMax= (float)atof(stmp); + float angleMax; + NLMISC::fromString(stmp, angleMax); NLMISC::clamp(angleMax, -90, 90); // make a sinus, because 90 => 1, and -90 =>-1 float cosAngleMax= (float)sin(angleMax*NLMISC::Pi/180.f); diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export.cpp index 68d3b8b2b..3a3e40810 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export.cpp @@ -173,7 +173,7 @@ INT_PTR CALLBACK OptionsDialogCallback ( if( SendMessage( GetDlgItem(hwndDlg,IDC_RADIORADIOSITYEXPORTLIGHTING), BM_GETCHECK, 0, 0 ) == BST_CHECKED ) theExportSceneStruct.nExportLighting = 1; SendMessage( GetDlgItem(hwndDlg,IDC_EDITLUMELSIZE), WM_GETTEXT, 1024, (long)tmp ); - theExportSceneStruct.rLumelSize = (float)atof( tmp ); + NLMISC::fromString(tmp, theExportSceneStruct.rLumelSize); if( SendMessage( GetDlgItem(hwndDlg,IDC_RADIOSS1), BM_GETCHECK, 0, 0 ) == BST_CHECKED ) theExportSceneStruct.nOverSampling = 1; @@ -192,9 +192,9 @@ INT_PTR CALLBACK OptionsDialogCallback ( // SurfaceLighting theExportSceneStruct.bTestSurfaceLighting= (SendMessage( GetDlgItem(hwndDlg,IDC_TEST_SURFACE_LIGHT), BM_GETCHECK, 0, 0 ) == BST_CHECKED); SendMessage( GetDlgItem(hwndDlg,IDC_EDITCELLSIZE), WM_GETTEXT, 1024, (long)tmp ); - theExportSceneStruct.SurfaceLightingCellSize= (float)atof( tmp ); + NLMISC::fromString(tmp, theExportSceneStruct.SurfaceLightingCellSize); SendMessage( GetDlgItem(hwndDlg,IDC_EDITCELLDELTAZ), WM_GETTEXT, 1024, (long)tmp ); - theExportSceneStruct.SurfaceLightingDeltaZ= (float)atof( tmp ); + NLMISC::fromString(tmp, theExportSceneStruct.SurfaceLightingDeltaZ); // End the dialog EndDialog(hwndDlg, TRUE); diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp index 155bbe5b5..508c482f6 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp @@ -300,9 +300,9 @@ void SLightBuild::convertFromMaxLight (INode *node,TimeValue tvTime) // Get Soft Shadow information string sTmp = CExportNel::getScriptAppData (node, NEL3D_APPDATA_SOFTSHADOW_RADIUS, toString(NEL3D_APPDATA_SOFTSHADOW_RADIUS_DEFAULT)); - this->rSoftShadowRadius = (float)atof(sTmp.c_str()); + NLMISC::fromString(sTmp, this->rSoftShadowRadius); sTmp = CExportNel::getScriptAppData (node, NEL3D_APPDATA_SOFTSHADOW_CONELENGTH, toString(NEL3D_APPDATA_SOFTSHADOW_CONELENGTH_DEFAULT)); - this->rSoftShadowConeLength = (float)atof(sTmp.c_str()); + NLMISC::fromString(sTmp, this->rSoftShadowConeLength); if( deleteIt ) maxLight->DeleteThis(); @@ -2147,7 +2147,8 @@ bool CExportNel::calculateLM( CMesh::CMeshBuild *pZeMeshBuild, CMeshBase::CMeshB // **** Retrieve Shape Node properties string sLumelSizeMul = CExportNel::getScriptAppData (&ZeNode, NEL3D_APPDATA_LUMELSIZEMUL, "1.0"); - float rLumelSizeMul = (float)atof(sLumelSizeMul.c_str()); + float rLumelSizeMul; + NLMISC::fromString(sLumelSizeMul, rLumelSizeMul); // 8Bits LightMap Compression bool lmcEnabled= CExportNel::getScriptAppData (&ZeNode, NEL3D_APPDATA_EXPORT_LMC_ENABLED, BST_UNCHECKED)==BST_CHECKED; enum {NumLightGroup= 3};