From 517336923fae93215712623b986f130e197210dd Mon Sep 17 00:00:00 2001 From: kervala Date: Thu, 20 Oct 2016 12:33:37 +0200 Subject: [PATCH] Changed: Replace sscanf by fromString --HG-- branch : develop --- code/nel/src/misc/hierarchical_timer.cpp | 2 +- code/ryzom/server/src/ai_service/commands.cpp | 8 ++++---- .../src/entities_game_service/entities_game_service.cpp | 3 ++- .../server/src/persistant_data_service/db_manager.cpp | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/code/nel/src/misc/hierarchical_timer.cpp b/code/nel/src/misc/hierarchical_timer.cpp index 62dc0786a..70fb98d9f 100644 --- a/code/nel/src/misc/hierarchical_timer.cpp +++ b/code/nel/src/misc/hierarchical_timer.cpp @@ -1082,7 +1082,7 @@ NLMISC_CATEGORISED_COMMAND(nel,displayMeasures, "display hierarchical timer", "[ } sint depth = 0; - bool hasDepth = (sscanf(args[0].c_str(), "%d", &depth) == 1 || (args.size() > 1 && sscanf(args[1].c_str(), "%d", &depth) == 1)); + bool hasDepth = (fromString(args[0], depth) || (args.size() > 1 && fromString(args[1], depth))); CASE_DISPLAYMEASURES(NoSort, -3) CASE_DISPLAYMEASURES(TotalTime, -2) diff --git a/code/ryzom/server/src/ai_service/commands.cpp b/code/ryzom/server/src/ai_service/commands.cpp index 8d8d1c7c9..0cea6f93c 100644 --- a/code/ryzom/server/src/ai_service/commands.cpp +++ b/code/ryzom/server/src/ai_service/commands.cpp @@ -3122,8 +3122,8 @@ static void setRyzomDebugDate(CRyzomDate &rd) NLMISC_COMMAND(setDebugHour, "set the current debug hour", "") { if (args.size() != 1) return false; - int hour; - if (sscanf(args[0].c_str(), "%d", &hour) != 1) return false; + sint hour; + if (!fromString(args[0], hour)) return false; CRyzomDate rd; getRyzomDebugDate(rd); rd.Time = fmodf(rd.Time, 1.f) + (float) hour; @@ -3134,8 +3134,8 @@ NLMISC_COMMAND(setDebugHour, "set the current debug hour", "") NLMISC_COMMAND(setDebugDayOfYear, "set the current debug day of year (first day has index 1)", "") { if (args.size() != 1) return false; - int day; - if (sscanf(args[0].c_str(), "%d", &day) != 1) return false; + sint day; + if (!fromString(args[0], day)) return false; CRyzomDate rd; getRyzomDebugDate(rd); rd.Day = day - 1; // for the user, days start at '1' diff --git a/code/ryzom/server/src/entities_game_service/entities_game_service.cpp b/code/ryzom/server/src/entities_game_service/entities_game_service.cpp index 23a43beff..b84129e46 100644 --- a/code/ryzom/server/src/entities_game_service/entities_game_service.cpp +++ b/code/ryzom/server/src/entities_game_service/entities_game_service.cpp @@ -3916,7 +3916,8 @@ NLMISC_COMMAND( db, "Display or set the value of a property in the database", "< { // Set sint64 value; - sscanf( args[2].c_str(), "%"NL_I64"d", &value ); + fromString(args[2], value); + if ( (args.size() > 3) && (args[3]!="0") ) { res = e->_PropertyDatabase.x_setPropButDontSend( entry, value ); diff --git a/code/ryzom/server/src/persistant_data_service/db_manager.cpp b/code/ryzom/server/src/persistant_data_service/db_manager.cpp index 39590d3ca..582788257 100644 --- a/code/ryzom/server/src/persistant_data_service/db_manager.cpp +++ b/code/ryzom/server/src/persistant_data_service/db_manager.cpp @@ -1217,7 +1217,7 @@ NLMISC_COMMAND(dumpToXml, "dump the content of an object into an xml file", "