From b28ac4667d8e2141a7b1161be47ba83c3435e787 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 26 May 2019 22:47:09 +0200 Subject: [PATCH] Platform: no need to reinterpret_cast the void pointers. --- src/Magnum/Platform/EmscriptenApplication.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Magnum/Platform/EmscriptenApplication.cpp b/src/Magnum/Platform/EmscriptenApplication.cpp index a6f8636b3..628e68d5a 100644 --- a/src/Magnum/Platform/EmscriptenApplication.cpp +++ b/src/Magnum/Platform/EmscriptenApplication.cpp @@ -359,28 +359,28 @@ void EmscriptenApplication::setupCallbacks() { emscripten_set_mousedown_callback("#canvas", this, false, ([](int, const EmscriptenMouseEvent* event, void* userData) -> Int { MouseEvent e{event}; - reinterpret_cast(userData)->mousePressEvent(e); + static_cast(userData)->mousePressEvent(e); return e.isAccepted(); })); emscripten_set_mouseup_callback("#canvas", this, false, ([](int, const EmscriptenMouseEvent* event, void* userData) -> Int { MouseEvent e{event}; - reinterpret_cast(userData)->mouseReleaseEvent(e); + static_cast(userData)->mouseReleaseEvent(e); return e.isAccepted(); })); emscripten_set_mousemove_callback("#canvas", this, false, ([](int, const EmscriptenMouseEvent* event, void* userData) -> Int { MouseMoveEvent e{event}; - reinterpret_cast(userData)->mouseMoveEvent(e); + static_cast(userData)->mouseMoveEvent(e); return e.isAccepted(); })); emscripten_set_wheel_callback("#canvas", this, false, ([](int, const EmscriptenWheelEvent* event, void* userData) -> Int { MouseScrollEvent e{event}; - reinterpret_cast(userData)->mouseScrollEvent(e); + static_cast(userData)->mouseScrollEvent(e); return e.isAccepted(); })); @@ -429,21 +429,21 @@ void EmscriptenApplication::setupCallbacks() { don't seem to work, keydown on the other hand works fine for all */ emscripten_set_keydown_callback(keyboardListeningElement, this, false, ([](int, const EmscriptenKeyboardEvent* event, void* userData) -> Int { - EmscriptenApplication* app = reinterpret_cast(userData); - if(app->isTextInputActive() && std::strlen(event->key) == 1) { + EmscriptenApplication& app = *static_cast(userData); + if(app.isTextInputActive() && std::strlen(event->key) == 1) { TextInputEvent e{{event->key, 1}}; - app->textInputEvent(e); + app.textInputEvent(e); return e.isAccepted(); } KeyEvent e{event}; - app->keyPressEvent(e); + app.keyPressEvent(e); return e.isAccepted(); })); emscripten_set_keyup_callback(keyboardListeningElement, this, false, ([](int, const EmscriptenKeyboardEvent* event, void* userData) -> Int { KeyEvent e{event}; - reinterpret_cast(userData)->keyReleaseEvent(e); + static_cast(userData)->keyReleaseEvent(e); return e.isAccepted(); }));