aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRechi <Rechi@users.noreply.github.com>2020-10-30 18:53:28 +0000
committerRechi <Rechi@users.noreply.github.com>2020-10-30 18:53:28 +0000
commit9962d275b4258f880bb5af4fed426514da47947e (patch)
treeaa41228a0b38aedfac04d4b0898a236797178dea
parent11f3fb3e526bf7f7fb385ace31e5dc03d5d90320 (diff)
[clang-tidy] performance-for-range-copy
-rw-r--r--xbmc/FileItem.cpp2
-rw-r--r--xbmc/Util.cpp2
-rw-r--r--xbmc/addons/LanguageResource.cpp2
-rw-r--r--xbmc/addons/PluginSource.cpp2
-rw-r--r--xbmc/addons/Repository.cpp2
-rw-r--r--xbmc/addons/Scraper.cpp2
-rw-r--r--xbmc/addons/Skin.cpp2
-rw-r--r--xbmc/addons/addoninfo/AddonExtensions.cpp6
-rw-r--r--xbmc/addons/addoninfo/AddonExtensions.h2
-rw-r--r--xbmc/addons/addoninfo/AddonType.cpp2
-rw-r--r--xbmc/addons/binary-addons/AddonDll.cpp8
-rw-r--r--xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/Visualization.h4
-rw-r--r--xbmc/addons/settings/AddonSettings.cpp2
-rw-r--r--xbmc/cores/AudioEngine/AESinkFactory.cpp8
-rw-r--r--xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp3
-rw-r--r--xbmc/cores/VideoPlayer/Buffers/VideoBuffer.cpp6
-rw-r--r--xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp2
-rw-r--r--xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamMultiSource.cpp10
-rw-r--r--xbmc/filesystem/EventsDirectory.cpp2
-rw-r--r--xbmc/guilib/GUIBaseContainer.cpp4
-rw-r--r--xbmc/guilib/GUIIncludes.cpp2
-rw-r--r--xbmc/guilib/imagefactory.cpp2
-rw-r--r--xbmc/input/ButtonTranslator.cpp2
-rw-r--r--xbmc/interfaces/json-rpc/JSONServiceDescription.cpp12
-rw-r--r--xbmc/interfaces/json-rpc/PlayerOperations.cpp4
-rw-r--r--xbmc/interfaces/python/PythonInvoker.cpp2
-rw-r--r--xbmc/music/Album.cpp6
-rw-r--r--xbmc/music/MusicThumbLoader.cpp2
-rw-r--r--xbmc/music/Song.cpp2
-rw-r--r--xbmc/music/dialogs/GUIDialogMusicInfo.cpp2
-rw-r--r--xbmc/network/AirTunesServer.cpp2
-rw-r--r--xbmc/peripherals/addons/AddonButtonMap.cpp2
-rw-r--r--xbmc/peripherals/addons/PeripheralAddon.cpp10
-rw-r--r--xbmc/platform/android/network/NetworkAndroid.cpp2
-rw-r--r--xbmc/platform/android/network/ZeroconfAndroid.cpp4
-rw-r--r--xbmc/platform/darwin/ios-common/AnnounceReceiver.mm2
-rw-r--r--xbmc/platform/linux/network/zeroconf/ZeroconfAvahi.cpp2
-rw-r--r--xbmc/pvr/channels/PVRChannelGroups.cpp4
-rw-r--r--xbmc/settings/lib/Setting.cpp18
-rw-r--r--xbmc/utils/BufferObjectFactory.cpp2
-rw-r--r--xbmc/utils/RecentlyAddedJob.cpp2
-rw-r--r--xbmc/video/PlayerController.cpp2
-rw-r--r--xbmc/video/VideoInfoScanner.cpp2
-rw-r--r--xbmc/windowing/X11/XRandR.cpp2
-rw-r--r--xbmc/windowing/android/AndroidUtils.cpp2
-rw-r--r--xbmc/windows/GUIMediaWindow.cpp2
46 files changed, 84 insertions, 85 deletions
diff --git a/xbmc/FileItem.cpp b/xbmc/FileItem.cpp
index 49210a5686..3266a8abfa 100644
--- a/xbmc/FileItem.cpp
+++ b/xbmc/FileItem.cpp
@@ -2990,7 +2990,7 @@ bool CFileItemList::Save(int windowID)
// name when list cached) can not be accurately derived from item path.
StringUtils::Replace(cachefile, "special://temp/archive_cache/", "");
StringUtils::Replace(cachefile, ".fi", "");
- for (auto item : m_items)
+ for (const auto& item : m_items)
item->SetProperty("cachefilename", cachefile);
CArchive ar(&file, CArchive::store);
diff --git a/xbmc/Util.cpp b/xbmc/Util.cpp
index f05315a436..2fdf4bdf91 100644
--- a/xbmc/Util.cpp
+++ b/xbmc/Util.cpp
@@ -1965,7 +1965,7 @@ int CUtil::ScanArchiveForAssociatedItems(const std::string& strArchivePath,
StringUtils::StartsWithNoCase(URIUtils::GetFileName(strPathInRar), CURL::Decode(videoNameNoExt))))
continue;
- for (auto ext : item_exts)
+ for (const auto& ext : item_exts)
{
if (StringUtils::EqualsNoCase(strExt, ext))
{
diff --git a/xbmc/addons/LanguageResource.cpp b/xbmc/addons/LanguageResource.cpp
index 41c301ffc8..ccc5e29b70 100644
--- a/xbmc/addons/LanguageResource.cpp
+++ b/xbmc/addons/LanguageResource.cpp
@@ -67,7 +67,7 @@ CLanguageResource::CLanguageResource(const AddonInfoPtr& addonInfo)
* <token>Le</token>
* ...
*/
- for (auto values : sorttokensElement->GetValues())
+ for (const auto& values : sorttokensElement->GetValues())
{
/* Second loop goes around the row parts, e.g.
* separators = "'"
diff --git a/xbmc/addons/PluginSource.cpp b/xbmc/addons/PluginSource.cpp
index 16fdfbb19e..c8cdf5f8a5 100644
--- a/xbmc/addons/PluginSource.cpp
+++ b/xbmc/addons/PluginSource.cpp
@@ -22,7 +22,7 @@ CPluginSource::CPluginSource(const AddonInfoPtr& addonInfo, TYPE addonType) : CA
{
std::string provides = addonInfo->Type(addonType)->GetValue("provides").asString();
- for (auto values : addonInfo->Type(addonType)->GetValues())
+ for (const auto& values : addonInfo->Type(addonType)->GetValues())
{
if (values.first != "medialibraryscanpath")
continue;
diff --git a/xbmc/addons/Repository.cpp b/xbmc/addons/Repository.cpp
index 76764c59dc..c1fcf19607 100644
--- a/xbmc/addons/Repository.cpp
+++ b/xbmc/addons/Repository.cpp
@@ -108,7 +108,7 @@ CRepository::CRepository(const AddonInfoPtr& addonInfo)
if (addonver)
version = addonver->Version();
- for (auto element : Type(ADDON_REPOSITORY)->GetElements("dir"))
+ for (const auto& element : Type(ADDON_REPOSITORY)->GetElements("dir"))
{
DirInfo dir = ParseDirConfiguration(element.second);
if ((dir.minversion.empty() || version >= dir.minversion) &&
diff --git a/xbmc/addons/Scraper.cpp b/xbmc/addons/Scraper.cpp
index 60b6bf439d..22e0feafe4 100644
--- a/xbmc/addons/Scraper.cpp
+++ b/xbmc/addons/Scraper.cpp
@@ -675,7 +675,7 @@ static std::vector<T> PythonFind(const std::string &ID,
if (XFILE::CDirectory::GetDirectory(str.str(), items, "", DIR_FLAG_DEFAULTS))
{
- for (auto it : items)
+ for (const auto& it : items)
result.emplace_back(std::move(FromFileItem<T>(*it)));
}
diff --git a/xbmc/addons/Skin.cpp b/xbmc/addons/Skin.cpp
index 2ffb02885d..3d7ba36c36 100644
--- a/xbmc/addons/Skin.cpp
+++ b/xbmc/addons/Skin.cpp
@@ -156,7 +156,7 @@ CSkinInfo::CSkinInfo(
CSkinInfo::CSkinInfo(const AddonInfoPtr& addonInfo) : CAddon(addonInfo, ADDON_SKIN)
{
- for (auto values : Type(ADDON_SKIN)->GetValues())
+ for (const auto& values : Type(ADDON_SKIN)->GetValues())
{
if (values.first != "res")
continue;
diff --git a/xbmc/addons/addoninfo/AddonExtensions.cpp b/xbmc/addons/addoninfo/AddonExtensions.cpp
index f380e4a7a2..61df9289e0 100644
--- a/xbmc/addons/addoninfo/AddonExtensions.cpp
+++ b/xbmc/addons/addoninfo/AddonExtensions.cpp
@@ -12,9 +12,9 @@ using namespace ADDON;
const SExtValue CAddonExtensions::GetValue(const std::string& id) const
{
- for (auto values : m_values)
+ for (const auto& values : m_values)
{
- for (auto value : values.second)
+ for (const auto& value : values.second)
{
if (value.first == id)
return value.second;
@@ -45,7 +45,7 @@ const EXT_ELEMENTS CAddonExtensions::GetElements(const std::string& id) const
return m_children;
EXT_ELEMENTS children;
- for (auto child : m_children)
+ for (const auto& child : m_children)
{
if (child.first == id)
children.push_back(std::make_pair(child.first, child.second));
diff --git a/xbmc/addons/addoninfo/AddonExtensions.h b/xbmc/addons/addoninfo/AddonExtensions.h
index 694a9dd6e8..0a0c3aa8fd 100644
--- a/xbmc/addons/addoninfo/AddonExtensions.h
+++ b/xbmc/addons/addoninfo/AddonExtensions.h
@@ -44,7 +44,7 @@ public:
const SExtValue GetValue(const std::string& id) const
{
- for (auto value : *this)
+ for (const auto& value : *this)
{
if (value.first == id)
return value.second;
diff --git a/xbmc/addons/addoninfo/AddonType.cpp b/xbmc/addons/addoninfo/AddonType.cpp
index e17d82ed88..0df7dda4f0 100644
--- a/xbmc/addons/addoninfo/AddonType.cpp
+++ b/xbmc/addons/addoninfo/AddonType.cpp
@@ -43,7 +43,7 @@ void CAddonType::SetProvides(const std::string& content)
if (GetValue("provides").empty())
Insert("provides", content);
- for (auto provide : StringUtils::Split(content, ' '))
+ for (const auto& provide : StringUtils::Split(content, ' '))
{
TYPE content = CAddonInfo::TranslateSubContent(provide);
if (content != ADDON_UNKNOWN)
diff --git a/xbmc/addons/binary-addons/AddonDll.cpp b/xbmc/addons/binary-addons/AddonDll.cpp
index 8ec04de55e..a6169a1f10 100644
--- a/xbmc/addons/binary-addons/AddonDll.cpp
+++ b/xbmc/addons/binary-addons/AddonDll.cpp
@@ -353,13 +353,13 @@ ADDON_STATUS CAddonDll::TransferSettings()
auto settings = GetSettings();
if (settings != nullptr)
{
- for (auto section : settings->GetSections())
+ for (const auto& section : settings->GetSections())
{
- for (auto category : section->GetCategories())
+ for (const auto& category : section->GetCategories())
{
- for (auto group : category->GetGroups())
+ for (const auto& group : category->GetGroups())
{
- for (auto setting : group->GetSettings())
+ for (const auto& setting : group->GetSettings())
{
ADDON_STATUS status = ADDON_STATUS_OK;
const char* id = setting->GetId().c_str();
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/Visualization.h b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/Visualization.h
index 7b1db6503e..1dddea2561 100644
--- a/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/Visualization.h
+++ b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/Visualization.h
@@ -721,7 +721,7 @@ public:
inline void TransferPresets(const std::vector<std::string>& presets)
{
m_instanceData->toKodi->clear_presets(m_instanceData->toKodi->kodiInstance);
- for (auto it : presets)
+ for (const auto& it : presets)
m_instanceData->toKodi->transfer_preset(m_instanceData->toKodi->kodiInstance, it.c_str());
}
//----------------------------------------------------------------------------
@@ -915,7 +915,7 @@ private:
std::vector<std::string> presets;
if (thisClass->GetPresets(presets))
{
- for (auto it : presets)
+ for (const auto& it : presets)
thisClass->m_instanceData->toKodi->transfer_preset(addon->toKodi->kodiInstance, it.c_str());
}
diff --git a/xbmc/addons/settings/AddonSettings.cpp b/xbmc/addons/settings/AddonSettings.cpp
index 92a703c85f..10bfb0c554 100644
--- a/xbmc/addons/settings/AddonSettings.cpp
+++ b/xbmc/addons/settings/AddonSettings.cpp
@@ -1519,7 +1519,7 @@ void CAddonSettings::FileEnumSettingOptionsFiller(std::shared_ptr<const CSetting
XFILE::CDirectory::GetDirectory(settingPath->GetSources().front(), items, masking, XFILE::DIR_FLAG_NO_FILE_DIRS);
// process the matching files/directories
- for (auto item : items)
+ for (const auto& item : items)
{
if ((masking == "/" && item->m_bIsFolder) || !item->m_bIsFolder)
{
diff --git a/xbmc/cores/AudioEngine/AESinkFactory.cpp b/xbmc/cores/AudioEngine/AESinkFactory.cpp
index 5356359c4a..af573328a3 100644
--- a/xbmc/cores/AudioEngine/AESinkFactory.cpp
+++ b/xbmc/cores/AudioEngine/AESinkFactory.cpp
@@ -46,7 +46,7 @@ void CAESinkFactory::ParseDevice(std::string &device, std::string &driver)
{
driver = device.substr(0, pos);
- for (auto reg : m_AESinkRegEntry)
+ for (const auto& reg : m_AESinkRegEntry)
{
if (!StringUtils::EqualsNoCase(driver, reg.second.sinkName))
continue;
@@ -70,7 +70,7 @@ IAESink *CAESinkFactory::Create(std::string &device, AEAudioFormat &desiredForma
IAESink *sink;
std::string tmpDevice = device;
- for (auto reg : m_AESinkRegEntry)
+ for (const auto& reg : m_AESinkRegEntry)
{
if (driver != reg.second.sinkName)
continue;
@@ -89,7 +89,7 @@ void CAESinkFactory::EnumerateEx(std::vector<AESinkInfo>& list, bool force, std:
{
AESinkInfo info;
- for(auto reg : m_AESinkRegEntry)
+ for (const auto& reg : m_AESinkRegEntry)
{
if (!driver.empty() && driver != reg.second.sinkName)
continue;
@@ -104,7 +104,7 @@ void CAESinkFactory::EnumerateEx(std::vector<AESinkInfo>& list, bool force, std:
void CAESinkFactory::Cleanup()
{
- for (auto reg : m_AESinkRegEntry)
+ for (const auto& reg : m_AESinkRegEntry)
{
if (reg.second.cleanupFunc)
reg.second.cleanupFunc();
diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp
index cde2e84d69..3148c375b4 100644
--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp
+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp
@@ -215,9 +215,8 @@ bool CActiveAESink::DeviceExist(std::string driver, std::string device)
if (itt.m_sinkName != driver)
continue;
- for (auto itt2 : itt.m_deviceInfoList)
+ for (const CAEDeviceInfo& info : itt.m_deviceInfoList)
{
- CAEDeviceInfo& info = itt2;
if (info.m_deviceName == device)
return true;
}
diff --git a/xbmc/cores/VideoPlayer/Buffers/VideoBuffer.cpp b/xbmc/cores/VideoPlayer/Buffers/VideoBuffer.cpp
index eb7847ca0a..ce6a7f578f 100644
--- a/xbmc/cores/VideoPlayer/Buffers/VideoBuffer.cpp
+++ b/xbmc/cores/VideoPlayer/Buffers/VideoBuffer.cpp
@@ -401,7 +401,7 @@ void CVideoBufferManager::ReleasePools()
m_discardedPools = pools;
- for (auto pool : pools)
+ for (const auto& pool : pools)
{
pool->Discard(this, &CVideoBufferManager::ReadyForDisposal);
}
@@ -441,7 +441,7 @@ void CVideoBufferManager::ReadyForDisposal(IVideoBufferPool *pool)
CVideoBuffer* CVideoBufferManager::Get(AVPixelFormat format, int size, IVideoBufferPool **pPool)
{
CSingleLock lock(m_critSection);
- for (auto pool: m_pools)
+ for (const auto& pool : m_pools)
{
if (!pool->IsConfigured())
{
@@ -453,7 +453,7 @@ CVideoBuffer* CVideoBufferManager::Get(AVPixelFormat format, int size, IVideoBuf
}
}
- for (auto fact : m_poolFactories)
+ for (const auto& fact : m_poolFactories)
{
std::shared_ptr<IVideoBufferPool> pool = fact.second();
m_pools.push_front(pool);
diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp
index 4d2d461bd8..057a819a85 100644
--- a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp
+++ b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp
@@ -52,7 +52,7 @@ std::shared_ptr<CDVDInputStream> CDVDFactoryInputStream::CreateInputStream(IVide
std::vector<AddonInfoPtr> addonInfos;
CServiceBroker::GetAddonMgr().GetAddonInfos(addonInfos, true /*enabled only*/, ADDON_INPUTSTREAM);
- for (auto addonInfo : addonInfos)
+ for (const auto& addonInfo : addonInfos)
{
if (CInputStreamAddon::Supports(addonInfo, fileitem))
{
diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamMultiSource.cpp b/xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamMultiSource.cpp
index d7d4692bb3..fc86e59792 100644
--- a/xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamMultiSource.cpp
+++ b/xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamMultiSource.cpp
@@ -30,7 +30,7 @@ CInputStreamMultiSource::~CInputStreamMultiSource()
void CInputStreamMultiSource::Abort()
{
- for (auto iter : m_InputStreams)
+ for (const auto& iter : m_InputStreams)
iter->Abort();
}
@@ -58,7 +58,7 @@ bool CInputStreamMultiSource::GetCacheStatus(XFILE::SCacheStatus *status)
int64_t CInputStreamMultiSource::GetLength()
{
int64_t length = 0;
- for (auto iter : m_InputStreams)
+ for (const auto& iter : m_InputStreams)
{
length = std::max(length, iter->GetLength());
}
@@ -71,7 +71,7 @@ bool CInputStreamMultiSource::IsEOF()
if (m_InputStreams.empty())
return true;
- for (auto iter : m_InputStreams)
+ for (const auto& iter : m_InputStreams)
{
if (!(iter->IsEOF()))
return false;
@@ -88,7 +88,7 @@ CDVDInputStream::ENextStream CInputStreamMultiSource::NextStream()
CDVDInputStream::ENextStream next;
- for (auto iter : m_InputStreams)
+ for (const auto& iter : m_InputStreams)
{
next = iter->NextStream();
if (next != NEXTSTREAM_NONE)
@@ -136,6 +136,6 @@ int64_t CInputStreamMultiSource::Seek(int64_t offset, int whence)
void CInputStreamMultiSource::SetReadRate(unsigned rate)
{
- for (auto iter : m_InputStreams)
+ for (const auto& iter : m_InputStreams)
iter->SetReadRate(rate);
}
diff --git a/xbmc/filesystem/EventsDirectory.cpp b/xbmc/filesystem/EventsDirectory.cpp
index 33f731068d..34e0b2c495 100644
--- a/xbmc/filesystem/EventsDirectory.cpp
+++ b/xbmc/filesystem/EventsDirectory.cpp
@@ -46,7 +46,7 @@ bool CEventsDirectory::GetDirectory(const CURL& url, CFileItemList &items)
events = log.Get(level, includeHigherLevels);
}
- for (auto eventItem : events)
+ for (const auto& eventItem : events)
items.Add(EventToFileItem(eventItem));
return true;
diff --git a/xbmc/guilib/GUIBaseContainer.cpp b/xbmc/guilib/GUIBaseContainer.cpp
index 83bd0002fb..cf1905640b 100644
--- a/xbmc/guilib/GUIBaseContainer.cpp
+++ b/xbmc/guilib/GUIBaseContainer.cpp
@@ -60,7 +60,7 @@ CGUIBaseContainer::CGUIBaseContainer(const CGUIBaseContainer &) = default;
CGUIBaseContainer::~CGUIBaseContainer(void)
{
// release the container from items
- for (auto item : m_items)
+ for (const auto& item : m_items)
item->FreeMemory();
delete m_listProvider;
@@ -1358,7 +1358,7 @@ std::string CGUIBaseContainer::GetLabel(int info) const
case CONTAINER_NUM_NONFOLDER_ITEMS:
{
int numItems = 0;
- for (auto item : m_items)
+ for (const auto& item : m_items)
{
if (!item->m_bIsFolder)
numItems++;
diff --git a/xbmc/guilib/GUIIncludes.cpp b/xbmc/guilib/GUIIncludes.cpp
index f8f4a90fea..b88be087f0 100644
--- a/xbmc/guilib/GUIIncludes.cpp
+++ b/xbmc/guilib/GUIIncludes.cpp
@@ -291,7 +291,7 @@ void CGUIIncludes::FlattenSkinVariableConditions()
bool CGUIIncludes::HasLoaded(const std::string &file) const
{
- for (auto loadedFile : m_files)
+ for (const auto& loadedFile : m_files)
{
if (loadedFile == file)
return true;
diff --git a/xbmc/guilib/imagefactory.cpp b/xbmc/guilib/imagefactory.cpp
index 1234369b3c..f6bbbb78c4 100644
--- a/xbmc/guilib/imagefactory.cpp
+++ b/xbmc/guilib/imagefactory.cpp
@@ -38,7 +38,7 @@ IImage* ImageFactory::CreateLoaderFromMimeType(const std::string& strMimeType)
{
std::vector<AddonInfoPtr> addonInfos;
CServiceBroker::GetAddonMgr().GetAddonInfos(addonInfos, true, ADDON_IMAGEDECODER);
- for (auto addonInfo : addonInfos)
+ for (const auto& addonInfo : addonInfos)
{
std::vector<std::string> mime = StringUtils::Split(addonInfo->Type(ADDON_IMAGEDECODER)->GetValue("@mimetype").asString(), "|");
if (std::find(mime.begin(), mime.end(), strMimeType) != mime.end())
diff --git a/xbmc/input/ButtonTranslator.cpp b/xbmc/input/ButtonTranslator.cpp
index 66241bd82c..00d0c3a894 100644
--- a/xbmc/input/ButtonTranslator.cpp
+++ b/xbmc/input/ButtonTranslator.cpp
@@ -371,7 +371,7 @@ void CButtonTranslator::MapWindowActions(const TiXmlNode* pWindow, int windowID)
}
}
- for (auto it : m_buttonMappers)
+ for (const auto& it : m_buttonMappers)
{
const std::string& device = it.first;
IButtonMapper* mapper = it.second;
diff --git a/xbmc/interfaces/json-rpc/JSONServiceDescription.cpp b/xbmc/interfaces/json-rpc/JSONServiceDescription.cpp
index 2ac6d43216..7c0055343a 100644
--- a/xbmc/interfaces/json-rpc/JSONServiceDescription.cpp
+++ b/xbmc/interfaces/json-rpc/JSONServiceDescription.cpp
@@ -1148,15 +1148,15 @@ void JSONSchemaTypeDefinition::ResolveReference()
referencedTypeSet = true;
// Take care of all nested types
- for (auto it : extends)
+ for (const auto& it : extends)
it->ResolveReference();
- for (auto it : unionTypes)
+ for (const auto& it : unionTypes)
it->ResolveReference();
- for (auto it : items)
+ for (const auto& it : items)
it->ResolveReference();
- for (auto it : additionalItems)
+ for (const auto& it : additionalItems)
it->ResolveReference();
- for (auto it : properties)
+ for (const auto& it : properties)
it.second->ResolveReference();
if (additionalProperties)
@@ -1413,7 +1413,7 @@ JSONRPC_STATUS JsonRpcMethod::checkParameter(const CVariant &requestParameters,
void CJSONServiceDescription::ResolveReferences()
{
- for (auto it : m_types)
+ for (const auto& it : m_types)
it.second->ResolveReference();
}
diff --git a/xbmc/interfaces/json-rpc/PlayerOperations.cpp b/xbmc/interfaces/json-rpc/PlayerOperations.cpp
index 1f97bdc6bc..8572736bef 100644
--- a/xbmc/interfaces/json-rpc/PlayerOperations.cpp
+++ b/xbmc/interfaces/json-rpc/PlayerOperations.cpp
@@ -123,7 +123,7 @@ JSONRPC_STATUS CPlayerOperations::GetPlayers(const std::string &method, ITranspo
playerCoreFactory.GetPlayers(players, true, video);
}
- for (auto playername: players)
+ for (const auto& playername : players)
{
CVariant player(CVariant::VariantTypeObject);
player["name"] = playername;
@@ -811,7 +811,7 @@ JSONRPC_STATUS CPlayerOperations::Open(const std::string &method, ITransportLaye
playerCoreFactory.GetPlayers(*list.Get(0).get(), possiblePlayers);
bool match = false;
- for (auto entry : possiblePlayers)
+ for (const auto& entry : possiblePlayers)
{
if (StringUtils::EqualsNoCase(entry, playername))
{
diff --git a/xbmc/interfaces/python/PythonInvoker.cpp b/xbmc/interfaces/python/PythonInvoker.cpp
index 7480321ec3..30d095a20e 100644
--- a/xbmc/interfaces/python/PythonInvoker.cpp
+++ b/xbmc/interfaces/python/PythonInvoker.cpp
@@ -150,7 +150,7 @@ bool CPythonInvoker::Execute(
bool CPythonInvoker::execute(const std::string& script, const std::vector<std::string>& arguments)
{
std::vector<std::wstring> w_arguments;
- for (auto argument : arguments)
+ for (const auto& argument : arguments)
{
std::wstring w_argument;
g_charsetConverter.utf8ToW(argument, w_argument);
diff --git a/xbmc/music/Album.cpp b/xbmc/music/Album.cpp
index c91e9e9db4..6561632b6e 100644
--- a/xbmc/music/Album.cpp
+++ b/xbmc/music/Album.cpp
@@ -271,7 +271,7 @@ void CAlbum::MergeScrapedAlbum(const CAlbum& source, bool override /* = true */)
{
if (artistCredit.GetMusicBrainzArtistID().empty())
{
- for (auto sourceartistCredit : source.artistCredits)
+ for (const auto& sourceartistCredit : source.artistCredits)
{
if (StringUtils::EqualsNoCase(artistCredit.GetArtist(), sourceartistCredit.GetArtist()))
{
@@ -332,7 +332,7 @@ void CAlbum::MergeScrapedAlbum(const CAlbum& source, bool override /* = true */)
for (auto &song : songs)
{
if (!song.strMusicBrainzTrackID.empty())
- for (auto sourceSong : source.songs)
+ for (const auto& sourceSong : source.songs)
if ((sourceSong.strMusicBrainzTrackID == song.strMusicBrainzTrackID) && (sourceSong.iTrack == song.iTrack))
song.MergeScrapedSong(sourceSong, override);
}
@@ -388,7 +388,7 @@ const std::string CAlbum::GetAlbumArtistSort() const
if (!strArtistSort.empty())
return strArtistSort;
std::vector<std::string> artistvector;
- for (auto artistcredit : artistCredits)
+ for (const auto& artistcredit : artistCredits)
if (!artistcredit.GetSortName().empty())
artistvector.emplace_back(artistcredit.GetSortName());
std::string artistString;
diff --git a/xbmc/music/MusicThumbLoader.cpp b/xbmc/music/MusicThumbLoader.cpp
index 1f0ff867d9..adfe428b48 100644
--- a/xbmc/music/MusicThumbLoader.cpp
+++ b/xbmc/music/MusicThumbLoader.cpp
@@ -325,7 +325,7 @@ bool CMusicThumbLoader::FillLibraryArt(CFileItem &item)
item.SetArtFallback("fanart", fanartfallback);
// Process specific disc art when we have some
- for (auto discart : discartmap)
+ for (const auto& discart : discartmap)
{
std::map<std::string, std::string>::iterator it;
if (tag.GetType() == MediaTypeAlbum)
diff --git a/xbmc/music/Song.cpp b/xbmc/music/Song.cpp
index 5a5f235f92..4e0a9c9cc9 100644
--- a/xbmc/music/Song.cpp
+++ b/xbmc/music/Song.cpp
@@ -306,7 +306,7 @@ const std::string CSong::GetArtistSort() const
if (!strArtistSort.empty())
return strArtistSort;
std::vector<std::string> artistvector;
- for (auto artistcredit: artistCredits)
+ for (const auto& artistcredit : artistCredits)
if (!artistcredit.GetSortName().empty())
artistvector.emplace_back(artistcredit.GetSortName());
std::string artistString;
diff --git a/xbmc/music/dialogs/GUIDialogMusicInfo.cpp b/xbmc/music/dialogs/GUIDialogMusicInfo.cpp
index ce75b36a25..94b641ec44 100644
--- a/xbmc/music/dialogs/GUIDialogMusicInfo.cpp
+++ b/xbmc/music/dialogs/GUIDialogMusicInfo.cpp
@@ -497,7 +497,7 @@ void CGUIDialogMusicInfo::SetDiscography(CMusicDatabase& database) const
m_albumSongs->Clear();
database.GetArtistDiscography(m_artist.idArtist, *m_albumSongs);
CMusicThumbLoader loader;
- for (auto item : *m_albumSongs)
+ for (const auto& item : *m_albumSongs)
{
// Load all the album art and related artist(s) art (could be other collaborating artists)
loader.LoadItem(item.get());
diff --git a/xbmc/network/AirTunesServer.cpp b/xbmc/network/AirTunesServer.cpp
index b4be1543c1..52edc48020 100644
--- a/xbmc/network/AirTunesServer.cpp
+++ b/xbmc/network/AirTunesServer.cpp
@@ -235,7 +235,7 @@ void CAirTunesServer::Process()
m_actionQueue.clear();
}
- for (auto currentAction : currentActions)
+ for (const auto& currentAction : currentActions)
{
CSingleLock lock(m_dacpLock);
if (m_pDACP)
diff --git a/xbmc/peripherals/addons/AddonButtonMap.cpp b/xbmc/peripherals/addons/AddonButtonMap.cpp
index 07d740ddc4..fbaf1d34a9 100644
--- a/xbmc/peripherals/addons/AddonButtonMap.cpp
+++ b/xbmc/peripherals/addons/AddonButtonMap.cpp
@@ -480,7 +480,7 @@ bool CAddonButtonMap::GetAxisProperties(unsigned int axisIndex, int& center, uns
{
CSingleLock lock(m_mutex);
- for (auto it : m_driverMap)
+ for (const auto& it : m_driverMap)
{
const CDriverPrimitive& primitive = it.first;
diff --git a/xbmc/peripherals/addons/PeripheralAddon.cpp b/xbmc/peripherals/addons/PeripheralAddon.cpp
index fcf8f4abd8..e02df0f298 100644
--- a/xbmc/peripherals/addons/PeripheralAddon.cpp
+++ b/xbmc/peripherals/addons/PeripheralAddon.cpp
@@ -264,7 +264,7 @@ PeripheralPtr CPeripheralAddon::GetByPath(const std::string& strPath) const
PeripheralPtr result;
CSingleLock lock(m_critSection);
- for (auto it : m_peripherals)
+ for (const auto& it : m_peripherals)
{
if (StringUtils::EqualsNoCase(strPath, it.second->FileLocation()))
{
@@ -296,7 +296,7 @@ unsigned int CPeripheralAddon::GetPeripheralsWithFeature(PeripheralVector& resul
{
unsigned int iReturn = 0;
CSingleLock lock(m_critSection);
- for (auto it : m_peripherals)
+ for (const auto& it : m_peripherals)
{
if (it.second->HasFeature(feature))
{
@@ -318,7 +318,7 @@ unsigned int CPeripheralAddon::GetNumberOfPeripheralsWithId(const int iVendorId,
{
unsigned int iReturn = 0;
CSingleLock lock(m_critSection);
- for (auto it : m_peripherals)
+ for (const auto& it : m_peripherals)
{
if (it.second->VendorId() == iVendorId && it.second->ProductId() == iProductId)
iReturn++;
@@ -330,7 +330,7 @@ unsigned int CPeripheralAddon::GetNumberOfPeripheralsWithId(const int iVendorId,
void CPeripheralAddon::GetDirectory(const std::string& strPath, CFileItemList& items) const
{
CSingleLock lock(m_critSection);
- for (auto it : m_peripherals)
+ for (const auto& it : m_peripherals)
{
const PeripheralPtr& peripheral = it.second;
if (peripheral->IsHidden())
@@ -463,7 +463,7 @@ bool CPeripheralAddon::ProcessEvents(void)
}
}
- for (auto it : m_peripherals)
+ for (const auto& it : m_peripherals)
{
if (it.second->Type() == PERIPHERAL_JOYSTICK)
std::static_pointer_cast<CPeripheralJoystick>(it.second)->ProcessAxisMotions();
diff --git a/xbmc/platform/android/network/NetworkAndroid.cpp b/xbmc/platform/android/network/NetworkAndroid.cpp
index c6ccc364d2..b97afcabcf 100644
--- a/xbmc/platform/android/network/NetworkAndroid.cpp
+++ b/xbmc/platform/android/network/NetworkAndroid.cpp
@@ -317,7 +317,7 @@ void CNetworkAndroid::RetrieveInterfaces()
CJNIConnectivityManager connman(CXBMCApp::getSystemService(CJNIContext::CONNECTIVITY_SERVICE));
std::vector<CJNINetwork> networks = connman.getAllNetworks();
- for (auto n : networks)
+ for (const auto& n : networks)
{
CJNILinkProperties lp = connman.getLinkProperties(n);
if (lp)
diff --git a/xbmc/platform/android/network/ZeroconfAndroid.cpp b/xbmc/platform/android/network/ZeroconfAndroid.cpp
index fac2c08f5e..ee31fc1712 100644
--- a/xbmc/platform/android/network/ZeroconfAndroid.cpp
+++ b/xbmc/platform/android/network/ZeroconfAndroid.cpp
@@ -34,7 +34,7 @@ bool CZeroconfAndroid::doPublishService(const std::string& fcr_identifier, const
newService.serviceInfo.setHost(CJNIInetAddress::getLocalHost());
newService.serviceInfo.setPort(f_port);
- for (auto it : txt)
+ for (const auto& it : txt)
{
// CLog::Log(LOGDEBUG, "ZeroconfAndroid: key:%s, value:%s", it.first.c_str(),it.second.c_str());
newService.serviceInfo.setAttribute(it.first, it.second);
@@ -92,7 +92,7 @@ void CZeroconfAndroid::doStop()
{
CSingleLock lock(m_data_guard);
CLog::Log(LOGDEBUG, "ZeroconfAndroid: Shutdown services");
- for(auto it : m_services)
+ for (const auto& it : m_services)
{
m_manager.unregisterService(it.second.registrationListener);
CLog::Log(LOGDEBUG, "CZeroconfAndroid: Removed service %s", it.first.c_str());
diff --git a/xbmc/platform/darwin/ios-common/AnnounceReceiver.mm b/xbmc/platform/darwin/ios-common/AnnounceReceiver.mm
index 6931b93423..d17063a3d8 100644
--- a/xbmc/platform/darwin/ios-common/AnnounceReceiver.mm
+++ b/xbmc/platform/darwin/ios-common/AnnounceReceiver.mm
@@ -161,7 +161,7 @@ void AnnounceBridge(ANNOUNCEMENT::AnnouncementFlag flag,
if (!genre.empty())
{
NSMutableArray* genreArray = [[NSMutableArray alloc] initWithCapacity:genre.size()];
- for (auto genreItem : genre)
+ for (const auto& genreItem : genre)
{
[genreArray addObject:@(genreItem.c_str())];
}
diff --git a/xbmc/platform/linux/network/zeroconf/ZeroconfAvahi.cpp b/xbmc/platform/linux/network/zeroconf/ZeroconfAvahi.cpp
index 91872552d1..9b8595fac7 100644
--- a/xbmc/platform/linux/network/zeroconf/ZeroconfAvahi.cpp
+++ b/xbmc/platform/linux/network/zeroconf/ZeroconfAvahi.cpp
@@ -132,7 +132,7 @@ bool CZeroconfAvahi::doPublishService(const std::string& fcr_identifier,
//txt records to AvahiStringList
AvahiStringList *txtList = NULL;
- for (const auto it : txt)
+ for (const auto& it : txt)
{
txtList = avahi_string_list_add_pair(txtList, it.first.c_str(), it.second.c_str());
}
diff --git a/xbmc/pvr/channels/PVRChannelGroups.cpp b/xbmc/pvr/channels/PVRChannelGroups.cpp
index 419ee0b592..66a6394c7b 100644
--- a/xbmc/pvr/channels/PVRChannelGroups.cpp
+++ b/xbmc/pvr/channels/PVRChannelGroups.cpp
@@ -156,7 +156,7 @@ std::vector<std::shared_ptr<CPVRChannelGroup>> CPVRChannelGroups::GetGroupsByCha
std::vector<std::shared_ptr<CPVRChannelGroup>> groups;
CSingleLock lock(m_critSection);
- for (std::shared_ptr<CPVRChannelGroup> group : m_groups)
+ for (const std::shared_ptr<CPVRChannelGroup>& group : m_groups)
{
if ((!bExcludeHidden || !group->IsHidden()) && group->IsGroupMember(channel))
groups.push_back(group);
@@ -433,7 +433,7 @@ std::vector<std::shared_ptr<CPVRChannelGroup>> CPVRChannelGroups::GetMembers(boo
std::vector<std::shared_ptr<CPVRChannelGroup>> groups;
CSingleLock lock(m_critSection);
- for (std::shared_ptr<CPVRChannelGroup> group : m_groups)
+ for (const std::shared_ptr<CPVRChannelGroup>& group : m_groups)
{
if (!bExcludeHidden || !group->IsHidden())
groups.push_back(group);
diff --git a/xbmc/settings/lib/Setting.cpp b/xbmc/settings/lib/Setting.cpp
index 3b464c68b8..271f800df2 100644
--- a/xbmc/settings/lib/Setting.cpp
+++ b/xbmc/settings/lib/Setting.cpp
@@ -21,7 +21,7 @@
template<typename TKey, typename TValue>
bool CheckSettingOptionsValidity(const TValue& value, const std::vector<std::pair<TKey, TValue>>& options)
{
- for (auto it : options)
+ for (const auto& it : options)
{
if (it.second == value)
return true;
@@ -33,7 +33,7 @@ bool CheckSettingOptionsValidity(const TValue& value, const std::vector<std::pai
template<typename TKey, typename TValue>
bool CheckSettingOptionsValidity(const TValue& value, const std::vector<TKey>& options)
{
- for (auto it : options)
+ for (const auto& it : options)
{
if (it.value == value)
return true;
@@ -199,7 +199,7 @@ bool CSetting::IsEnabled() const
}
bool enabled = m_enabled;
- for (auto dep : m_dependencies)
+ for (const auto& dep : m_dependencies)
{
if (dep.GetType() != SettingDependencyType::Enable)
continue;
@@ -239,7 +239,7 @@ bool CSetting::IsVisible() const
return false;
bool visible = true;
- for (auto dep : m_dependencies)
+ for (const auto& dep : m_dependencies)
{
if (dep.GetType() != SettingDependencyType::Visible)
continue;
@@ -477,7 +477,7 @@ void CSettingList::Reset()
{
CExclusiveLock lock(m_critical);
SettingList values;
- for (auto it : m_defaults)
+ for (const auto& it : m_defaults)
values.push_back(it->Clone(it->GetId()));
SetValue(values);
@@ -545,7 +545,7 @@ void CSettingList::SetDefault(const SettingList &values)
if (!m_changed)
{
m_values.clear();
- for (auto it : m_defaults)
+ for (const auto& it : m_defaults)
m_values.push_back(it->Clone(it->GetId()));
}
}
@@ -573,7 +573,7 @@ void CSettingList::copy(const SettingList &srcValues, SettingList &dstValues)
{
dstValues.clear();
- for (auto value : srcValues)
+ for (const auto& value : srcValues)
{
if (value == nullptr)
continue;
@@ -599,7 +599,7 @@ bool CSettingList::fromValues(const std::vector<std::string> &strValues, Setting
bool ret = true;
int index = 0;
- for (auto value : strValues)
+ for (const auto& value : strValues)
{
auto settingValue = m_definition->Clone(StringUtils::Format("{}.{}", m_id, index++));
if (settingValue == nullptr ||
@@ -621,7 +621,7 @@ bool CSettingList::fromValues(const std::vector<std::string> &strValues, Setting
std::string CSettingList::toString(const SettingList &values) const
{
std::vector<std::string> strValues;
- for (auto value : values)
+ for (const auto& value : values)
{
if (value != nullptr)
strValues.push_back(value->ToString());
diff --git a/xbmc/utils/BufferObjectFactory.cpp b/xbmc/utils/BufferObjectFactory.cpp
index eb1ec7e07c..429b69dc3b 100644
--- a/xbmc/utils/BufferObjectFactory.cpp
+++ b/xbmc/utils/BufferObjectFactory.cpp
@@ -12,7 +12,7 @@ std::list<std::function<std::unique_ptr<CBufferObject>()>> CBufferObjectFactory:
std::unique_ptr<CBufferObject> CBufferObjectFactory::CreateBufferObject(bool needsCreateBySize)
{
- for (const auto bufferObject : m_bufferObjects)
+ for (const auto& bufferObject : m_bufferObjects)
{
auto bo = bufferObject();
diff --git a/xbmc/utils/RecentlyAddedJob.cpp b/xbmc/utils/RecentlyAddedJob.cpp
index 93344a984f..80093a3859 100644
--- a/xbmc/utils/RecentlyAddedJob.cpp
+++ b/xbmc/utils/RecentlyAddedJob.cpp
@@ -280,7 +280,7 @@ bool CRecentlyAddedJob::UpdateMusic()
artfound = musicdatabase.GetArtForItem(-1, album.idAlbum, -1, true, art);
if (artfound)
{
- for (auto artitem : art)
+ for (const auto& artitem : art)
{
if (artitem.mediaType == MediaTypeAlbum && artitem.artType == "thumb")
strThumb = artitem.url;
diff --git a/xbmc/video/PlayerController.cpp b/xbmc/video/PlayerController.cpp
index f1df869f23..29ccc5dea5 100644
--- a/xbmc/video/PlayerController.cpp
+++ b/xbmc/video/PlayerController.cpp
@@ -452,7 +452,7 @@ bool CPlayerController::OnAction(const CAction &action)
{
int playing = 0;
int idx = 0;
- for (auto prog : programs)
+ for (const auto& prog : programs)
{
dialog->Add(prog.name);
if (prog.playing)
diff --git a/xbmc/video/VideoInfoScanner.cpp b/xbmc/video/VideoInfoScanner.cpp
index d6cbbe25ce..04c057da3f 100644
--- a/xbmc/video/VideoInfoScanner.cpp
+++ b/xbmc/video/VideoInfoScanner.cpp
@@ -1534,7 +1534,7 @@ namespace VIDEO
if (moviePartOfSet)
{
movieSetArtTypes = CVideoThumbLoader::GetArtTypes(MediaTypeVideoCollection);
- for (std::string artType : movieSetArtTypes)
+ for (const std::string& artType : movieSetArtTypes)
artTypes.push_back("set." + artType);
}
bool addAll = artLevel == CSettings::VIDEOLIBRARY_ARTWORK_LEVEL_ALL;
diff --git a/xbmc/windowing/X11/XRandR.cpp b/xbmc/windowing/X11/XRandR.cpp
index 93727400b8..e58ef41a9f 100644
--- a/xbmc/windowing/X11/XRandR.cpp
+++ b/xbmc/windowing/X11/XRandR.cpp
@@ -480,7 +480,7 @@ int CXRandR::GetCrtc(int x, int y, float &hz)
(m_outputs[i].y <= y && (m_outputs[i].y+m_outputs[i].h) > y))
{
crtc = m_outputs[i].crtc;
- for (auto mode: m_outputs[i].modes)
+ for (const auto& mode : m_outputs[i].modes)
{
if (mode.isCurrent)
{
diff --git a/xbmc/windowing/android/AndroidUtils.cpp b/xbmc/windowing/android/AndroidUtils.cpp
index a5afacf40a..4c6f46c112 100644
--- a/xbmc/windowing/android/AndroidUtils.cpp
+++ b/xbmc/windowing/android/AndroidUtils.cpp
@@ -128,7 +128,7 @@ CAndroidUtils::CAndroidUtils()
if (CJNIBase::GetSDKVersion() >= 24)
{
fetchDisplayModes();
- for (auto res : s_res_displayModes)
+ for (const auto& res : s_res_displayModes)
{
if (res.iWidth > m_width || res.iHeight > m_height)
{
diff --git a/xbmc/windows/GUIMediaWindow.cpp b/xbmc/windows/GUIMediaWindow.cpp
index a3306f8894..2709106a9f 100644
--- a/xbmc/windows/GUIMediaWindow.cpp
+++ b/xbmc/windows/GUIMediaWindow.cpp
@@ -859,7 +859,7 @@ bool CGUIMediaWindow::Update(const std::string &strDirectory, bool updateFilterP
// Removable sources
VECSOURCES removables;
CServiceBroker::GetMediaManager().GetRemovableDrives(removables);
- for (auto s : removables)
+ for (const auto& s : removables)
{
if (URIUtils::CompareWithoutSlashAtEnd(s.strPath, m_vecItems->GetPath()))
{