diff --git a/code/ryzom/common/src/game_share/object.cpp b/code/ryzom/common/src/game_share/object.cpp index f395bcf7a..d15497ce4 100644 --- a/code/ryzom/common/src/game_share/object.cpp +++ b/code/ryzom/common/src/game_share/object.cpp @@ -1897,16 +1897,18 @@ uint32 CObject::instanceIdToUint32(const std::string& instanceId) std::string clientIdStr = instanceId.substr(6, clientIdIt-6); std::string componentIdStr = instanceId.substr(clientIdIt+1, size - clientIdIt); - char* ko=NULL; - uint32 clientId = static_cast(strtol(clientIdStr.c_str(), &ko, 10)); - if (*ko != '\0') + bool ko; + uint32 clientId; + ko = NLMISC::fromString(clientIdStr, clientId); + if (!ko) { nlwarning("R2Share: Wrong InstanceId(%s)", instanceId.c_str()); return 0; } - uint32 componentId = static_cast(strtol(componentIdStr.c_str(), &ko, 10)); - if (*ko != '\0') + uint32 componentId; + ko = NLMISC::fromString(componentIdStr, componentId); + if (!ko) { nlwarning("R2Share: Wrong InstanceId(%s)", instanceId.c_str()); return 0; diff --git a/code/ryzom/common/src/game_share/server_animation_module.cpp b/code/ryzom/common/src/game_share/server_animation_module.cpp index 1db870ca9..577cd3078 100644 --- a/code/ryzom/common/src/game_share/server_animation_module.cpp +++ b/code/ryzom/common/src/game_share/server_animation_module.cpp @@ -3932,14 +3932,15 @@ void CServerAnimationModule::activateEasterEgg(class NLNET::IModuleProxy * /* ai DROP_IF( itemAndQt.size() != 2, "Syntax error in activateEasterEgg", return ); - char* ok = 0; - uint32 item = static_cast(strtol(itemAndQt[0].c_str(), &ok, 10)); + uint32 item; + bool ok = NLMISC::fromString(itemAndQt[0], item); - DROP_IF( *ok != '\0', "Error activateEasterEgg", return); + DROP_IF( !ok, "Error activateEasterEgg", return); - uint32 qt = static_cast(strtol(itemAndQt[1].c_str(), &ok, 10)); + uint32 qt; + ok = NLMISC::fromString(itemAndQt[1], qt); - DROP_IF( *ok != '\0', "Error in activateEasterEgg", return); + DROP_IF( !ok, "Error in activateEasterEgg", return); DROP_IF( qt > 255, "Error in activateEasterEgg", return); DROP_IF( item >= session->MissionItems.size(), "Error activateEasterEgg", return);