diff options
Diffstat (limited to 'intern/ghost/intern/GHOST_NDOFManager.cpp')
-rw-r--r-- | intern/ghost/intern/GHOST_NDOFManager.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/intern/ghost/intern/GHOST_NDOFManager.cpp b/intern/ghost/intern/GHOST_NDOFManager.cpp index 7f6b5f53316..d58fb90f63e 100644 --- a/intern/ghost/intern/GHOST_NDOFManager.cpp +++ b/intern/ghost/intern/GHOST_NDOFManager.cpp @@ -5,11 +5,12 @@ #include "GHOST_EventKey.h" #include "GHOST_EventNDOF.h" #include "GHOST_WindowManager.h" +#include "GHOST_utildefines.h" -#include <limits.h> -#include <math.h> -#include <stdio.h> /* For error/info reporting. */ -#include <string.h> /* For memory functions. */ +#include <climits> +#include <cmath> +#include <cstdio> /* For error/info reporting. */ +#include <cstring> /* For memory functions. */ #ifdef DEBUG_NDOF_MOTION /* Printable version of each GHOST_TProgress value. */ @@ -128,7 +129,7 @@ static const NDOF_ButtonT Generic_HID_map[] = { NDOF_BUTTON_C, }; -static const int genericButtonCount = sizeof(Generic_HID_map) / sizeof(NDOF_ButtonT); +static const int genericButtonCount = ARRAY_SIZE(Generic_HID_map); GHOST_NDOFManager::GHOST_NDOFManager(GHOST_System &sys) : m_system(sys), @@ -255,8 +256,9 @@ bool GHOST_NDOFManager::setDevice(unsigned short vendor_id, unsigned short produ printf("ndof: unknown device %04hx:%04hx\n", vendor_id, product_id); } - if (m_buttonMask == 0) + if (m_buttonMask == 0) { m_buttonMask = (int)~(UINT_MAX << m_buttonCount); + } #ifdef DEBUG_NDOF_BUTTONS printf("ndof: %d buttons -> hex:%X\n", m_buttonCount, m_buttonMask); |