summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2021-10-13 21:52:22 +0200
committerGitHub <noreply@github.com>2021-10-13 21:52:22 +0200
commit023eb0b7029eb3633ce9eeb039c11d835ea7fd74 (patch)
tree93aeabec56ac75e8d88baeb6f78e27840d09dead /Source/Core/InputCommon
parenta0a91ec4b86b16624b2da7000a0f54852cd33872 (diff)
parent78bfd25964206a1f0a34170fdd90ca1a8ce242db (diff)
Merge pull request #10085 from Pokechu22/C26495
Fix all uninitialized variable warnings (C26495)
Diffstat (limited to 'Source/Core/InputCommon')
-rw-r--r--Source/Core/InputCommon/ControlReference/ControlReference.cpp4
-rw-r--r--Source/Core/InputCommon/ControlReference/ControlReference.h5
-rw-r--r--Source/Core/InputCommon/ControlReference/ExpressionParser.h2
-rw-r--r--Source/Core/InputCommon/ControllerInterface/CoreDevice.h6
-rw-r--r--Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp3
-rw-r--r--Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.h2
-rw-r--r--Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.h4
-rw-r--r--Source/Core/InputCommon/ControllerInterface/DualShockUDPClient/DualShockUDPClient.cpp2
-rw-r--r--Source/Core/InputCommon/GCPadStatus.h20
9 files changed, 22 insertions, 26 deletions
diff --git a/Source/Core/InputCommon/ControlReference/ControlReference.cpp b/Source/Core/InputCommon/ControlReference/ControlReference.cpp
index 4bdfbddfef..795204cc05 100644
--- a/Source/Core/InputCommon/ControlReference/ControlReference.cpp
+++ b/Source/Core/InputCommon/ControlReference/ControlReference.cpp
@@ -58,9 +58,7 @@ std::optional<std::string> ControlReference::SetExpression(std::string expr)
return parse_result.description;
}
-ControlReference::ControlReference() : range(1), m_parsed_expression(nullptr)
-{
-}
+ControlReference::ControlReference() = default;
ControlReference::~ControlReference() = default;
diff --git a/Source/Core/InputCommon/ControlReference/ControlReference.h b/Source/Core/InputCommon/ControlReference/ControlReference.h
index da6e10a5c2..f12e354bb3 100644
--- a/Source/Core/InputCommon/ControlReference/ControlReference.h
+++ b/Source/Core/InputCommon/ControlReference/ControlReference.h
@@ -41,13 +41,14 @@ public:
// Returns a human-readable error description when the given expression is invalid.
std::optional<std::string> SetExpression(std::string expr);
- ControlState range;
+ ControlState range = 1;
protected:
ControlReference();
std::string m_expression;
std::unique_ptr<ciface::ExpressionParser::Expression> m_parsed_expression;
- ciface::ExpressionParser::ParseStatus m_parse_status;
+ ciface::ExpressionParser::ParseStatus m_parse_status =
+ ciface::ExpressionParser::ParseStatus::EmptyExpression;
};
template <>
diff --git a/Source/Core/InputCommon/ControlReference/ExpressionParser.h b/Source/Core/InputCommon/ControlReference/ExpressionParser.h
index 16554738eb..405445b8a0 100644
--- a/Source/Core/InputCommon/ControlReference/ExpressionParser.h
+++ b/Source/Core/InputCommon/ControlReference/ExpressionParser.h
@@ -181,7 +181,7 @@ public:
static ParseResult MakeSuccessfulResult(std::unique_ptr<Expression>&& expr);
static ParseResult MakeErrorResult(Token token, std::string description);
- ParseStatus status;
+ ParseStatus status = ParseStatus::EmptyExpression;
std::unique_ptr<Expression> expr;
// Used for parse errors:
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<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;
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<ControlState> 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<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();
};
diff --git a/Source/Core/InputCommon/GCPadStatus.h b/Source/Core/InputCommon/GCPadStatus.h
index 62cd071f26..74849e5594 100644
--- a/Source/Core/InputCommon/GCPadStatus.h
+++ b/Source/Core/InputCommon/GCPadStatus.h
@@ -30,16 +30,16 @@ enum PadButton
struct GCPadStatus
{
- u16 button; // Or-ed PAD_BUTTON_* and PAD_TRIGGER_* bits
- u8 stickX; // 0 <= stickX <= 255
- u8 stickY; // 0 <= stickY <= 255
- u8 substickX; // 0 <= substickX <= 255
- u8 substickY; // 0 <= substickY <= 255
- u8 triggerLeft; // 0 <= triggerLeft <= 255
- u8 triggerRight; // 0 <= triggerRight <= 255
- u8 analogA; // 0 <= analogA <= 255
- u8 analogB; // 0 <= analogB <= 255
- bool isConnected{true};
+ u16 button = 0; // Or-ed PAD_BUTTON_* and PAD_TRIGGER_* bits
+ u8 stickX = 0; // 0 <= stickX <= 255
+ u8 stickY = 0; // 0 <= stickY <= 255
+ u8 substickX = 0; // 0 <= substickX <= 255
+ u8 substickY = 0; // 0 <= substickY <= 255
+ u8 triggerLeft = 0; // 0 <= triggerLeft <= 255
+ u8 triggerRight = 0; // 0 <= triggerRight <= 255
+ u8 analogA = 0; // 0 <= analogA <= 255
+ u8 analogB = 0; // 0 <= analogB <= 255
+ bool isConnected = true;
static const u8 MAIN_STICK_CENTER_X = 0x80;
static const u8 MAIN_STICK_CENTER_Y = 0x80;