17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-02 13:59:12 +01:00

refactor(sonar): rely on class template argument deduction (cpp:S6012)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jerrrrycho
2026-10-10 16:37:55 +02:00
parent 89583b2569
commit 7c0f81fb30
7 changed files with 12 additions and 12 deletions

View File

@@ -393,7 +393,7 @@ sound_source::play_basic() {
// dispatch appropriate sound // dispatch appropriate sound
if( true == m_playbeginning if( true == m_playbeginning
&& sound(sound_id::begin).buffer != null_handle) { && sound(sound_id::begin).buffer != null_handle) {
std::vector<sound_id> sounds { sound_id::begin, sound_id::main }; std::vector sounds { sound_id::begin, sound_id::main };
insert( std::begin( sounds ), std::end( sounds ) ); insert( std::begin( sounds ), std::end( sounds ) );
m_playbeginning = false; m_playbeginning = false;
} }
@@ -1009,7 +1009,7 @@ sound_source::update_soundproofing() {
void void
sound_source::insert( sound_handle const Sound ) { sound_source::insert( sound_handle const Sound ) {
std::vector<sound_handle> sounds { Sound }; std::vector sounds { Sound };
return insert( std::begin( sounds ), std::end( sounds ) ); return insert( std::begin( sounds ), std::end( sounds ) );
} }

View File

@@ -36,7 +36,7 @@ opengl33_precipitation::create( int const Tesselation ) {
std::uint16_t index = 0; std::uint16_t index = 0;
// auto const radius { 25.f }; // cylinder radius // auto const radius { 25.f }; // cylinder radius
std::vector<float> radii { 25.f, 10.f, 5.f, 1.f }; std::vector radii { 25.f, 10.f, 5.f, 1.f };
for( auto radius : radii ) { for( auto radius : radii ) {
for( int i = 0; i <= latitudes; ++i ) { for( int i = 0; i <= latitudes; ++i ) {

View File

@@ -39,7 +39,7 @@ opengl_precipitation::create( int const Tesselation ) {
std::uint16_t index = 0; std::uint16_t index = 0;
// auto const radius { 25.f }; // cylinder radius // auto const radius { 25.f }; // cylinder radius
std::vector<float> radii { 25.f, 10.f, 5.f, 1.f }; std::vector radii { 25.f, 10.f, 5.f, 1.f };
for( auto radius : radii ) { for( auto radius : radii ) {
for( int i = 0; i <= latitudes; ++i ) { for( int i = 0; i <= latitudes; ++i ) {

View File

@@ -127,14 +127,14 @@ bool ClearFlag(int &Flag, int const Value)
double Random(double min, double max) double Random(double min, double max)
{ {
if (max < min) { std::swap(min, max); } // std::uniform_real_distribution requires min <= max (inverted bounds are UB) if (max < min) { std::swap(min, max); } // std::uniform_real_distribution requires min <= max (inverted bounds are UB)
std::uniform_real_distribution<double> dist(min, max); std::uniform_real_distribution dist(min, max);
return dist(Global.random_engine); return dist(Global.random_engine);
} }
int Random(int min, int max) int Random(int min, int max)
{ {
if (max < min) { std::swap(min, max); } // std::uniform_int_distribution requires min <= max (inverted bounds are UB) if (max < min) { std::swap(min, max); } // std::uniform_int_distribution requires min <= max (inverted bounds are UB)
std::uniform_int_distribution<int> dist(min, max); std::uniform_int_distribution dist(min, max);
return dist(Global.random_engine); return dist(Global.random_engine);
} }
@@ -178,7 +178,7 @@ std::uint32_t seed_of(std::string const &Text)
std::string generate_uuid_v4() std::string generate_uuid_v4()
{ {
std::uniform_int_distribution<int> dist(0, 255); std::uniform_int_distribution dist(0, 255);
std::array<uint8_t, 16> bytes; std::array<uint8_t, 16> bytes;
for (auto &b : bytes) for (auto &b : bytes)
@@ -203,7 +203,7 @@ std::string generate_uuid_v4()
double LocalRandom(double a, double b) double LocalRandom(double a, double b)
{ {
if (b < a) { std::swap(a, b); } // std::uniform_real_distribution requires a <= b (inverted bounds are UB) if (b < a) { std::swap(a, b); } // std::uniform_real_distribution requires a <= b (inverted bounds are UB)
std::uniform_real_distribution<double> dist(a, b); std::uniform_real_distribution dist(a, b);
return dist(Global.local_random_engine); return dist(Global.local_random_engine);
} }

View File

@@ -426,12 +426,12 @@ class condition_variable
// methods // methods
void wait() void wait()
{ {
std::unique_lock<std::mutex> lock(m_mutex); std::unique_lock lock(m_mutex);
m_condition.wait(lock, [this]() { return m_spurious == false; }); m_condition.wait(lock, [this]() { return m_spurious == false; });
} }
template <class Rep_, class Period_> void wait_for(const std::chrono::duration<Rep_, Period_> &Time) template <class Rep_, class Period_> void wait_for(const std::chrono::duration<Rep_, Period_> &Time)
{ {
std::unique_lock<std::mutex> lock(m_mutex); std::unique_lock lock(m_mutex);
m_condition.wait_for(lock, Time, [this]() { return m_spurious == false; }); m_condition.wait_for(lock, Time, [this]() { return m_spurious == false; });
} }
void notify_one() void notify_one()

View File

@@ -76,7 +76,7 @@ void TGauge::Init(TSubModel *Submodel, TSubModel *Submodelon, TGaugeAnimation Ty
auto const nulloffset { glm::vec3{} }; auto const nulloffset { glm::vec3{} };
auto const offset { model_offset() }; auto const offset { model_offset() };
{ {
std::vector<sound_source *> soundfxs = { std::vector soundfxs = {
&m_soundfxincrease, &m_soundfxincrease,
&m_soundfxdecrease, &m_soundfxdecrease,
&m_soundfxon, &m_soundfxon,

View File

@@ -180,7 +180,7 @@ void ui::cameraview_panel::record_func()
while (record_state == RUNNING) { while (record_state == RUNNING) {
if (bufpos == frame_size) if (bufpos == frame_size)
{ {
std::unique_lock<std::mutex> lock(mutex); std::unique_lock lock(mutex);
auto r = notify_var.wait_for(lock, std::chrono::milliseconds(50), [this, last_cnt]{return last_cnt != frame_cnt;}); auto r = notify_var.wait_for(lock, std::chrono::milliseconds(50), [this, last_cnt]{return last_cnt != frame_cnt;});
last_cnt = frame_cnt; last_cnt = frame_cnt;
if (!image_ptr || !r) if (!image_ptr || !r)