17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 13:19:20 +02:00

refactor(sonar): scope single-use variables in if init-statements (cpp:S6004)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jerrrrycho
2026-10-10 15:44:18 +02:00
parent f8104bd0dd
commit 9b89a5d887
27 changed files with 78 additions and 175 deletions

View File

@@ -239,8 +239,7 @@ void keyboard_input::dump_bindings() const
stream << simulation::Commands_descriptions[static_cast<std::size_t>(binding.first)].name << ' ';
int keycode = std::get<int>(binding.second);
auto it = keytonamemap.find(keycode & 0xFFFF);
if (it != keytonamemap.end()) {
if (auto it = keytonamemap.find(keycode & 0xFFFF); it != keytonamemap.end()) {
if (keycode & keymodifier::control)
stream << "ctrl ";
if (keycode & keymodifier::shift)
@@ -298,8 +297,7 @@ keyboard_input::key( int const Key, int const Action ) {
| ( modifier ? 0 : input::key_ctrl ? keymodifier::control : 0 );
if( Action == GLFW_RELEASE ) {
auto const stored = m_modsforkeys.find( Key );
if( stored != m_modsforkeys.end() ) {
if( auto const stored = m_modsforkeys.find( Key ); stored != m_modsforkeys.end() ) {
key = stored->second;
}
m_modsforkeys.erase( Key );