Use std::from_chars in Emulator::SetUsr
This commit is contained in:
+3
-10
@@ -37,6 +37,7 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
#include <charconv>
|
||||||
|
|
||||||
#include "Utilities/JIT.h"
|
#include "Utilities/JIT.h"
|
||||||
|
|
||||||
@@ -537,16 +538,8 @@ const bool Emulator::SetUsr(const std::string& user)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 id;
|
u32 id = 0;
|
||||||
|
std::from_chars(&user.front(), &user.back() + 1, id);
|
||||||
try
|
|
||||||
{
|
|
||||||
id = static_cast<u32>(std::stoul(user));
|
|
||||||
}
|
|
||||||
catch (const std::exception&)
|
|
||||||
{
|
|
||||||
id = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (id == 0)
|
if (id == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user