From 5bed29dd1922dc66d07257a023bd9e996fbb1949 Mon Sep 17 00:00:00 2001 From: Jan Haller Date: Mon, 19 Apr 2021 17:12:58 +0200 Subject: [PATCH] Fix conversion and other warnings, mainly on Windows --- include/SFML/System/Utf.inl | 2 +- src/SFML/System/Err.cpp | 2 +- src/SFML/Window/Win32/CursorImpl.cpp | 2 +- src/SFML/Window/Win32/InputImpl.cpp | 2 +- src/SFML/Window/Win32/JoystickImpl.cpp | 10 +++++----- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/SFML/System/Utf.inl b/include/SFML/System/Utf.inl index 091b7a13..3f0c81f3 100644 --- a/include/SFML/System/Utf.inl +++ b/include/SFML/System/Utf.inl @@ -675,7 +675,7 @@ Uint32 Utf<32>::decodeWide(In input) // In both cases, a simple copy is enough (UCS-2 is a subset of UCS-4, // and UCS-4 *is* UTF-32). - return input; + return static_cast(input); } diff --git a/src/SFML/System/Err.cpp b/src/SFML/System/Err.cpp index 377da23e..4dc2f509 100644 --- a/src/SFML/System/Err.cpp +++ b/src/SFML/System/Err.cpp @@ -83,7 +83,7 @@ private: if (pbase() != pptr()) { // Print the contents of the write buffer into the standard error output - std::size_t size = static_cast(pptr() - pbase()); + std::size_t size = static_cast(pptr() - pbase()); fwrite(pbase(), 1, size, stderr); // Reset the pointer position to the beginning of the write buffer diff --git a/src/SFML/Window/Win32/CursorImpl.cpp b/src/SFML/Window/Win32/CursorImpl.cpp index e3da27fa..98f5a1cc 100755 --- a/src/SFML/Window/Win32/CursorImpl.cpp +++ b/src/SFML/Window/Win32/CursorImpl.cpp @@ -142,7 +142,7 @@ bool CursorImpl::loadFromSystem(Cursor::Type type) { release(); - LPCTSTR shape; + LPCTSTR shape = NULL; switch (type) { case Cursor::Arrow: shape = IDC_ARROW; break; diff --git a/src/SFML/Window/Win32/InputImpl.cpp b/src/SFML/Window/Win32/InputImpl.cpp index 6314fe61..dc37cf9f 100644 --- a/src/SFML/Window/Win32/InputImpl.cpp +++ b/src/SFML/Window/Win32/InputImpl.cpp @@ -157,7 +157,7 @@ bool InputImpl::isKeyPressed(Keyboard::Key key) //////////////////////////////////////////////////////////// -void InputImpl::setVirtualKeyboardVisible(bool visible) +void InputImpl::setVirtualKeyboardVisible(bool /*visible*/) { // Not applicable } diff --git a/src/SFML/Window/Win32/JoystickImpl.cpp b/src/SFML/Window/Win32/JoystickImpl.cpp index 37199261..84985d49 100644 --- a/src/SFML/Window/Win32/JoystickImpl.cpp +++ b/src/SFML/Window/Win32/JoystickImpl.cpp @@ -523,12 +523,12 @@ bool JoystickImpl::openDInput(unsigned int index) m_buffered = false; // Search for a joystick with the given index in the connected list - for (std::vector::iterator i = joystickList.begin(); i != joystickList.end(); ++i) + for (std::vector::iterator it = joystickList.begin(); it != joystickList.end(); ++it) { - if (i->index == index) + if (it->index == index) { // Create device - HRESULT result = directInput->CreateDevice(i->guid, &m_device, NULL); + HRESULT result = directInput->CreateDevice(it->guid, &m_device, NULL); if (FAILED(result)) { @@ -905,7 +905,7 @@ JoystickState JoystickImpl::updateDInputBuffered() // Get the current state of each axis for (int j = 0; j < Joystick::AxisCount; ++j) { - if (m_axes[j] == events[i].dwOfs) + if (m_axes[j] == static_cast(events[i].dwOfs)) { if ((j == Joystick::PovX) || (j == Joystick::PovY)) { @@ -941,7 +941,7 @@ JoystickState JoystickImpl::updateDInputBuffered() // Get the current state of each button for (int j = 0; j < Joystick::ButtonCount; ++j) { - if (m_buttons[j] == events[i].dwOfs) + if (m_buttons[j] == static_cast(events[i].dwOfs)) m_state.buttons[j] = (events[i].dwData != 0); } }