From 1a908338392daa21dd46b94a38f122738dffc095 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Fri, 5 Apr 2019 09:48:35 -0700 Subject: [PATCH] Avoid 31-bit left shift of 32-bit signed values --- include/wx/aui/framemanager.h | 2 +- src/osx/core/hidjoystick.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/wx/aui/framemanager.h b/include/wx/aui/framemanager.h index 41cb717ad7..17c9a84153 100644 --- a/include/wx/aui/framemanager.h +++ b/include/wx/aui/framemanager.h @@ -368,7 +368,7 @@ public: buttonCustom3 = 1 << 28, savedHiddenState = 1 << 30, // used internally - actionPane = 1 << 31 // used internally + actionPane = 1u << 31 // used internally }; public: diff --git a/src/osx/core/hidjoystick.cpp b/src/osx/core/hidjoystick.cpp index cf47209311..dfb6950997 100644 --- a/src/osx/core/hidjoystick.cpp +++ b/src/osx/core/hidjoystick.cpp @@ -235,7 +235,7 @@ int wxJoystick::GetButtonState() const bool wxJoystick::GetButtonState(unsigned int id) const { - if (id > sizeof(int) * 8) + if (id >= sizeof(int) * 8) return false; return (GetButtonState() & (1 << id)) != 0; @@ -859,20 +859,20 @@ void* wxJoystickThread::Entry() #endif //is the cookie a button? - if (nIndex < 40) + if (nIndex < 32) { if (hidevent.value) { - pThis->m_buttons |= (1 << nIndex); + pThis->m_buttons |= (1u << nIndex); wxevent.SetEventType(wxEVT_JOY_BUTTON_DOWN); } else { - pThis->m_buttons &= ~(1 << nIndex); + pThis->m_buttons &= ~(1u << nIndex); wxevent.SetEventType(wxEVT_JOY_BUTTON_UP); } - wxevent.SetButtonChange(1 << nIndex); + wxevent.SetButtonChange(1u << nIndex); } else if (nIndex == wxJS_AXIS_X) {