Skip to content

Commit b5b1398

Browse files
committed
Switched to brace initialization, benefits are that it won't implicitly narrow a literal value to fit the type without a warning or error.
1 parent 2427acb commit b5b1398

15 files changed

+57
-57
lines changed

XMapLib/CPPRunnerGeneric.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ namespace sds
3232
const LambdaType m_lambda;
3333
InternalData m_local_state{}; // default constructed type InternalData
3434
std::atomic<bool> m_is_stop_requested{ false };
35-
std::unique_ptr<std::thread> m_local_thread;
36-
std::mutex m_state_mutex;
35+
std::unique_ptr<std::thread> m_local_thread{};
36+
std::mutex m_state_mutex{};
3737
public:
3838
/// <summary>Starts running a new thread for the lambda.</summary>
3939
/// <returns>true on success, false on failure.</returns>

XMapLib/DelayManager.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ namespace sds::Utilities
77
class DelayManager
88
{
99
using TimeType = std::chrono::time_point<std::chrono::high_resolution_clock>;
10-
TimeType m_start_time = std::chrono::high_resolution_clock::now();
11-
size_t m_duration = 1;
12-
bool m_has_fired = false;
10+
TimeType m_start_time{ std::chrono::high_resolution_clock::now() };
11+
size_t m_duration{ 1 };
12+
bool m_has_fired{ false };
1313
public:
1414
//us is microseconds
1515
DelayManager() = delete;

XMapLib/KeyboardInputPoller.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ namespace sds
1313
using InternalType = std::vector<XINPUT_KEYSTROKE>;
1414
using LambdaRunnerType = sds::CPPRunnerGeneric<InternalType>;
1515
using lock = LambdaRunnerType::ScopedLockType;
16-
const int EMPTY_COUNT = 5000;
17-
KeyboardPlayerInfo m_local_player;
18-
std::unique_ptr<LambdaRunnerType> m_workThread;
16+
const int EMPTY_COUNT{ 5000 };
17+
KeyboardPlayerInfo m_local_player{};
18+
std::unique_ptr<LambdaRunnerType> m_workThread{};
1919
void InitWorkThread() noexcept
2020
{
2121
m_workThread =

XMapLib/KeyboardKeyMap.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ namespace sds
2121
KEYUP = XINPUT_KEYSTROKE_KEYUP
2222
};
2323
//Struct members
24-
int SendingElementVK = 0; // VK of controller button
25-
int MappedToVK = 0; // VK of mapped-to input (key or mouse button)
26-
bool UsesRepeat = true; // Uses the key-repeat behavior when held down
27-
ActionType LastAction = ActionType::NONE;
24+
int SendingElementVK{ 0 }; // VK of controller button
25+
int MappedToVK{ 0 }; // VK of mapped-to input (key or mouse button)
26+
bool UsesRepeat{ true }; // Uses the key-repeat behavior when held down
27+
ActionType LastAction{ ActionType::NONE };
2828
Utilities::DelayManager LastSentTime{ KeyboardSettings::MICROSECONDS_DELAY_KEYREPEAT };
2929
//Ctor
3030
KeyboardKeyMap(const int controllerElementVK, const int keyboardMouseElementVK, const bool useRepeat)

XMapLib/KeyboardMapper.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ namespace sds
1414
using InternalType = int;
1515
using LambdaRunnerType = sds::CPPRunnerGeneric<InternalType>;
1616
using lock = LambdaRunnerType::ScopedLockType;
17-
sds::KeyboardPlayerInfo m_localPlayerInfo;
18-
sds::KeyboardInputPoller m_poller;
19-
sds::KeyboardTranslator m_translator;
20-
std::unique_ptr<LambdaRunnerType> m_workThread;
17+
sds::KeyboardPlayerInfo m_localPlayerInfo{};
18+
sds::KeyboardInputPoller m_poller{};
19+
sds::KeyboardTranslator m_translator{};
20+
std::unique_ptr<LambdaRunnerType> m_workThread{};
2121
void InitWorkThread() noexcept
2222
{
2323
m_workThread =

XMapLib/KeyboardSettings.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ namespace sds
77
struct KeyboardSettings
88
{
99
//Input Poller maximum number of XINPUT_KEYSTROKE structs to queue before dropping input.
10-
constexpr static const int MAX_STATE_COUNT = 128;
10+
constexpr static const int MAX_STATE_COUNT{ 128 };
1111
//Input Poller thread delay, in milliseconds.
12-
constexpr static const int THREAD_DELAY_POLLER = 10;
12+
constexpr static const int THREAD_DELAY_POLLER{ 10 };
1313
//Microseconds Delay Keyrepeat is the time delay a button has in between activations.
14-
constexpr static const int MICROSECONDS_DELAY_KEYREPEAT = 100000;
14+
constexpr static const int MICROSECONDS_DELAY_KEYREPEAT{ 100000 };
1515
//It is necessary to be able to distinguish these mapping values in KeyboardTranslator.
1616
constexpr static std::array<int,8> THUMBSTICK_L_VK_LIST
1717
{

XMapLib/KeyboardTranslator.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ namespace sds
1515
/// </summary>
1616
class KeyboardTranslator
1717
{
18-
const std::string ERR_BAD_VK = "Either WordData.MappedToVK OR WordData.SendElementVK is <= 0";
19-
const std::string ERR_DUP_KEYUP = "Sent a duplicate keyup event to handle thumbstick direction changing behavior.";
2018
using ClockType = std::chrono::high_resolution_clock;
2119
using PointInTime = std::chrono::time_point<ClockType>;
2220
using InpType = sds::KeyboardKeyMap::ActionType;
21+
const std::string ERR_BAD_VK{ "Either WordData.MappedToVK OR WordData.SendElementVK is <= 0" };
22+
const std::string ERR_DUP_KEYUP{ "Sent a duplicate keyup event to handle thumbstick direction changing behavior." };
2323
private:
24-
Utilities::SendKeyInput m_key_send;
25-
std::vector<KeyboardKeyMap> m_map_token_info;
26-
KeyboardPlayerInfo m_local_player;
24+
Utilities::SendKeyInput m_key_send{};
25+
std::vector<KeyboardKeyMap> m_map_token_info{};
26+
KeyboardPlayerInfo m_local_player{};
2727
public:
2828
explicit KeyboardTranslator(const KeyboardPlayerInfo &p) : m_local_player(p)
2929
{

XMapLib/MouseInputPoller.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ namespace sds
1313
using InternalType = XINPUT_STATE;
1414
using LambdaRunnerType = sds::CPPRunnerGeneric<InternalType>;
1515
using lock = LambdaRunnerType::ScopedLockType;
16-
MousePlayerInfo m_local_player;
17-
std::unique_ptr<LambdaRunnerType> m_workThread;
16+
MousePlayerInfo m_local_player{};
17+
std::unique_ptr<LambdaRunnerType> m_workThread{};
1818
void InitWorkThread() noexcept
1919
{
2020
m_workThread =

XMapLib/MouseMapper.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ namespace sds
2121
std::atomic<SHORT> m_thread_x{ 0 };
2222
std::atomic<SHORT> m_thread_y{0};
2323
std::atomic<int> m_mouse_sensitivity{ MouseSettings::SENSITIVITY_DEFAULT };
24-
sds::MousePlayerInfo m_local_player;
25-
sds::MouseInputPoller m_poller;
26-
std::unique_ptr<LambdaRunnerType> m_workThread;
24+
sds::MousePlayerInfo m_local_player{};
25+
sds::MouseInputPoller m_poller{};
26+
std::unique_ptr<LambdaRunnerType> m_workThread{};
2727
void InitWorkThread() noexcept
2828
{
2929
m_workThread =

XMapLib/MouseMoveThread.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace sds
1717
std::atomic<bool> m_is_y_moving{ false };
1818
std::atomic<bool> m_is_x_positive{ false };
1919
std::atomic<bool> m_is_y_positive{ false };
20-
std::unique_ptr<LambdaRunnerType> m_workThread;
20+
std::unique_ptr<LambdaRunnerType> m_workThread{};
2121
void InitWorkThread() noexcept
2222
{
2323
m_workThread =

0 commit comments

Comments
 (0)