diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-12-24 18:54:34 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-12-24 19:32:10 +0100 |
commit | a88e34b21b07f70123926fcb5c505d6afdf99807 (patch) | |
tree | 905059194dcc64c7c163b8912947d8173fd4cc91 /dinput | |
parent | 5bf85412e4eacf92acc936b6e74bce0e2b1055d9 (diff) |
style/quality only
No functional changes.
- add `override' everywhere where missing
- almost pass clang's `-Wweak-vtables'
- avoid some float/double conversions
- remove unused private members
- make signedness conversions explicit
- put stuff in right namespaces to aid analysis
Diffstat (limited to 'dinput')
-rw-r--r-- | dinput/dinput.cpp | 18 | ||||
-rw-r--r-- | dinput/keybinding-worker.hpp | 1 | ||||
-rw-r--r-- | dinput/win32-joystick.hpp | 1 |
3 files changed, 10 insertions, 10 deletions
diff --git a/dinput/dinput.cpp b/dinput/dinput.cpp index 8a3d0f4a..3931255b 100644 --- a/dinput/dinput.cpp +++ b/dinput/dinput.cpp @@ -10,12 +10,12 @@ diptr di_t::init_di_() CoInitialize(nullptr); diptr di = nullptr; - if (HRESULT hr = DirectInput8Create(GetModuleHandle(nullptr), - DIRECTINPUT_VERSION, - IID_IDirectInput8, - (void**)&di, - nullptr); - !SUCCEEDED(hr)) + HRESULT hr = DirectInput8Create(GetModuleHandle(nullptr), + DIRECTINPUT_VERSION, + IID_IDirectInput8, + (void**)&di, + nullptr); + if (!SUCCEEDED(hr)) { qDebug() << "can't make dinput:" << (void*)(LONG_PTR)hr; qDebug() << "crashing!"; @@ -32,7 +32,8 @@ di_t::di_t() void di_t::ref_di() { - while (init_lock.test_and_set()) { /* busy loop */ } + while (init_lock.test_and_set()) + (void)0; if (!handle) handle = init_di_(); @@ -48,7 +49,8 @@ void di_t::unref_di() if (refcnt_ == 0) { - while (init_lock.test_and_set()) { /* busy loop */ } + while (init_lock.test_and_set()) + (void)0; qDebug() << "exit: di handle"; handle->Release(); diff --git a/dinput/keybinding-worker.hpp b/dinput/keybinding-worker.hpp index fdcf94c9..43a4aee1 100644 --- a/dinput/keybinding-worker.hpp +++ b/dinput/keybinding-worker.hpp @@ -53,7 +53,6 @@ private: di_t din; bool keystate[256] {}; - bool old_keystate[256] {}; void run() override; bool run_keyboard_nolock(); diff --git a/dinput/win32-joystick.hpp b/dinput/win32-joystick.hpp index 8d5524ff..59ec0c49 100644 --- a/dinput/win32-joystick.hpp +++ b/dinput/win32-joystick.hpp @@ -51,7 +51,6 @@ struct OTR_DINPUT_EXPORT win32_joy_ctx final LPDIRECTINPUTDEVICE8 joy_handle; QString guid, name; bool last_state[max_buttons_and_pov_hats] {}; - Timer first_timer; static DIDEVICEOBJECTDATA keystate_buffers[num_buffers]; |