From 9b6d6747b582316a1de5043b2f8ec7375eb7801a Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Sat, 16 May 2026 13:30:50 +0200 Subject: [PATCH] fix: std::fill en lloc de raw loops (cppcheck) --- source/core/audio/jail_audio.hpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/source/core/audio/jail_audio.hpp b/source/core/audio/jail_audio.hpp index b1e7625..276841f 100644 --- a/source/core/audio/jail_audio.hpp +++ b/source/core/audio/jail_audio.hpp @@ -3,6 +3,7 @@ // --- Includes --- #include +#include #include #include #include @@ -258,7 +259,7 @@ namespace Ja { sdl_audio_device = SDL_OpenAudioDevice(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &audio_spec); if (sdl_audio_device == 0) { std::cout << "Failed to initialize SDL audio!" << '\n'; } for (auto& ch : channels) { ch.state = ChannelState::FREE; } - for (float& v : sound_volume) { v = 0.5F; } + std::fill(std::begin(sound_volume), std::end(sound_volume), 0.5F); } inline void quit() { @@ -662,9 +663,7 @@ namespace Ja { const float V = SDL_clamp(volume, 0.0F, 1.0F); if (group == -1) { - for (float& sv : sound_volume) { - sv = V; - } + std::fill(std::begin(sound_volume), std::end(sound_volume), V); } else if (group >= 0 && group < MAX_GROUPS) { sound_volume[group] = V; } else {