mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-26 22:38:34 +00:00
IniFile: Handle s64/u64 values
This commit is contained in:
parent
51136681df
commit
beec40f178
19 changed files with 133 additions and 40 deletions
|
@ -247,6 +247,25 @@ bool TryParse(const std::string& str, u32* const output)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool TryParse(const std::string& str, u64* const output)
|
||||
{
|
||||
char* end_ptr = nullptr;
|
||||
|
||||
// Set errno to a clean slate
|
||||
errno = 0;
|
||||
|
||||
u64 value = strtoull(str.c_str(), &end_ptr, 0);
|
||||
|
||||
if (end_ptr == nullptr || *end_ptr != '\0')
|
||||
return false;
|
||||
|
||||
if (errno == ERANGE)
|
||||
return false;
|
||||
|
||||
*output = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TryParse(const std::string& str, bool* const output)
|
||||
{
|
||||
float value;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue