aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.clang-tidy1
-rw-r--r--xbmc/FileItem.cpp9
-rw-r--r--xbmc/addons/AddonInstaller.cpp9
-rw-r--r--xbmc/addons/gui/GUIDialogAddonInfo.cpp4
-rw-r--r--xbmc/addons/settings/AddonSettings.cpp3
-rw-r--r--xbmc/application/Application.cpp189
-rw-r--r--xbmc/application/ApplicationPlayerCallback.cpp6
-rw-r--r--xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp10
-rw-r--r--xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp39
-rw-r--r--xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamAddon.cpp18
-rw-r--r--xbmc/dialogs/GUIDialogColorPicker.cpp3
-rw-r--r--xbmc/dialogs/GUIDialogSelect.cpp6
-rw-r--r--xbmc/filesystem/BlurayDirectory.cpp5
-rw-r--r--xbmc/filesystem/ShoutcastFile.cpp3
-rw-r--r--xbmc/filesystem/SmartPlaylistDirectory.cpp3
-rw-r--r--xbmc/games/addons/input/GameClientInput.cpp4
-rw-r--r--xbmc/input/IRTranslator.cpp3
-rw-r--r--xbmc/input/JoystickMapper.cpp3
-rw-r--r--xbmc/interfaces/AnnouncementManager.cpp3
-rw-r--r--xbmc/interfaces/generic/ScriptInvocationManager.cpp4
-rw-r--r--xbmc/interfaces/json-rpc/AudioLibrary.cpp8
-rw-r--r--xbmc/interfaces/json-rpc/FileItemHandler.cpp3
-rw-r--r--xbmc/interfaces/json-rpc/FileOperations.cpp6
-rw-r--r--xbmc/interfaces/json-rpc/JSONServiceDescription.cpp22
-rw-r--r--xbmc/interfaces/json-rpc/PVROperations.cpp8
-rw-r--r--xbmc/interfaces/json-rpc/VideoLibrary.cpp29
-rw-r--r--xbmc/interfaces/legacy/ListItem.cpp3
-rw-r--r--xbmc/interfaces/legacy/ListItem.h3
-rw-r--r--xbmc/interfaces/python/ContextItemAddonInvoker.cpp10
-rw-r--r--xbmc/messaging/ApplicationMessenger.cpp2
-rw-r--r--xbmc/music/MusicUtils.cpp4
-rw-r--r--xbmc/music/windows/GUIWindowMusicBase.cpp39
-rw-r--r--xbmc/music/windows/MusicFileItemListModifier.cpp8
-rw-r--r--xbmc/network/upnp/UPnPInternal.cpp3
-rw-r--r--xbmc/network/upnp/UPnPServer.cpp10
-rw-r--r--xbmc/pictures/GUIWindowSlideShow.cpp3
-rw-r--r--xbmc/profiles/ProfileManager.cpp37
-rw-r--r--xbmc/pvr/PVRManager.cpp10
-rw-r--r--xbmc/pvr/addons/PVRClient.cpp2
-rw-r--r--xbmc/pvr/dialogs/GUIDialogPVRTimerSettings.cpp4
-rw-r--r--xbmc/pvr/epg/EpgContainer.cpp4
-rw-r--r--xbmc/pvr/epg/EpgInfoTag.cpp2
-rw-r--r--xbmc/pvr/filesystem/PVRGUIDirectory.cpp40
-rw-r--r--xbmc/pvr/guilib/GUIEPGGridContainerModel.cpp2
-rw-r--r--xbmc/pvr/guilib/PVRGUIChannelNavigator.cpp5
-rw-r--r--xbmc/pvr/timers/PVRTimerInfoTag.cpp2
-rw-r--r--xbmc/pvr/timers/PVRTimers.cpp5
-rw-r--r--xbmc/settings/dialogs/GUIDialogContentSettings.cpp25
-rw-r--r--xbmc/settings/dialogs/GUIDialogSettingsBase.cpp37
-rw-r--r--xbmc/threads/test/TestEvent.cpp6
-rw-r--r--xbmc/utils/BooleanLogic.cpp4
-rw-r--r--xbmc/utils/FileOperationJob.cpp4
-rw-r--r--xbmc/video/VideoDatabase.cpp2
-rw-r--r--xbmc/video/VideoInfoScanner.cpp5
-rw-r--r--xbmc/video/dialogs/GUIDialogAudioSettings.cpp8
-rw-r--r--xbmc/video/dialogs/GUIDialogCMSSettings.cpp21
-rw-r--r--xbmc/video/jobs/VideoLibraryMarkWatchedJob.cpp12
-rw-r--r--xbmc/video/jobs/VideoLibraryRefreshingJob.cpp5
-rw-r--r--xbmc/video/windows/GUIWindowVideoBase.cpp4
-rw-r--r--xbmc/video/windows/VideoFileItemListModifier.cpp6
60 files changed, 402 insertions, 336 deletions
diff --git a/.clang-tidy b/.clang-tidy
index b5865a5de9..2a0e381fa2 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -1,4 +1,5 @@
Checks: "\
+ modernize-make-shared,\
modernize-use-default-member-init,\
performance-faster-string-find,\
performance-for-range-copy,\
diff --git a/xbmc/FileItem.cpp b/xbmc/FileItem.cpp
index 39a6e240fc..476018cf6b 100644
--- a/xbmc/FileItem.cpp
+++ b/xbmc/FileItem.cpp
@@ -61,6 +61,7 @@
#include <algorithm>
#include <cstdlib>
+#include <memory>
#include <mutex>
using namespace KODI;
@@ -2105,11 +2106,11 @@ bool CFileItem::LoadTracksFromCueDocument(CFileItemList& scannedItems)
if ( tag.Loaded() && oneFilePerTrack && ! ( tag.GetAlbum().empty() || tag.GetArtist().empty() || tag.GetTitle().empty() ) )
{
// If there are multiple files in a cue file, the tags from the files should be preferred if they exist.
- scannedItems.Add(CFileItemPtr(new CFileItem(song, tag)));
+ scannedItems.Add(std::make_shared<CFileItem>(song, tag));
}
else
{
- scannedItems.Add(CFileItemPtr(new CFileItem(song)));
+ scannedItems.Add(std::make_shared<CFileItem>(song));
}
++tracksFound;
}
@@ -2460,7 +2461,7 @@ void CFileItemList::Sort(SortDescription sortDescription)
SortItems sortItems((size_t)Size());
for (int index = 0; index < Size(); index++)
{
- sortItems[index] = std::shared_ptr<SortItem>(new SortItem);
+ sortItems[index] = std::make_shared<SortItem>();
m_items[index]->ToSortable(*sortItems[index], fields);
(*sortItems[index])[FieldId] = index;
}
@@ -2542,7 +2543,7 @@ void CFileItemList::Archive(CArchive& ar)
{
CFileItemPtr pItem=m_items[0];
if (pItem->IsParentFolder())
- pParent.reset(new CFileItem(*pItem));
+ pParent = std::make_shared<CFileItem>(*pItem);
}
SetIgnoreURLOptions(false);
diff --git a/xbmc/addons/AddonInstaller.cpp b/xbmc/addons/AddonInstaller.cpp
index 0a0d1694dd..3343bf1170 100644
--- a/xbmc/addons/AddonInstaller.cpp
+++ b/xbmc/addons/AddonInstaller.cpp
@@ -46,6 +46,7 @@
#include "utils/log.h"
#include <functional>
+#include <memory>
#include <mutex>
using namespace XFILE;
@@ -553,7 +554,7 @@ void CAddonInstaller::PrunePackageCache()
{
it->second->Sort(SortByLabel, SortOrderDescending);
for (int j = 2; j < it->second->Size(); j++)
- items.Add(CFileItemPtr(new CFileItem(*it->second->Get(j))));
+ items.Add(std::make_shared<CFileItem>(*it->second->Get(j)));
}
items.Sort(SortBySize, SortOrderDescending);
@@ -572,7 +573,7 @@ void CAddonInstaller::PrunePackageCache()
for (auto it = packs.begin(); it != packs.end(); ++it)
{
if (it->second->Size() > 1)
- items.Add(CFileItemPtr(new CFileItem(*it->second->Get(1))));
+ items.Add(std::make_shared<CFileItem>(*it->second->Get(1)));
}
items.Sort(SortByDate, SortOrderAscending);
@@ -626,7 +627,7 @@ int64_t CAddonInstaller::EnumeratePackageFolder(
CAddonVersion::SplitFileName(pack, dummy, items[i]->GetLabel());
if (result.find(pack) == result.end())
result[pack] = std::make_unique<CFileItemList>();
- result[pack]->Add(CFileItemPtr(new CFileItem(*items[i])));
+ result[pack]->Add(std::make_shared<CFileItem>(*items[i]));
}
return size;
@@ -979,7 +980,7 @@ bool CAddonInstallJob::DownloadPackage(const std::string &path, const std::strin
// need to download/copy the package first
CFileItemList list;
- list.Add(CFileItemPtr(new CFileItem(path, false)));
+ list.Add(std::make_shared<CFileItem>(path, false));
list[0]->Select(true);
return DoFileOperation(CFileOperationJob::ActionReplace, list, dest, true);
diff --git a/xbmc/addons/gui/GUIDialogAddonInfo.cpp b/xbmc/addons/gui/GUIDialogAddonInfo.cpp
index b1a24a9687..671e55dcf4 100644
--- a/xbmc/addons/gui/GUIDialogAddonInfo.cpp
+++ b/xbmc/addons/gui/GUIDialogAddonInfo.cpp
@@ -45,6 +45,7 @@
#include "utils/log.h"
#include <functional>
+#include <memory>
#include <sstream>
#include <utility>
@@ -65,7 +66,8 @@ using namespace XFILE;
using namespace KODI::MESSAGING;
CGUIDialogAddonInfo::CGUIDialogAddonInfo(void)
- : CGUIDialog(WINDOW_DIALOG_ADDON_INFO, "DialogAddonInfo.xml"), m_item(CFileItemPtr(new CFileItem))
+ : CGUIDialog(WINDOW_DIALOG_ADDON_INFO, "DialogAddonInfo.xml"),
+ m_item(std::make_shared<CFileItem>())
{
m_loadType = KEEP_IN_MEMORY;
}
diff --git a/xbmc/addons/settings/AddonSettings.cpp b/xbmc/addons/settings/AddonSettings.cpp
index 1d4b808b31..fbf1dbe69f 100644
--- a/xbmc/addons/settings/AddonSettings.cpp
+++ b/xbmc/addons/settings/AddonSettings.cpp
@@ -39,6 +39,7 @@
#include <algorithm>
#include <cassert>
+#include <memory>
#include <mutex>
#include <vector>
@@ -590,7 +591,7 @@ std::shared_ptr<CSettingGroup> CAddonSettings::ParseOldSettingElement(
category->AddGroup(group);
// and create a new one
- group.reset(new CSettingGroup(std::to_string(groupId), GetSettingsManager()));
+ group = std::make_shared<CSettingGroup>(std::to_string(groupId), GetSettingsManager());
groupId += 1;
}
diff --git a/xbmc/application/Application.cpp b/xbmc/application/Application.cpp
index c0408a965c..8696ea9b06 100644
--- a/xbmc/application/Application.cpp
+++ b/xbmc/application/Application.cpp
@@ -10,20 +10,32 @@
#include "Autorun.h"
#include "CompileInfo.h"
+#include "DatabaseManager.h"
+#include "FileItem.h"
#include "GUIInfoManager.h"
+#include "GUILargeTextureManager.h"
+#include "GUIPassword.h"
+#include "GUIUserMessages.h"
#include "HDRStatus.h"
#include "LangInfo.h"
+#include "PartyModeManager.h"
#include "PlayListPlayer.h"
+#include "SectionLoader.h"
+#include "SeekHandler.h"
+#include "ServiceBroker.h"
#include "ServiceManager.h"
+#include "TextureCache.h"
#include "URL.h"
#include "Util.h"
#include "addons/AddonManager.h"
+#include "addons/AddonSystemSettings.h"
#include "addons/RepositoryUpdater.h"
#include "addons/Service.h"
#include "addons/Skin.h"
#include "addons/VFSEntry.h"
#include "addons/addoninfo/AddonInfo.h"
#include "addons/addoninfo/AddonType.h"
+#include "addons/gui/GUIDialogAddonSettings.h"
#include "application/AppInboundProtocol.h"
#include "application/AppParams.h"
#include "application/ApplicationActionListeners.h"
@@ -33,170 +45,141 @@
#include "application/ApplicationStackHelper.h"
#include "application/ApplicationVolumeHandling.h"
#include "cores/AudioEngine/Engines/ActiveAE/ActiveAE.h"
+#include "cores/FFmpeg.h"
#include "cores/IPlayer.h"
#include "cores/playercorefactory/PlayerCoreFactory.h"
#include "dialogs/GUIDialogBusy.h"
#include "dialogs/GUIDialogCache.h"
#include "dialogs/GUIDialogKaiToast.h"
+#include "dialogs/GUIDialogSimpleMenu.h"
#include "events/EventLog.h"
#include "events/NotificationEvent.h"
+#include "filesystem/Directory.h"
+#include "filesystem/DirectoryCache.h"
#include "filesystem/DirectoryFactory.h"
+#include "filesystem/DllLibCurl.h"
#include "filesystem/File.h"
+#ifdef HAS_FILESYSTEM_NFS
+#include "filesystem/NFSFile.h"
+#endif
+#include "filesystem/PluginDirectory.h"
+#include "filesystem/SpecialProtocol.h"
+#ifdef HAS_UPNP
+#include "filesystem/UPnPDirectory.h"
+#endif
+#include "guilib/GUIAudioManager.h"
#include "guilib/GUIComponent.h"
#include "guilib/GUIControlProfiler.h"
#include "guilib/GUIFontManager.h"
+#include "guilib/GUIWindowManager.h"
+#include "guilib/LocalizeStrings.h"
#include "guilib/StereoscopicsManager.h"
#include "guilib/TextureManager.h"
+#include "input/InertialScrollingHandler.h"
+#include "input/InputManager.h"
+#include "input/KeyboardLayoutManager.h"
+#include "input/actions/ActionTranslator.h"
+#include "interfaces/AnnouncementManager.h"
#include "interfaces/builtins/Builtins.h"
#include "interfaces/generic/ScriptInvocationManager.h"
-#include "music/MusicLibraryQueue.h"
-#include "music/tags/MusicInfoTag.h"
-#include "network/EventServer.h"
-#include "network/Network.h"
-#include "platform/Environment.h"
-#include "playlists/PlayListFactory.h"
-#include "threads/SystemClock.h"
-#include "utils/ContentUtils.h"
-#include "utils/JobManager.h"
-#include "utils/LangCodeExpander.h"
-#include "utils/Screenshot.h"
-#include "utils/Variant.h"
-#include "video/Bookmark.h"
-#include "video/VideoLibraryQueue.h"
-
+#include "interfaces/json-rpc/JSONRPC.h"
#ifdef HAS_PYTHON
#include "interfaces/python/XBPython.h"
#endif
-#include "GUILargeTextureManager.h"
-#include "GUIPassword.h"
-#include "GUIUserMessages.h"
-#include "SectionLoader.h"
-#include "SeekHandler.h"
-#include "ServiceBroker.h"
-#include "TextureCache.h"
-#include "filesystem/Directory.h"
-#include "filesystem/DirectoryCache.h"
-#include "filesystem/DllLibCurl.h"
-#include "filesystem/PluginDirectory.h"
-#include "filesystem/SpecialProtocol.h"
-#include "guilib/GUIAudioManager.h"
-#include "guilib/LocalizeStrings.h"
-#include "input/InertialScrollingHandler.h"
-#include "input/KeyboardLayoutManager.h"
-#include "input/actions/ActionTranslator.h"
#include "messaging/ApplicationMessenger.h"
#include "messaging/ThreadMessage.h"
#include "messaging/helpers/DialogHelper.h"
#include "messaging/helpers/DialogOKHelper.h"
+#include "music/MusicLibraryQueue.h"
+#include "music/MusicThumbLoader.h"
+#include "music/MusicUtils.h"
+#include "music/infoscanner/MusicInfoScanner.h"
+#include "music/tags/MusicInfoTag.h"
+#include "network/EventServer.h"
+#include "network/Network.h"
+#include "network/ZeroconfBrowser.h"
+#ifdef HAS_UPNP
+#include "network/upnp/UPnP.h"
+#endif
+#include "peripherals/Peripherals.h"
+#include "pictures/GUIWindowSlideShow.h"
+#include "platform/Environment.h"
#include "playlists/PlayList.h"
+#include "playlists/PlayListFactory.h"
#include "playlists/SmartPlayList.h"
#include "powermanagement/PowerManager.h"
#include "profiles/ProfileManager.h"
+#include "pvr/PVRManager.h"
+#include "pvr/guilib/PVRGUIActionsPlayback.h"
+#include "pvr/guilib/PVRGUIActionsPowerManagement.h"
#include "settings/AdvancedSettings.h"
#include "settings/DisplaySettings.h"
#include "settings/MediaSettings.h"
#include "settings/Settings.h"
#include "settings/SettingsComponent.h"
#include "speech/ISpeechRecognition.h"
+#include "storage/MediaManager.h"
#include "threads/SingleLock.h"
+#include "threads/SystemClock.h"
+#include "utils/AlarmClock.h"
#include "utils/CPUInfo.h"
+#include "utils/CharsetConverter.h"
+#include "utils/ContentUtils.h"
#include "utils/FileExtensionProvider.h"
+#include "utils/JobManager.h"
+#include "utils/LangCodeExpander.h"
#include "utils/RegExp.h"
+#include "utils/Screenshot.h"
+#include "utils/StringUtils.h"
#include "utils/SystemInfo.h"
#include "utils/TimeUtils.h"
+#include "utils/URIUtils.h"
+#include "utils/Variant.h"
#include "utils/XTimeUtils.h"
#include "utils/log.h"
-#include "windowing/WinSystem.h"
-#include "windowing/WindowSystemFactory.h"
-
-#include <cmath>
-
-#ifdef HAS_UPNP
-#include "network/upnp/UPnP.h"
-#include "filesystem/UPnPDirectory.h"
-#endif
-#if defined(TARGET_POSIX) && defined(HAS_FILESYSTEM_SMB)
-#include "platform/posix/filesystem/SMBFile.h"
-#endif
-#ifdef HAS_FILESYSTEM_NFS
-#include "filesystem/NFSFile.h"
-#endif
-#include "PartyModeManager.h"
-#include "network/ZeroconfBrowser.h"
-#ifndef TARGET_POSIX
-#include "platform/win32/threads/Win32Exception.h"
-#endif
-#include "interfaces/json-rpc/JSONRPC.h"
-#include "interfaces/AnnouncementManager.h"
-#include "peripherals/Peripherals.h"
-#include "music/infoscanner/MusicInfoScanner.h"
-#include "music/MusicUtils.h"
-#include "music/MusicThumbLoader.h"
-
-// Windows includes
-#include "guilib/GUIWindowManager.h"
+#include "video/Bookmark.h"
#include "video/PlayerController.h"
-
-// Dialog includes
-#include "addons/gui/GUIDialogAddonSettings.h"
-#include "dialogs/GUIDialogKaiToast.h"
-#include "dialogs/GUIDialogSimpleMenu.h"
+#include "video/VideoLibraryQueue.h"
#include "video/dialogs/GUIDialogVideoBookmarks.h"
-
-// PVR related include Files
-#include "pvr/PVRManager.h"
-#include "pvr/guilib/PVRGUIActionsPlayback.h"
-#include "pvr/guilib/PVRGUIActionsPowerManagement.h"
-
#ifdef TARGET_WINDOWS
#include "win32util.h"
#endif
+#include "windowing/WinSystem.h"
+#include "windowing/WindowSystemFactory.h"
-#ifdef TARGET_DARWIN_OSX
-#ifdef HAS_XBMCHELPER
-#include "platform/darwin/osx/XBMCHelper.h"
-#endif
+#if defined(TARGET_ANDROID)
+#include "platform/android/activity/XBMCApp.h"
#endif
#ifdef TARGET_DARWIN
#include "platform/darwin/DarwinUtils.h"
#endif
-
-#ifdef HAS_OPTICAL_DRIVE
-#include <cdio/logging.h>
+#ifdef TARGET_DARWIN_OSX
+#ifdef HAS_XBMCHELPER
+#include "platform/darwin/osx/XBMCHelper.h"
+#endif
#endif
-
-#include "DatabaseManager.h"
-#include "input/InputManager.h"
-#include "storage/MediaManager.h"
-#include "utils/AlarmClock.h"
-#include "utils/StringUtils.h"
-#include "utils/URIUtils.h"
-
#ifdef TARGET_POSIX
-#include "platform/posix/XHandle.h"
#include "platform/posix/PlatformPosix.h"
+#include "platform/posix/XHandle.h"
#endif
-
-#if defined(TARGET_ANDROID)
-#include "platform/android/activity/XBMCApp.h"
+#if defined(TARGET_POSIX) && defined(HAS_FILESYSTEM_SMB)
+#include "platform/posix/filesystem/SMBFile.h"
#endif
-
-#ifdef TARGET_WINDOWS
-#include "platform/Environment.h"
+#ifndef TARGET_POSIX
+#include "platform/win32/threads/Win32Exception.h"
#endif
+#include <cmath>
+#include <memory>
+#include <mutex>
+
//TODO: XInitThreads
#ifdef HAVE_X11
#include <X11/Xlib.h>
#endif
-
-#include "FileItem.h"
-#include "addons/AddonSystemSettings.h"
-#include "cores/FFmpeg.h"
-#include "pictures/GUIWindowSlideShow.h"
-#include "utils/CharsetConverter.h"
-
-#include <mutex>
+#ifdef HAS_OPTICAL_DRIVE
+#include <cdio/logging.h>
+#endif
using namespace ADDON;
using namespace XFILE;
@@ -2747,7 +2730,7 @@ bool CApplication::OnMessage(CGUIMessage& message)
CGUIMessage msg(GUI_MSG_PLAYLISTPLAYER_CHANGED, 0, 0, CServiceBroker::GetPlaylistPlayer().GetCurrentPlaylist(), param, item);
CServiceBroker::GetGUI()->GetWindowManager().SendThreadMessage(msg);
CServiceBroker::GetPlaylistPlayer().SetCurrentSong(m_nextPlaylistItem);
- m_itemCurrentFile.reset(new CFileItem(*item));
+ m_itemCurrentFile = std::make_shared<CFileItem>(*item);
}
CServiceBroker::GetGUI()->GetInfoManager().SetCurrentItem(*m_itemCurrentFile);
g_partyModeManager.OnSongChange(true);
diff --git a/xbmc/application/ApplicationPlayerCallback.cpp b/xbmc/application/ApplicationPlayerCallback.cpp
index 0dbb4b9fe5..262a106e01 100644
--- a/xbmc/application/ApplicationPlayerCallback.cpp
+++ b/xbmc/application/ApplicationPlayerCallback.cpp
@@ -35,6 +35,8 @@
#include "video/VideoDatabase.h"
#include "video/VideoInfoTag.h"
+#include <memory>
+
CApplicationPlayerCallback::CApplicationPlayerCallback()
: m_itemCurrentFile(new CFileItem), m_playerEvent(true, true)
{
@@ -77,9 +79,9 @@ void CApplicationPlayerCallback::OnPlayBackStarted(const CFileItem& file)
auto& components = CServiceBroker::GetAppComponents();
const auto stackHelper = components.GetComponent<CApplicationStackHelper>();
if (stackHelper->IsPlayingISOStack() || stackHelper->IsPlayingRegularStack())
- m_itemCurrentFile.reset(new CFileItem(*stackHelper->GetRegisteredStack(file)));
+ m_itemCurrentFile = std::make_shared<CFileItem>(*stackHelper->GetRegisteredStack(file));
else
- m_itemCurrentFile.reset(new CFileItem(file));
+ m_itemCurrentFile = std::make_shared<CFileItem>(file);
/* When playing video pause any low priority jobs, they will be unpaused when playback stops.
* This should speed up player startup for files on internet filesystems (eg. webdav) and
diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp
index 21ded53a1b..0cdf8c3864 100644
--- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp
+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp
@@ -432,7 +432,7 @@ void CDVDDemuxClient::SetStreamProps(CDemuxStream *stream, std::map<int, std::sh
streamAudio = std::dynamic_pointer_cast<CDemuxStreamClientInternalTpl<CDemuxStreamAudio>>(currentStream);
if (forceInit || !streamAudio || streamAudio->codec != source->codec)
{
- streamAudio.reset(new CDemuxStreamClientInternalTpl<CDemuxStreamAudio>());
+ streamAudio = std::make_shared<CDemuxStreamClientInternalTpl<CDemuxStreamAudio>>();
streamAudio->m_parser = av_parser_init(source->codec);
if (streamAudio->m_parser)
streamAudio->m_parser->flags |= PARSER_FLAG_COMPLETE_FRAMES;
@@ -469,7 +469,7 @@ void CDVDDemuxClient::SetStreamProps(CDemuxStream *stream, std::map<int, std::sh
streamVideo = std::dynamic_pointer_cast<CDemuxStreamClientInternalTpl<CDemuxStreamVideo>>(currentStream);
if (forceInit || !streamVideo || streamVideo->codec != source->codec)
{
- streamVideo.reset(new CDemuxStreamClientInternalTpl<CDemuxStreamVideo>());
+ streamVideo = std::make_shared<CDemuxStreamClientInternalTpl<CDemuxStreamVideo>>();
streamVideo->m_parser = av_parser_init(source->codec);
if (streamVideo->m_parser)
streamVideo->m_parser->flags |= PARSER_FLAG_COMPLETE_FRAMES;
@@ -513,7 +513,7 @@ void CDVDDemuxClient::SetStreamProps(CDemuxStream *stream, std::map<int, std::sh
streamSubtitle = std::dynamic_pointer_cast<CDemuxStreamClientInternalTpl<CDemuxStreamSubtitle>>(currentStream);
if (!streamSubtitle || streamSubtitle->codec != source->codec)
{
- streamSubtitle.reset(new CDemuxStreamClientInternalTpl<CDemuxStreamSubtitle>());
+ streamSubtitle = std::make_shared<CDemuxStreamClientInternalTpl<CDemuxStreamSubtitle>>();
streamSubtitle->m_parser = av_parser_init(source->codec);
if (streamSubtitle->m_parser)
streamSubtitle->m_parser->flags |= PARSER_FLAG_COMPLETE_FRAMES;
@@ -543,7 +543,7 @@ void CDVDDemuxClient::SetStreamProps(CDemuxStream *stream, std::map<int, std::sh
streamTeletext = std::dynamic_pointer_cast<CDemuxStreamClientInternalTpl<CDemuxStreamTeletext>>(currentStream);
if (!streamTeletext || streamTeletext->codec != source->codec)
{
- streamTeletext.reset(new CDemuxStreamClientInternalTpl<CDemuxStreamTeletext>());
+ streamTeletext = std::make_shared<CDemuxStreamClientInternalTpl<CDemuxStreamTeletext>>();
}
map[stream->uniqueId] = streamTeletext;
@@ -566,7 +566,7 @@ void CDVDDemuxClient::SetStreamProps(CDemuxStream *stream, std::map<int, std::sh
streamRDS = std::dynamic_pointer_cast<CDemuxStreamClientInternalTpl<CDemuxStreamRadioRDS>>(currentStream);
if (!streamRDS || streamRDS->codec != source->codec)
{
- streamRDS.reset(new CDemuxStreamClientInternalTpl<CDemuxStreamRadioRDS>());
+ streamRDS = std::make_shared<CDemuxStreamClientInternalTpl<CDemuxStreamRadioRDS>>();
}
map[stream->uniqueId] = streamRDS;
diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp
index caacf7f86a..e25e35dcaf 100644
--- a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp
+++ b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp
@@ -33,6 +33,7 @@
#include "utils/FileUtils.h"
#include "utils/URIUtils.h"
+#include <memory>
std::shared_ptr<CDVDInputStream> CDVDFactoryInputStream::CreateInputStream(IVideoPlayer* pPlayer, const CFileItem &fileitem, bool scanforextaudio)
{
@@ -68,7 +69,7 @@ std::shared_ptr<CDVDInputStream> CDVDFactoryInputStream::CreateInputStream(IVide
if (fileitem.GetProperty(STREAM_PROPERTY_INPUTSTREAM).asString() ==
STREAM_PROPERTY_VALUE_INPUTSTREAMFFMPEG)
- return std::shared_ptr<CDVDInputStreamFFmpeg>(new CDVDInputStreamFFmpeg(fileitem));
+ return std::make_shared<CDVDInputStreamFFmpeg>(fileitem);
if (fileitem.IsDiscImage())
{
@@ -77,14 +78,14 @@ std::shared_ptr<CDVDInputStream> CDVDFactoryInputStream::CreateInputStream(IVide
url.SetHostName(file);
url.SetFileName("BDMV/index.bdmv");
if (CFileUtils::Exists(url.Get()))
- return std::shared_ptr<CDVDInputStreamBluray>(new CDVDInputStreamBluray(pPlayer, fileitem));
+ return std::make_shared<CDVDInputStreamBluray>(pPlayer, fileitem);
url.SetHostName(file);
url.SetFileName("BDMV/INDEX.BDM");
if (CFileUtils::Exists(url.Get()))
- return std::shared_ptr<CDVDInputStreamBluray>(new CDVDInputStreamBluray(pPlayer, fileitem));
+ return std::make_shared<CDVDInputStreamBluray>(pPlayer, fileitem);
#endif
- return std::shared_ptr<CDVDInputStreamNavigator>(new CDVDInputStreamNavigator(pPlayer, fileitem));
+ return std::make_shared<CDVDInputStreamNavigator>(pPlayer, fileitem);
}
#ifdef HAS_OPTICAL_DRIVE
@@ -93,24 +94,24 @@ std::shared_ptr<CDVDInputStream> CDVDFactoryInputStream::CreateInputStream(IVide
#ifdef HAVE_LIBBLURAY
if (CFileUtils::Exists(URIUtils::AddFileToFolder(file, "BDMV", "index.bdmv")) ||
CFileUtils::Exists(URIUtils::AddFileToFolder(file, "BDMV", "INDEX.BDM")))
- return std::shared_ptr<CDVDInputStreamBluray>(new CDVDInputStreamBluray(pPlayer, fileitem));
+ return std::make_shared<CDVDInputStreamBluray>(pPlayer, fileitem);
#endif
- return std::shared_ptr<CDVDInputStreamNavigator>(new CDVDInputStreamNavigator(pPlayer, fileitem));
+ return std::make_shared<CDVDInputStreamNavigator>(pPlayer, fileitem);
}
#endif
if (fileitem.IsDVDFile(false, true))
- return std::shared_ptr<CDVDInputStreamNavigator>(new CDVDInputStreamNavigator(pPlayer, fileitem));
+ return std::make_shared<CDVDInputStreamNavigator>(pPlayer, fileitem);
else if (URIUtils::IsPVRChannel(file))
- return std::shared_ptr<CInputStreamPVRChannel>(new CInputStreamPVRChannel(pPlayer, fileitem));
+ return std::make_shared<CInputStreamPVRChannel>(pPlayer, fileitem);
else if (URIUtils::IsPVRRecording(file))
- return std::shared_ptr<CInputStreamPVRRecording>(new CInputStreamPVRRecording(pPlayer, fileitem));
+ return std::make_shared<CInputStreamPVRRecording>(pPlayer, fileitem);
#ifdef HAVE_LIBBLURAY
else if (fileitem.IsType(".bdmv") || fileitem.IsType(".mpls")
|| fileitem.IsType(".bdm") || fileitem.IsType(".mpl")
|| StringUtils::StartsWithNoCase(file, "bluray:"))
- return std::shared_ptr<CDVDInputStreamBluray>(new CDVDInputStreamBluray(pPlayer, fileitem));
+ return std::make_shared<CDVDInputStreamBluray>(pPlayer, fileitem);
#endif
else if (StringUtils::StartsWithNoCase(file, "rtp://") ||
StringUtils::StartsWithNoCase(file, "rtsp://") ||
@@ -128,10 +129,10 @@ std::shared_ptr<CDVDInputStream> CDVDFactoryInputStream::CreateInputStream(IVide
StringUtils::StartsWithNoCase(file, "rtmpte://") ||
StringUtils::StartsWithNoCase(file, "rtmps://"))
{
- return std::shared_ptr<CDVDInputStreamFFmpeg>(new CDVDInputStreamFFmpeg(fileitem));
+ return std::make_shared<CDVDInputStreamFFmpeg>(fileitem);
}
else if(StringUtils::StartsWithNoCase(file, "stack://"))
- return std::shared_ptr<CDVDInputStreamStack>(new CDVDInputStreamStack(fileitem));
+ return std::make_shared<CDVDInputStreamStack>(fileitem);
CFileItem finalFileitem(fileitem);
@@ -165,25 +166,23 @@ std::shared_ptr<CDVDInputStream> CDVDFactoryInputStream::CreateInputStream(IVide
}
if (finalFileitem.IsType(".m3u8"))
- return std::shared_ptr<CDVDInputStreamFFmpeg>(new CDVDInputStreamFFmpeg(finalFileitem));
+ return std::make_shared<CDVDInputStreamFFmpeg>(finalFileitem);
// mime type for m3u8/hls streams
if (finalFileitem.GetMimeType() == "application/vnd.apple.mpegurl" ||
finalFileitem.GetMimeType() == "application/x-mpegURL")
- return std::shared_ptr<CDVDInputStreamFFmpeg>(new CDVDInputStreamFFmpeg(finalFileitem));
+ return std::make_shared<CDVDInputStreamFFmpeg>(finalFileitem);
if (URIUtils::IsProtocol(finalFileitem.GetPath(), "udp"))
- return std::shared_ptr<CDVDInputStreamFFmpeg>(new CDVDInputStreamFFmpeg(finalFileitem));
+ return std::make_shared<CDVDInputStreamFFmpeg>(finalFileitem);
}
// our file interface handles all these types of streams
- return std::shared_ptr<CDVDInputStreamFile>(new CDVDInputStreamFile(finalFileitem,
- XFILE::READ_TRUNCATED |
- XFILE::READ_BITRATE |
- XFILE::READ_CHUNKED));
+ return std::make_shared<CDVDInputStreamFile>(
+ finalFileitem, XFILE::READ_TRUNCATED | XFILE::READ_BITRATE | XFILE::READ_CHUNKED);
}
std::shared_ptr<CDVDInputStream> CDVDFactoryInputStream::CreateInputStream(IVideoPlayer* pPlayer, const CFileItem &fileitem, const std::vector<std::string>& filenames)
{
- return std::shared_ptr<CInputStreamMultiSource>(new CInputStreamMultiSource(pPlayer, fileitem, filenames));
+ return std::make_shared<CInputStreamMultiSource>(pPlayer, fileitem, filenames);
}
diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamAddon.cpp b/xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamAddon.cpp
index be8f46d8ab..66173a9d36 100644
--- a/xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamAddon.cpp
+++ b/xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamAddon.cpp
@@ -24,6 +24,8 @@
#include "utils/log.h"
#include "windowing/Resolution.h"
+#include <memory>
+
CInputStreamProvider::CInputStreamProvider(const ADDON::AddonInfoPtr& addonInfo,
KODI_HANDLE parentInstance)
: m_addonInfo(addonInfo), m_parentInstance(parentInstance)
@@ -191,8 +193,8 @@ bool CInputStreamAddon::Open()
m_caps = {};
m_ifc.inputstream->toAddon->get_capabilities(m_ifc.inputstream, &m_caps);
- m_subAddonProvider = std::shared_ptr<CInputStreamProvider>(
- new CInputStreamProvider(GetAddonInfo(), m_ifc.inputstream->toAddon->addonInstance));
+ m_subAddonProvider = std::make_shared<CInputStreamProvider>(
+ GetAddonInfo(), m_ifc.inputstream->toAddon->addonInstance);
}
return ret;
}
@@ -444,8 +446,7 @@ KODI_HANDLE CInputStreamAddon::cb_get_stream_transfer(KODI_HANDLE handle,
if (stream->m_masteringMetadata)
{
- videoStream->masteringMetaData =
- std::shared_ptr<AVMasteringDisplayMetadata>(new AVMasteringDisplayMetadata);
+ videoStream->masteringMetaData = std::make_shared<AVMasteringDisplayMetadata>();
videoStream->masteringMetaData->display_primaries[0][0] =
av_d2q(stream->m_masteringMetadata->primary_r_chromaticity_x, INT_MAX);
videoStream->masteringMetaData->display_primaries[0][1] =
@@ -472,8 +473,7 @@ KODI_HANDLE CInputStreamAddon::cb_get_stream_transfer(KODI_HANDLE handle,
if (stream->m_contentLightMetadata)
{
- videoStream->contentLightMetaData =
- std::shared_ptr<AVContentLightMetadata>(new AVContentLightMetadata);
+ videoStream->contentLightMetaData = std::make_shared<AVContentLightMetadata>();
videoStream->contentLightMetaData->MaxCLL =
static_cast<unsigned>(stream->m_contentLightMetadata->max_cll);
videoStream->contentLightMetaData->MaxFALL =
@@ -543,9 +543,9 @@ KODI_HANDLE CInputStreamAddon::cb_get_stream_transfer(KODI_HANDLE handle,
CRYPTO_SESSION_SYSTEM_PLAYREADY, CRYPTO_SESSION_SYSTEM_WISEPLAY,
CRYPTO_SESSION_SYSTEM_CLEARKEY,
};
- demuxStream->cryptoSession = std::shared_ptr<DemuxCryptoSession>(
- new DemuxCryptoSession(map[stream->m_cryptoSession.keySystem],
- stream->m_cryptoSession.sessionId, stream->m_cryptoSession.flags));
+ demuxStream->cryptoSession = std::make_shared<DemuxCryptoSession>(
+ map[stream->m_cryptoSession.keySystem], stream->m_cryptoSession.sessionId,
+ stream->m_cryptoSession.flags);
if ((stream->m_features & INPUTSTREAM_FEATURE_DECODE) != 0)
demuxStream->externalInterfaces = thisClass->m_subAddonProvider;
diff --git a/xbmc/dialogs/GUIDialogColorPicker.cpp b/xbmc/dialogs/GUIDialogColorPicker.cpp
index a73e47b142..5b6842996b 100644
--- a/xbmc/dialogs/GUIDialogColorPicker.cpp
+++ b/xbmc/dialogs/GUIDialogColorPicker.cpp
@@ -19,6 +19,7 @@
#include "utils/log.h"
#include <algorithm>
+#include <memory>
#include <utility>
#include <vector>
@@ -143,7 +144,7 @@ void CGUIDialogColorPicker::Reset()
void CGUIDialogColorPicker::AddItem(const CFileItem& item)
{
- m_vecList->Add(CFileItemPtr(new CFileItem(item)));
+ m_vecList->Add(std::make_shared<CFileItem>(item));
}
void CGUIDialogColorPicker::SetItems(const CFileItemList& pList)
diff --git a/xbmc/dialogs/GUIDialogSelect.cpp b/xbmc/dialogs/GUIDialogSelect.cpp
index 0f125b2884..daa11d551d 100644
--- a/xbmc/dialogs/GUIDialogSelect.cpp
+++ b/xbmc/dialogs/GUIDialogSelect.cpp
@@ -14,6 +14,8 @@
#include "input/Key.h"
#include "utils/StringUtils.h"
+#include <memory>
+
#define CONTROL_HEADING 1
#define CONTROL_NUMBER_OF_ITEMS 2
#define CONTROL_SIMPLE_LIST 3
@@ -195,7 +197,7 @@ int CGUIDialogSelect::Add(const std::string& strLabel)
int CGUIDialogSelect::Add(const CFileItem& item)
{
- m_vecList->Add(CFileItemPtr(new CFileItem(item)));
+ m_vecList->Add(std::make_shared<CFileItem>(item));
return m_vecList->Size() - 1;
}
@@ -217,7 +219,7 @@ const CFileItemPtr CGUIDialogSelect::GetSelectedFileItem() const
{
if (m_selectedItem)
return m_selectedItem;
- return CFileItemPtr(new CFileItem);
+ return std::make_shared<CFileItem>();
}
const std::vector<int>& CGUIDialogSelect::GetSelectedItems() const
diff --git a/xbmc/filesystem/BlurayDirectory.cpp b/xbmc/filesystem/BlurayDirectory.cpp
index dbfb41bd74..b6c339a110 100644
--- a/xbmc/filesystem/BlurayDirectory.cpp
+++ b/xbmc/filesystem/BlurayDirectory.cpp
@@ -24,6 +24,7 @@
#include <array>
#include <cassert>
#include <climits>
+#include <memory>
#include <stdlib.h>
#include <string>
@@ -187,7 +188,7 @@ void CBlurayDirectory::GetRoot(CFileItemList &items)
CFileItemPtr item;
path.SetFileName(URIUtils::AddFileToFolder(m_url.GetFileName(), "titles"));
- item.reset(new CFileItem());
+ item = std::make_shared<CFileItem>();
item->SetPath(path.Get());
item->m_bIsFolder = true;
item->SetLabel(g_localizeStrings.Get(25002) /* All titles */);
@@ -202,7 +203,7 @@ void CBlurayDirectory::GetRoot(CFileItemList &items)
}
path.SetFileName("menu");
- item.reset(new CFileItem());
+ item = std::make_shared<CFileItem>();
item->SetPath(path.Get());
item->m_bIsFolder = false;
item->SetLabel(g_localizeStrings.Get(25003) /* Menus */);
diff --git a/xbmc/filesystem/ShoutcastFile.cpp b/xbmc/filesystem/ShoutcastFile.cpp
index 7488ee7d3d..e54f275b98 100644
--- a/xbmc/filesystem/ShoutcastFile.cpp
+++ b/xbmc/filesystem/ShoutcastFile.cpp
@@ -31,6 +31,7 @@
#include "utils/UrlOptions.h"
#include <climits>
+#include <memory>
#include <mutex>
using namespace XFILE;
@@ -120,7 +121,7 @@ bool CShoutcastFile::Open(const CURL& url)
{
std::unique_lock<CCriticalSection> lock(m_tagSection);
- m_masterTag.reset(new CMusicInfoTag());
+ m_masterTag = std::make_shared<CMusicInfoTag>();
m_masterTag->SetStationName(icyTitle);
m_masterTag->SetGenre(icyGenre);
m_masterTag->SetLoaded(true);
diff --git a/xbmc/filesystem/SmartPlaylistDirectory.cpp b/xbmc/filesystem/SmartPlaylistDirectory.cpp
index 9e05599a20..a45e796071 100644
--- a/xbmc/filesystem/SmartPlaylistDirectory.cpp
+++ b/xbmc/filesystem/SmartPlaylistDirectory.cpp
@@ -26,6 +26,7 @@
#include "video/VideoDbUrl.h"
#include <math.h>
+#include <memory>
#define PROPERTY_PATH_DB "path.db"
#define PROPERTY_SORT_ORDER "sort.order"
@@ -82,7 +83,7 @@ namespace XFILE
playlist.GetVirtualFolders(virtualFolders);
for (const std::string& virtualFolder : virtualFolders)
{
- CFileItemPtr pItem = CFileItemPtr(new CFileItem(virtualFolder, true));
+ CFileItemPtr pItem = std::make_shared<CFileItem>(virtualFolder, true);
IFileDirectory *dir = CFileDirectoryFactory::Create(pItem->GetURL(), pItem.get());
if (dir != NULL)
diff --git a/xbmc/games/addons/input/GameClientInput.cpp b/xbmc/games/addons/input/GameClientInput.cpp
index 273f376fe3..0ae30d26f8 100644
--- a/xbmc/games/addons/input/GameClientInput.cpp
+++ b/xbmc/games/addons/input/GameClientInput.cpp
@@ -35,6 +35,7 @@
#include "utils/log.h"
#include <algorithm>
+#include <memory>
#include <mutex>
using namespace KODI;
@@ -626,7 +627,8 @@ bool CGameClientInput::OpenJoystick(const std::string& portAddress, const Contro
return false;
}
- m_joysticks[portAddress].reset(new CGameClientJoystick(m_gameClient, portAddress, controller));
+ m_joysticks[portAddress] =
+ std::make_shared<CGameClientJoystick>(m_gameClient, portAddress, controller);
return true;
}
diff --git a/xbmc/input/IRTranslator.cpp b/xbmc/input/IRTranslator.cpp
index e115352b7e..394eae62de 100644
--- a/xbmc/input/IRTranslator.cpp
+++ b/xbmc/input/IRTranslator.cpp
@@ -19,6 +19,7 @@
#include "utils/log.h"
#include <cstring>
+#include <memory>
#include <stdlib.h>
#include <vector>
@@ -106,7 +107,7 @@ void CIRTranslator::MapRemote(tinyxml2::XMLNode* pRemote, const std::string& szD
auto it = m_irRemotesMap.find(szDevice);
if (it == m_irRemotesMap.end())
- m_irRemotesMap[szDevice].reset(new IRButtonMap);
+ m_irRemotesMap[szDevice] = std::make_shared<IRButtonMap>();
const std::shared_ptr<IRButtonMap>& buttons = m_irRemotesMap[szDevice];
diff --git a/xbmc/input/JoystickMapper.cpp b/xbmc/input/JoystickMapper.cpp
index 4e1337ab5f..72145e2972 100644
--- a/xbmc/input/JoystickMapper.cpp
+++ b/xbmc/input/JoystickMapper.cpp
@@ -16,6 +16,7 @@
#include "utils/StringUtils.h"
#include <algorithm>
+#include <memory>
#include <sstream>
#include <utility>
@@ -43,7 +44,7 @@ void CJoystickMapper::MapActions(int windowID, const tinyxml2::XMLNode* pDevice)
// Create/overwrite keymap
auto& keymap = m_joystickKeymaps[controllerId];
if (!keymap)
- keymap.reset(new CWindowKeymap(controllerId));
+ keymap = std::make_shared<CWindowKeymap>(controllerId);
const auto* pButton = pDevice->FirstChildElement();
while (pButton != nullptr)
diff --git a/xbmc/interfaces/AnnouncementManager.cpp b/xbmc/interfaces/AnnouncementManager.cpp
index 2f5101bf71..2718adf0d5 100644
--- a/xbmc/interfaces/AnnouncementManager.cpp
+++ b/xbmc/interfaces/AnnouncementManager.cpp
@@ -19,6 +19,7 @@
#include "utils/log.h"
#include "video/VideoDatabase.h"
+#include <memory>
#include <mutex>
#include <stdio.h>
@@ -135,7 +136,7 @@ void CAnnouncementManager::Announce(AnnouncementFlag flag,
announcement.data = data;
if (item != nullptr)
- announcement.item = CFileItemPtr(new CFileItem(*item));
+ announcement.item = std::make_shared<CFileItem>(*item);
{
std::unique_lock<CCriticalSection> lock(m_queueCritSection);
diff --git a/xbmc/interfaces/generic/ScriptInvocationManager.cpp b/xbmc/interfaces/generic/ScriptInvocationManager.cpp
index 9daae0f69f..a3ea29c368 100644
--- a/xbmc/interfaces/generic/ScriptInvocationManager.cpp
+++ b/xbmc/interfaces/generic/ScriptInvocationManager.cpp
@@ -18,6 +18,7 @@
#include "utils/log.h"
#include <cerrno>
+#include <memory>
#include <mutex>
#include <utility>
#include <vector>
@@ -268,8 +269,7 @@ int CScriptInvocationManager::ExecuteAsync(
return invokerThread->GetId();
}
- m_lastInvokerThread =
- CLanguageInvokerThreadPtr(new CLanguageInvokerThread(languageInvoker, this, reuseable));
+ m_lastInvokerThread = std::make_shared<CLanguageInvokerThread>(languageInvoker, this, reuseable);
if (m_lastInvokerThread == NULL)
return -1;
diff --git a/xbmc/interfaces/json-rpc/AudioLibrary.cpp b/xbmc/interfaces/json-rpc/AudioLibrary.cpp
index 813c4c85c4..3d6fa79d79 100644
--- a/xbmc/interfaces/json-rpc/AudioLibrary.cpp
+++ b/xbmc/interfaces/json-rpc/AudioLibrary.cpp
@@ -29,6 +29,8 @@
#include "utils/URIUtils.h"
#include "utils/Variant.h"
+#include <memory>
+
using namespace MUSIC_INFO;
using namespace JSONRPC;
using namespace XFILE;
@@ -495,7 +497,7 @@ JSONRPC_STATUS CAudioLibrary::GetSongDetails(const std::string &method, ITranspo
return InvalidParams;
CFileItemList items;
- CFileItemPtr item = CFileItemPtr(new CFileItem(song));
+ CFileItemPtr item = std::make_shared<CFileItem>(song);
FillItemArtistIDs(song.GetArtistIDArray(), item);
items.Add(item);
@@ -1151,7 +1153,7 @@ bool CAudioLibrary::FillFileItemList(const CVariant &parameterObject, CFileItemL
CSong song;
if (musicdatabase.GetSong(songID, song))
{
- list.Add(CFileItemPtr(new CFileItem(song)));
+ list.Add(std::make_shared<CFileItem>(song));
success = true;
}
}
@@ -1190,7 +1192,7 @@ void CAudioLibrary::FillAlbumItem(const CAlbum& album,
const std::string& path,
std::shared_ptr<CFileItem>& item)
{
- item = CFileItemPtr(new CFileItem(path, album));
+ item = std::make_shared<CFileItem>(path, album);
// Add album artistIds as separate property as not part of CMusicInfoTag
std::vector<int> artistids = album.GetArtistIDArray();
FillItemArtistIDs(artistids, item);
diff --git a/xbmc/interfaces/json-rpc/FileItemHandler.cpp b/xbmc/interfaces/json-rpc/FileItemHandler.cpp
index 9d649d346d..07426447e1 100644
--- a/xbmc/interfaces/json-rpc/FileItemHandler.cpp
+++ b/xbmc/interfaces/json-rpc/FileItemHandler.cpp
@@ -37,6 +37,7 @@
#include "video/VideoThumbLoader.h"
#include <map>
+#include <memory>
#include <string.h>
using namespace MUSIC_INFO;
@@ -524,7 +525,7 @@ bool CFileItemHandler::FillFileItemList(const CVariant &parameterObject, CFileIt
if (!added)
{
- CFileItemPtr item = CFileItemPtr(new CFileItem(file, false));
+ CFileItemPtr item = std::make_shared<CFileItem>(file, false);
if (item->IsPicture())
{
CPictureInfoTag picture;
diff --git a/xbmc/interfaces/json-rpc/FileOperations.cpp b/xbmc/interfaces/json-rpc/FileOperations.cpp
index 6329a7867c..4658e99353 100644
--- a/xbmc/interfaces/json-rpc/FileOperations.cpp
+++ b/xbmc/interfaces/json-rpc/FileOperations.cpp
@@ -26,6 +26,8 @@
#include "utils/Variant.h"
#include "video/VideoDatabase.h"
+#include <memory>
+
using namespace XFILE;
using namespace JSONRPC;
@@ -44,7 +46,7 @@ JSONRPC_STATUS CFileOperations::GetRootDirectory(const std::string &method, ITra
if (sources->at(i).m_iHasLock == LOCK_STATE_LOCKED)
continue;
- items.Add(CFileItemPtr(new CFileItem(sources->at(i))));
+ items.Add(std::make_shared<CFileItem>(sources->at(i)));
}
for (unsigned int i = 0; i < (unsigned int)items.Size(); i++)
@@ -184,7 +186,7 @@ JSONRPC_STATUS CFileOperations::GetFileDetails(const std::string &method, ITrans
if (CDirectory::GetDirectory(path, items, "", DIR_FLAG_DEFAULTS) && items.Contains(file))
item = items.Get(file);
else
- item = CFileItemPtr(new CFileItem(file, false));
+ item = std::make_shared<CFileItem>(file, false);
if (!URIUtils::IsUPnP(file))
FillFileItem(item, item, parameterObject["media"].asString(), parameterObject);
diff --git a/xbmc/interfaces/json-rpc/JSONServiceDescription.cpp b/xbmc/interfaces/json-rpc/JSONServiceDescription.cpp
index da100b24cb..3a9cd037ad 100644
--- a/xbmc/interfaces/json-rpc/JSONServiceDescription.cpp
+++ b/xbmc/interfaces/json-rpc/JSONServiceDescription.cpp
@@ -30,6 +30,8 @@
#include "utils/StringUtils.h"
#include "utils/log.h"
+#include <memory>
+
using namespace JSONRPC;
std::map<std::string, CVariant> CJSONServiceDescription::m_notifications = std::map<std::string, CVariant>();
@@ -422,7 +424,7 @@ bool JSONSchemaTypeDefinition::Parse(const CVariant &value, bool isParameter /*
// of the current property into it, parse it
// recursively and add its default value
// to the current type's default value
- JSONSchemaTypeDefinitionPtr propertyType = JSONSchemaTypeDefinitionPtr(new JSONSchemaTypeDefinition());
+ JSONSchemaTypeDefinitionPtr propertyType = std::make_shared<JSONSchemaTypeDefinition>();
propertyType->name = itr->first;
if (!propertyType->Parse(itr->second))
{
@@ -435,7 +437,7 @@ bool JSONSchemaTypeDefinition::Parse(const CVariant &value, bool isParameter /*
}
hasAdditionalProperties = true;
- additionalProperties = JSONSchemaTypeDefinitionPtr(new JSONSchemaTypeDefinition());
+ additionalProperties = std::make_shared<JSONSchemaTypeDefinition>();
if (value.isMember("additionalProperties"))
{
if (value["additionalProperties"].isBoolean())
@@ -484,7 +486,7 @@ bool JSONSchemaTypeDefinition::Parse(const CVariant &value, bool isParameter /*
// If it is an object, there is only one schema for it
if (value["additionalItems"].isObject())
{
- JSONSchemaTypeDefinitionPtr additionalItem = JSONSchemaTypeDefinitionPtr(new JSONSchemaTypeDefinition());
+ JSONSchemaTypeDefinitionPtr additionalItem = std::make_shared<JSONSchemaTypeDefinition>();
if (additionalItem->Parse(value["additionalItems"]))
additionalItems.push_back(additionalItem);
else
@@ -499,7 +501,7 @@ bool JSONSchemaTypeDefinition::Parse(const CVariant &value, bool isParameter /*
{
for (unsigned int itemIndex = 0; itemIndex < value["additionalItems"].size(); itemIndex++)
{
- JSONSchemaTypeDefinitionPtr additionalItem = JSONSchemaTypeDefinitionPtr(new JSONSchemaTypeDefinition());
+ JSONSchemaTypeDefinitionPtr additionalItem = std::make_shared<JSONSchemaTypeDefinition>();
if (additionalItem->Parse(value["additionalItems"][itemIndex]))
additionalItems.push_back(additionalItem);
@@ -527,7 +529,7 @@ bool JSONSchemaTypeDefinition::Parse(const CVariant &value, bool isParameter /*
{
if (value["items"].isObject())
{
- JSONSchemaTypeDefinitionPtr item = JSONSchemaTypeDefinitionPtr(new JSONSchemaTypeDefinition());
+ JSONSchemaTypeDefinitionPtr item = std::make_shared<JSONSchemaTypeDefinition>();
if (!item->Parse(value["items"]))
{
CLog::Log(LOGDEBUG, "Invalid item definition in \"items\" for type {}", name);
@@ -542,7 +544,7 @@ bool JSONSchemaTypeDefinition::Parse(const CVariant &value, bool isParameter /*
{
for (CVariant::const_iterator_array itemItr = value["items"].begin_array(); itemItr != value["items"].end_array(); ++itemItr)
{
- JSONSchemaTypeDefinitionPtr item = JSONSchemaTypeDefinitionPtr(new JSONSchemaTypeDefinition());
+ JSONSchemaTypeDefinitionPtr item = std::make_shared<JSONSchemaTypeDefinition>();
if (!item->Parse(*itemItr))
{
CLog::Log(LOGDEBUG, "Invalid item definition in \"items\" array for type {}", name);
@@ -1335,7 +1337,7 @@ bool JsonRpcMethod::Parse(const CVariant &value)
// Parse the parameter and add it to the list
// of defined parameters
- JSONSchemaTypeDefinitionPtr param = JSONSchemaTypeDefinitionPtr(new JSONSchemaTypeDefinition());
+ JSONSchemaTypeDefinitionPtr param = std::make_shared<JSONSchemaTypeDefinition>();
if (!parseParameter(parameter, param))
{
missingReference = param->missingReference;
@@ -1615,7 +1617,7 @@ bool CJSONServiceDescription::AddType(const std::string &jsonType)
// Make sure the "id" attribute is correctly populated
descriptionObject[typeName]["id"] = typeName;
- JSONSchemaTypeDefinitionPtr globalType = JSONSchemaTypeDefinitionPtr(new JSONSchemaTypeDefinition());
+ JSONSchemaTypeDefinitionPtr globalType = std::make_shared<JSONSchemaTypeDefinition>();
globalType->name = typeName;
globalType->ID = typeName;
CJSONServiceDescription::addReferenceTypeDefinition(globalType);
@@ -1704,7 +1706,7 @@ bool CJSONServiceDescription::AddEnum(const std::string &name, const std::vector
values.size() == 0)
return false;
- JSONSchemaTypeDefinitionPtr definition = JSONSchemaTypeDefinitionPtr(new JSONSchemaTypeDefinition());
+ JSONSchemaTypeDefinitionPtr definition = std::make_shared<JSONSchemaTypeDefinition>();
definition->ID = name;
std::vector<CVariant::VariantType> types;
@@ -1994,7 +1996,7 @@ bool CJSONServiceDescription::parseJSONSchemaType(const CVariant &value, std::ve
// to handle a union type
for (unsigned int typeIndex = 0; typeIndex < value.size(); typeIndex++)
{
- JSONSchemaTypeDefinitionPtr definition = JSONSchemaTypeDefinitionPtr(new JSONSchemaTypeDefinition());
+ JSONSchemaTypeDefinitionPtr definition = std::make_shared<JSONSchemaTypeDefinition>();
// If the type is a string try to parse it
if (value[typeIndex].isString())
definition->type = StringToSchemaValueType(value[typeIndex].asString());
diff --git a/xbmc/interfaces/json-rpc/PVROperations.cpp b/xbmc/interfaces/json-rpc/PVROperations.cpp
index 3611ad6d66..50922320d0 100644
--- a/xbmc/interfaces/json-rpc/PVROperations.cpp
+++ b/xbmc/interfaces/json-rpc/PVROperations.cpp
@@ -27,6 +27,8 @@
#include "pvr/timers/PVRTimers.h"
#include "utils/Variant.h"
+#include <memory>
+
using namespace JSONRPC;
using namespace PVR;
using namespace KODI::MESSAGING;
@@ -217,7 +219,8 @@ JSONRPC_STATUS CPVROperations::GetBroadcastDetails(const std::string &method, IT
if (!epgTag)
return InvalidParams;
- HandleFileItem("broadcastid", false, "broadcastdetails", CFileItemPtr(new CFileItem(epgTag)), parameterObject, parameterObject["properties"], result, false);
+ HandleFileItem("broadcastid", false, "broadcastdetails", std::make_shared<CFileItem>(epgTag),
+ parameterObject, parameterObject["properties"], result, false);
return OK;
}
@@ -396,7 +399,8 @@ JSONRPC_STATUS CPVROperations::GetTimerDetails(const std::string &method, ITrans
if (!timer)
return InvalidParams;
- HandleFileItem("timerid", false, "timerdetails", CFileItemPtr(new CFileItem(timer)), parameterObject, parameterObject["properties"], result, false);
+ HandleFileItem("timerid", false, "timerdetails", std::make_shared<CFileItem>(timer),
+ parameterObject, parameterObject["properties"], result, false);
return OK;
}
diff --git a/xbmc/interfaces/json-rpc/VideoLibrary.cpp b/xbmc/interfaces/json-rpc/VideoLibrary.cpp
index db152cd634..f98c84552e 100644
--- a/xbmc/interfaces/json-rpc/VideoLibrary.cpp
+++ b/xbmc/interfaces/json-rpc/VideoLibrary.cpp
@@ -22,6 +22,8 @@
#include "video/VideoDbUrl.h"
#include "video/VideoLibraryQueue.h"
+#include <memory>
+
using namespace JSONRPC;
JSONRPC_STATUS CVideoLibrary::GetMovies(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
@@ -93,7 +95,8 @@ JSONRPC_STATUS CVideoLibrary::GetMovieDetails(const std::string &method, ITransp
if (!videodatabase.GetMovieInfo("", infos, id, RequiresAdditionalDetails(MediaTypeMovie, parameterObject)) || infos.m_iDbId <= 0)
return InvalidParams;
- HandleFileItem("movieid", true, "moviedetails", CFileItemPtr(new CFileItem(infos)), parameterObject, parameterObject["properties"], result, false);
+ HandleFileItem("movieid", true, "moviedetails", std::make_shared<CFileItem>(infos),
+ parameterObject, parameterObject["properties"], result, false);
return OK;
}
@@ -124,7 +127,8 @@ JSONRPC_STATUS CVideoLibrary::GetMovieSetDetails(const std::string &method, ITra
if (!videodatabase.GetSetInfo(id, infos) || infos.m_iDbId <= 0)
return InvalidParams;
- HandleFileItem("setid", false, "setdetails", CFileItemPtr(new CFileItem(infos)), parameterObject, parameterObject["properties"], result, false);
+ HandleFileItem("setid", false, "setdetails", std::make_shared<CFileItem>(infos), parameterObject,
+ parameterObject["properties"], result, false);
// Get movies from the set
CFileItemList items;
@@ -227,7 +231,7 @@ JSONRPC_STATUS CVideoLibrary::GetSeasonDetails(const std::string &method, ITrans
infos.m_iDbId <= 0 || infos.m_iIdShow <= 0)
return InvalidParams;
- CFileItemPtr pItem = CFileItemPtr(new CFileItem(infos));
+ CFileItemPtr pItem = std::make_shared<CFileItem>(infos);
HandleFileItem("seasonid", false, "seasondetails", pItem, parameterObject, parameterObject["properties"], result, false);
return OK;
}
@@ -301,7 +305,7 @@ JSONRPC_STATUS CVideoLibrary::GetEpisodeDetails(const std::string &method, ITran
if (!videodatabase.GetEpisodeInfo("", infos, id, RequiresAdditionalDetails(MediaTypeEpisode, parameterObject)) || infos.m_iDbId <= 0)
return InvalidParams;
- CFileItemPtr pItem = CFileItemPtr(new CFileItem(infos));
+ CFileItemPtr pItem = std::make_shared<CFileItem>(infos);
// We need to set the correct base path to get the valid fanart
int tvshowid = infos.m_iIdShow;
if (tvshowid <= 0)
@@ -374,7 +378,8 @@ JSONRPC_STATUS CVideoLibrary::GetMusicVideoDetails(const std::string &method, IT
if (!videodatabase.GetMusicVideoInfo("", infos, id, RequiresAdditionalDetails(MediaTypeMusicVideo, parameterObject)) || infos.m_iDbId <= 0)
return InvalidParams;
- HandleFileItem("musicvideoid", true, "musicvideodetails", CFileItemPtr(new CFileItem(infos)), parameterObject, parameterObject["properties"], result, false);
+ HandleFileItem("musicvideoid", true, "musicvideodetails", std::make_shared<CFileItem>(infos),
+ parameterObject, parameterObject["properties"], result, false);
return OK;
}
@@ -861,7 +866,8 @@ JSONRPC_STATUS CVideoLibrary::RefreshMovie(const std::string &method, ITransport
bool ignoreNfo = parameterObject["ignorenfo"].asBoolean();
std::string searchTitle = parameterObject["title"].asString();
- CVideoLibraryQueue::GetInstance().RefreshItem(CFileItemPtr(new CFileItem(infos)), ignoreNfo, true, false, searchTitle);
+ CVideoLibraryQueue::GetInstance().RefreshItem(std::make_shared<CFileItem>(infos), ignoreNfo, true,
+ false, searchTitle);
return ACK;
}
@@ -901,7 +907,7 @@ JSONRPC_STATUS CVideoLibrary::RefreshEpisode(const std::string &method, ITranspo
if (!videodatabase.GetEpisodeInfo("", infos, id) || infos.m_iDbId <= 0)
return InvalidParams;
- CFileItemPtr item = CFileItemPtr(new CFileItem(infos));
+ CFileItemPtr item = std::make_shared<CFileItem>(infos);
// We need to set the correct base path to get the valid fanart
int tvshowid = infos.m_iIdShow;
if (tvshowid <= 0)
@@ -928,7 +934,8 @@ JSONRPC_STATUS CVideoLibrary::RefreshMusicVideo(const std::string &method, ITran
bool ignoreNfo = parameterObject["ignorenfo"].asBoolean();
std::string searchTitle = parameterObject["title"].asString();
- CVideoLibraryQueue::GetInstance().RefreshItem(CFileItemPtr(new CFileItem(infos)), ignoreNfo, true, false, searchTitle);
+ CVideoLibraryQueue::GetInstance().RefreshItem(std::make_shared<CFileItem>(infos), ignoreNfo, true,
+ false, searchTitle);
return ACK;
}
@@ -1063,7 +1070,7 @@ bool CVideoLibrary::FillFileItemList(const CVariant &parameterObject, CFileItemL
videodatabase.GetMovieInfo("", details, movieID);
if (!details.IsEmpty())
{
- list.Add(CFileItemPtr(new CFileItem(details)));
+ list.Add(std::make_shared<CFileItem>(details));
success = true;
}
}
@@ -1072,7 +1079,7 @@ bool CVideoLibrary::FillFileItemList(const CVariant &parameterObject, CFileItemL
CVideoInfoTag details;
if (videodatabase.GetEpisodeInfo("", details, episodeID) && !details.IsEmpty())
{
- list.Add(CFileItemPtr(new CFileItem(details)));
+ list.Add(std::make_shared<CFileItem>(details));
success = true;
}
}
@@ -1082,7 +1089,7 @@ bool CVideoLibrary::FillFileItemList(const CVariant &parameterObject, CFileItemL
videodatabase.GetMusicVideoInfo("", details, musicVideoID);
if (!details.IsEmpty())
{
- list.Add(CFileItemPtr(new CFileItem(details)));
+ list.Add(std::make_shared<CFileItem>(details));
success = true;
}
}
diff --git a/xbmc/interfaces/legacy/ListItem.cpp b/xbmc/interfaces/legacy/ListItem.cpp
index 64410ad22a..397a38e136 100644
--- a/xbmc/interfaces/legacy/ListItem.cpp
+++ b/xbmc/interfaces/legacy/ListItem.cpp
@@ -23,6 +23,7 @@
#include "video/VideoInfoTag.h"
#include <cstdlib>
+#include <memory>
#include <sstream>
#include <utility>
@@ -39,7 +40,7 @@ namespace XBMCAddon
item.reset();
// create CFileItem
- item.reset(new CFileItem());
+ item = std::make_shared<CFileItem>();
if (!item) // not sure if this is really possible
return;
diff --git a/xbmc/interfaces/legacy/ListItem.h b/xbmc/interfaces/legacy/ListItem.h
index 82513e0f45..85662588e9 100644
--- a/xbmc/interfaces/legacy/ListItem.h
+++ b/xbmc/interfaces/legacy/ListItem.h
@@ -22,6 +22,7 @@
#include "commons/Exception.h"
#include <map>
+#include <memory>
#include <utility>
#include <vector>
@@ -110,7 +111,7 @@ namespace XBMCAddon
static inline AddonClass::Ref<ListItem> fromString(const String& str)
{
AddonClass::Ref<ListItem> ret = AddonClass::Ref<ListItem>(new ListItem());
- ret->item.reset(new CFileItem(str));
+ ret->item = std::make_shared<CFileItem>(str);
return ret;
}
#endif
diff --git a/xbmc/interfaces/python/ContextItemAddonInvoker.cpp b/xbmc/interfaces/python/ContextItemAddonInvoker.cpp
index 734193b15c..be529ffbea 100644
--- a/xbmc/interfaces/python/ContextItemAddonInvoker.cpp
+++ b/xbmc/interfaces/python/ContextItemAddonInvoker.cpp
@@ -12,14 +12,14 @@
#include "interfaces/python/swig.h"
#include "utils/log.h"
+#include <memory>
+
#include <Python.h>
#include <osdefs.h>
-
-CContextItemAddonInvoker::CContextItemAddonInvoker(
- ILanguageInvocationHandler *invocationHandler,
- const CFileItemPtr& item)
- : CAddonPythonInvoker(invocationHandler), m_item(CFileItemPtr(new CFileItem(*item.get())))
+CContextItemAddonInvoker::CContextItemAddonInvoker(ILanguageInvocationHandler* invocationHandler,
+ const CFileItemPtr& item)
+ : CAddonPythonInvoker(invocationHandler), m_item(std::make_shared<CFileItem>(*item.get()))
{
}
diff --git a/xbmc/messaging/ApplicationMessenger.cpp b/xbmc/messaging/ApplicationMessenger.cpp
index dfacac9e1e..d9eab6147a 100644
--- a/xbmc/messaging/ApplicationMessenger.cpp
+++ b/xbmc/messaging/ApplicationMessenger.cpp
@@ -96,7 +96,7 @@ int CApplicationMessenger::SendMsg(ThreadMessage&& message, bool wait)
// forever!
if (m_guiThreadId != CThread::GetCurrentThreadId())
{
- message.waitEvent.reset(new CEvent(true));
+ message.waitEvent = std::make_shared<CEvent>(true);
waitEvent = message.waitEvent;
result = message.result;
}
diff --git a/xbmc/music/MusicUtils.cpp b/xbmc/music/MusicUtils.cpp
index 0ebee30c01..15697919c1 100644
--- a/xbmc/music/MusicUtils.cpp
+++ b/xbmc/music/MusicUtils.cpp
@@ -42,6 +42,8 @@
#include "utils/log.h"
#include "view/GUIViewState.h"
+#include <memory>
+
using namespace MUSIC_INFO;
using namespace XFILE;
using namespace std::chrono_literals;
@@ -155,7 +157,7 @@ public:
const auto appPlayer = components.GetComponent<CApplicationPlayer>();
if (appPlayer->IsPlayingAudio() && g_application.CurrentFileItem().HasMusicInfoTag())
{
- CFileItemPtr songitem = CFileItemPtr(new CFileItem(g_application.CurrentFileItem()));
+ CFileItemPtr songitem = std::make_shared<CFileItem>(g_application.CurrentFileItem());
if (HasSongExtraArtChanged(songitem, type, itemID, db))
g_application.UpdateCurrentPlayArt();
}
diff --git a/xbmc/music/windows/GUIWindowMusicBase.cpp b/xbmc/music/windows/GUIWindowMusicBase.cpp
index b3cff68c93..9dc4e2dddd 100644
--- a/xbmc/music/windows/GUIWindowMusicBase.cpp
+++ b/xbmc/music/windows/GUIWindowMusicBase.cpp
@@ -8,33 +8,24 @@
#include "GUIWindowMusicBase.h"
+#include "Autorun.h"
+#include "FileItem.h"
+#include "GUIInfoManager.h"
+#include "GUIPassword.h"
#include "GUIUserMessages.h"
+#include "PartyModeManager.h"
#include "PlayListPlayer.h"
#include "ServiceBroker.h"
+#include "URL.h"
#include "Util.h"
+#include "addons/gui/GUIDialogAddonInfo.h"
#include "application/Application.h"
#include "application/ApplicationComponents.h"
#include "application/ApplicationPlayer.h"
-#include "dialogs/GUIDialogMediaSource.h"
-#include "input/actions/Action.h"
-#include "input/actions/ActionIDs.h"
-#include "music/MusicDbUrl.h"
-#include "music/MusicLibraryQueue.h"
-#include "music/MusicUtils.h"
-#include "music/dialogs/GUIDialogInfoProviderSettings.h"
-#include "music/dialogs/GUIDialogMusicInfo.h"
-#include "playlists/PlayList.h"
-#include "playlists/PlayListFactory.h"
#ifdef HAS_CDDA_RIPPER
#include "cdrip/CDDARipper.h"
#endif
-#include "Autorun.h"
-#include "FileItem.h"
-#include "GUIInfoManager.h"
-#include "GUIPassword.h"
-#include "PartyModeManager.h"
-#include "URL.h"
-#include "addons/gui/GUIDialogAddonInfo.h"
+#include "dialogs/GUIDialogMediaSource.h"
#include "dialogs/GUIDialogProgress.h"
#include "dialogs/GUIDialogSmartPlaylistEditor.h"
#include "dialogs/GUIDialogYesNo.h"
@@ -44,10 +35,19 @@
#include "guilib/GUIWindowManager.h"
#include "guilib/LocalizeStrings.h"
#include "guilib/guiinfo/GUIInfoLabels.h"
+#include "input/actions/Action.h"
+#include "input/actions/ActionIDs.h"
#include "messaging/helpers/DialogHelper.h"
#include "messaging/helpers/DialogOKHelper.h"
+#include "music/MusicDbUrl.h"
+#include "music/MusicLibraryQueue.h"
+#include "music/MusicUtils.h"
+#include "music/dialogs/GUIDialogInfoProviderSettings.h"
+#include "music/dialogs/GUIDialogMusicInfo.h"
#include "music/infoscanner/MusicInfoScanner.h"
#include "music/tags/MusicInfoTag.h"
+#include "playlists/PlayList.h"
+#include "playlists/PlayListFactory.h"
#include "profiles/ProfileManager.h"
#include "settings/AdvancedSettings.h"
#include "settings/MediaSourceSettings.h"
@@ -65,6 +65,7 @@
#include "view/GUIViewState.h"
#include <algorithm>
+#include <memory>
using namespace XFILE;
using namespace MUSICDATABASEDIRECTORY;
@@ -842,7 +843,7 @@ bool CGUIWindowMusicBase::GetDirectory(const std::string &strDirectory, CFileIte
newPlaylist->m_bIsFolder = true;
items.Add(newPlaylist);
- newPlaylist.reset(new CFileItem("newplaylist://", false));
+ newPlaylist = std::make_shared<CFileItem>("newplaylist://", false);
newPlaylist->SetLabel(g_localizeStrings.Get(525));
newPlaylist->SetArt("icon", "DefaultAddSource.png");
newPlaylist->SetLabelPreformatted(true);
@@ -850,7 +851,7 @@ bool CGUIWindowMusicBase::GetDirectory(const std::string &strDirectory, CFileIte
newPlaylist->SetCanQueue(false);
items.Add(newPlaylist);
- newPlaylist.reset(new CFileItem("newsmartplaylist://music", false));
+ newPlaylist = std::make_shared<CFileItem>("newsmartplaylist://music", false);
newPlaylist->SetLabel(g_localizeStrings.Get(21437));
newPlaylist->SetArt("icon", "DefaultAddSource.png");
newPlaylist->SetLabelPreformatted(true);
diff --git a/xbmc/music/windows/MusicFileItemListModifier.cpp b/xbmc/music/windows/MusicFileItemListModifier.cpp
index c78de793fd..fe04aed423 100644
--- a/xbmc/music/windows/MusicFileItemListModifier.cpp
+++ b/xbmc/music/windows/MusicFileItemListModifier.cpp
@@ -17,6 +17,8 @@
#include "settings/Settings.h"
#include "settings/SettingsComponent.h"
+#include <memory>
+
using namespace XFILE::MUSICDATABASEDIRECTORY;
bool CMusicFileItemListModifier::CanModify(const CFileItemList &items) const
@@ -74,7 +76,7 @@ void CMusicFileItemListModifier::AddQueuingFolder(CFileItemList& items)
switch (nodeChildType)
{
case NODE_TYPE_ARTIST:
- pItem.reset(new CFileItem(g_localizeStrings.Get(15103))); // "All Artists"
+ pItem = std::make_shared<CFileItem>(g_localizeStrings.Get(15103)); // "All Artists"
musicUrl.AppendPath("-1/");
pItem->SetPath(musicUrl.ToString());
break;
@@ -84,14 +86,14 @@ void CMusicFileItemListModifier::AddQueuingFolder(CFileItemList& items)
case NODE_TYPE_ALBUM_RECENTLY_PLAYED:
case NODE_TYPE_ALBUM_RECENTLY_ADDED:
case NODE_TYPE_ALBUM_TOP100:
- pItem.reset(new CFileItem(g_localizeStrings.Get(15102))); // "All Albums"
+ pItem = std::make_shared<CFileItem>(g_localizeStrings.Get(15102)); // "All Albums"
musicUrl.AppendPath("-1/");
pItem->SetPath(musicUrl.ToString());
break;
// Disc node
case NODE_TYPE_DISC:
- pItem.reset(new CFileItem(g_localizeStrings.Get(38075))); // "All Discs"
+ pItem = std::make_shared<CFileItem>(g_localizeStrings.Get(38075)); // "All Discs"
musicUrl.AppendPath("-1/");
pItem->SetPath(musicUrl.ToString());
break;
diff --git a/xbmc/network/upnp/UPnPInternal.cpp b/xbmc/network/upnp/UPnPInternal.cpp
index 19f1cfbe03..c4ec1d946c 100644
--- a/xbmc/network/upnp/UPnPInternal.cpp
+++ b/xbmc/network/upnp/UPnPInternal.cpp
@@ -32,6 +32,7 @@
#include <algorithm>
#include <array>
+#include <memory>
#include <optional>
#include <string_view>
@@ -1411,7 +1412,7 @@ std::shared_ptr<CFileItem> GetFileItem(const NPT_String& uri, const NPT_String&
}
else
{
- item.reset(new CFileItem((const char*)uri, false));
+ item = std::make_shared<CFileItem>((const char*)uri, false);
}
return item;
}
diff --git a/xbmc/network/upnp/UPnPServer.cpp b/xbmc/network/upnp/UPnPServer.cpp
index 7085c06599..ebd11ddb99 100644
--- a/xbmc/network/upnp/UPnPServer.cpp
+++ b/xbmc/network/upnp/UPnPServer.cpp
@@ -43,6 +43,8 @@
#include "view/GUIViewState.h"
#include "xbmc/interfaces/AnnouncementManager.h"
+#include <memory>
+
#include <Platinum/Source/Platinum/Platinum.h>
NPT_SET_LOCAL_LOGGER("xbmc.upnp.server")
@@ -601,7 +603,7 @@ CUPnPServer::OnBrowseMetadata(PLT_ActionReference& action,
id.TrimRight("/");
if (id == "virtualpath://upnproot") {
id += "/";
- item.reset(new CFileItem((const char*)id, true));
+ item = std::make_shared<CFileItem>((const char*)id, true);
item->SetLabel("Root");
item->SetLabelPreformatted(true);
object = Build(item, true, context, thumb_loader);
@@ -610,7 +612,7 @@ CUPnPServer::OnBrowseMetadata(PLT_ActionReference& action,
return NPT_FAILURE;
}
} else {
- item.reset(new CFileItem((const char*)id, false));
+ item = std::make_shared<CFileItem>((const char*)id, false);
// attempt to determine the parent of this item
std::string parent;
@@ -713,13 +715,13 @@ CUPnPServer::OnBrowseDirectChildren(PLT_ActionReference& action,
CFileItemPtr item;
// music library
- item.reset(new CFileItem("musicdb://", true));
+ item = std::make_shared<CFileItem>("musicdb://", true);
item->SetLabel("Music Library");
item->SetLabelPreformatted(true);
items.Add(item);
// video library
- item.reset(new CFileItem("library://video/", true));
+ item = std::make_shared<CFileItem>("library://video/", true);
item->SetLabel("Video Library");
item->SetLabelPreformatted(true);
items.Add(item);
diff --git a/xbmc/pictures/GUIWindowSlideShow.cpp b/xbmc/pictures/GUIWindowSlideShow.cpp
index e2f9db7bba..ba56dad85a 100644
--- a/xbmc/pictures/GUIWindowSlideShow.cpp
+++ b/xbmc/pictures/GUIWindowSlideShow.cpp
@@ -40,6 +40,7 @@
#include "utils/XTimeUtils.h"
#include "utils/log.h"
+#include <memory>
#include <random>
using namespace XFILE;
@@ -345,7 +346,7 @@ void CGUIWindowSlideShow::Select(const std::string& strPicture)
void CGUIWindowSlideShow::GetSlideShowContents(CFileItemList &list)
{
for (size_t index = 0; index < m_slides.size(); index++)
- list.Add(CFileItemPtr(new CFileItem(*m_slides.at(index))));
+ list.Add(std::make_shared<CFileItem>(*m_slides.at(index)));
}
std::shared_ptr<const CFileItem> CGUIWindowSlideShow::GetCurrentSlide()
diff --git a/xbmc/profiles/ProfileManager.cpp b/xbmc/profiles/ProfileManager.cpp
index 600c812cf1..827bfb112f 100644
--- a/xbmc/profiles/ProfileManager.cpp
+++ b/xbmc/profiles/ProfileManager.cpp
@@ -8,13 +8,17 @@
#include "ProfileManager.h"
+#include "ContextMenuManager.h" //! @todo Remove me
#include "DatabaseManager.h"
#include "FileItem.h"
#include "GUIInfoManager.h"
#include "GUIPassword.h"
#include "PasswordManager.h"
+#include "PlayListPlayer.h" //! @todo Remove me
#include "ServiceBroker.h"
#include "Util.h"
+#include "addons/AddonManager.h" //! @todo Remove me
+#include "addons/Service.h" //! @todo Remove me
#include "addons/Skin.h"
#include "application/Application.h" //! @todo Remove me
#include "application/ApplicationComponents.h"
@@ -23,6 +27,7 @@
#include "dialogs/GUIDialogYesNo.h"
#include "events/EventLog.h"
#include "events/EventLogManager.h"
+#include "favourites/FavouritesService.h" //! @todo Remove me
#include "filesystem/Directory.h"
#include "filesystem/DirectoryCache.h"
#include "filesystem/File.h"
@@ -30,31 +35,20 @@
#include "guilib/GUIComponent.h"
#include "guilib/GUIWindowManager.h"
#include "guilib/LocalizeStrings.h"
+#include "guilib/StereoscopicsManager.h" //! @todo Remove me
#include "input/InputManager.h"
+#include "interfaces/json-rpc/JSONRPC.h" //! @todo Remove me
#include "music/MusicLibraryQueue.h"
+#include "network/Network.h" //! @todo Remove me
+#include "network/NetworkServices.h" //! @todo Remove me
+#include "pvr/PVRManager.h" //! @todo Remove me
#include "settings/Settings.h"
#include "settings/SettingsComponent.h"
#include "settings/lib/SettingsManager.h"
-#include "threads/SingleLock.h"
-
-#include <algorithm>
-#include <mutex>
-#include <string>
-#include <vector>
#if !defined(TARGET_WINDOWS) && defined(HAS_OPTICAL_DRIVE)
#include "storage/DetectDVDType.h"
#endif
-#include "ContextMenuManager.h" //! @todo Remove me
-#include "PlayListPlayer.h" //! @todo Remove me
-#include "addons/AddonManager.h" //! @todo Remove me
-#include "addons/Service.h" //! @todo Remove me
-#include "application/Application.h" //! @todo Remove me
-#include "favourites/FavouritesService.h" //! @todo Remove me
-#include "guilib/StereoscopicsManager.h" //! @todo Remove me
-#include "interfaces/json-rpc/JSONRPC.h" //! @todo Remove me
-#include "network/Network.h" //! @todo Remove me
-#include "network/NetworkServices.h" //! @todo Remove me
-#include "pvr/PVRManager.h" //! @todo Remove me
+#include "threads/SingleLock.h"
#include "utils/FileUtils.h"
#include "utils/StringUtils.h"
#include "utils/URIUtils.h"
@@ -64,6 +58,12 @@
#include "video/VideoLibraryQueue.h" //! @todo Remove me
#include "weather/WeatherManager.h" //! @todo Remove me
+#include <algorithm>
+#include <memory>
+#include <mutex>
+#include <string>
+#include <vector>
+
//! @todo
//! eventually the profile should dictate where special://masterprofile/ is
//! but for now it makes sense to leave all the profile settings in a user
@@ -506,7 +506,8 @@ bool CProfileManager::DeleteProfile(unsigned int index)
m_settings->Save();
}
- CFileItemPtr item = CFileItemPtr(new CFileItem(URIUtils::AddFileToFolder(GetUserDataFolder(), strDirectory)));
+ CFileItemPtr item =
+ std::make_shared<CFileItem>(URIUtils::AddFileToFolder(GetUserDataFolder(), strDirectory));
item->SetPath(URIUtils::AddFileToFolder(GetUserDataFolder(), strDirectory + "/"));
item->m_bIsFolder = true;
item->Select(true);
diff --git a/xbmc/pvr/PVRManager.cpp b/xbmc/pvr/PVRManager.cpp
index dc950a7148..9dc0d7c120 100644
--- a/xbmc/pvr/PVRManager.cpp
+++ b/xbmc/pvr/PVRManager.cpp
@@ -349,11 +349,11 @@ void CPVRManager::ResetProperties()
std::unique_lock<CCriticalSection> lock(m_critSection);
Clear();
- m_database.reset(new CPVRDatabase);
- m_providers.reset(new CPVRProviders);
- m_channelGroups.reset(new CPVRChannelGroupsContainer);
- m_recordings.reset(new CPVRRecordings);
- m_timers.reset(new CPVRTimers);
+ m_database = std::make_shared<CPVRDatabase>();
+ m_providers = std::make_shared<CPVRProviders>();
+ m_channelGroups = std::make_shared<CPVRChannelGroupsContainer>();
+ m_recordings = std::make_shared<CPVRRecordings>();
+ m_timers = std::make_shared<CPVRTimers>();
m_guiInfo.reset(new CPVRGUIInfo);
m_parentalTimer.reset(new CStopWatch);
m_knownClients.clear();
diff --git a/xbmc/pvr/addons/PVRClient.cpp b/xbmc/pvr/addons/PVRClient.cpp
index f149301cce..7e19c5650e 100644
--- a/xbmc/pvr/addons/PVRClient.cpp
+++ b/xbmc/pvr/addons/PVRClient.cpp
@@ -1532,7 +1532,7 @@ PVR_ERROR CPVRClient::OnPowerSavingDeactivated()
std::shared_ptr<CPVRClientMenuHooks> CPVRClient::GetMenuHooks()
{
if (!m_menuhooks)
- m_menuhooks.reset(new CPVRClientMenuHooks(ID()));
+ m_menuhooks = std::make_shared<CPVRClientMenuHooks>(ID());
return m_menuhooks;
}
diff --git a/xbmc/pvr/dialogs/GUIDialogPVRTimerSettings.cpp b/xbmc/pvr/dialogs/GUIDialogPVRTimerSettings.cpp
index f7866278e7..a1098ea377 100644
--- a/xbmc/pvr/dialogs/GUIDialogPVRTimerSettings.cpp
+++ b/xbmc/pvr/dialogs/GUIDialogPVRTimerSettings.cpp
@@ -778,8 +778,8 @@ void CGUIDialogPVRTimerSettings::AddCondition(const std::shared_ptr<CSetting>& s
{
GetSettingsManager()->AddDynamicCondition(identifier, condition, this);
CSettingDependency dep(depType, GetSettingsManager());
- dep.And()->Add(CSettingDependencyConditionPtr(
- new CSettingDependencyCondition(identifier, "true", settingId, false, GetSettingsManager())));
+ dep.And()->Add(std::make_shared<CSettingDependencyCondition>(identifier, "true", settingId, false,
+ GetSettingsManager()));
SettingDependencies deps(setting->GetDependencies());
deps.push_back(dep);
setting->SetDependencies(deps);
diff --git a/xbmc/pvr/epg/EpgContainer.cpp b/xbmc/pvr/epg/EpgContainer.cpp
index 027cea91ed..fa8865078d 100644
--- a/xbmc/pvr/epg/EpgContainer.cpp
+++ b/xbmc/pvr/epg/EpgContainer.cpp
@@ -572,8 +572,8 @@ std::shared_ptr<CPVREpg> CPVREpgContainer::CreateChannelEpg(int iEpgId, const st
if (iEpgId <= 0)
iEpgId = NextEpgId();
- epg.reset(new CPVREpg(iEpgId, channelData->ChannelName(), strScraperName, channelData,
- GetEpgDatabase()));
+ epg = std::make_shared<CPVREpg>(iEpgId, channelData->ChannelName(), strScraperName, channelData,
+ GetEpgDatabase());
std::unique_lock<CCriticalSection> lock(m_critSection);
m_epgIdToEpgMap.insert({iEpgId, epg});
diff --git a/xbmc/pvr/epg/EpgInfoTag.cpp b/xbmc/pvr/epg/EpgInfoTag.cpp
index 8b0930e5d2..f7843dfce0 100644
--- a/xbmc/pvr/epg/EpgInfoTag.cpp
+++ b/xbmc/pvr/epg/EpgInfoTag.cpp
@@ -138,7 +138,7 @@ void CPVREpgInfoTag::SetChannelData(const std::shared_ptr<CPVREpgChannelData>& d
if (data)
m_channelData = data;
else
- m_channelData.reset(new CPVREpgChannelData);
+ m_channelData = std::make_shared<CPVREpgChannelData>();
}
bool CPVREpgInfoTag::operator==(const CPVREpgInfoTag& right) const
diff --git a/xbmc/pvr/filesystem/PVRGUIDirectory.cpp b/xbmc/pvr/filesystem/PVRGUIDirectory.cpp
index cf7baf0576..8928cc0539 100644
--- a/xbmc/pvr/filesystem/PVRGUIDirectory.cpp
+++ b/xbmc/pvr/filesystem/PVRGUIDirectory.cpp
@@ -72,8 +72,8 @@ bool GetRootDirectory(bool bRadio, CFileItemList& results)
const bool bAnyClientSupportingEPG = clients->AnyClientSupportingEPG();
if (bAnyClientSupportingEPG)
{
- item.reset(
- new CFileItem(StringUtils::Format("pvr://guide/{}/", bRadio ? "radio" : "tv"), true));
+ item = std::make_shared<CFileItem>(
+ StringUtils::Format("pvr://guide/{}/", bRadio ? "radio" : "tv"), true);
item->SetLabel(g_localizeStrings.Get(19069)); // Guide
item->SetProperty("node.target", CWindowTranslator::TranslateWindow(bRadio ? WINDOW_RADIO_GUIDE
: WINDOW_TV_GUIDE));
@@ -82,8 +82,8 @@ bool GetRootDirectory(bool bRadio, CFileItemList& results)
}
// Channels
- item.reset(new CFileItem(
- bRadio ? CPVRChannelsPath::PATH_RADIO_CHANNELS : CPVRChannelsPath::PATH_TV_CHANNELS, true));
+ item = std::make_shared<CFileItem>(
+ bRadio ? CPVRChannelsPath::PATH_RADIO_CHANNELS : CPVRChannelsPath::PATH_TV_CHANNELS, true);
item->SetLabel(g_localizeStrings.Get(19019)); // Channels
item->SetProperty("node.target", CWindowTranslator::TranslateWindow(bRadio ? WINDOW_RADIO_CHANNELS
: WINDOW_TV_CHANNELS));
@@ -93,9 +93,9 @@ bool GetRootDirectory(bool bRadio, CFileItemList& results)
// Recordings
if (clients->AnyClientSupportingRecordings())
{
- item.reset(new CFileItem(bRadio ? CPVRRecordingsPath::PATH_ACTIVE_RADIO_RECORDINGS
- : CPVRRecordingsPath::PATH_ACTIVE_TV_RECORDINGS,
- true));
+ item = std::make_shared<CFileItem>(bRadio ? CPVRRecordingsPath::PATH_ACTIVE_RADIO_RECORDINGS
+ : CPVRRecordingsPath::PATH_ACTIVE_TV_RECORDINGS,
+ true);
item->SetLabel(g_localizeStrings.Get(19017)); // Recordings
item->SetProperty("node.target", CWindowTranslator::TranslateWindow(
bRadio ? WINDOW_RADIO_RECORDINGS : WINDOW_TV_RECORDINGS));
@@ -105,16 +105,16 @@ bool GetRootDirectory(bool bRadio, CFileItemList& results)
// Timers/Timer rules
// - always present, because Reminders are always available, no client support needed for this
- item.reset(new CFileItem(
- bRadio ? CPVRTimersPath::PATH_RADIO_TIMERS : CPVRTimersPath::PATH_TV_TIMERS, true));
+ item = std::make_shared<CFileItem>(
+ bRadio ? CPVRTimersPath::PATH_RADIO_TIMERS : CPVRTimersPath::PATH_TV_TIMERS, true);
item->SetLabel(g_localizeStrings.Get(19040)); // Timers
item->SetProperty("node.target", CWindowTranslator::TranslateWindow(bRadio ? WINDOW_RADIO_TIMERS
: WINDOW_TV_TIMERS));
item->SetArt("icon", "DefaultPVRTimers.png");
results.Add(item);
- item.reset(new CFileItem(
- bRadio ? CPVRTimersPath::PATH_RADIO_TIMER_RULES : CPVRTimersPath::PATH_TV_TIMER_RULES, true));
+ item = std::make_shared<CFileItem>(
+ bRadio ? CPVRTimersPath::PATH_RADIO_TIMER_RULES : CPVRTimersPath::PATH_TV_TIMER_RULES, true);
item->SetLabel(g_localizeStrings.Get(19138)); // Timer rules
item->SetProperty("node.target", CWindowTranslator::TranslateWindow(
bRadio ? WINDOW_RADIO_TIMER_RULES : WINDOW_TV_TIMER_RULES));
@@ -124,8 +124,8 @@ bool GetRootDirectory(bool bRadio, CFileItemList& results)
// Search
if (bAnyClientSupportingEPG)
{
- item.reset(new CFileItem(
- bRadio ? CPVREpgSearchPath::PATH_RADIO_SEARCH : CPVREpgSearchPath::PATH_TV_SEARCH, true));
+ item = std::make_shared<CFileItem>(
+ bRadio ? CPVREpgSearchPath::PATH_RADIO_SEARCH : CPVREpgSearchPath::PATH_TV_SEARCH, true);
item->SetLabel(g_localizeStrings.Get(137)); // Search
item->SetProperty("node.target", CWindowTranslator::TranslateWindow(bRadio ? WINDOW_RADIO_SEARCH
: WINDOW_TV_SEARCH));
@@ -154,17 +154,17 @@ bool CPVRGUIDirectory::GetDirectory(CFileItemList& results) const
{
std::shared_ptr<CFileItem> item;
- item.reset(new CFileItem(base + "channels/", true));
+ item = std::make_shared<CFileItem>(base + "channels/", true);
item->SetLabel(g_localizeStrings.Get(19019)); // Channels
item->SetLabelPreformatted(true);
results.Add(item);
- item.reset(new CFileItem(base + "recordings/active/", true));
+ item = std::make_shared<CFileItem>(base + "recordings/active/", true);
item->SetLabel(g_localizeStrings.Get(19017)); // Recordings
item->SetLabelPreformatted(true);
results.Add(item);
- item.reset(new CFileItem(base + "recordings/deleted/", true));
+ item = std::make_shared<CFileItem>(base + "recordings/deleted/", true);
item->SetLabel(g_localizeStrings.Get(19184)); // Deleted recordings
item->SetLabelPreformatted(true);
results.Add(item);
@@ -309,7 +309,7 @@ void GetSubDirectories(const CPVRRecordingsPath& recParentPath,
std::shared_ptr<CFileItem> item;
if (!results.Contains(strFilePath))
{
- item.reset(new CFileItem(strCurrent, true));
+ item = std::make_shared<CFileItem>(strCurrent, true);
item->SetPath(strFilePath);
item->SetLabel(strCurrent);
item->SetLabelPreformatted(true);
@@ -468,13 +468,13 @@ bool CPVRGUIDirectory::GetChannelsDirectory(CFileItemList& results) const
std::shared_ptr<CFileItem> item;
// all tv channels
- item.reset(new CFileItem(CPVRChannelsPath::PATH_TV_CHANNELS, true));
+ item = std::make_shared<CFileItem>(CPVRChannelsPath::PATH_TV_CHANNELS, true);
item->SetLabel(g_localizeStrings.Get(19020)); // TV
item->SetLabelPreformatted(true);
results.Add(item);
// all radio channels
- item.reset(new CFileItem(CPVRChannelsPath::PATH_RADIO_CHANNELS, true));
+ item = std::make_shared<CFileItem>(CPVRChannelsPath::PATH_RADIO_CHANNELS, true);
item->SetLabel(g_localizeStrings.Get(19021)); // Radio
item->SetLabelPreformatted(true);
results.Add(item);
@@ -575,7 +575,7 @@ bool GetTimersSubDirectory(const CPVRTimersPath& path,
if ((timer->IsRadio() == bRadio) && timer->HasParent() && (timer->ClientID() == iClientId) &&
(timer->ParentClientIndex() == iParentId) && (!bHideDisabled || !timer->IsDisabled()))
{
- item.reset(new CFileItem(timer));
+ item = std::make_shared<CFileItem>(timer);
const CPVRTimersPath timersPath(path.GetPath(), timer->ClientID(), timer->ClientIndex());
item->SetPath(timersPath.GetPath());
results.Add(item);
diff --git a/xbmc/pvr/guilib/GUIEPGGridContainerModel.cpp b/xbmc/pvr/guilib/GUIEPGGridContainerModel.cpp
index f4b4fee56f..38e6e0645d 100644
--- a/xbmc/pvr/guilib/GUIEPGGridContainerModel.cpp
+++ b/xbmc/pvr/guilib/GUIEPGGridContainerModel.cpp
@@ -132,7 +132,7 @@ void CGUIEPGGridContainerModel::Initialize(const std::unique_ptr<CFileItemList>&
const CDateTimeSpan unit(0, 0, iRulerUnit * MINSPERBLOCK, 0);
for (; ruler < rulerEnd; ruler += unit)
{
- rulerItem.reset(new CFileItem(ruler.GetAsLocalizedTime("", false)));
+ rulerItem = std::make_shared<CFileItem>(ruler.GetAsLocalizedTime("", false));
rulerItem->SetLabel2(ruler.GetAsLocalizedDate(true));
m_rulerItems.emplace_back(rulerItem);
}
diff --git a/xbmc/pvr/guilib/PVRGUIChannelNavigator.cpp b/xbmc/pvr/guilib/PVRGUIChannelNavigator.cpp
index 0ccfdf8822..538217c9ae 100644
--- a/xbmc/pvr/guilib/PVRGUIChannelNavigator.cpp
+++ b/xbmc/pvr/guilib/PVRGUIChannelNavigator.cpp
@@ -23,6 +23,7 @@
#include "utils/JobManager.h"
#include "utils/XTimeUtils.h"
+#include <memory>
#include <mutex>
using namespace KODI::GUILIB::GUIINFO;
@@ -316,7 +317,7 @@ void CPVRGUIChannelNavigator::HideInfo()
{
m_currentChannel = m_playingChannel;
if (m_playingChannel)
- item.reset(new CFileItem(m_playingChannel));
+ item = std::make_shared<CFileItem>(m_playingChannel);
}
CheckAndPublishPreviewAndPlayerShowInfoChangedEvent();
@@ -350,7 +351,7 @@ void CPVRGUIChannelNavigator::SetPlayingChannel(
{
m_currentChannel = m_playingChannel;
if (m_playingChannel)
- item.reset(new CFileItem(m_playingChannel));
+ item = std::make_shared<CFileItem>(m_playingChannel);
}
CheckAndPublishPreviewAndPlayerShowInfoChangedEvent();
diff --git a/xbmc/pvr/timers/PVRTimerInfoTag.cpp b/xbmc/pvr/timers/PVRTimerInfoTag.cpp
index 0a11cf86e0..ba153d0033 100644
--- a/xbmc/pvr/timers/PVRTimerInfoTag.cpp
+++ b/xbmc/pvr/timers/PVRTimerInfoTag.cpp
@@ -829,7 +829,7 @@ std::shared_ptr<CPVRTimerInfoTag> CPVRTimerInfoTag::CreateFromDate(
if (!newTimer)
{
- newTimer.reset(new CPVRTimerInfoTag);
+ newTimer = std::make_shared<CPVRTimerInfoTag>();
newTimer->m_iClientIndex = PVR_TIMER_NO_CLIENT_INDEX;
newTimer->m_iParentClientIndex = PVR_TIMER_NO_PARENT;
diff --git a/xbmc/pvr/timers/PVRTimers.cpp b/xbmc/pvr/timers/PVRTimers.cpp
index 9537a52016..0d37840eed 100644
--- a/xbmc/pvr/timers/PVRTimers.cpp
+++ b/xbmc/pvr/timers/PVRTimers.cpp
@@ -264,8 +264,7 @@ bool CPVRTimers::UpdateEntries(const CPVRTimersContainer& timers,
else
{
/* new timer */
- std::shared_ptr<CPVRTimerInfoTag> newTimer =
- std::shared_ptr<CPVRTimerInfoTag>(new CPVRTimerInfoTag);
+ std::shared_ptr<CPVRTimerInfoTag> newTimer = std::make_shared<CPVRTimerInfoTag>();
newTimer->UpdateEntry(timersEntry);
newTimer->SetTimerID(++m_iLastId);
InsertEntry(newTimer);
@@ -928,7 +927,7 @@ std::shared_ptr<CPVRTimerInfoTag> CPVRTimers::UpdateEntry(
}
else
{
- tag.reset(new CPVRTimerInfoTag());
+ tag = std::make_shared<CPVRTimerInfoTag>();
if (tag->UpdateEntry(timer))
{
tag->SetTimerID(++m_iLastId);
diff --git a/xbmc/settings/dialogs/GUIDialogContentSettings.cpp b/xbmc/settings/dialogs/GUIDialogContentSettings.cpp
index da4caf1b6c..61a5edc454 100644
--- a/xbmc/settings/dialogs/GUIDialogContentSettings.cpp
+++ b/xbmc/settings/dialogs/GUIDialogContentSettings.cpp
@@ -367,16 +367,29 @@ void CGUIDialogContentSettings::InitializeSettings()
// define an enable dependency with (m_useDirectoryNames && !m_containsSingleItem) || !m_useDirectoryNames
CSettingDependency dependencyScanRecursive(SettingDependencyType::Enable, GetSettingsManager());
dependencyScanRecursive.Or()
- ->Add(CSettingDependencyConditionCombinationPtr((new CSettingDependencyConditionCombination(BooleanLogicOperationAnd, GetSettingsManager())) // m_useDirectoryNames && !m_containsSingleItem
- ->Add(CSettingDependencyConditionPtr(new CSettingDependencyCondition(SETTING_USE_DIRECTORY_NAMES, "true", SettingDependencyOperator::Equals, false, GetSettingsManager()))) // m_useDirectoryNames
- ->Add(CSettingDependencyConditionPtr(new CSettingDependencyCondition(SETTING_CONTAINS_SINGLE_ITEM, "false", SettingDependencyOperator::Equals, false, GetSettingsManager()))))) // !m_containsSingleItem
- ->Add(CSettingDependencyConditionPtr(new CSettingDependencyCondition(SETTING_USE_DIRECTORY_NAMES, "false", SettingDependencyOperator::Equals, false, GetSettingsManager()))); // !m_useDirectoryNames
+ ->Add(CSettingDependencyConditionCombinationPtr(
+ (new CSettingDependencyConditionCombination(
+ BooleanLogicOperationAnd,
+ GetSettingsManager())) // m_useDirectoryNames && !m_containsSingleItem
+ ->Add(std::make_shared<CSettingDependencyCondition>(
+ SETTING_USE_DIRECTORY_NAMES, "true", SettingDependencyOperator::Equals, false,
+ GetSettingsManager())) // m_useDirectoryNames
+ ->Add(std::make_shared<CSettingDependencyCondition>(
+ SETTING_CONTAINS_SINGLE_ITEM, "false", SettingDependencyOperator::Equals,
+ false, GetSettingsManager())))) // !m_containsSingleItem
+ ->Add(std::make_shared<CSettingDependencyCondition>(
+ SETTING_USE_DIRECTORY_NAMES, "false", SettingDependencyOperator::Equals, false,
+ GetSettingsManager())); // !m_useDirectoryNames
// define an enable dependency with m_useDirectoryNames && !m_scanRecursive
CSettingDependency dependencyContainsSingleItem(SettingDependencyType::Enable, GetSettingsManager());
dependencyContainsSingleItem.And()
- ->Add(CSettingDependencyConditionPtr(new CSettingDependencyCondition(SETTING_USE_DIRECTORY_NAMES, "true", SettingDependencyOperator::Equals, false, GetSettingsManager()))) // m_useDirectoryNames
- ->Add(CSettingDependencyConditionPtr(new CSettingDependencyCondition(SETTING_SCAN_RECURSIVE, "false", SettingDependencyOperator::Equals, false, GetSettingsManager()))); // !m_scanRecursive
+ ->Add(std::make_shared<CSettingDependencyCondition>(
+ SETTING_USE_DIRECTORY_NAMES, "true", SettingDependencyOperator::Equals, false,
+ GetSettingsManager())) // m_useDirectoryNames
+ ->Add(std::make_shared<CSettingDependencyCondition>(
+ SETTING_SCAN_RECURSIVE, "false", SettingDependencyOperator::Equals, false,
+ GetSettingsManager())); // !m_scanRecursive
SettingDependencies deps;
deps.push_back(dependencyScanRecursive);
diff --git a/xbmc/settings/dialogs/GUIDialogSettingsBase.cpp b/xbmc/settings/dialogs/GUIDialogSettingsBase.cpp
index d466e5da1f..77086caf2a 100644
--- a/xbmc/settings/dialogs/GUIDialogSettingsBase.cpp
+++ b/xbmc/settings/dialogs/GUIDialogSettingsBase.cpp
@@ -30,6 +30,7 @@
#include "utils/StringUtils.h"
#include "utils/Variant.h"
+#include <memory>
#include <set>
#include <string>
#include <vector>
@@ -675,8 +676,8 @@ CGUIControl* CGUIDialogSettingsBase::AddSetting(const std::shared_ptr<CSetting>&
return NULL;
static_cast<CGUIRadioButtonControl*>(pControl)->SetLabel(label);
- pSettingControl.reset(new CGUIControlRadioButtonSetting(
- static_cast<CGUIRadioButtonControl*>(pControl), iControlID, pSetting, this));
+ pSettingControl = std::make_shared<CGUIControlRadioButtonSetting>(
+ static_cast<CGUIRadioButtonControl*>(pControl), iControlID, pSetting, this);
}
else if (controlType == "spinner")
{
@@ -686,8 +687,8 @@ CGUIControl* CGUIDialogSettingsBase::AddSetting(const std::shared_ptr<CSetting>&
return NULL;
static_cast<CGUISpinControlEx*>(pControl)->SetText(label);
- pSettingControl.reset(new CGUIControlSpinExSetting(static_cast<CGUISpinControlEx*>(pControl),
- iControlID, pSetting, this));
+ pSettingControl = std::make_shared<CGUIControlSpinExSetting>(
+ static_cast<CGUISpinControlEx*>(pControl), iControlID, pSetting, this);
}
else if (controlType == "edit")
{
@@ -697,8 +698,8 @@ CGUIControl* CGUIDialogSettingsBase::AddSetting(const std::shared_ptr<CSetting>&
return NULL;
static_cast<CGUIEditControl*>(pControl)->SetLabel(label);
- pSettingControl.reset(new CGUIControlEditSetting(static_cast<CGUIEditControl*>(pControl),
- iControlID, pSetting, this));
+ pSettingControl = std::make_shared<CGUIControlEditSetting>(
+ static_cast<CGUIEditControl*>(pControl), iControlID, pSetting, this);
}
else if (controlType == "list")
{
@@ -708,8 +709,8 @@ CGUIControl* CGUIDialogSettingsBase::AddSetting(const std::shared_ptr<CSetting>&
return NULL;
static_cast<CGUIButtonControl*>(pControl)->SetLabel(label);
- pSettingControl.reset(new CGUIControlListSetting(static_cast<CGUIButtonControl*>(pControl),
- iControlID, pSetting, this));
+ pSettingControl = std::make_shared<CGUIControlListSetting>(
+ static_cast<CGUIButtonControl*>(pControl), iControlID, pSetting, this);
}
else if (controlType == "button" || controlType == "slider")
{
@@ -722,8 +723,8 @@ CGUIControl* CGUIDialogSettingsBase::AddSetting(const std::shared_ptr<CSetting>&
return NULL;
static_cast<CGUIButtonControl*>(pControl)->SetLabel(label);
- pSettingControl.reset(new CGUIControlButtonSetting(static_cast<CGUIButtonControl*>(pControl),
- iControlID, pSetting, this));
+ pSettingControl = std::make_shared<CGUIControlButtonSetting>(
+ static_cast<CGUIButtonControl*>(pControl), iControlID, pSetting, this);
}
else
{
@@ -733,8 +734,8 @@ CGUIControl* CGUIDialogSettingsBase::AddSetting(const std::shared_ptr<CSetting>&
return NULL;
static_cast<CGUISettingsSliderControl*>(pControl)->SetText(label);
- pSettingControl.reset(new CGUIControlSliderSetting(
- static_cast<CGUISettingsSliderControl*>(pControl), iControlID, pSetting, this));
+ pSettingControl = std::make_shared<CGUIControlSliderSetting>(
+ static_cast<CGUISettingsSliderControl*>(pControl), iControlID, pSetting, this);
}
}
else if (controlType == "range")
@@ -745,8 +746,8 @@ CGUIControl* CGUIDialogSettingsBase::AddSetting(const std::shared_ptr<CSetting>&
return NULL;
static_cast<CGUISettingsSliderControl*>(pControl)->SetText(label);
- pSettingControl.reset(new CGUIControlRangeSetting(
- static_cast<CGUISettingsSliderControl*>(pControl), iControlID, pSetting, this));
+ pSettingControl = std::make_shared<CGUIControlRangeSetting>(
+ static_cast<CGUISettingsSliderControl*>(pControl), iControlID, pSetting, this);
}
else if (controlType == "label")
{
@@ -756,8 +757,8 @@ CGUIControl* CGUIDialogSettingsBase::AddSetting(const std::shared_ptr<CSetting>&
return NULL;
static_cast<CGUIButtonControl*>(pControl)->SetLabel(label);
- pSettingControl.reset(new CGUIControlLabelSetting(static_cast<CGUIButtonControl*>(pControl),
- iControlID, pSetting, this));
+ pSettingControl = std::make_shared<CGUIControlLabelSetting>(
+ static_cast<CGUIButtonControl*>(pControl), iControlID, pSetting, this);
}
else if (controlType == "colorbutton")
{
@@ -767,8 +768,8 @@ CGUIControl* CGUIDialogSettingsBase::AddSetting(const std::shared_ptr<CSetting>&
return nullptr;
static_cast<CGUIColorButtonControl*>(pControl)->SetLabel(label);
- pSettingControl.reset(new CGUIControlColorButtonSetting(
- static_cast<CGUIColorButtonControl*>(pControl), iControlID, pSetting, this));
+ pSettingControl = std::make_shared<CGUIControlColorButtonSetting>(
+ static_cast<CGUIColorButtonControl*>(pControl), iControlID, pSetting, this);
}
else
return nullptr;
diff --git a/xbmc/threads/test/TestEvent.cpp b/xbmc/threads/test/TestEvent.cpp
index 5f9fd10fb1..0109a9c513 100644
--- a/xbmc/threads/test/TestEvent.cpp
+++ b/xbmc/threads/test/TestEvent.cpp
@@ -572,7 +572,7 @@ template <class W> void RunMassEventTest(std::vector<std::shared_ptr<W>>& m, boo
{
std::vector<std::shared_ptr<thread>> t(NUMTHREADS);
for(size_t i=0; i<NUMTHREADS; i++)
- t[i].reset(new thread(*m[i]));
+ t[i] = std::make_shared<thread>(*m[i]);
EXPECT_TRUE(waitForThread(g_mutex, NUMTHREADS, 10000ms));
if (canWaitOnEvent)
@@ -608,7 +608,7 @@ TEST(TestMassEvent, General)
std::vector<std::shared_ptr<mass_waiter>> m(NUMTHREADS);
for(size_t i=0; i<NUMTHREADS; i++)
- m[i].reset(new mass_waiter());
+ m[i] = std::make_shared<mass_waiter>();
RunMassEventTest(m,true);
delete g_event;
@@ -620,7 +620,7 @@ TEST(TestMassEvent, Polling)
std::vector<std::shared_ptr<poll_mass_waiter>> m(NUMTHREADS);
for(size_t i=0; i<NUMTHREADS; i++)
- m[i].reset(new poll_mass_waiter());
+ m[i] = std::make_shared<poll_mass_waiter>();
RunMassEventTest(m,false);
delete g_event;
diff --git a/xbmc/utils/BooleanLogic.cpp b/xbmc/utils/BooleanLogic.cpp
index 7ccc54750c..f58a05b987 100644
--- a/xbmc/utils/BooleanLogic.cpp
+++ b/xbmc/utils/BooleanLogic.cpp
@@ -12,6 +12,8 @@
#include "utils/XBMCTinyXML.h"
#include "utils/log.h"
+#include <memory>
+
bool CBooleanLogicValue::Deserialize(const TiXmlNode *node)
{
if (node == NULL)
@@ -112,7 +114,7 @@ bool CBooleanLogic::Deserialize(const TiXmlNode *node)
if (m_operation == NULL)
{
- m_operation = CBooleanLogicOperationPtr(new CBooleanLogicOperation());
+ m_operation = std::make_shared<CBooleanLogicOperation>();
if (m_operation == NULL)
return false;
diff --git a/xbmc/utils/FileOperationJob.cpp b/xbmc/utils/FileOperationJob.cpp
index 8b5066a7e0..7950c792ba 100644
--- a/xbmc/utils/FileOperationJob.cpp
+++ b/xbmc/utils/FileOperationJob.cpp
@@ -22,6 +22,8 @@
#include "utils/URIUtils.h"
#include "utils/log.h"
+#include <memory>
+
using namespace XFILE;
CFileOperationJob::CFileOperationJob()
@@ -58,7 +60,7 @@ void CFileOperationJob::SetFileOperation(FileAction action,
m_items.Clear();
for (int i = 0; i < items.Size(); i++)
- m_items.Add(CFileItemPtr(new CFileItem(*items[i])));
+ m_items.Add(std::make_shared<CFileItem>(*items[i]));
}
bool CFileOperationJob::DoWork()
diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp
index 087232e4f2..f5ea42ca25 100644
--- a/xbmc/video/VideoDatabase.cpp
+++ b/xbmc/video/VideoDatabase.cpp
@@ -6225,7 +6225,7 @@ CDateTime CVideoDatabase::SetPlayCount(const CFileItem& item, int count, const C
if (item.GetVideoInfoTag()->GetPlayCount() != count)
data["playcount"] = count;
CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::VideoLibrary, "OnUpdate",
- CFileItemPtr(new CFileItem(item)), data);
+ std::make_shared<CFileItem>(item), data);
}
return lastPlayed;
diff --git a/xbmc/video/VideoInfoScanner.cpp b/xbmc/video/VideoInfoScanner.cpp
index 6b7ab281e5..835d9e8618 100644
--- a/xbmc/video/VideoInfoScanner.cpp
+++ b/xbmc/video/VideoInfoScanner.cpp
@@ -47,6 +47,7 @@
#include "video/VideoThumbLoader.h"
#include <algorithm>
+#include <memory>
#include <utility>
using namespace XFILE;
@@ -1478,7 +1479,7 @@ namespace VIDEO
m_database.Close();
- CFileItemPtr itemCopy = CFileItemPtr(new CFileItem(*pItem));
+ CFileItemPtr itemCopy = std::make_shared<CFileItem>(*pItem);
CVariant data;
data["added"] = true;
if (m_bRunning)
@@ -2079,7 +2080,7 @@ namespace VIDEO
const std::vector<std::string> &excludes) const
{
CFileItemList items;
- items.Add(CFileItemPtr(new CFileItem(directory, true)));
+ items.Add(std::make_shared<CFileItem>(directory, true));
CUtil::GetRecursiveDirsListing(directory, items, DIR_FLAG_NO_FILE_DIRS | DIR_FLAG_NO_FILE_INFO);
CDigest digest{CDigest::Type::MD5};
diff --git a/xbmc/video/dialogs/GUIDialogAudioSettings.cpp b/xbmc/video/dialogs/GUIDialogAudioSettings.cpp
index 83b888b90d..9c8b1b10ff 100644
--- a/xbmc/video/dialogs/GUIDialogAudioSettings.cpp
+++ b/xbmc/video/dialogs/GUIDialogAudioSettings.cpp
@@ -33,6 +33,7 @@
#include "utils/log.h"
#include "video/VideoDatabase.h"
+#include <memory>
#include <string>
#include <vector>
@@ -241,8 +242,11 @@ void CGUIDialogAudioSettings::InitializeSettings()
CSettingDependency dependencyAudioOutputPassthroughDisabled(SettingDependencyType::Enable, GetSettingsManager());
dependencyAudioOutputPassthroughDisabled.Or()
- ->Add(CSettingDependencyConditionPtr(new CSettingDependencyCondition(SETTING_AUDIO_PASSTHROUGH, "false", SettingDependencyOperator::Equals, false, GetSettingsManager())))
- ->Add(CSettingDependencyConditionPtr(new CSettingDependencyCondition("IsPlayingPassthrough", "", "", true, GetSettingsManager())));
+ ->Add(std::make_shared<CSettingDependencyCondition>(SETTING_AUDIO_PASSTHROUGH, "false",
+ SettingDependencyOperator::Equals, false,
+ GetSettingsManager()))
+ ->Add(std::make_shared<CSettingDependencyCondition>("IsPlayingPassthrough", "", "", true,
+ GetSettingsManager()));
SettingDependencies depsAudioOutputPassthroughDisabled;
depsAudioOutputPassthroughDisabled.push_back(dependencyAudioOutputPassthroughDisabled);
diff --git a/xbmc/video/dialogs/GUIDialogCMSSettings.cpp b/xbmc/video/dialogs/GUIDialogCMSSettings.cpp
index ac1a7addfa..eae6ee6354 100644
--- a/xbmc/video/dialogs/GUIDialogCMSSettings.cpp
+++ b/xbmc/video/dialogs/GUIDialogCMSSettings.cpp
@@ -27,6 +27,7 @@
#include "utils/log.h"
#include "video/VideoDatabase.h"
+#include <memory>
#include <vector>
#define SETTING_VIDEO_CMSENABLE "videoscreen.cmsenabled"
@@ -79,31 +80,35 @@ void CGUIDialogCMSSettings::InitializeSettings()
// create "depsCmsEnabled" for settings depending on CMS being enabled
CSettingDependency dependencyCmsEnabled(SettingDependencyType::Enable, GetSettingsManager());
- dependencyCmsEnabled.Or()
- ->Add(CSettingDependencyConditionPtr(new CSettingDependencyCondition(SETTING_VIDEO_CMSENABLE, "true", SettingDependencyOperator::Equals, false, GetSettingsManager())));
+ dependencyCmsEnabled.Or()->Add(std::make_shared<CSettingDependencyCondition>(
+ SETTING_VIDEO_CMSENABLE, "true", SettingDependencyOperator::Equals, false,
+ GetSettingsManager()));
SettingDependencies depsCmsEnabled;
depsCmsEnabled.push_back(dependencyCmsEnabled);
// create "depsCms3dlut" for 3dlut settings
CSettingDependency dependencyCms3dlut(SettingDependencyType::Visible, GetSettingsManager());
- dependencyCms3dlut.And()
- ->Add(CSettingDependencyConditionPtr(new CSettingDependencyCondition(SETTING_VIDEO_CMSMODE, std::to_string(CMS_MODE_3DLUT), SettingDependencyOperator::Equals, false, GetSettingsManager())));
+ dependencyCms3dlut.And()->Add(std::make_shared<CSettingDependencyCondition>(
+ SETTING_VIDEO_CMSMODE, std::to_string(CMS_MODE_3DLUT), SettingDependencyOperator::Equals,
+ false, GetSettingsManager()));
SettingDependencies depsCms3dlut;
depsCms3dlut.push_back(dependencyCmsEnabled);
depsCms3dlut.push_back(dependencyCms3dlut);
// create "depsCmsIcc" for display settings with icc profile
CSettingDependency dependencyCmsIcc(SettingDependencyType::Visible, GetSettingsManager());
- dependencyCmsIcc.And()
- ->Add(CSettingDependencyConditionPtr(new CSettingDependencyCondition(SETTING_VIDEO_CMSMODE, std::to_string(CMS_MODE_PROFILE), SettingDependencyOperator::Equals, false, GetSettingsManager())));
+ dependencyCmsIcc.And()->Add(std::make_shared<CSettingDependencyCondition>(
+ SETTING_VIDEO_CMSMODE, std::to_string(CMS_MODE_PROFILE), SettingDependencyOperator::Equals,
+ false, GetSettingsManager()));
SettingDependencies depsCmsIcc;
depsCmsIcc.push_back(dependencyCmsEnabled);
depsCmsIcc.push_back(dependencyCmsIcc);
// create "depsCmsGamma" for effective gamma adjustment (not available with bt.1886)
CSettingDependency dependencyCmsGamma(SettingDependencyType::Visible, GetSettingsManager());
- dependencyCmsGamma.And()
- ->Add(CSettingDependencyConditionPtr(new CSettingDependencyCondition(SETTING_VIDEO_CMSGAMMAMODE, std::to_string(CMS_TRC_BT1886), SettingDependencyOperator::Equals, true, GetSettingsManager())));
+ dependencyCmsGamma.And()->Add(std::make_shared<CSettingDependencyCondition>(
+ SETTING_VIDEO_CMSGAMMAMODE, std::to_string(CMS_TRC_BT1886), SettingDependencyOperator::Equals,
+ true, GetSettingsManager()));
SettingDependencies depsCmsGamma;
depsCmsGamma.push_back(dependencyCmsEnabled);
depsCmsGamma.push_back(dependencyCmsIcc);
diff --git a/xbmc/video/jobs/VideoLibraryMarkWatchedJob.cpp b/xbmc/video/jobs/VideoLibraryMarkWatchedJob.cpp
index 25381bbe82..486bd7a727 100644
--- a/xbmc/video/jobs/VideoLibraryMarkWatchedJob.cpp
+++ b/xbmc/video/jobs/VideoLibraryMarkWatchedJob.cpp
@@ -6,23 +6,25 @@
* See LICENSES/README.md for more information.
*/
-#include <vector>
-
#include "VideoLibraryMarkWatchedJob.h"
+
#include "FileItem.h"
+#include "ServiceBroker.h"
#include "Util.h"
#include "filesystem/Directory.h"
#ifdef HAS_UPNP
#include "network/upnp/UPnP.h"
#endif
+#include "profiles/ProfileManager.h"
#include "pvr/PVRManager.h"
#include "pvr/recordings/PVRRecordings.h"
-#include "profiles/ProfileManager.h"
#include "settings/SettingsComponent.h"
-#include "ServiceBroker.h"
#include "utils/URIUtils.h"
#include "video/VideoDatabase.h"
+#include <memory>
+#include <vector>
+
CVideoLibraryMarkWatchedJob::CVideoLibraryMarkWatchedJob(const std::shared_ptr<CFileItem>& item,
bool mark)
: m_item(item), m_mark(mark)
@@ -50,7 +52,7 @@ bool CVideoLibraryMarkWatchedJob::Work(CVideoDatabase &db)
return false;
CFileItemList items;
- items.Add(CFileItemPtr(new CFileItem(*m_item)));
+ items.Add(std::make_shared<CFileItem>(*m_item));
if (m_item->m_bIsFolder)
CUtil::GetRecursiveListing(m_item->GetPath(), items, "", XFILE::DIR_FLAG_NO_FILE_INFO);
diff --git a/xbmc/video/jobs/VideoLibraryRefreshingJob.cpp b/xbmc/video/jobs/VideoLibraryRefreshingJob.cpp
index 9f300720b2..4e10720a3c 100644
--- a/xbmc/video/jobs/VideoLibraryRefreshingJob.cpp
+++ b/xbmc/video/jobs/VideoLibraryRefreshingJob.cpp
@@ -32,6 +32,7 @@
#include "video/tags/VideoInfoTagLoaderFactory.h"
#include "video/tags/VideoTagLoaderPlugin.h"
+#include <memory>
#include <utility>
using namespace KODI::MESSAGING;
@@ -281,13 +282,13 @@ bool CVideoLibraryRefreshingJob::Work(CVideoDatabase &db)
}
// otherwise just add a copy of the item
else
- items.Add(CFileItemPtr(new CFileItem(*m_item->GetVideoInfoTag())));
+ items.Add(std::make_shared<CFileItem>(*m_item->GetVideoInfoTag()));
// update the path to the real path (instead of a videodb:// one)
path = m_item->GetVideoInfoTag()->m_strPath;
}
else
- items.Add(CFileItemPtr(new CFileItem(*m_item)));
+ items.Add(std::make_shared<CFileItem>(*m_item));
// set the proper path of the list of items to lookup
items.SetPath(m_item->m_bIsFolder ? URIUtils::GetParentPath(path) : URIUtils::GetDirectory(path));
diff --git a/xbmc/video/windows/GUIWindowVideoBase.cpp b/xbmc/video/windows/GUIWindowVideoBase.cpp
index 53b9dcccd8..37665111aa 100644
--- a/xbmc/video/windows/GUIWindowVideoBase.cpp
+++ b/xbmc/video/windows/GUIWindowVideoBase.cpp
@@ -59,6 +59,8 @@
#include "video/guilib/VideoSelectActionProcessor.h"
#include "view/GUIViewState.h"
+#include <memory>
+
using namespace XFILE;
using namespace VIDEODATABASEDIRECTORY;
using namespace VIDEO;
@@ -1137,7 +1139,7 @@ bool CGUIWindowVideoBase::GetDirectory(const std::string &strDirectory, CFileIte
newPlaylist->SetLabelPreformatted(true);
items.Add(newPlaylist);
*/
- newPlaylist.reset(new CFileItem("newsmartplaylist://video", false));
+ newPlaylist = std::make_shared<CFileItem>("newsmartplaylist://video", false);
newPlaylist->SetLabel(g_localizeStrings.Get(21437)); // "new smart playlist..."
newPlaylist->SetArt("icon", "DefaultAddSource.png");
newPlaylist->SetLabelPreformatted(true);
diff --git a/xbmc/video/windows/VideoFileItemListModifier.cpp b/xbmc/video/windows/VideoFileItemListModifier.cpp
index 4205d68af1..b17a71db87 100644
--- a/xbmc/video/windows/VideoFileItemListModifier.cpp
+++ b/xbmc/video/windows/VideoFileItemListModifier.cpp
@@ -18,6 +18,8 @@
#include "video/VideoDatabase.h"
#include "video/VideoDbUrl.h"
+#include <memory>
+
using namespace XFILE::VIDEODATABASEDIRECTORY;
bool CVideoFileItemListModifier::CanModify(const CFileItemList &items) const
@@ -65,7 +67,7 @@ void CVideoFileItemListModifier::AddQueuingFolder(CFileItemList& items)
case NODE_TYPE_SEASONS:
{
const std::string& strLabel = g_localizeStrings.Get(20366);
- pItem.reset(new CFileItem(strLabel)); // "All Seasons"
+ pItem = std::make_shared<CFileItem>(strLabel); // "All Seasons"
videoUrl.AppendPath("-1/");
pItem->SetPath(videoUrl.ToString());
// set the number of watched and unwatched items accordingly
@@ -120,7 +122,7 @@ void CVideoFileItemListModifier::AddQueuingFolder(CFileItemList& items)
}
break;
case NODE_TYPE_MUSICVIDEOS_ALBUM:
- pItem.reset(new CFileItem("* " + g_localizeStrings.Get(16100))); // "* All Videos"
+ pItem = std::make_shared<CFileItem>("* " + g_localizeStrings.Get(16100)); // "* All Videos"
videoUrl.AppendPath("-1/");
pItem->SetPath(videoUrl.ToString());
break;