Merge pull request #4101 from meffij/SIDevicesEnumFix

clean up bounds checking for SIDEVICE_ENUM
This commit is contained in:
Scott Mansell 2016-08-09 06:09:52 +12:00 committed by GitHub
commit d56ae505dd
2 changed files with 3 additions and 1 deletions

View File

@ -287,7 +287,7 @@ bool BootCore(const std::string& _rFilename)
{
int source;
controls_section->Get(StringFromFormat("PadType%u", i), &source, -1);
if (source >= (int)SIDEVICE_NONE && source <= (int)SIDEVICE_WIIU_ADAPTER)
if (source >= SIDEVICE_NONE && source < SIDEVICE_COUNT)
{
SConfig::GetInstance().m_SIDevice[i] = (SIDevices)source;
config_cache.bSetPads[i] = true;

View File

@ -64,6 +64,8 @@ enum SIDevices : int
SIDEVICE_GC_TARUKONGA,
SIDEVICE_AM_BASEBOARD,
SIDEVICE_WIIU_ADAPTER,
// not a valid device, used for checking whether enum value is valid
SIDEVICE_COUNT,
};
class ISIDevice