From d3036986ce5263a1ddf45df8a68a40396292d59d Mon Sep 17 00:00:00 2001 From: Rechi Date: Fri, 30 Oct 2020 18:53:28 +0000 Subject: [clang-tidy] performance-unnecessary-copy-initialization --- xbmc/GUIPassword.cpp | 8 ++++---- xbmc/Util.cpp | 2 -- xbmc/addons/Scraper.cpp | 4 ++-- xbmc/addons/gui/GUIDialogAddonSettings.cpp | 4 ++-- xbmc/addons/settings/AddonSettings.cpp | 2 +- xbmc/cores/VideoPlayer/DVDFileInfo.cpp | 2 +- .../VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp | 2 +- .../VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp | 2 +- xbmc/cores/VideoPlayer/Edl.cpp | 2 +- xbmc/cores/VideoPlayer/VideoRenderers/OverlayRendererGUI.cpp | 2 +- xbmc/dbwrappers/sqlitedataset.cpp | 2 +- xbmc/dialogs/GUIDialogKeyboardGeneric.cpp | 2 +- xbmc/dialogs/GUIDialogMediaSource.cpp | 2 -- xbmc/filesystem/AddonsDirectory.cpp | 12 ++++++------ xbmc/filesystem/BlurayDirectory.cpp | 2 +- xbmc/filesystem/BlurayFile.cpp | 2 +- xbmc/filesystem/DAVDirectory.cpp | 2 +- xbmc/filesystem/Directorization.h | 4 ++-- xbmc/filesystem/HTTPDirectory.cpp | 2 +- xbmc/filesystem/MusicSearchDirectory.cpp | 2 +- xbmc/filesystem/NFSDirectory.cpp | 2 +- xbmc/filesystem/PluginDirectory.cpp | 2 +- xbmc/filesystem/ResourceFile.cpp | 2 +- xbmc/filesystem/SpecialProtocol.cpp | 2 +- xbmc/filesystem/UPnPDirectory.cpp | 2 +- xbmc/filesystem/XbtFile.cpp | 2 -- xbmc/filesystem/ZipFile.cpp | 2 +- xbmc/filesystem/ZipManager.cpp | 4 ++-- xbmc/games/controllers/dialogs/GUIDialogAxisDetection.cpp | 2 +- xbmc/games/controllers/dialogs/GUIDialogIgnoreInput.cpp | 2 +- .../games/controllers/guicontrols/GUIScalarFeatureButton.cpp | 4 ++-- xbmc/games/controllers/guicontrols/GUISelectKeyButton.cpp | 8 ++++---- xbmc/games/controllers/windows/ControllerInstaller.cpp | 2 +- xbmc/guilib/GUIKeyboardFactory.cpp | 2 +- xbmc/guilib/GUIStaticItem.cpp | 2 +- xbmc/guilib/StereoscopicsManager.cpp | 2 +- xbmc/guilib/guiinfo/MusicGUIInfo.cpp | 2 +- xbmc/interfaces/json-rpc/ProfilesOperations.cpp | 2 +- xbmc/interfaces/legacy/Dialog.cpp | 8 ++++---- xbmc/music/MusicDatabase.cpp | 7 +++---- xbmc/music/Song.cpp | 1 - xbmc/music/tags/MusicInfoTagLoaderCDDA.cpp | 2 +- xbmc/music/windows/GUIWindowMusicBase.cpp | 2 +- xbmc/network/WakeOnAccess.cpp | 4 ++-- xbmc/network/cddb.cpp | 2 +- xbmc/pictures/GUIWindowSlideShow.cpp | 8 ++++---- xbmc/platform/android/filesystem/APKDirectory.cpp | 2 +- xbmc/platform/android/filesystem/APKFile.cpp | 6 +++--- xbmc/platform/darwin/ios-common/AnnounceReceiver.mm | 2 +- xbmc/profiles/ProfileManager.cpp | 2 +- xbmc/profiles/windows/GUIWindowSettingsProfile.cpp | 2 +- xbmc/pvr/channels/PVRChannelGroupInternal.cpp | 2 +- xbmc/settings/SettingPath.cpp | 2 +- xbmc/storage/MediaManager.cpp | 2 +- xbmc/utils/URIUtils.cpp | 4 ++-- xbmc/video/VideoDatabase.cpp | 4 ++-- xbmc/video/VideoInfoScanner.cpp | 2 +- xbmc/video/windows/GUIWindowFullScreen.cpp | 4 ++-- xbmc/video/windows/GUIWindowVideoBase.cpp | 4 ++-- xbmc/video/windows/GUIWindowVideoNav.cpp | 8 ++++---- xbmc/video/windows/VideoFileItemListModifier.cpp | 2 +- xbmc/windowing/X11/WinSystemX11.cpp | 2 +- xbmc/windows/GUIMediaWindow.cpp | 2 +- xbmc/windows/GUIWindowFileManager.cpp | 4 ++-- 64 files changed, 95 insertions(+), 103 deletions(-) diff --git a/xbmc/GUIPassword.cpp b/xbmc/GUIPassword.cpp index b41d0b6ab2..68919aed5a 100644 --- a/xbmc/GUIPassword.cpp +++ b/xbmc/GUIPassword.cpp @@ -126,7 +126,7 @@ bool CGUIPassword::IsItemUnlocked(CFileItem* pItem, const std::string& strType) bool CGUIPassword::IsItemUnlocked(CMediaSource* pItem, const std::string& strType) { const std::string strLabel = pItem->strName; - std::string strHeading = g_localizeStrings.Get(12325); // "Locked! Enter code..." + const std::string& strHeading = g_localizeStrings.Get(12325); // "Locked! Enter code..." return IsItemUnlocked(pItem, strType, strLabel, strHeading); } @@ -136,7 +136,7 @@ bool CGUIPassword::CheckStartUpLock() // prompt user for mastercode if the mastercode was set b4 or by xml int iVerifyPasswordResult = -1; - std::string strHeader = g_localizeStrings.Get(20075); // "Enter master lock code" + const std::string& strHeader = g_localizeStrings.Get(20075); // "Enter master lock code" if (iMasterLockRetriesLeft == -1) iMasterLockRetriesLeft = CServiceBroker::GetSettingsComponent()->GetSettings()->GetInt(CSettings::SETTING_MASTERLOCK_MAXRETRIES); @@ -279,7 +279,7 @@ bool CGUIPassword::IsMasterLockUnlocked(bool bPromptUser, bool& bCanceled) } // no, unlock since we are allowed to prompt - std::string strHeading = g_localizeStrings.Get(20075); + const std::string& strHeading = g_localizeStrings.Get(20075); std::string strPassword = profileManager->GetMasterProfile().getLockCode(); int iVerifyPasswordResult = VerifyPassword(profileManager->GetMasterProfile().getLockMode(), strPassword, strHeading); @@ -352,7 +352,7 @@ bool CGUIPassword::CheckLock(LockType btnType, const std::string& strPassword, i return true; } - std::string strHeading = g_localizeStrings.Get(iHeading); + const std::string& strHeading = g_localizeStrings.Get(iHeading); int iVerifyPasswordResult = VerifyPassword(btnType, strPassword, strHeading); if (iVerifyPasswordResult == -1) diff --git a/xbmc/Util.cpp b/xbmc/Util.cpp index 2fdf4bdf91..33a349e78c 100644 --- a/xbmc/Util.cpp +++ b/xbmc/Util.cpp @@ -310,8 +310,6 @@ std::string CUtil::GetTitleFromPath(const CURL& url, bool bIsFolder /* = false * URIUtils::RemoveSlashAtEnd(path); std::string strFilename = URIUtils::GetFileName(path); - std::string strHostname = url.GetHostName(); - #ifdef HAS_UPNP // UPNP if (url.IsProtocol("upnp")) diff --git a/xbmc/addons/Scraper.cpp b/xbmc/addons/Scraper.cpp index 5a8cc43701..c9b9bb732f 100644 --- a/xbmc/addons/Scraper.cpp +++ b/xbmc/addons/Scraper.cpp @@ -609,7 +609,7 @@ template<> CMusicAlbumInfo FromFileItem(const CFileItem &item) { CMusicAlbumInfo info; - std::string sTitle = item.GetLabel(); + const std::string& sTitle = item.GetLabel(); std::string sArtist = item.GetProperty("album.artist").asString(); std::string sAlbumName; if (!sArtist.empty()) @@ -641,7 +641,7 @@ template<> CMusicArtistInfo FromFileItem(const CFileItem &item) { CMusicArtistInfo info; - std::string sTitle = item.GetLabel(); + const std::string& sTitle = item.GetLabel(); CScraperUrl url; url.AppendUrl(CScraperUrl::SUrlEntry(item.GetDynPath())); diff --git a/xbmc/addons/gui/GUIDialogAddonSettings.cpp b/xbmc/addons/gui/GUIDialogAddonSettings.cpp index 5e5be83695..496766d29a 100644 --- a/xbmc/addons/gui/GUIDialogAddonSettings.cpp +++ b/xbmc/addons/gui/GUIDialogAddonSettings.cpp @@ -50,8 +50,8 @@ bool CGUIDialogAddonSettings::OnMessage(CGUIMessage& message) case GUI_MSG_SETTING_UPDATED: { - std::string settingId = message.GetStringParam(0); - std::string settingValue = message.GetStringParam(1); + const std::string& settingId = message.GetStringParam(0); + const std::string& settingValue = message.GetStringParam(1); std::shared_ptr setting = GetSettingsManager()->GetSetting(settingId); if (setting != nullptr) diff --git a/xbmc/addons/settings/AddonSettings.cpp b/xbmc/addons/settings/AddonSettings.cpp index 10bfb0c554..b58ce18af6 100644 --- a/xbmc/addons/settings/AddonSettings.cpp +++ b/xbmc/addons/settings/AddonSettings.cpp @@ -261,7 +261,7 @@ bool CAddonSettings::Load(const CXBMCTinyXML& doc) // check if this really is a category with setting elements if (category->FirstChild() && category->FirstChild()->Type() == CXBMCTinyXML::TINYXML_ELEMENT) { - const auto categoryId = category->ValueStr(); + const auto& categoryId = category->ValueStr(); auto setting = category->FirstChild(); while (setting != nullptr) { diff --git a/xbmc/cores/VideoPlayer/DVDFileInfo.cpp b/xbmc/cores/VideoPlayer/DVDFileInfo.cpp index 16ddea9f4e..c9f8451a0b 100644 --- a/xbmc/cores/VideoPlayer/DVDFileInfo.cpp +++ b/xbmc/cores/VideoPlayer/DVDFileInfo.cpp @@ -132,7 +132,7 @@ bool CDVDFileInfo::ExtractThumb(const CFileItem& fileItem, if (pStreamDetails) { - const std::string strPath = item.GetPath(); + const std::string& strPath = item.GetPath(); DemuxerToStreamDetails(pInputStream, pDemuxer, *pStreamDetails, strPath); //extern subtitles diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp index 057a819a85..094eeb77d0 100644 --- a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp +++ b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp @@ -36,7 +36,7 @@ std::shared_ptr CDVDFactoryInputStream::CreateInputStream(IVide { using namespace ADDON; - std::string file = fileitem.GetDynPath(); + const std::string& file = fileitem.GetDynPath(); if (scanforextaudio) { // find any available external audio tracks diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp index 93ec1639a0..00d52add9f 100644 --- a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp +++ b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp @@ -156,7 +156,7 @@ bool CDVDInputStreamBluray::Open() { //get rid of the udf:// protocol CURL url2(root); - std::string root2 = url2.GetHostName(); + const std::string& root2 = url2.GetHostName(); CURL url(root2); CFileItem item(url, false); diff --git a/xbmc/cores/VideoPlayer/Edl.cpp b/xbmc/cores/VideoPlayer/Edl.cpp index ed448b7f3c..6c09e64325 100644 --- a/xbmc/cores/VideoPlayer/Edl.cpp +++ b/xbmc/cores/VideoPlayer/Edl.cpp @@ -51,7 +51,7 @@ bool CEdl::ReadEditDecisionLists(const CFileItem& fileItem, const float fFramesP * Only check for edit decision lists if the movie is on the local hard drive, or accessed over a * network share. */ - const std::string strMovie = fileItem.GetDynPath(); + const std::string& strMovie = fileItem.GetDynPath(); if ((URIUtils::IsHD(strMovie) || URIUtils::IsOnLAN(strMovie)) && !URIUtils::IsInternetStream(strMovie)) { diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/OverlayRendererGUI.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/OverlayRendererGUI.cpp index 47a18fb16d..fabf661b8b 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/OverlayRendererGUI.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/OverlayRendererGUI.cpp @@ -40,7 +40,7 @@ CGUITextLayout* COverlayText::GetFontLayout(const std::string &font, int color, { if (CUtil::IsUsingTTFSubtitles()) { - std::string font_file = font; + const std::string& font_file = font; std::string font_path = URIUtils::AddFileToFolder("special://home/media/Fonts/", font_file); if (!XFILE::CFile::Exists(font_path)) font_path = URIUtils::AddFileToFolder("special://xbmc/media/Fonts/", font_file); diff --git a/xbmc/dbwrappers/sqlitedataset.cpp b/xbmc/dbwrappers/sqlitedataset.cpp index 09de656aa9..da7800b76b 100644 --- a/xbmc/dbwrappers/sqlitedataset.cpp +++ b/xbmc/dbwrappers/sqlitedataset.cpp @@ -808,7 +808,7 @@ const void* SqliteDataset::getExecRes() { bool SqliteDataset::query(const std::string &query) { if(!handle()) throw DbErrors("No Database Connection"); - std::string qry = query; + const std::string& qry = query; int fs = qry.find("select"); int fS = qry.find("SELECT"); if (!( fs >= 0 || fS >=0)) diff --git a/xbmc/dialogs/GUIDialogKeyboardGeneric.cpp b/xbmc/dialogs/GUIDialogKeyboardGeneric.cpp index 3d0f126963..349e3a4aa6 100644 --- a/xbmc/dialogs/GUIDialogKeyboardGeneric.cpp +++ b/xbmc/dialogs/GUIDialogKeyboardGeneric.cpp @@ -327,7 +327,7 @@ bool CGUIDialogKeyboardGeneric::OnMessage(CGUIMessage& message) } case GUI_MSG_CODINGTABLE_LOOKUP_COMPLETED: { - std::string code = message.GetStringParam(); + const std::string& code = message.GetStringParam(); if (code == m_hzcode) { int response = message.GetParam1(); diff --git a/xbmc/dialogs/GUIDialogMediaSource.cpp b/xbmc/dialogs/GUIDialogMediaSource.cpp index d152b81edc..df6e5eaafa 100644 --- a/xbmc/dialogs/GUIDialogMediaSource.cpp +++ b/xbmc/dialogs/GUIDialogMediaSource.cpp @@ -240,8 +240,6 @@ void CGUIDialogMediaSource::OnPathBrowse(int item) m_bNameChanged = true; path.clear(); - std::string strDevices = g_localizeStrings.Get(33040); //"% Devices" - if (m_type == "music") { CMediaSource share1; diff --git a/xbmc/filesystem/AddonsDirectory.cpp b/xbmc/filesystem/AddonsDirectory.cpp index ffb251d34e..14637af4e3 100644 --- a/xbmc/filesystem/AddonsDirectory.cpp +++ b/xbmc/filesystem/AddonsDirectory.cpp @@ -350,7 +350,7 @@ static void GenerateMainCategoryListing(const CURL& path, const VECADDONS& addon static void GenerateCategoryListing(const CURL& path, VECADDONS& addons, CFileItemList& items) { - const std::string category = path.GetFileName(); + const std::string& category = path.GetFileName(); if (category == CATEGORY_INFO_PROVIDERS) { items.SetProperty("addoncategory", g_localizeStrings.Get(24993)); @@ -446,7 +446,7 @@ static void UserInstalledAddons(const CURL& path, CFileItemList &items) if (addons.empty()) return; - const std::string category = path.GetFileName(); + const std::string& category = path.GetFileName(); if (category.empty()) { GenerateMainCategoryListing(path, addons, items); @@ -531,7 +531,7 @@ static void RunningAddons(const CURL& path, CFileItemList &items) static bool Browse(const CURL& path, CFileItemList &items) { - const std::string repoId = path.GetHostName(); + const std::string& repoId = path.GetHostName(); VECADDONS addons; items.SetPath(path.Get()); @@ -577,7 +577,7 @@ static bool Browse(const CURL& path, CFileItemList &items) items.SetLabel(repoAddon->Name()); } - const std::string category = path.GetFileName(); + const std::string& category = path.GetFileName(); if (category.empty()) GenerateMainCategoryListing(path, addons, items); else @@ -682,7 +682,7 @@ bool CAddonsDirectory::GetDirectory(const CURL& url, CFileItemList &items) std::string tmp(url.Get()); URIUtils::RemoveSlashAtEnd(tmp); CURL path(tmp); - const std::string endpoint = path.GetHostName(); + const std::string& endpoint = path.GetHostName(); items.ClearItems(); items.ClearProperties(); items.SetCacheToDisc(CFileItemList::CACHE_NEVER); @@ -763,7 +763,7 @@ bool CAddonsDirectory::GetDirectory(const CURL& url, CFileItemList &items) } else if (endpoint == "more") { - std::string type = path.GetFileName(); + const std::string& type = path.GetFileName(); if (type == "video" || type == "audio" || type == "image" || type == "executable") return Browse(CURL("addons://all/xbmc.addon." + type), items); else if (type == "game") diff --git a/xbmc/filesystem/BlurayDirectory.cpp b/xbmc/filesystem/BlurayDirectory.cpp index 02de5bd7ee..003af44dc8 100644 --- a/xbmc/filesystem/BlurayDirectory.cpp +++ b/xbmc/filesystem/BlurayDirectory.cpp @@ -242,7 +242,7 @@ CURL CBlurayDirectory::GetUnderlyingCURL(const CURL& url) { assert(url.IsProtocol("bluray")); std::string host = url.GetHostName(); - std::string filename = url.GetFileName(); + const std::string& filename = url.GetFileName(); return CURL(host.append(filename)); } diff --git a/xbmc/filesystem/BlurayFile.cpp b/xbmc/filesystem/BlurayFile.cpp index 4b987de423..34d2732935 100644 --- a/xbmc/filesystem/BlurayFile.cpp +++ b/xbmc/filesystem/BlurayFile.cpp @@ -26,7 +26,7 @@ namespace XFILE assert(url.IsProtocol("bluray")); std::string host = url.GetHostName(); - std::string filename = url.GetFileName(); + const std::string& filename = url.GetFileName(); if (host.empty() || filename.empty()) return ""; diff --git a/xbmc/filesystem/DAVDirectory.cpp b/xbmc/filesystem/DAVDirectory.cpp index b9b0a71d5b..5989fb8336 100644 --- a/xbmc/filesystem/DAVDirectory.cpp +++ b/xbmc/filesystem/DAVDirectory.cpp @@ -144,7 +144,7 @@ bool CDAVDirectory::GetDirectory(const CURL& url, CFileItemList &items) { CFileItem item; ParseResponse(pChild->ToElement(), item); - CURL url2(url); + const CURL& url2(url); CURL url3(item.GetPath()); std::string itemPath(URIUtils::AddFileToFolder(url2.GetWithoutFilename(), url3.GetFileName())); diff --git a/xbmc/filesystem/Directorization.h b/xbmc/filesystem/Directorization.h index b3a221f20f..f413635e6d 100644 --- a/xbmc/filesystem/Directorization.h +++ b/xbmc/filesystem/Directorization.h @@ -51,8 +51,8 @@ namespace XFILE if (url.Get().empty() || entries.empty()) return; - std::string options = url.GetOptions(); - std::string filePath = url.GetFileName(); + const std::string& options = url.GetOptions(); + const std::string& filePath = url.GetFileName(); CURL baseUrl(url); baseUrl.SetOptions(""); // delete options to have a clean path to add stuff too diff --git a/xbmc/filesystem/HTTPDirectory.cpp b/xbmc/filesystem/HTTPDirectory.cpp index 7bf61dc2d1..851d9bc74a 100644 --- a/xbmc/filesystem/HTTPDirectory.cpp +++ b/xbmc/filesystem/HTTPDirectory.cpp @@ -32,7 +32,7 @@ bool CHTTPDirectory::GetDirectory(const CURL& url, CFileItemList &items) { CCurlFile http; - std::string strBasePath = url.GetFileName(); + const std::string& strBasePath = url.GetFileName(); if(!http.Open(url)) { diff --git a/xbmc/filesystem/MusicSearchDirectory.cpp b/xbmc/filesystem/MusicSearchDirectory.cpp index 8945e07276..3a5fd6e8f9 100644 --- a/xbmc/filesystem/MusicSearchDirectory.cpp +++ b/xbmc/filesystem/MusicSearchDirectory.cpp @@ -25,7 +25,7 @@ bool CMusicSearchDirectory::GetDirectory(const CURL& url, CFileItemList &items) { // break up our path // format is: musicsearch:// - std::string search(url.GetHostName()); + const std::string& search(url.GetHostName()); if (search.empty()) return false; diff --git a/xbmc/filesystem/NFSDirectory.cpp b/xbmc/filesystem/NFSDirectory.cpp index 62b1d33499..24119d3ada 100644 --- a/xbmc/filesystem/NFSDirectory.cpp +++ b/xbmc/filesystem/NFSDirectory.cpp @@ -56,7 +56,7 @@ bool CNFSDirectory::GetDirectoryFromExportList(const std::string& strPath, CFile for (const std::string& it : exportList) { - std::string currentExport(it); + const std::string& currentExport(it); URIUtils::RemoveSlashAtEnd(nonConstStrPath); CFileItemPtr pItem(new CFileItem(currentExport)); diff --git a/xbmc/filesystem/PluginDirectory.cpp b/xbmc/filesystem/PluginDirectory.cpp index e8686829d2..ab3d4bb6f4 100644 --- a/xbmc/filesystem/PluginDirectory.cpp +++ b/xbmc/filesystem/PluginDirectory.cpp @@ -637,7 +637,7 @@ bool CPluginDirectory::IsMediaLibraryScanningAllowed(const std::string& content, auto it = paths.find(content); if (it == paths.end()) return false; - std::string path = url.GetFileName(); + const std::string& path = url.GetFileName(); for (const auto& p : it->second) if (p.empty() || p == "/" || URIUtils::PathHasParent(path, p)) return true; diff --git a/xbmc/filesystem/ResourceFile.cpp b/xbmc/filesystem/ResourceFile.cpp index 9f485012f8..f319f12f76 100644 --- a/xbmc/filesystem/ResourceFile.cpp +++ b/xbmc/filesystem/ResourceFile.cpp @@ -37,7 +37,7 @@ bool CResourceFile::TranslatePath(const CURL &url, std::string &translatedPath) return false; // the share name represents an identifier that can be mapped to an addon ID - std::string addonId = url.GetShareName(); + const std::string& addonId = url.GetShareName(); std::string filePath; if (url.GetFileName().length() > addonId.length()) filePath = url.GetFileName().substr(addonId.size() + 1); diff --git a/xbmc/filesystem/SpecialProtocol.cpp b/xbmc/filesystem/SpecialProtocol.cpp index 9dfa1e6b34..2178955750 100644 --- a/xbmc/filesystem/SpecialProtocol.cpp +++ b/xbmc/filesystem/SpecialProtocol.cpp @@ -130,7 +130,7 @@ std::string CSpecialProtocol::TranslatePath(const CURL &url) return url.Get(); } - std::string FullFileName = url.GetFileName(); + const std::string& FullFileName = url.GetFileName(); std::string translatedPath; std::string FileName; diff --git a/xbmc/filesystem/UPnPDirectory.cpp b/xbmc/filesystem/UPnPDirectory.cpp index 9dc8ff72e3..3a9f76419d 100644 --- a/xbmc/filesystem/UPnPDirectory.cpp +++ b/xbmc/filesystem/UPnPDirectory.cpp @@ -144,7 +144,7 @@ bool CUPnPDirectory::GetResource(const CURL& path, CFileItem &item) if(!upnp) return false; - std::string uuid = path.GetHostName(); + const std::string& uuid = path.GetHostName(); std::string object = path.GetFileName(); StringUtils::TrimRight(object, "/"); object = CURL::Decode(object); diff --git a/xbmc/filesystem/XbtFile.cpp b/xbmc/filesystem/XbtFile.cpp index 7b3f22324e..ab87f5e45b 100644 --- a/xbmc/filesystem/XbtFile.cpp +++ b/xbmc/filesystem/XbtFile.cpp @@ -41,8 +41,6 @@ bool CXbtFile::Open(const CURL& url) if (m_open) return false; - std::string options = url.GetOptions(); - CURL xbtUrl(url); xbtUrl.SetOptions(""); diff --git a/xbmc/filesystem/ZipFile.cpp b/xbmc/filesystem/ZipFile.cpp index 225e9fd624..6c358352a7 100644 --- a/xbmc/filesystem/ZipFile.cpp +++ b/xbmc/filesystem/ZipFile.cpp @@ -36,7 +36,7 @@ CZipFile::~CZipFile() bool CZipFile::Open(const CURL&url) { - std::string strOpts = url.GetOptions(); + const std::string& strOpts = url.GetOptions(); CURL url2(url); url2.SetOptions(""); if (!g_ZipManager.GetZipEntry(url2,mZipItem)) diff --git a/xbmc/filesystem/ZipManager.cpp b/xbmc/filesystem/ZipManager.cpp index b0819f2e29..1be97e7c37 100644 --- a/xbmc/filesystem/ZipManager.cpp +++ b/xbmc/filesystem/ZipManager.cpp @@ -219,7 +219,7 @@ bool CZipManager::GetZipList(const CURL& url, std::vector& items) bool CZipManager::GetZipEntry(const CURL& url, SZipEntry& item) { - std::string strFile = url.GetHostName(); + const std::string& strFile = url.GetHostName(); std::map >::iterator it = mZipMap.find(strFile); std::vector items; @@ -232,7 +232,7 @@ bool CZipManager::GetZipEntry(const CURL& url, SZipEntry& item) items = it->second; } - std::string strFileName = url.GetFileName(); + const std::string& strFileName = url.GetFileName(); for (const auto& it2 : items) { if (std::string(it2.name) == strFileName) diff --git a/xbmc/games/controllers/dialogs/GUIDialogAxisDetection.cpp b/xbmc/games/controllers/dialogs/GUIDialogAxisDetection.cpp index b7f7ef4895..9625f317f9 100644 --- a/xbmc/games/controllers/dialogs/GUIDialogAxisDetection.cpp +++ b/xbmc/games/controllers/dialogs/GUIDialogAxisDetection.cpp @@ -22,7 +22,7 @@ using namespace GAME; std::string CGUIDialogAxisDetection::GetDialogText() { // "Press all analog buttons now to detect them:[CR][CR]%s" - std::string dialogText = g_localizeStrings.Get(35020); + const std::string& dialogText = g_localizeStrings.Get(35020); std::vector primitives; diff --git a/xbmc/games/controllers/dialogs/GUIDialogIgnoreInput.cpp b/xbmc/games/controllers/dialogs/GUIDialogIgnoreInput.cpp index 943b4d26ec..d6843415cc 100644 --- a/xbmc/games/controllers/dialogs/GUIDialogIgnoreInput.cpp +++ b/xbmc/games/controllers/dialogs/GUIDialogIgnoreInput.cpp @@ -39,7 +39,7 @@ std::string CGUIDialogIgnoreInput::GetDialogText() { // "Some controllers have buttons and axes that interfere with mapping. Press // these now to disable them:[CR]%s" - std::string dialogText = g_localizeStrings.Get(35014); + const std::string& dialogText = g_localizeStrings.Get(35014); std::vector primitives; diff --git a/xbmc/games/controllers/guicontrols/GUIScalarFeatureButton.cpp b/xbmc/games/controllers/guicontrols/GUIScalarFeatureButton.cpp index aa8a5b6b83..c61945b18e 100644 --- a/xbmc/games/controllers/guicontrols/GUIScalarFeatureButton.cpp +++ b/xbmc/games/controllers/guicontrols/GUIScalarFeatureButton.cpp @@ -32,8 +32,8 @@ bool CGUIScalarFeatureButton::PromptForInput(CEvent& waitEvent) { case STATE::NEED_INPUT: { - std::string strPrompt = g_localizeStrings.Get(35090); // "Press %s" - std::string strWarn = g_localizeStrings.Get(35091); // "Press %s (%d)" + const std::string& strPrompt = g_localizeStrings.Get(35090); // "Press %s" + const std::string& strWarn = g_localizeStrings.Get(35091); // "Press %s (%d)" bInterrupted = DoPrompt(strPrompt, strWarn, m_feature.Label(), waitEvent); diff --git a/xbmc/games/controllers/guicontrols/GUISelectKeyButton.cpp b/xbmc/games/controllers/guicontrols/GUISelectKeyButton.cpp index 3713719196..0ad3640b48 100644 --- a/xbmc/games/controllers/guicontrols/GUISelectKeyButton.cpp +++ b/xbmc/games/controllers/guicontrols/GUISelectKeyButton.cpp @@ -38,8 +38,8 @@ bool CGUISelectKeyButton::PromptForInput(CEvent& waitEvent) { case STATE::NEED_KEY: { - std::string strPrompt = g_localizeStrings.Get(35169); // "Press a key" - std::string strWarn = g_localizeStrings.Get(35170); // "Press a key ({1:d})" + const std::string& strPrompt = g_localizeStrings.Get(35169); // "Press a key" + const std::string& strWarn = g_localizeStrings.Get(35170); // "Press a key ({1:d})" bInterrupted = DoPrompt(strPrompt, strWarn, "", waitEvent); @@ -49,8 +49,8 @@ bool CGUISelectKeyButton::PromptForInput(CEvent& waitEvent) } case STATE::NEED_INPUT: { - std::string strPrompt = g_localizeStrings.Get(35090); // "Press {0:s}" - std::string strWarn = g_localizeStrings.Get(35091); // "Press {0:s} ({1:d})" + const std::string& strPrompt = g_localizeStrings.Get(35090); // "Press {0:s}" + const std::string& strWarn = g_localizeStrings.Get(35091); // "Press {0:s} ({1:d})" bInterrupted = DoPrompt(strPrompt, strWarn, m_selectedKey.Label(), waitEvent); diff --git a/xbmc/games/controllers/windows/ControllerInstaller.cpp b/xbmc/games/controllers/windows/ControllerInstaller.cpp index 74f942e1fa..b6c17c289a 100644 --- a/xbmc/games/controllers/windows/ControllerInstaller.cpp +++ b/xbmc/games/controllers/windows/ControllerInstaller.cpp @@ -98,7 +98,7 @@ void CControllerInstaller::Process() const auto& addon = installableAddons[installedCount]; // Set dialog text - const std::string progressTemplate = g_localizeStrings.Get(24057); // "Installing {0:s}..." + const std::string& progressTemplate = g_localizeStrings.Get(24057); // "Installing {0:s}..." const std::string progressText = StringUtils::Format(progressTemplate, addon->Name()); pProgressDialog->SetLine(0, CVariant{progressText}); diff --git a/xbmc/guilib/GUIKeyboardFactory.cpp b/xbmc/guilib/GUIKeyboardFactory.cpp index 181e146c0d..b6a2c62dc0 100644 --- a/xbmc/guilib/GUIKeyboardFactory.cpp +++ b/xbmc/guilib/GUIKeyboardFactory.cpp @@ -182,7 +182,7 @@ bool CGUIKeyboardFactory::ShowAndVerifyNewPassword(std::string& newPassword, CVa // \return true if successful display and user input entry/re-entry. false if unsuccessful display, no user input, or canceled editing. bool CGUIKeyboardFactory::ShowAndVerifyNewPassword(std::string& newPassword, unsigned int autoCloseMs /* = 0 */) { - std::string heading = g_localizeStrings.Get(12340); + const std::string& heading = g_localizeStrings.Get(12340); return ShowAndVerifyNewPassword(newPassword, heading, false, autoCloseMs); } diff --git a/xbmc/guilib/GUIStaticItem.cpp b/xbmc/guilib/GUIStaticItem.cpp index ea67c89ca1..f251c0bb5c 100644 --- a/xbmc/guilib/GUIStaticItem.cpp +++ b/xbmc/guilib/GUIStaticItem.cpp @@ -71,7 +71,7 @@ void CGUIStaticItem::UpdateProperties(int contextWindow) const GUIINFO::CGUIInfoLabel& info = i.first; const std::string& name = i.second; bool preferTexture = StringUtils::CompareNoCase("label", name, 5) != 0; - std::string value(info.GetLabel(contextWindow, preferTexture)); + const std::string& value(info.GetLabel(contextWindow, preferTexture)); if (StringUtils::EqualsNoCase(name, "label")) SetLabel(value); else if (StringUtils::EqualsNoCase(name, "label2")) diff --git a/xbmc/guilib/StereoscopicsManager.cpp b/xbmc/guilib/StereoscopicsManager.cpp index e99b71c29a..4b79ab6fef 100644 --- a/xbmc/guilib/StereoscopicsManager.cpp +++ b/xbmc/guilib/StereoscopicsManager.cpp @@ -162,7 +162,7 @@ RENDER_STEREO_MODE CStereoscopicsManager::GetNextSupportedStereoMode(const RENDE std::string CStereoscopicsManager::DetectStereoModeByString(const std::string &needle) const { std::string stereoMode; - std::string searchString(needle); + const std::string& searchString(needle); CRegExp re(true); if (!re.RegComp(CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_stereoscopicregex_3d.c_str())) diff --git a/xbmc/guilib/guiinfo/MusicGUIInfo.cpp b/xbmc/guilib/guiinfo/MusicGUIInfo.cpp index d716718a3a..3e385411e0 100644 --- a/xbmc/guilib/guiinfo/MusicGUIInfo.cpp +++ b/xbmc/guilib/guiinfo/MusicGUIInfo.cpp @@ -113,7 +113,7 @@ bool CMusicGUIInfo::GetLabel(std::string& value, const CFileItem *item, int cont case MUSICPLAYER_LASTPLAYED: case LISTITEM_LASTPLAYED: { - const CDateTime dateTime = tag->GetLastPlayed(); + const CDateTime& dateTime = tag->GetLastPlayed(); if (dateTime.IsValid()) { value = dateTime.GetAsLocalizedDate(); diff --git a/xbmc/interfaces/json-rpc/ProfilesOperations.cpp b/xbmc/interfaces/json-rpc/ProfilesOperations.cpp index a1804d2f06..1648d930b9 100644 --- a/xbmc/interfaces/json-rpc/ProfilesOperations.cpp +++ b/xbmc/interfaces/json-rpc/ProfilesOperations.cpp @@ -111,7 +111,7 @@ JSONRPC_STATUS CProfilesOperations::LoadProfile(const std::string &method, ITran else if (!bCanceled) // Password needed and user provided it { const CVariant &passwordObject = parameterObject["password"]; - std::string strToVerify = profile->getLockCode(); + const std::string& strToVerify = profile->getLockCode(); std::string password = passwordObject["value"].asString(); // Create password hash from the provided password if md5 is not used diff --git a/xbmc/interfaces/legacy/Dialog.cpp b/xbmc/interfaces/legacy/Dialog.cpp index b00c03facf..d1c641a3dc 100644 --- a/xbmc/interfaces/legacy/Dialog.cpp +++ b/xbmc/interfaces/legacy/Dialog.cpp @@ -282,7 +282,7 @@ namespace XBMCAddon { if (!defaultt.empty() && defaultt.size() == 10) { - std::string sDefault = defaultt; + const std::string& sDefault = defaultt; timedate.day = atoi(sDefault.substr(0, 2).c_str()); timedate.month = atoi(sDefault.substr(3, 4).c_str()); timedate.year = atoi(sDefault.substr(sDefault.size() - 4).c_str()); @@ -296,7 +296,7 @@ namespace XBMCAddon { if (!defaultt.empty() && defaultt.size() == 5) { - std::string sDefault = defaultt; + const std::string& sDefault = defaultt; timedate.hour = atoi(sDefault.substr(0, 2).c_str()); timedate.minute = atoi(sDefault.substr(3, 2).c_str()); } @@ -375,7 +375,7 @@ namespace XBMCAddon { if (!defaultt.empty() && defaultt.size() == 10) { - std::string sDefault = defaultt; + const std::string& sDefault = defaultt; timedate.day = atoi(sDefault.substr(0, 2).c_str()); timedate.month = atoi(sDefault.substr(3, 4).c_str()); timedate.year = atoi(sDefault.substr(sDefault.size() - 4).c_str()); @@ -391,7 +391,7 @@ namespace XBMCAddon { if (!defaultt.empty() && defaultt.size() == 5) { - std::string sDefault = defaultt; + const std::string& sDefault = defaultt; timedate.hour = atoi(sDefault.substr(0, 2).c_str()); timedate.minute = atoi(sDefault.substr(3, 2).c_str()); } diff --git a/xbmc/music/MusicDatabase.cpp b/xbmc/music/MusicDatabase.cpp index ce5c8b1ba7..16aecbf9d5 100644 --- a/xbmc/music/MusicDatabase.cpp +++ b/xbmc/music/MusicDatabase.cpp @@ -3113,7 +3113,7 @@ bool CMusicDatabase::SearchArtists(const std::string& search, CFileItemList &art return false; } - std::string artistLabel(g_localizeStrings.Get(557)); // Artist + const std::string& artistLabel(g_localizeStrings.Get(557)); // Artist while (!m_pDS->eof()) { std::string path = StringUtils::Format("musicdb://artists/%i/", m_pDS->fv(0).get_asInt()); @@ -3682,7 +3682,6 @@ bool CMusicDatabase::SearchSongs(const std::string& search, CFileItemList &items if (!m_pDS->query(strSQL)) return false; if (m_pDS->num_rows() == 0) return false; - std::string songLabel = g_localizeStrings.Get(179); // Song while (!m_pDS->eof()) { CFileItemPtr item(new CFileItem); @@ -3719,7 +3718,7 @@ bool CMusicDatabase::SearchAlbums(const std::string& search, CFileItemList &albu if (!m_pDS->query(strSQL)) return false; - std::string albumLabel(g_localizeStrings.Get(558)); // Album + const std::string& albumLabel(g_localizeStrings.Get(558)); // Album while (!m_pDS->eof()) { CAlbum album = GetAlbumFromDataset(m_pDS.get()); @@ -4297,7 +4296,7 @@ bool CMusicDatabase::LookupCDDBInfo(bool bRequery/*=false*/) std::string strTitle = cddb.getInexactTitle(i); if (strTitle == "") break; - std::string strArtist = cddb.getInexactArtist(i); + const std::string& strArtist = cddb.getInexactArtist(i); if (!strArtist.empty()) strTitle += " - " + strArtist; diff --git a/xbmc/music/Song.cpp b/xbmc/music/Song.cpp index 4e0a9c9cc9..313a67c987 100644 --- a/xbmc/music/Song.cpp +++ b/xbmc/music/Song.cpp @@ -24,7 +24,6 @@ CSong::CSong(CFileItem& item) CMusicInfoTag& tag = *item.GetMusicInfoTag(); strTitle = tag.GetTitle(); genre = tag.GetGenre(); - std::vector artist = tag.GetArtist(); strArtistDesc = tag.GetArtistString(); //Set sort string before processing artist credits strArtistSort = tag.GetArtistSort(); diff --git a/xbmc/music/tags/MusicInfoTagLoaderCDDA.cpp b/xbmc/music/tags/MusicInfoTagLoaderCDDA.cpp index 2cfea52be9..8b37e34b22 100644 --- a/xbmc/music/tags/MusicInfoTagLoaderCDDA.cpp +++ b/xbmc/music/tags/MusicInfoTagLoaderCDDA.cpp @@ -66,7 +66,7 @@ bool CMusicInfoTagLoaderCDDA::Load(const std::string& strFileName, CMusicInfoTag if (cddb.queryCDinfo(pCdInfo)) { // Fill the fileitems music tag with cddb information, if available - std::string strTitle = cddb.getTrackTitle(iTrack); + const std::string& strTitle = cddb.getTrackTitle(iTrack); if (!strTitle.empty()) { // Tracknumber diff --git a/xbmc/music/windows/GUIWindowMusicBase.cpp b/xbmc/music/windows/GUIWindowMusicBase.cpp index 633f48a908..70f9074c91 100644 --- a/xbmc/music/windows/GUIWindowMusicBase.cpp +++ b/xbmc/music/windows/GUIWindowMusicBase.cpp @@ -1008,7 +1008,7 @@ bool CGUIWindowMusicBase::GetDirectory(const std::string &strDirectory, CFileIte bool CGUIWindowMusicBase::CheckFilterAdvanced(CFileItemList &items) const { - std::string content = items.GetContent(); + const std::string& content = items.GetContent(); if ((items.IsMusicDb() || CanContainFilter(m_strFilterPath)) && (StringUtils::EqualsNoCase(content, "artists") || StringUtils::EqualsNoCase(content, "albums") || diff --git a/xbmc/network/WakeOnAccess.cpp b/xbmc/network/WakeOnAccess.cpp index 4e24fb06e9..5a37fe7f35 100644 --- a/xbmc/network/WakeOnAccess.cpp +++ b/xbmc/network/WakeOnAccess.cpp @@ -449,7 +449,7 @@ CWakeOnAccess &CWakeOnAccess::GetInstance() bool CWakeOnAccess::WakeUpHost(const CURL& url) { - std::string hostName = url.GetHostName(); + const std::string& hostName = url.GetHostName(); if (!hostName.empty()) return WakeUpHost(hostName, url.Get(), url.IsProtocol("upnp")); @@ -753,7 +753,7 @@ void CWakeOnAccess::OnJobComplete(unsigned int jobID, bool success, CJob *job) if (IsEnabled()) { - std::string heading = LOCALIZED(13033); + const std::string& heading = LOCALIZED(13033); std::string message = StringUtils::Format(LOCALIZED(13036).c_str(), host.c_str()); CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error, heading, message, 4000, true, 3000); } diff --git a/xbmc/network/cddb.cpp b/xbmc/network/cddb.cpp index e949c0b72f..04c7ee616a 100644 --- a/xbmc/network/cddb.cpp +++ b/xbmc/network/cddb.cpp @@ -537,7 +537,7 @@ void Xcddb::parseData(const char *buffer) addTitle((strKeyword + "=" + strValue).c_str()); else if (strKeyword == "EXTD") { - std::string strExtd(strValue); + const std::string& strExtd(strValue); if (m_strYear.empty()) { diff --git a/xbmc/pictures/GUIWindowSlideShow.cpp b/xbmc/pictures/GUIWindowSlideShow.cpp index 767cefd51c..0e86c74704 100644 --- a/xbmc/pictures/GUIWindowSlideShow.cpp +++ b/xbmc/pictures/GUIWindowSlideShow.cpp @@ -962,7 +962,7 @@ bool CGUIWindowSlideShow::OnMessage(CGUIMessage& message) case GUI_MSG_SHOW_PICTURE: { - std::string strFile = message.GetStringParam(); + const std::string& strFile = message.GetStringParam(); Reset(); CFileItem item(strFile, false); Add(&item); @@ -972,9 +972,9 @@ bool CGUIWindowSlideShow::OnMessage(CGUIMessage& message) case GUI_MSG_START_SLIDESHOW: { - std::string strFolder = message.GetStringParam(); + const std::string& strFolder = message.GetStringParam(); unsigned int iParams = message.GetParam1(); - std::string beginSlidePath = message.GetStringParam(1); + const std::string& beginSlidePath = message.GetStringParam(1); //decode params bool bRecursive = false; bool bRandom = false; @@ -1155,7 +1155,7 @@ void CGUIWindowSlideShow::OnLoadPic( if (URIUtils::IsInRAR(m_slides.at(m_iCurrentSlide)->GetPath()) || URIUtils::IsInZIP(m_slides.at(m_iCurrentSlide)->GetPath())) // move to top for cbr/cbz { CURL url(m_slides.at(m_iCurrentSlide)->GetPath()); - std::string strHostName = url.GetHostName(); + const std::string& strHostName = url.GetHostName(); if (URIUtils::HasExtension(strHostName, ".cbr|.cbz")) { m_Image[iPic].m_bIsComic = true; diff --git a/xbmc/platform/android/filesystem/APKDirectory.cpp b/xbmc/platform/android/filesystem/APKDirectory.cpp index 3a2efe43e4..f01473f93a 100644 --- a/xbmc/platform/android/filesystem/APKDirectory.cpp +++ b/xbmc/platform/android/filesystem/APKDirectory.cpp @@ -27,7 +27,7 @@ bool CAPKDirectory::GetDirectory(const CURL& url, CFileItemList &items) { // uses a /filename.apk/... std::string path = url.GetFileName(); - std::string host = url.GetHostName(); + const std::string& host = url.GetHostName(); URIUtils::AddSlashAtEnd(path); int zip_flags = 0, zip_error = 0; diff --git a/xbmc/platform/android/filesystem/APKFile.cpp b/xbmc/platform/android/filesystem/APKFile.cpp index 62e82d7841..bfeb1c401a 100644 --- a/xbmc/platform/android/filesystem/APKFile.cpp +++ b/xbmc/platform/android/filesystem/APKFile.cpp @@ -35,8 +35,8 @@ bool CAPKFile::Open(const CURL& url) Close(); m_url = url; - std::string path = url.GetFileName(); - std::string host = url.GetHostName(); + const std::string& path = url.GetFileName(); + const std::string& host = url.GetHostName(); int zip_flags = 0, zip_error = 0; m_zip_archive = zip_open(host.c_str(), zip_flags, &zip_error); @@ -193,7 +193,7 @@ int CAPKFile::Stat(const CURL& url, struct __stat64* buffer) // do not use internal member vars here, // we might be called without opening std::string path = url.GetFileName(); - std::string host = url.GetHostName(); + const std::string& host = url.GetHostName(); struct zip *zip_archive; int zip_flags = 0, zip_error = 0; diff --git a/xbmc/platform/darwin/ios-common/AnnounceReceiver.mm b/xbmc/platform/darwin/ios-common/AnnounceReceiver.mm index d17063a3d8..0211f1923b 100644 --- a/xbmc/platform/darwin/ios-common/AnnounceReceiver.mm +++ b/xbmc/platform/darwin/ios-common/AnnounceReceiver.mm @@ -85,7 +85,7 @@ void AnnounceBridge(ANNOUNCEMENT::AnnouncementFlag flag, int item_id = -1; std::string item_type = ""; CVariant nonConstData = data; - const std::string msg(message); + const std::string& msg(message); // handle data which only has a database id and not the metadata inside if (msg == "OnPlay" || msg == "OnResume") diff --git a/xbmc/profiles/ProfileManager.cpp b/xbmc/profiles/ProfileManager.cpp index 14fbc37663..c5079f6c98 100644 --- a/xbmc/profiles/ProfileManager.cpp +++ b/xbmc/profiles/ProfileManager.cpp @@ -471,7 +471,7 @@ bool CProfileManager::DeleteProfile(unsigned int index) if (dlgYesNo == NULL) return false; - std::string str = g_localizeStrings.Get(13201); + const std::string& str = g_localizeStrings.Get(13201); dlgYesNo->SetHeading(CVariant{13200}); dlgYesNo->SetLine(0, CVariant{StringUtils::Format(str.c_str(), profile->getName().c_str())}); dlgYesNo->SetLine(1, CVariant{""}); diff --git a/xbmc/profiles/windows/GUIWindowSettingsProfile.cpp b/xbmc/profiles/windows/GUIWindowSettingsProfile.cpp index ea90b575f8..cc111a0da3 100644 --- a/xbmc/profiles/windows/GUIWindowSettingsProfile.cpp +++ b/xbmc/profiles/windows/GUIWindowSettingsProfile.cpp @@ -245,7 +245,7 @@ bool CGUIWindowSettingsProfile::GetAutoLoginProfileChoice(int &iProfile) for (unsigned int i = 0; i < profileManager->GetNumberOfProfiles(); i++) { const CProfile *profile = profileManager->GetProfile(i); - std::string locked = g_localizeStrings.Get(profile->getLockMode() > 0 ? 20166 : 20165); + const std::string& locked = g_localizeStrings.Get(profile->getLockMode() > 0 ? 20166 : 20165); CFileItemPtr item(new CFileItem(profile->getName())); item->SetLabel2(locked); // lock setting std::string thumb = profile->getThumb(); diff --git a/xbmc/pvr/channels/PVRChannelGroupInternal.cpp b/xbmc/pvr/channels/PVRChannelGroupInternal.cpp index 663ba0d4a6..96e065d9dd 100644 --- a/xbmc/pvr/channels/PVRChannelGroupInternal.cpp +++ b/xbmc/pvr/channels/PVRChannelGroupInternal.cpp @@ -58,7 +58,7 @@ void CPVRChannelGroupInternal::CheckGroupName() CSingleLock lock(m_critSection); /* check whether the group name is still correct, or channels will fail to load after the language setting changed */ - const std::string strNewGroupName = g_localizeStrings.Get(19287); + const std::string& strNewGroupName = g_localizeStrings.Get(19287); if (GroupName() != strNewGroupName) { SetGroupName(strNewGroupName); diff --git a/xbmc/settings/SettingPath.cpp b/xbmc/settings/SettingPath.cpp index cfeb791541..dc0d7a349c 100644 --- a/xbmc/settings/SettingPath.cpp +++ b/xbmc/settings/SettingPath.cpp @@ -68,7 +68,7 @@ bool CSettingPath::Deserialize(const TiXmlNode *node, bool update /* = false */) auto child = source->FirstChild(); if (child != nullptr) { - std::string strSource = child->ValueStr(); + const std::string& strSource = child->ValueStr(); if (!strSource.empty()) m_sources.push_back(strSource); } diff --git a/xbmc/storage/MediaManager.cpp b/xbmc/storage/MediaManager.cpp index eb549000fa..f975294ec1 100644 --- a/xbmc/storage/MediaManager.cpp +++ b/xbmc/storage/MediaManager.cpp @@ -194,7 +194,7 @@ void CMediaManager::GetNetworkLocations(VECSOURCES &locations, bool autolocation #ifdef HAS_UPNP if (CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(CSettings::SETTING_SERVICES_UPNP)) { - std::string strDevices = g_localizeStrings.Get(33040); //"% Devices" + const std::string& strDevices = g_localizeStrings.Get(33040); //"% Devices" share.strPath = "upnp://"; share.strName = StringUtils::Format(strDevices.c_str(), "UPnP"); //"UPnP Devices" locations.push_back(share); diff --git a/xbmc/utils/URIUtils.cpp b/xbmc/utils/URIUtils.cpp index 74ae86dcbe..9ee77f4f9f 100644 --- a/xbmc/utils/URIUtils.cpp +++ b/xbmc/utils/URIUtils.cpp @@ -665,7 +665,7 @@ bool URIUtils::IsOnLAN(const std::string& strPath) if(!IsRemote(strPath)) return false; - std::string host = url.GetHostName(); + const std::string& host = url.GetHostName(); return IsHostOnLAN(host); } @@ -1163,7 +1163,7 @@ bool URIUtils::HasSlashAtEnd(const std::string& strFile, bool checkURL /* = fals if (checkURL && IsURL(strFile)) { CURL url(strFile); - std::string file = url.GetFileName(); + const std::string& file = url.GetFileName(); return file.empty() || HasSlashAtEnd(file, false); } char kar = strFile.c_str()[strFile.size() - 1]; diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp index d1d8a34b28..b04a803fe8 100644 --- a/xbmc/video/VideoDatabase.cpp +++ b/xbmc/video/VideoDatabase.cpp @@ -9432,7 +9432,7 @@ std::vector CVideoDatabase::CleanMediaType(const std::string &mediaType, co if (mediaType.empty() || cleanableFileIDs.empty()) return cleanedIDs; - std::string table = mediaType; + const std::string& table = mediaType; std::string idField; std::string parentPathIdField; bool isEpisode = false; @@ -10566,7 +10566,7 @@ void CVideoDatabase::AnnounceUpdate(std::string content, int id) bool CVideoDatabase::GetItemsForPath(const std::string &content, const std::string &strPath, CFileItemList &items) { - std::string path(strPath); + const std::string& path(strPath); if(URIUtils::IsMultiPath(path)) { diff --git a/xbmc/video/VideoInfoScanner.cpp b/xbmc/video/VideoInfoScanner.cpp index 04c057da3f..bfb3ea5eb9 100644 --- a/xbmc/video/VideoInfoScanner.cpp +++ b/xbmc/video/VideoInfoScanner.cpp @@ -1694,7 +1694,7 @@ namespace VIDEO // handle .nfo files CInfoScanner::INFO_TYPE result=CInfoScanner::NO_NFO; CScraperUrl scrUrl; - ScraperPtr info(scraper); + const ScraperPtr& info(scraper); std::unique_ptr loader; if (useLocal) { diff --git a/xbmc/video/windows/GUIWindowFullScreen.cpp b/xbmc/video/windows/GUIWindowFullScreen.cpp index f94a8fce75..adc2d0e05d 100644 --- a/xbmc/video/windows/GUIWindowFullScreen.cpp +++ b/xbmc/video/windows/GUIWindowFullScreen.cpp @@ -313,10 +313,10 @@ void CGUIWindowFullScreen::FrameMove() { // get the "View Mode" string - std::string strTitle = g_localizeStrings.Get(629); + const std::string& strTitle = g_localizeStrings.Get(629); const auto& vs = g_application.GetAppPlayer().GetVideoSettings(); int sId = CViewModeSettings::GetViewModeStringIndex(vs.m_ViewMode); - std::string strMode = g_localizeStrings.Get(sId); + const std::string& strMode = g_localizeStrings.Get(sId); std::string strInfo = StringUtils::Format("%s : %s", strTitle.c_str(), strMode.c_str()); CGUIMessage msg(GUI_MSG_LABEL_SET, GetID(), LABEL_ROW1); msg.SetLabel(strInfo); diff --git a/xbmc/video/windows/GUIWindowVideoBase.cpp b/xbmc/video/windows/GUIWindowVideoBase.cpp index 0a07fa5a32..5c9e785551 100644 --- a/xbmc/video/windows/GUIWindowVideoBase.cpp +++ b/xbmc/video/windows/GUIWindowVideoBase.cpp @@ -315,7 +315,7 @@ bool CGUIWindowVideoBase::ShowIMDB(CFileItemPtr item, const ScraperPtr &info2, b CGUIDialogSelect* pDlgSelect = CServiceBroker::GetGUI()->GetWindowManager().GetWindow(WINDOW_DIALOG_SELECT); CGUIDialogVideoInfo* pDlgInfo = CServiceBroker::GetGUI()->GetWindowManager().GetWindow(WINDOW_DIALOG_VIDEO_INFO); - ScraperPtr info(info2); // use this as nfo might change it.. + const ScraperPtr& info(info2); // use this as nfo might change it.. if (!pDlgProgress) return false; if (!pDlgSelect) return false; @@ -1419,7 +1419,7 @@ void CGUIWindowVideoBase::GetGroupedItems(CFileItemList &items) bool CGUIWindowVideoBase::CheckFilterAdvanced(CFileItemList &items) const { - std::string content = items.GetContent(); + const std::string& content = items.GetContent(); if ((items.IsVideoDb() || CanContainFilter(m_strFilterPath)) && (StringUtils::EqualsNoCase(content, "movies") || StringUtils::EqualsNoCase(content, "tvshows") || diff --git a/xbmc/video/windows/GUIWindowVideoNav.cpp b/xbmc/video/windows/GUIWindowVideoNav.cpp index 61c5c09566..fcbe0a81e1 100644 --- a/xbmc/video/windows/GUIWindowVideoNav.cpp +++ b/xbmc/video/windows/GUIWindowVideoNav.cpp @@ -152,7 +152,7 @@ bool CGUIWindowVideoNav::OnMessage(CGUIMessage& message) if (url.GetOption("showinfo") == "true") { // We are here if the item is filtered out in the nav window - std::string path = message.GetStringParam(0); + const std::string& path = message.GetStringParam(0); CFileItem item(path, URIUtils::HasSlashAtEnd(path)); if (item.IsVideoDb()) { @@ -718,9 +718,9 @@ bool CGUIWindowVideoNav::GetFilteredItems(const std::string &filter, CFileItemLi void CGUIWindowVideoNav::DoSearch(const std::string& strSearch, CFileItemList& items) { CFileItemList tempItems; - std::string strGenre = g_localizeStrings.Get(515); // Genre - std::string strActor = g_localizeStrings.Get(20337); // Actor - std::string strDirector = g_localizeStrings.Get(20339); // Director + const std::string& strGenre = g_localizeStrings.Get(515); // Genre + const std::string& strActor = g_localizeStrings.Get(20337); // Actor + const std::string& strDirector = g_localizeStrings.Get(20339); // Director //get matching names m_database.GetMoviesByName(strSearch, tempItems); diff --git a/xbmc/video/windows/VideoFileItemListModifier.cpp b/xbmc/video/windows/VideoFileItemListModifier.cpp index aab689b826..d1677682ca 100644 --- a/xbmc/video/windows/VideoFileItemListModifier.cpp +++ b/xbmc/video/windows/VideoFileItemListModifier.cpp @@ -64,7 +64,7 @@ void CVideoFileItemListModifier::AddQueuingFolder(CFileItemList& items) { case NODE_TYPE_SEASONS: { - std::string strLabel = g_localizeStrings.Get(20366); + const std::string& strLabel = g_localizeStrings.Get(20366); pItem.reset(new CFileItem(strLabel)); // "All Seasons" videoUrl.AppendPath("-1/"); pItem->SetPath(videoUrl.ToString()); diff --git a/xbmc/windowing/X11/WinSystemX11.cpp b/xbmc/windowing/X11/WinSystemX11.cpp index 08ac4698b6..f5ecb75adb 100644 --- a/xbmc/windowing/X11/WinSystemX11.cpp +++ b/xbmc/windowing/X11/WinSystemX11.cpp @@ -820,7 +820,7 @@ bool CWinSystemX11::SetWindow(int width, int height, bool fullscreen, const std: XTextProperty windowName, iconName; std::string titleString = CCompileInfo::GetAppName(); - std::string classString = titleString; + const std::string& classString = titleString; char *title = const_cast(titleString.c_str()); XStringListToTextProperty(&title, 1, &windowName); diff --git a/xbmc/windows/GUIMediaWindow.cpp b/xbmc/windows/GUIMediaWindow.cpp index 2709106a9f..b089be9bfc 100644 --- a/xbmc/windows/GUIMediaWindow.cpp +++ b/xbmc/windows/GUIMediaWindow.cpp @@ -903,7 +903,7 @@ bool CGUIMediaWindow::Update(const std::string &strDirectory, bool updateFilterP showLabel = 35250; // "Add games..." if (showLabel && (m_vecItems->Size() == 0 || !m_guiState->DisableAddSourceButtons())) // add 'add source button' { - std::string strLabel = g_localizeStrings.Get(showLabel); + const std::string& strLabel = g_localizeStrings.Get(showLabel); CFileItemPtr pItem(new CFileItem(strLabel)); pItem->SetPath("add"); pItem->SetArt("icon", "DefaultAddSource.png"); diff --git a/xbmc/windows/GUIWindowFileManager.cpp b/xbmc/windows/GUIWindowFileManager.cpp index f5ca1abe8d..736f49346d 100644 --- a/xbmc/windows/GUIWindowFileManager.cpp +++ b/xbmc/windows/GUIWindowFileManager.cpp @@ -487,7 +487,7 @@ bool CGUIWindowFileManager::Update(int iList, const std::string &strDirectory) URIUtils::GetParentPath(strDirectory, strParentPath); if (strDirectory.empty() && (m_vecItems[iList]->Size() == 0 || CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(CSettings::SETTING_FILELISTS_SHOWADDSOURCEBUTTONS))) { // add 'add source button' - std::string strLabel = g_localizeStrings.Get(1026); + const std::string& strLabel = g_localizeStrings.Get(1026); CFileItemPtr pItem(new CFileItem(strLabel)); pItem->SetPath("add"); pItem->SetArt("icon", "DefaultAddSource.png"); @@ -630,7 +630,7 @@ void CGUIWindowFileManager::OnStart(CFileItem *pItem, const std::string &player) // start playlists from file manager if (pItem->IsPlayList()) { - std::string strPlayList = pItem->GetPath(); + const std::string& strPlayList = pItem->GetPath(); std::unique_ptr pPlayList (CPlayListFactory::Create(strPlayList)); if (nullptr != pPlayList) { -- cgit v1.2.3