diff --git a/code/nel/samples/misc/command/main.cpp b/code/nel/samples/misc/command/main.cpp index bd101c6b5..ba0bd3e96 100644 --- a/code/nel/samples/misc/command/main.cpp +++ b/code/nel/samples/misc/command/main.cpp @@ -56,7 +56,8 @@ NLMISC_COMMAND(square,"display the square of the parameter","") // check args, if there is not the right number of parameters, return bad status. if (args.size() != 1) return false; - uint32 val = atoi(args[0].c_str()); + uint32 val; + NLMISC::fromString(args[0], val); // display the result. log.displayNL("The square of %d is %d", val, val*val); diff --git a/code/nel/samples/net/udp/client.cpp b/code/nel/samples/net/udp/client.cpp index 06f494138..749797368 100644 --- a/code/nel/samples/net/udp/client.cpp +++ b/code/nel/samples/net/udp/client.cpp @@ -215,8 +215,9 @@ void cbInfo (CMessage &msgin, TSockId from, CCallbackNetBase &netbase) string token = "MeanPongTime "; string::size_type pos=line.find (token); string::size_type pos2=line.find (" ", pos+token.size()); - uint32 val = atoi(line.substr (pos+token.size(), pos2-pos-token.size()).c_str()); - LagGraph.addOneValue ((float)val); + float val; + NLMISC::fromString(line.substr (pos+token.size(), pos2-pos-token.size()), val); + LagGraph.addOneValue (val); #endif } diff --git a/code/nel/src/logic/logic_variable.cpp b/code/nel/src/logic/logic_variable.cpp index bca00fc91..63f5f66fc 100644 --- a/code/nel/src/logic/logic_variable.cpp +++ b/code/nel/src/logic/logic_variable.cpp @@ -381,7 +381,7 @@ void CLogicCounter::read (xmlNodePtr node) _Name = getXMLProp (node, "Name"); _Value = atoiInt64 (getXMLProp (node, "Value").c_str()); - _Verbose = atoi(getXMLProp (node, "Verbose").c_str()) == 1; + NLMISC::fromString(getXMLProp (node, "Verbose"), _Verbose); Period.setValue(atoiInt64(getXMLProp (node, "Period").c_str())); Phase.setValue(atoiInt64(getXMLProp (node, "Phase").c_str())); Step.setValue(atoiInt64(getXMLProp (node, "Step").c_str())); diff --git a/code/nel/src/misc/config_file/config_file.cpp b/code/nel/src/misc/config_file/config_file.cpp index 2351a58f7..f85469003 100644 --- a/code/nel/src/misc/config_file/config_file.cpp +++ b/code/nel/src/misc/config_file/config_file.cpp @@ -56,8 +56,12 @@ int CConfigFile::CVar::asInt (int index) const switch (Type) { case T_STRING: + { if (index >= (int)StrValues.size () || index < 0) throw EBadSize (Name, (int)StrValues.size (), index); - return atoi(StrValues[index].c_str()); + int ret = 0; + NLMISC::fromString(StrValues[index], ret); + return ret; + } case T_REAL: if (index >= (int)RealValues.size () || index < 0) throw EBadSize (Name, (int)RealValues.size (), index); return (int)RealValues[index]; diff --git a/code/nel/tools/3d/build_shadow_skin/main.cpp b/code/nel/tools/3d/build_shadow_skin/main.cpp index 38562e5d1..1c180d1e2 100644 --- a/code/nel/tools/3d/build_shadow_skin/main.cpp +++ b/code/nel/tools/3d/build_shadow_skin/main.cpp @@ -314,9 +314,9 @@ int main(int argc, char *argv[]) sint percentageFace= 100; sint maxFace= INT_MAX; if(argc>=4) - percentageFace= atoi(argv[3]); + NLMISC::fromString(argv[3], percentageFace); if(argc>=5) - maxFace= atoi(argv[4]); + NLMISC::fromString(argv[4], maxFace); // **** Load the Mesh In. IShape *pResult = NULL; diff --git a/code/nel/tools/3d/object_viewer/edit_ex.cpp b/code/nel/tools/3d/object_viewer/edit_ex.cpp index 5659145f1..754635b6d 100644 --- a/code/nel/tools/3d/object_viewer/edit_ex.cpp +++ b/code/nel/tools/3d/object_viewer/edit_ex.cpp @@ -52,13 +52,17 @@ void CEditEx::OnSetFocus(CWnd* pOldWnd) sint CEditEx::getSInt() const { nlassert(_Type == SIntType); - return (sint) ::atoi(getString().c_str()); + sint ret = 0; + NLMISC::fromString(getString(), ret); + return ret; } uint CEditEx::getUInt() const { nlassert(_Type == UIntType); - return (uint) ::atoi(getString().c_str()); + uint ret = 0; + NLMISC::fromString(getString(), ret); + return ret; } float CEditEx::getFloat() const { diff --git a/code/nel/tools/3d/shapes_exporter/shapes_exporter.cpp b/code/nel/tools/3d/shapes_exporter/shapes_exporter.cpp index 2585e762b..6abfe682b 100644 --- a/code/nel/tools/3d/shapes_exporter/shapes_exporter.cpp +++ b/code/nel/tools/3d/shapes_exporter/shapes_exporter.cpp @@ -880,7 +880,8 @@ bool ShapesExporter::createThumbnail(const string &filename, const string &path) if (!fgets(str, 100, fp)) strcpy(str, "0"); fclose(fp); - selectedFrame = atoi(str)/2; + NLMISC::fromString(std::string(str), selectedFrame); + selectedFrame /= 2; } } diff --git a/code/nel/tools/3d/zone_lib/zone_utility.cpp b/code/nel/tools/3d/zone_lib/zone_utility.cpp index 63570aa39..3c73e3739 100644 --- a/code/nel/tools/3d/zone_lib/zone_utility.cpp +++ b/code/nel/tools/3d/zone_lib/zone_utility.cpp @@ -116,7 +116,8 @@ bool getZoneCoordByName(const char * name, uint16& x, uint16& y) return false; } } - y = atoi(ystr.c_str()); + + NLMISC::fromString(ystr, y); // x x = 0; diff --git a/code/nel/tools/3d/zviewer/zviewer.cpp b/code/nel/tools/3d/zviewer/zviewer.cpp index 420551a3e..6cd17e7df 100644 --- a/code/nel/tools/3d/zviewer/zviewer.cpp +++ b/code/nel/tools/3d/zviewer/zviewer.cpp @@ -962,7 +962,7 @@ int main(int /* argc */, char ** /* argv */) NLMISC::CApplicationContext myApplicationContext; #ifdef NL_OS_UNIX - NLMISC::CPath::addSearchPath(NLMISC::CFile::getApplicationDirectory("NeL")); + NLMISC::CPath::addSearchPath(NLMISC::CPath::getApplicationDirectory("NeL")); #endif // NL_OS_UNIX NLMISC::CPath::addSearchPath(NL_ZVIEWER_CFG); diff --git a/code/nel/tools/misc/log_analyser/log_analyserDlg.cpp b/code/nel/tools/misc/log_analyser/log_analyserDlg.cpp index 8103090c8..1f09bd91e 100644 --- a/code/nel/tools/misc/log_analyser/log_analyserDlg.cpp +++ b/code/nel/tools/misc/log_analyser/log_analyserDlg.cpp @@ -59,7 +59,8 @@ afx_msg void CLAEdit::OnKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags ) int start, end; GetSel( start, end ); str = str.Mid( start, end-start ); - int lineNum = atoi( str ); + sint lineNum; + NLMISC::fromString(str, lineNum); if ( ! ((lineNum != 0) || (str == "0")) ) break; @@ -713,7 +714,8 @@ void CLog_analyserDlg::insertTraceLine( int index, char *traceLine ) char *line = strchr( traceLine, ':' ); char scycle [10]; strncpy( scycle, traceLine, line-traceLine ); - int cycle = atoi(scycle); + sint cycle; + NLMISC::fromString(scycle, cycle); TStampedLine stampedLine; stampedLine.Index = index; stampedLine.Line = CString(traceLine); diff --git a/code/nel/tools/misc/make_sheet_id/make_sheet_id.cpp b/code/nel/tools/misc/make_sheet_id/make_sheet_id.cpp index c84b328ef..215dafa9e 100644 --- a/code/nel/tools/misc/make_sheet_id/make_sheet_id.cpp +++ b/code/nel/tools/misc/make_sheet_id/make_sheet_id.cpp @@ -424,7 +424,7 @@ int main( int argc, char ** argv ) NLMISC::CApplicationContext appContext; #ifdef NL_OS_UNIX - NLMISC::CPath::addSearchPath(NLMISC::CFile::getApplicationDirectory("NeL")); + NLMISC::CPath::addSearchPath(NLMISC::CPath::getApplicationDirectory("NeL")); #endif // NL_OS_UNIX NLMISC::CPath::addSearchPath(NL_MK_SH_ID_CFG); diff --git a/code/nel/tools/pacs/build_ig_boxes/main.cpp b/code/nel/tools/pacs/build_ig_boxes/main.cpp index 9d420745d..046e5ee74 100644 --- a/code/nel/tools/pacs/build_ig_boxes/main.cpp +++ b/code/nel/tools/pacs/build_ig_boxes/main.cpp @@ -86,7 +86,7 @@ void init() try { #ifdef NL_OS_UNIX - NLMISC::CPath::addSearchPath(NLMISC::CFile::getApplicationDirectory("NeL")); + NLMISC::CPath::addSearchPath(NLMISC::CPath::getApplicationDirectory("NeL")); #endif // NL_OS_UNIX NLMISC::CPath::addSearchPath(NL_BIB_CFG); diff --git a/code/nel/tools/pacs/build_indoor_rbank/main.cpp b/code/nel/tools/pacs/build_indoor_rbank/main.cpp index 9fbd77d1e..1d459e2ee 100644 --- a/code/nel/tools/pacs/build_indoor_rbank/main.cpp +++ b/code/nel/tools/pacs/build_indoor_rbank/main.cpp @@ -122,7 +122,7 @@ void initConfig() try { #ifdef NL_OS_UNIX - NLMISC::CPath::addSearchPath(NLMISC::CFile::getApplicationDirectory("NeL")); + NLMISC::CPath::addSearchPath(NLMISC::CPath::getApplicationDirectory("NeL")); #endif // NL_OS_UNIX NLMISC::CPath::addSearchPath(NL_BIRB_CFG);