Fix all uninitialized variable warnings (C26495)

This commit is contained in:
Pokechu22
2021-09-03 21:43:19 -07:00
parent 525e6b2194
commit 78bfd25964
111 changed files with 638 additions and 651 deletions

View File

@ -174,7 +174,7 @@ protected:
void AddCombinedInput(std::string name, const std::pair<std::string, std::string>& inputs);
private:
int m_id;
int m_id = 0;
std::vector<Input*> m_inputs;
std::vector<Output*> m_outputs;
};
@ -216,10 +216,10 @@ public:
struct InputDetection
{
std::shared_ptr<Device> device;
Device::Input* input;
Device::Input* input = nullptr;
Clock::time_point press_time;
std::optional<Clock::time_point> release_time;
ControlState smoothness;
ControlState smoothness = 0;
};
Device::Input* FindInput(std::string_view name, const Device* def_dev) const;

View File

@ -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);

View File

@ -70,7 +70,7 @@ public:
private:
const LPDIRECTINPUTDEVICE8 m_device;
DIJOYSTATE m_state_in;
DIJOYSTATE m_state_in{};
bool m_buffered;
};

View File

@ -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<ControlState> cursor;

View File

@ -191,7 +191,7 @@ struct Server
std::string m_description;
std::string m_address;
u16 m_port;
std::array<Proto::MessageType::PortInfo, Proto::PORT_COUNT> m_port_info;
std::array<Proto::MessageType::PortInfo, Proto::PORT_COUNT> m_port_info{};
sf::UdpSocket m_socket;
SteadyClock::time_point m_disconnect_time = SteadyClock::now();
};