From a50766384b0ec535eb322d32772fb100287dabac Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Fri, 14 Apr 2017 22:10:08 +0200 Subject: [PATCH] onepad: use range loop for hash iteration --- plugins/onepad/Linux/dialog.cpp | 8 +++----- plugins/onepad/Linux/ini.cpp | 5 ++--- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/plugins/onepad/Linux/dialog.cpp b/plugins/onepad/Linux/dialog.cpp index 9b235b19cf..68f4e3fc9f 100644 --- a/plugins/onepad/Linux/dialog.cpp +++ b/plugins/onepad/Linux/dialog.cpp @@ -441,11 +441,9 @@ void Dialog::repopulate() { for (int gamepad_id = 0; gamepad_id < GAMEPAD_NUMBER; ++gamepad_id) { // keyboard/mouse key - map::iterator it; - for (it = conf->keysym_map[gamepad_id].begin(); - it != conf->keysym_map[gamepad_id].end(); ++it) { - int keysym = it->first; - int key = it->second; + for (const auto &it : conf->keysym_map[gamepad_id]) { + int keysym = it.first; + int key = it.second; m_bt_gamepad[gamepad_id][key]->SetLabel( KeyName(gamepad_id, key, keysym).c_str()); diff --git a/plugins/onepad/Linux/ini.cpp b/plugins/onepad/Linux/ini.cpp index ca972a774c..3df948afad 100644 --- a/plugins/onepad/Linux/ini.cpp +++ b/plugins/onepad/Linux/ini.cpp @@ -95,10 +95,9 @@ void SaveConfig() fprintf(f, "joy_pad_map = %d\n", conf->joyid_map); fprintf(f, "ff_intensity = %d\n", conf->get_ff_intensity()); - map::iterator it; for (int pad = 0; pad < GAMEPAD_NUMBER; pad++) - for (it = conf->keysym_map[pad].begin(); it != conf->keysym_map[pad].end(); ++it) - fprintf(f, "PAD %d:KEYSYM 0x%x = %d\n", pad, it->first, it->second); + for (auto const &it : conf->keysym_map[pad]) + fprintf(f, "PAD %d:KEYSYM 0x%x = %d\n", pad, it.first, it.second); fclose(f); }