From 9d588a0fa48ae32801e55b276830151f1940322f Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Fri, 18 Sep 2020 12:13:15 +0200 Subject: Fix compiler warnings: 'Loop variable creates copy. Use reference type to prevent copying'. --- xbmc/addons/ContextMenuAddon.cpp | 4 ++-- xbmc/music/MusicUtils.cpp | 2 +- xbmc/music/dialogs/GUIDialogMusicInfo.cpp | 2 +- xbmc/music/dialogs/GUIDialogSongInfo.cpp | 2 +- xbmc/network/WebServer.cpp | 6 +++--- xbmc/pictures/GUIWindowPictures.cpp | 2 +- xbmc/settings/windows/GUIControlSettings.cpp | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/xbmc/addons/ContextMenuAddon.cpp b/xbmc/addons/ContextMenuAddon.cpp index d5815873f4..a051a1285b 100644 --- a/xbmc/addons/ContextMenuAddon.cpp +++ b/xbmc/addons/ContextMenuAddon.cpp @@ -76,10 +76,10 @@ void CContextMenuAddon::ParseMenu( m_items.push_back(CContextMenuItem::CreateGroup(menuLabel, parent, menuId, ID())); - for (const auto subMenu : elem->GetElements("menu")) + for (const auto& subMenu : elem->GetElements("menu")) ParseMenu(&subMenu.second, menuId, anonGroupCount); - for (const auto element : elem->GetElements("item")) + for (const auto& element : elem->GetElements("item")) { std::string visCondition = element.second.GetValue("visible").asString(); std::string library = element.second.GetValue("@library").asString(); diff --git a/xbmc/music/MusicUtils.cpp b/xbmc/music/MusicUtils.cpp index ce82045138..f7e68547d3 100644 --- a/xbmc/music/MusicUtils.cpp +++ b/xbmc/music/MusicUtils.cpp @@ -250,7 +250,7 @@ namespace MUSIC_UTILS db.Close(); - for (const auto type : artTypes) + for (const auto& type : artTypes) { CFileItemPtr artitem(new CFileItem(type, false)); // Localise the names of common types of art diff --git a/xbmc/music/dialogs/GUIDialogMusicInfo.cpp b/xbmc/music/dialogs/GUIDialogMusicInfo.cpp index 44ee58792e..ed02a39021 100644 --- a/xbmc/music/dialogs/GUIDialogMusicInfo.cpp +++ b/xbmc/music/dialogs/GUIDialogMusicInfo.cpp @@ -932,7 +932,7 @@ void CGUIDialogMusicInfo::OnGetArt() // Update local item and art list with current art m_item->SetArt(type, newArt); - for (const auto artitem : m_artTypeList) + for (const auto& artitem : m_artTypeList) { if (artitem->GetProperty("artType") == type) { diff --git a/xbmc/music/dialogs/GUIDialogSongInfo.cpp b/xbmc/music/dialogs/GUIDialogSongInfo.cpp index f95ed85e86..405ae25d08 100644 --- a/xbmc/music/dialogs/GUIDialogSongInfo.cpp +++ b/xbmc/music/dialogs/GUIDialogSongInfo.cpp @@ -453,7 +453,7 @@ void CGUIDialogSongInfo::OnGetArt() // Show any fallback art when song art removed if (newArt.empty() && m_song->HasArt(type)) newArt = m_song->GetArt(type); - for (const auto artitem : m_artTypeList) + for (const auto& artitem : m_artTypeList) { if (artitem->GetProperty("artType") == type) { diff --git a/xbmc/network/WebServer.cpp b/xbmc/network/WebServer.cpp index 427ca38c70..16cf5e158c 100644 --- a/xbmc/network/WebServer.cpp +++ b/xbmc/network/WebServer.cpp @@ -1385,13 +1385,13 @@ void CWebServer::LogRequest(const HTTPRequest& request) const if (!getValues.empty()) { std::vector values; - for (const auto get : getValues) + for (const auto& get : getValues) values.push_back(get.first + " = " + get.second); m_logger->debug(" [IN] Query arguments: {}", StringUtils::Join(values, "; ")); } - for (const auto header : headerValues) + for (const auto& header : headerValues) m_logger->debug(" [IN] {}: {}", header.first, header.second); } @@ -1406,7 +1406,7 @@ void CWebServer::LogResponse(const HTTPRequest& request, int responseStatus) con m_logger->debug("[OUT] {} {} {}", request.version, responseStatus, request.pathUrlFull); - for (const auto header : headerValues) + for (const auto& header : headerValues) m_logger->debug("[OUT] {}: {}", header.first, header.second); } diff --git a/xbmc/pictures/GUIWindowPictures.cpp b/xbmc/pictures/GUIWindowPictures.cpp index a49383f31a..5d462024d1 100644 --- a/xbmc/pictures/GUIWindowPictures.cpp +++ b/xbmc/pictures/GUIWindowPictures.cpp @@ -320,7 +320,7 @@ bool CGUIWindowPictures::ShowPicture(int iItem, bool startSlideShow) pSlideShow->Reset(); bool bShowVideos = CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(CSettings::SETTING_PICTURES_SHOWVIDEOS); - for (const auto pItem : *m_vecItems) + for (const auto& pItem : *m_vecItems) { if (!pItem->m_bIsFolder && !(URIUtils::IsRAR(pItem->GetPath()) || URIUtils::IsZIP(pItem->GetPath())) && diff --git a/xbmc/settings/windows/GUIControlSettings.cpp b/xbmc/settings/windows/GUIControlSettings.cpp index 86f437d11f..75c06fbaca 100644 --- a/xbmc/settings/windows/GUIControlSettings.cpp +++ b/xbmc/settings/windows/GUIControlSettings.cpp @@ -895,7 +895,7 @@ bool CGUIControlButtonSetting::OnClick() std::shared_ptr settingList = std::static_pointer_cast(m_pSetting); setting = std::static_pointer_cast(settingList->GetDefinition()); - for (const SettingPtr addon : settingList->GetValue()) + for (const SettingPtr& addon : settingList->GetValue()) addonIDs.push_back(std::static_pointer_cast(addon)->GetValue()); } else @@ -1021,7 +1021,7 @@ void CGUIControlButtonSetting::Update(bool fromControl, bool updateDisplayOnly) addonIDs.push_back(std::static_pointer_cast(setting)->GetValue()); std::vector addonNames; - for (const auto addonID : addonIDs) + for (const auto& addonID : addonIDs) { ADDON::AddonPtr addon; if (CServiceBroker::GetAddonMgr().GetAddon(addonID, addon)) -- cgit v1.2.3