Merge pull request #859 from cxd4/strtoul-ya-no-stds-plz

[core] fixed strtoul() for more compile errors
This commit is contained in:
zilmar 2016-01-06 13:22:04 +11:00
commit 1f30475f97
1 changed files with 8 additions and 8 deletions

View File

@ -40,7 +40,7 @@ bool CCheats::LoadCode(int CheatNo, const char * CheatString)
{
GAMESHARK_CODE CodeEntry;
CodeEntry.Command = std::strtoul(ReadPos, 0, 16);
CodeEntry.Command = strtoul(ReadPos, 0, 16);
ReadPos = strchr(ReadPos, ' ');
if (ReadPos == NULL) { break; }
ReadPos += 1;
@ -50,27 +50,27 @@ bool CCheats::LoadCode(int CheatNo, const char * CheatString)
if (CheatNo < 0 || CheatNo > MaxCheats) { return false; }
stdstr CheatExt = g_Settings->LoadStringIndex(Cheat_Extension, CheatNo);
if (CheatExt.empty()) { return false; }
CodeEntry.Value = CheatExt[0] == '$' ? (uint16_t)std::strtoul(&CheatExt.c_str()[1], 0, 16) : (uint16_t)atol(CheatExt.c_str());
CodeEntry.Value = CheatExt[0] == '$' ? (uint16_t)strtoul(&CheatExt.c_str()[1], 0, 16) : (uint16_t)atol(CheatExt.c_str());
}
else if (strncmp(ReadPos, "??", 2) == 0)
{
if (CheatNo < 0 || CheatNo > MaxCheats) { return false; }
stdstr CheatExt = g_Settings->LoadStringIndex(Cheat_Extension, CheatNo);
if (CheatExt.empty()) { return false; }
CodeEntry.Value = (uint8_t)(std::strtoul(ReadPos, 0, 16));
CodeEntry.Value |= (CheatExt[0] == '$' ? (uint8_t)std::strtoul(&CheatExt.c_str()[1], 0, 16) : (uint8_t)atol(CheatExt.c_str())) << 16;
CodeEntry.Value = (uint8_t)(strtoul(ReadPos, 0, 16));
CodeEntry.Value |= (CheatExt[0] == '$' ? (uint8_t)strtoul(&CheatExt.c_str()[1], 0, 16) : (uint8_t)atol(CheatExt.c_str())) << 16;
}
else if (strncmp(&ReadPos[2], "??", 2) == 0)
{
if (CheatNo < 0 || CheatNo > MaxCheats) { return false; }
stdstr CheatExt = g_Settings->LoadStringIndex(Cheat_Extension, CheatNo);
if (CheatExt.empty()) { return false; }
CodeEntry.Value = (uint16_t)(std::strtoul(ReadPos, 0, 16) << 16);
CodeEntry.Value |= CheatExt[0] == '$' ? (uint8_t)std::strtoul(&CheatExt.c_str()[1], 0, 16) : (uint8_t)atol(CheatExt.c_str());
CodeEntry.Value = (uint16_t)(strtoul(ReadPos, 0, 16) << 16);
CodeEntry.Value |= CheatExt[0] == '$' ? (uint8_t)strtoul(&CheatExt.c_str()[1], 0, 16) : (uint8_t)atol(CheatExt.c_str());
}
else
{
CodeEntry.Value = (uint16_t)std::strtoul(ReadPos, 0, 16);
CodeEntry.Value = (uint16_t)strtoul(ReadPos, 0, 16);
}
Code.push_back(CodeEntry);
@ -264,7 +264,7 @@ bool CCheats::IsValid16BitCode(const char * CheatString)
{
GAMESHARK_CODE CodeEntry;
CodeEntry.Command = std::strtoul(ReadPos, 0, 16);
CodeEntry.Command = strtoul(ReadPos, 0, 16);
ReadPos = strchr(ReadPos, ' ');
if (ReadPos == NULL) { break; }
ReadPos += 1;