diff options
author | Matthias Kortstiege <mkortstiege@users.noreply.github.com> | 2015-01-17 10:45:39 +0100 |
---|---|---|
committer | Matthias Kortstiege <mkortstiege@users.noreply.github.com> | 2015-01-17 10:45:39 +0100 |
commit | c2edfe47819b167cdc6e65e9f1921da929112ef7 (patch) | |
tree | e178a6bab25a8a9a0c1362ab816cb9039116b636 | |
parent | 88bb1dfe2f39e84c5f321ac0b160496972fa0168 (diff) | |
parent | 5be9c23d8c86f32d9ebd54c47c6aeff21b13cef5 (diff) |
Merge pull request #6133 from tobbi/cppcheck_perf_input
cppcheck performance fixes in input/
-rw-r--r-- | xbmc/input/ButtonTranslator.cpp | 14 | ||||
-rw-r--r-- | xbmc/input/KeyboardLayout.cpp | 10 | ||||
-rw-r--r-- | xbmc/input/SDLJoystick.cpp | 4 | ||||
-rw-r--r-- | xbmc/input/linux/LIRC.cpp | 4 | ||||
-rw-r--r-- | xbmc/input/linux/LinuxInputDevices.cpp | 4 | ||||
-rw-r--r-- | xbmc/input/linux/LinuxInputDevices.h | 2 | ||||
-rw-r--r-- | xbmc/input/touch/generic/GenericTouchInputHandler.cpp | 16 | ||||
-rw-r--r-- | xbmc/input/windows/WINJoystick.cpp | 2 |
8 files changed, 28 insertions, 28 deletions
diff --git a/xbmc/input/ButtonTranslator.cpp b/xbmc/input/ButtonTranslator.cpp index fa898c45f1..bc6c5c1422 100644 --- a/xbmc/input/ButtonTranslator.cpp +++ b/xbmc/input/ButtonTranslator.cpp @@ -508,7 +508,7 @@ void CButtonTranslator::AddDevice(std::string& strDevice) { // Only add the device if it isn't already in the list std::list<std::string>::iterator it; - for (it = m_deviceList.begin(); it != m_deviceList.end(); it++) + for (it = m_deviceList.begin(); it != m_deviceList.end(); ++it) if (*it == strDevice) return; @@ -524,7 +524,7 @@ void CButtonTranslator::RemoveDevice(std::string& strDevice) { // Find the device std::list<std::string>::iterator it; - for (it = m_deviceList.begin(); it != m_deviceList.end(); it++) + for (it = m_deviceList.begin(); it != m_deviceList.end(); ++it) if (*it == strDevice) break; if (it == m_deviceList.end()) @@ -566,7 +566,7 @@ bool CButtonTranslator::Load(bool AlwaysLoad) // Load mappings for any HID devices we have connected std::list<std::string>::iterator it; - for (it = m_deviceList.begin(); it != m_deviceList.end(); it++) + for (it = m_deviceList.begin(); it != m_deviceList.end(); ++it) { std::string devicedir = DIRS_TO_CHECK[dirIndex]; devicedir.append(*it); @@ -880,7 +880,7 @@ void CButtonTranslator::MapJoystickActions(int windowID, TiXmlNode *pJoystick) if (windowID == -1) m_joystickAxesConfigs[*it] = axesConfig; // CLog::Log(LOGDEBUG, "Found Joystick map for window %d using %s", windowID, it->c_str()); - it++; + ++it; } } @@ -901,7 +901,7 @@ void CButtonTranslator::MergeMap(boost::shared_ptr<CRegExp> joyName, JoystickMap { // find or create WindowMap entry, match on pattern equality JoystickMap::iterator jit; - for (jit = joystick->begin(); jit != joystick->end(); jit++) + for (jit = joystick->begin(); jit != joystick->end(); ++jit) { if (jit->first->GetPattern() == joyName->GetPattern()) break; @@ -910,14 +910,14 @@ void CButtonTranslator::MergeMap(boost::shared_ptr<CRegExp> joyName, JoystickMap // find or create ActionMap, and merge/overwrite new entries ActionMap *a = &(*w)[windowID]; - for (ActionMap::const_iterator it = map.begin(); it != map.end(); it++) + for (ActionMap::const_iterator it = map.begin(); it != map.end(); ++it) (*a)[it->first] = it->second; } CButtonTranslator::JoystickMap::const_iterator CButtonTranslator::FindWindowMap(const std::string& joyName, const JoystickMap &maps) const { JoystickMap::const_iterator it; - for (it = maps.begin(); it != maps.end(); it++) + for (it = maps.begin(); it != maps.end(); ++it) { if (it->first->RegFind(joyName) >= 0) { diff --git a/xbmc/input/KeyboardLayout.cpp b/xbmc/input/KeyboardLayout.cpp index 3821bbe168..b930e65cf4 100644 --- a/xbmc/input/KeyboardLayout.cpp +++ b/xbmc/input/KeyboardLayout.cpp @@ -45,11 +45,11 @@ CKeyboardLayout::CKeyboardLayout(const std::string &name, const TiXmlElement &el StringUtils::ToLower(modifiers); std::vector<std::string> variants = StringUtils::Split(modifiers, ","); - for (std::vector<std::string>::const_iterator itv = variants.begin(); itv != variants.end(); itv++) + for (std::vector<std::string>::const_iterator itv = variants.begin(); itv != variants.end(); ++itv) { unsigned int iKeys = MODIFIER_KEY_NONE; std::vector<std::string> keys = StringUtils::Split(*itv, "+"); - for (std::vector<std::string>::const_iterator it = keys.begin(); it != keys.end(); it++) + for (std::vector<std::string>::const_iterator it = keys.begin(); it != keys.end(); ++it) { std::string strKey = *it; if (strKey == "shift") @@ -71,7 +71,7 @@ CKeyboardLayout::CKeyboardLayout(const std::string &name, const TiXmlElement &el std::vector<std::string> chars = BreakCharacters(strRow); if (!modifierKeysSet.empty()) { - for (std::set<unsigned int>::const_iterator it = modifierKeysSet.begin(); it != modifierKeysSet.end(); it++) + for (std::set<unsigned int>::const_iterator it = modifierKeysSet.begin(); it != modifierKeysSet.end(); ++it) m_keyboards[*it].push_back(chars); } else @@ -127,7 +127,7 @@ std::vector<std::string> CKeyboardLayout::BreakCharacters(const std::string &cha CKeyboardLayout CKeyboardLayout::Load(const std::string& layout) { std::vector<CKeyboardLayout> layouts = LoadLayouts(); - for (std::vector<CKeyboardLayout>::const_iterator it = layouts.begin(); it != layouts.end(); it++) + for (std::vector<CKeyboardLayout>::const_iterator it = layouts.begin(); it != layouts.end(); ++it) { if (it->GetName() == layout) return *it; @@ -159,7 +159,7 @@ std::vector<CKeyboardLayout> CKeyboardLayout::LoadLayouts() void CKeyboardLayout::SettingOptionsKeyboardLayoutsFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t, void *data) { std::vector<CKeyboardLayout> layouts = LoadLayouts(); - for (std::vector<CKeyboardLayout>::const_iterator it = layouts.begin(); it != layouts.end(); it++) + for (std::vector<CKeyboardLayout>::const_iterator it = layouts.begin(); it != layouts.end(); ++it) { std::string name = it->GetName(); list.push_back(make_pair(name, name)); diff --git a/xbmc/input/SDLJoystick.cpp b/xbmc/input/SDLJoystick.cpp index 21b26cbe76..2051a74fa8 100644 --- a/xbmc/input/SDLJoystick.cpp +++ b/xbmc/input/SDLJoystick.cpp @@ -416,11 +416,11 @@ void CJoystick::ApplyAxesConfigs() { // load axes configuration from keymap int axesCount = 0; - for (std::map<int, SDL_Joystick*>::const_iterator it = m_Joysticks.begin(); it != m_Joysticks.end(); it++) + for (std::map<int, SDL_Joystick*>::const_iterator it = m_Joysticks.begin(); it != m_Joysticks.end(); ++it) { std::string joyName(SDL_JoystickName(it->second)); std::map<boost::shared_ptr<CRegExp>, AxesConfig>::const_iterator axesCfg; - for (axesCfg = m_AxesConfigs.begin(); axesCfg != m_AxesConfigs.end(); axesCfg++) + for (axesCfg = m_AxesConfigs.begin(); axesCfg != m_AxesConfigs.end(); ++axesCfg) { if (axesCfg->first->RegFind(joyName) >= 0) break; diff --git a/xbmc/input/linux/LIRC.cpp b/xbmc/input/linux/LIRC.cpp index 396ea882ad..e167d06171 100644 --- a/xbmc/input/linux/LIRC.cpp +++ b/xbmc/input/linux/LIRC.cpp @@ -39,7 +39,8 @@ CRemoteControl g_RemoteControl; -CRemoteControl::CRemoteControl() +CRemoteControl::CRemoteControl(): + m_deviceName(LIRC_DEVICE) { m_fd = -1; m_file = NULL; @@ -47,7 +48,6 @@ CRemoteControl::CRemoteControl() m_button = 0; m_holdTime = 0; m_used = true; - m_deviceName = LIRC_DEVICE; m_inotify_fd = -1; m_inotify_wd = -1; m_bLogConnectFailure = true; diff --git a/xbmc/input/linux/LinuxInputDevices.cpp b/xbmc/input/linux/LinuxInputDevices.cpp index 0b0f7aecb2..b24f66f962 100644 --- a/xbmc/input/linux/LinuxInputDevices.cpp +++ b/xbmc/input/linux/LinuxInputDevices.cpp @@ -275,12 +275,12 @@ typedef enum static char remoteStatus = 0xFF; // paired, battery OK -CLinuxInputDevice::CLinuxInputDevice(const std::string fileName, int index) +CLinuxInputDevice::CLinuxInputDevice(const std::string& fileName, int index): + m_fileName(fileName) { m_fd = -1; m_vt_fd = -1; m_hasLeds = false; - m_fileName = fileName; m_ledState[0] = false; m_ledState[1] = false; m_ledState[2] = false; diff --git a/xbmc/input/linux/LinuxInputDevices.h b/xbmc/input/linux/LinuxInputDevices.h index 384a83aa9d..cf1c5ce202 100644 --- a/xbmc/input/linux/LinuxInputDevices.h +++ b/xbmc/input/linux/LinuxInputDevices.h @@ -38,7 +38,7 @@ struct KeymapEntry class CLinuxInputDevice { public: - CLinuxInputDevice(const std::string fileName, int index); + CLinuxInputDevice(const std::string& fileName, int index); ~CLinuxInputDevice(); XBMC_Event ReadEvent(); const std::string& GetFileName(); diff --git a/xbmc/input/touch/generic/GenericTouchInputHandler.cpp b/xbmc/input/touch/generic/GenericTouchInputHandler.cpp index 4c91563998..4461ca98ce 100644 --- a/xbmc/input/touch/generic/GenericTouchInputHandler.cpp +++ b/xbmc/input/touch/generic/GenericTouchInputHandler.cpp @@ -39,7 +39,7 @@ CGenericTouchInputHandler::~CGenericTouchInputHandler() { delete m_holdTimer; - for (std::set<IGenericTouchGestureDetector*>::const_iterator detector = m_detectors.begin(); detector != m_detectors.end(); detector++) + for (std::set<IGenericTouchGestureDetector*>::const_iterator detector = m_detectors.begin(); detector != m_detectors.end(); ++detector) delete (*detector); m_detectors.clear(); } @@ -313,7 +313,7 @@ bool CGenericTouchInputHandler::UpdateTouchPointer(int32_t pointer, float x, flo m_pointers[pointer].moving = true; } - for (std::set<IGenericTouchGestureDetector*>::const_iterator detector = m_detectors.begin(); detector != m_detectors.end(); detector++) + for (std::set<IGenericTouchGestureDetector*>::const_iterator detector = m_detectors.begin(); detector != m_detectors.end(); ++detector) (*detector)->OnTouchUpdate(pointer, m_pointers[pointer]); return true; @@ -361,7 +361,7 @@ void CGenericTouchInputHandler::triggerDetectors(TouchInput event, int32_t point { case TouchInputAbort: { - for (std::set<IGenericTouchGestureDetector*>::const_iterator detector = m_detectors.begin(); detector != m_detectors.end(); detector++) + for (std::set<IGenericTouchGestureDetector*>::const_iterator detector = m_detectors.begin(); detector != m_detectors.end(); ++detector) delete (*detector); m_detectors.clear(); break; @@ -369,21 +369,21 @@ void CGenericTouchInputHandler::triggerDetectors(TouchInput event, int32_t point case TouchInputDown: { - for (std::set<IGenericTouchGestureDetector*>::const_iterator detector = m_detectors.begin(); detector != m_detectors.end(); detector++) + for (std::set<IGenericTouchGestureDetector*>::const_iterator detector = m_detectors.begin(); detector != m_detectors.end(); ++detector) (*detector)->OnTouchDown(pointer, m_pointers[pointer]); break; } case TouchInputUp: { - for (std::set<IGenericTouchGestureDetector*>::const_iterator detector = m_detectors.begin(); detector != m_detectors.end(); detector++) + for (std::set<IGenericTouchGestureDetector*>::const_iterator detector = m_detectors.begin(); detector != m_detectors.end(); ++detector) (*detector)->OnTouchUp(pointer, m_pointers[pointer]); break; } case TouchInputMove: { - for (std::set<IGenericTouchGestureDetector*>::const_iterator detector = m_detectors.begin(); detector != m_detectors.end(); detector++) + for (std::set<IGenericTouchGestureDetector*>::const_iterator detector = m_detectors.begin(); detector != m_detectors.end(); ++detector) (*detector)->OnTouchMove(pointer, m_pointers[pointer]); break; } @@ -393,12 +393,12 @@ void CGenericTouchInputHandler::triggerDetectors(TouchInput event, int32_t point } std::set<IGenericTouchGestureDetector*> finishedDetectors; - for (std::set<IGenericTouchGestureDetector*>::const_iterator detector = m_detectors.begin(); detector != m_detectors.end(); detector++) + for (std::set<IGenericTouchGestureDetector*>::const_iterator detector = m_detectors.begin(); detector != m_detectors.end(); ++detector) { if ((*detector)->IsDone()) finishedDetectors.insert(*detector); } - for (std::set<IGenericTouchGestureDetector*>::const_iterator detector = finishedDetectors.begin(); detector != finishedDetectors.end(); detector++) + for (std::set<IGenericTouchGestureDetector*>::const_iterator detector = finishedDetectors.begin(); detector != finishedDetectors.end(); ++detector) m_detectors.erase(*detector); } diff --git a/xbmc/input/windows/WINJoystick.cpp b/xbmc/input/windows/WINJoystick.cpp index b2da2ac3d1..154092ec15 100644 --- a/xbmc/input/windows/WINJoystick.cpp +++ b/xbmc/input/windows/WINJoystick.cpp @@ -140,7 +140,7 @@ BOOL CALLBACK CJoystick::EnumJoysticksCallback( const DIDEVICEINSTANCE* pdidInst // load axes configuration from keymap std::map<boost::shared_ptr<CRegExp>, AxesConfig>::const_iterator axesCfg; - for (axesCfg = p_this->m_AxesConfigs.begin(); axesCfg != p_this->m_AxesConfigs.end(); axesCfg++) + for (axesCfg = p_this->m_AxesConfigs.begin(); axesCfg != p_this->m_AxesConfigs.end(); ++axesCfg) { if (axesCfg->first->RegFind(joyName) >= 0) break; |