clean up bounds checking for SIDEVICE_ENUM

This commit is contained in:
Calvin Cochran 2016-08-07 18:04:16 -07:00 committed by Calvin Cochran
parent 1ab99ee22c
commit ba45a5999f
2 changed files with 3 additions and 1 deletions

View File

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

View File

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