diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-12-07 08:43:03 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-12-08 21:30:48 +0100 |
commit | 709fe557a3a5c2dc8675472dac9325f8efdff004 (patch) | |
tree | fa257eae76fc50d3cbe7b69b5c423108c170af90 /dinput | |
parent | 788cfe69a1668dfd7e6bca16907de696e6063fbe (diff) |
clean up a bit
Diffstat (limited to 'dinput')
-rw-r--r-- | dinput/keybinding-worker.hpp | 8 | ||||
-rw-r--r-- | dinput/win32-joystick.cpp | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/dinput/keybinding-worker.hpp b/dinput/keybinding-worker.hpp index ec403c15..d1dc4149 100644 --- a/dinput/keybinding-worker.hpp +++ b/dinput/keybinding-worker.hpp @@ -41,6 +41,9 @@ struct OTR_DINPUT_EXPORT KeybindingWorker : private QThread { using fun = std::function<void(const Key&)>; + KeybindingWorker(const KeybindingWorker&) = delete; + KeybindingWorker& operator=(KeybindingWorker&) = delete; + private: LPDIRECTINPUTDEVICE8 dinkeyboard { nullptr }; win32_joy_ctx joy_ctx; @@ -62,13 +65,10 @@ private: static KeybindingWorker& make(); fun* _add_receiver(fun &receiver); void remove_receiver(fun* pos); - ~KeybindingWorker(); + ~KeybindingWorker() override; static constexpr int num_keyboard_states = 64; DIDEVICEOBJECTDATA keyboard_states[num_keyboard_states] {}; - - KeybindingWorker(const KeybindingWorker&) = delete; - KeybindingWorker& operator=(KeybindingWorker&) = delete; public: class Token { diff --git a/dinput/win32-joystick.cpp b/dinput/win32-joystick.cpp index 71c93543..d1546df3 100644 --- a/dinput/win32-joystick.cpp +++ b/dinput/win32-joystick.cpp @@ -49,7 +49,7 @@ bool win32_joy_ctx::poll_axis(const QString &guid, int* axes) auto& joy_handle = j->joy_handle; bool ok = false; - HRESULT hr; + HRESULT hr = S_OK; (void)hr; if (SUCCEEDED(hr = joy_handle->Poll())) ok = true; @@ -84,7 +84,7 @@ bool win32_joy_ctx::poll_axis(const QString &guid, int* axes) js.rglSlider[1] }; - for (int i = 0; i < 8; i++) + for (unsigned i = 0; i < 8; i++) axes[i] = values[i]; return true; @@ -184,7 +184,7 @@ bool win32_joy_ctx::joy::poll(fn const& f) default: if (event.dwOfs >= BUTTON_OFFSET(0) && event.dwOfs <= BUTTON_OFFSET(max_buttons - 1)) { - i = event.dwOfs - BUTTON_OFFSET(0); + i = int(event.dwOfs - BUTTON_OFFSET(0)); i /= sizeof(DIJOYSTATE2().rgbButtons[0]); i %= max_buttons; // defensive programming } |