Skip to content

Commit c146c27

Browse files
committed
Modified construction of std::atomic types to not use assignment.
1 parent 898a375 commit c146c27

File tree

8 files changed

+21
-21
lines changed

8 files changed

+21
-21
lines changed

XMapLib/CPPRunnerGeneric.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ namespace sds
3131
protected:
3232
const LambdaType m_lambda;
3333
InternalData m_local_state{}; // default constructed type InternalData
34-
std::atomic<bool> m_is_stop_requested = false;
34+
std::atomic<bool> m_is_stop_requested{ false };
3535
std::unique_ptr<std::thread> m_local_thread;
3636
std::mutex m_state_mutex;
3737
public:

XMapLib/KeyboardPlayerInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace sds
1010
{
1111
using PidType = int;
1212
//ISO CPP guidelines C.45 followed here: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rc-default
13-
std::atomic<PidType> player_id = 0;
13+
std::atomic<PidType> player_id{ 0 };
1414
//default ctor
1515
KeyboardPlayerInfo() = default;
1616
//copy constructor

XMapLib/MouseMapper.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ namespace sds
1717
using InternalType = int;
1818
using LambdaRunnerType = sds::CPPRunnerGeneric<InternalType>;
1919
using lock = LambdaRunnerType::ScopedLockType;
20-
std::atomic<StickMap> m_stickmap_info = StickMap::NEITHER_STICK;
21-
std::atomic<SHORT> m_thread_x = 0;
22-
std::atomic<SHORT> m_thread_y = 0;
23-
std::atomic<int> m_mouse_sensitivity = MouseSettings::SENSITIVITY_DEFAULT;
20+
std::atomic<StickMap> m_stickmap_info{ StickMap::NEITHER_STICK };
21+
std::atomic<SHORT> m_thread_x{ 0 };
22+
std::atomic<SHORT> m_thread_y{0};
23+
std::atomic<int> m_mouse_sensitivity{ MouseSettings::SENSITIVITY_DEFAULT };
2424
sds::MousePlayerInfo m_local_player;
2525
sds::MouseInputPoller m_poller;
2626
std::unique_ptr<LambdaRunnerType> m_workThread;

XMapLib/MouseMoveThread.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ namespace sds
1313
using InternalType = int;
1414
using LambdaRunnerType = sds::CPPRunnerGeneric<InternalType>;
1515
using lock = LambdaRunnerType::ScopedLockType;
16-
std::atomic<size_t> m_x_axis_delay = 1;
17-
std::atomic<size_t> m_y_axis_delay = 1;
18-
std::atomic<bool> m_is_x_moving = false;
19-
std::atomic<bool> m_is_y_moving = false;
20-
std::atomic<bool> m_is_x_positive = false;
21-
std::atomic<bool> m_is_y_positive = false;
16+
std::atomic<size_t> m_x_axis_delay{ 1 };
17+
std::atomic<size_t> m_y_axis_delay{ 1 };
18+
std::atomic<bool> m_is_x_moving{ false };
19+
std::atomic<bool> m_is_y_moving{ false };
20+
std::atomic<bool> m_is_x_positive{ false };
21+
std::atomic<bool> m_is_y_positive{ false };
2222
std::unique_ptr<LambdaRunnerType> m_workThread;
2323
void InitWorkThread() noexcept
2424
{

XMapLib/MousePlayerInfo.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ namespace sds
1010
using PidType = int;
1111
using DzType = int;
1212
//ISO CPP guidelines C.45 followed here: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rc-default
13-
std::atomic<DzType> left_x_dz = XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE; // left stick X axis dz
14-
std::atomic<DzType> left_y_dz = XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE; // left stick Y axis dz
15-
std::atomic<DzType> right_x_dz = XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE; // right stick X axis dz
16-
std::atomic<DzType> right_y_dz = XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE; // right stick Y axis dz
17-
std::atomic<PidType> player_id = 0;
13+
std::atomic<DzType> left_x_dz{ XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE }; // left stick X axis dz
14+
std::atomic<DzType> left_y_dz{ XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE }; // left stick Y axis dz
15+
std::atomic<DzType> right_x_dz{ XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE }; // right stick X axis dz
16+
std::atomic<DzType> right_y_dz{ XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE }; // right stick Y axis dz
17+
std::atomic<PidType> player_id{ 0 };
1818
//default ctor
1919
MousePlayerInfo() = default;
2020
//copy constructor

XMapLib/ThumbstickToDelay.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace sds
1313
class ThumbstickToDelay
1414
{
1515
const std::string BAD_DELAY_MSG = "Bad timer delay value, exception.";
16-
inline static std::atomic<bool> m_is_deadzone_activated = false; //shared between instances
16+
inline static std::atomic<bool> m_is_deadzone_activated{ false }; //shared between instances
1717
float m_alt_deadzone_multiplier = MouseSettings::ALT_DEADZONE_MULT_DEFAULT;
1818
int m_axis_sensitivity = MouseSettings::SENSITIVITY_DEFAULT;
1919
int m_x_axis_deadzone = MouseSettings::DEADZONE_DEFAULT;

XMapLib/XMapLib.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ void AddTestKeyMappings(sds::KeyboardMapper& mapper, std::osyncstream &ss);
1212
class GetterExit
1313
{
1414
std::unique_ptr<std::thread> workerThread;
15-
std::atomic<bool> m_exitState = false;
15+
std::atomic<bool> m_exitState{ false };
1616
const sds::KeyboardMapper& m_mp;
1717
public:
1818
GetterExit(const sds::KeyboardMapper& m) : m_mp(m) { startThread(); }

XMapLibSharp/KeymapPresetOperations.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public static void ChangeButtonTextForSelected(Button prButton, bool makeSelecte
3030
if (IsButtonTextSelected(prButton))
3131
{
3232
string temp = prButton.Text;
33-
int index = temp.IndexOf(MSG_PRESET_SELECTED);
33+
int index = temp.IndexOf(MSG_PRESET_SELECTED, StringComparison.Ordinal);
3434
prButton.Text = temp[..index];
3535
}
3636
}
@@ -39,7 +39,7 @@ public static void ChangeButtonTextForSelected(Button prButton, bool makeSelecte
3939
public static bool IsButtonTextSelected(Button prButton)
4040
{
4141
string temp = prButton.Text;
42-
int index = temp.IndexOf(MSG_PRESET_SELECTED);
42+
int index = temp.IndexOf(MSG_PRESET_SELECTED, StringComparison.Ordinal);
4343
return (index != -1);
4444
}
4545

0 commit comments

Comments
 (0)