Merge pull request #766 from cxd4/plz-dont-do-this

fixed impossible arithmetic condition
This commit is contained in:
zilmar 2015-11-18 19:51:21 +11:00
commit 5008c7f024
1 changed files with 2 additions and 3 deletions

View File

@ -426,14 +426,13 @@ void CRomBrowser::FillRomExtensionInfo(ROM_INFO * pRomInfo)
//Get the selected color //Get the selected color
sprintf(String, "%s.Sel", pRomInfo->Status); sprintf(String, "%s.Sel", pRomInfo->Status);
m_RomIniFile->GetString("Rom Status", String, "FFFFFFFF", String, 9); m_RomIniFile->GetString("Rom Status", String, "FFFFFFFF", String, 9);
int selcol = std::strtoul(String, 0, 16); uint32_t selcol = std::strtoul(String, NULL, 16);
if (selcol < 0) if (selcol & 0x80000000)
{ {
pRomInfo->SelColor = -1; pRomInfo->SelColor = -1;
} }
else else
{ {
selcol = (std::strtoul(String, 0, 16) & 0xFFFFFF);
selcol = (selcol & 0x00FF00) | ((selcol >> 0x10) & 0xFF) | ((selcol & 0xFF) << 0x10); selcol = (selcol & 0x00FF00) | ((selcol >> 0x10) & 0xFF) | ((selcol & 0xFF) << 0x10);
pRomInfo->SelColor = selcol; pRomInfo->SelColor = selcol;
} }