From ba45a5999fe3fe6b5bc83f325d9dacd7daacd649 Mon Sep 17 00:00:00 2001 From: Calvin Cochran Date: Sun, 7 Aug 2016 18:04:16 -0700 Subject: [PATCH] clean up bounds checking for SIDEVICE_ENUM --- Source/Core/Core/BootManager.cpp | 2 +- Source/Core/Core/HW/SI_Device.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/Core/Core/BootManager.cpp b/Source/Core/Core/BootManager.cpp index f443491dfcf7..dae95c785ac3 100644 --- a/Source/Core/Core/BootManager.cpp +++ b/Source/Core/Core/BootManager.cpp @@ -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; diff --git a/Source/Core/Core/HW/SI_Device.h b/Source/Core/Core/HW/SI_Device.h index d2fadc6ac4df..fe3953494c00 100644 --- a/Source/Core/Core/HW/SI_Device.h +++ b/Source/Core/Core/HW/SI_Device.h @@ -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