From 78bfd25964206a1f0a34170fdd90ca1a8ce242db Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Fri, 3 Sep 2021 21:43:19 -0700 Subject: Fix all uninitialized variable warnings (C26495) --- Source/Core/InputCommon/ControllerInterface/CoreDevice.h | 6 +++--- .../Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp | 3 --- Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.h | 2 +- .../InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.h | 4 ++-- .../ControllerInterface/DualShockUDPClient/DualShockUDPClient.cpp | 2 +- 5 files changed, 7 insertions(+), 10 deletions(-) (limited to 'Source/Core/InputCommon/ControllerInterface') diff --git a/Source/Core/InputCommon/ControllerInterface/CoreDevice.h b/Source/Core/InputCommon/ControllerInterface/CoreDevice.h index def895afa1..2840f43463 100644 --- a/Source/Core/InputCommon/ControllerInterface/CoreDevice.h +++ b/Source/Core/InputCommon/ControllerInterface/CoreDevice.h @@ -174,7 +174,7 @@ protected: void AddCombinedInput(std::string name, const std::pair& inputs); private: - int m_id; + int m_id = 0; std::vector m_inputs; std::vector m_outputs; }; @@ -216,10 +216,10 @@ public: struct InputDetection { std::shared_ptr device; - Device::Input* input; + Device::Input* input = nullptr; Clock::time_point press_time; std::optional release_time; - ControlState smoothness; + ControlState smoothness = 0; }; Device::Input* FindInput(std::string_view name, const Device* def_dev) const; diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp index 5a6c6c221e..e7a8bea6fe 100644 --- a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp +++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp @@ -177,9 +177,6 @@ Joystick::Joystick(const LPDIRECTINPUTDEVICE8 device) : m_device(device) InitForceFeedback(m_device, num_ff_axes); } - // Zero inputs: - m_state_in = {}; - // Set hats to center: // "The center position is normally reported as -1" -MSDN std::fill(std::begin(m_state_in.rgdwPOV), std::end(m_state_in.rgdwPOV), -1); diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.h b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.h index be04becf41..a142aeba00 100644 --- a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.h +++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.h @@ -70,7 +70,7 @@ public: private: const LPDIRECTINPUTDEVICE8 m_device; - DIJOYSTATE m_state_in; + DIJOYSTATE m_state_in{}; bool m_buffered; }; diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.h b/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.h index d174f4a28e..eba4c8ab93 100644 --- a/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.h +++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.h @@ -22,10 +22,10 @@ class KeyboardMouse : public Core::Device private: struct State { - BYTE keyboard[256]; + BYTE keyboard[256]{}; // Old smoothed relative mouse movement. - DIMOUSESTATE2 mouse; + DIMOUSESTATE2 mouse{}; // Normalized mouse cursor position. Common::TVec2 cursor; diff --git a/Source/Core/InputCommon/ControllerInterface/DualShockUDPClient/DualShockUDPClient.cpp b/Source/Core/InputCommon/ControllerInterface/DualShockUDPClient/DualShockUDPClient.cpp index b63a8582ae..7342ef4d47 100644 --- a/Source/Core/InputCommon/ControllerInterface/DualShockUDPClient/DualShockUDPClient.cpp +++ b/Source/Core/InputCommon/ControllerInterface/DualShockUDPClient/DualShockUDPClient.cpp @@ -191,7 +191,7 @@ struct Server std::string m_description; std::string m_address; u16 m_port; - std::array m_port_info; + std::array m_port_info{}; sf::UdpSocket m_socket; SteadyClock::time_point m_disconnect_time = SteadyClock::now(); }; -- cgit v1.2.3