Permalink
Browse files

changed: used const reference (thanks jmarshall)

  • Loading branch information...
1 parent 67a3fcb commit 942afac10262429864f4daa07fcd67022e5c4209 @malard malard committed Jun 13, 2011
Showing with 8 additions and 7 deletions.
  1. +5 −4 xbmc/input/KeymapLoader.cpp
  2. +3 −3 xbmc/input/KeymapLoader.h
@@ -39,7 +39,7 @@ CKeymapLoader::CKeymapLoader()
}
}
-void CKeymapLoader::DeviceAdded(CStdString deviceId)
+void CKeymapLoader::DeviceAdded(const CStdString& deviceId)
{
CStdString keymapName;
if (FindMappedDevice(deviceId, keymapName))
@@ -49,7 +49,7 @@ void CKeymapLoader::DeviceAdded(CStdString deviceId)
}
}
-void CKeymapLoader::DeviceRemoved(CStdString deviceId)
+void CKeymapLoader::DeviceRemoved(const CStdString& deviceId)
{
CStdString keymapName;
if (FindMappedDevice(deviceId, keymapName))
@@ -82,9 +82,10 @@ void CKeymapLoader::ParseDeviceMappings()
}
}
-bool CKeymapLoader::FindMappedDevice(CStdString deviceId, CStdString& keymapName)
+bool CKeymapLoader::FindMappedDevice(const CStdString& deviceId, CStdString& keymapName)
{
- std::map<CStdString, CStdString>::iterator deviceIdIt = deviceMappings.find(deviceId.ToUpper());
+ CStdString deviceIdTemp = deviceId;
+ std::map<CStdString, CStdString>::iterator deviceIdIt = deviceMappings.find(deviceIdTemp.ToUpper());
if (deviceIdIt == deviceMappings.end())
return false;
@@ -26,9 +26,9 @@ class CKeymapLoader
{
public:
CKeymapLoader();
- void DeviceRemoved(CStdString deviceID);
- void DeviceAdded(CStdString deviceID);
+ void DeviceRemoved(const CStdString& deviceID);
+ void DeviceAdded(const CStdString& deviceID);
private:
void ParseDeviceMappings();
- bool FindMappedDevice(CStdString deviceId, CStdString& keymapName);
+ bool FindMappedDevice(const CStdString& deviceId, CStdString& keymapName);
};

0 comments on commit 942afac

Please sign in to comment.