aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRechi <Rechi@users.noreply.github.com>2019-09-05 14:22:19 +0200
committerGitHub <noreply@github.com>2019-09-05 14:22:19 +0200
commitdf4baf4d899e9099f22aba67a2556abb12585147 (patch)
tree7a3f4574ab0721cd3cb3f699033fe6cb69ecf3c1
parent8b4547955bb8f1f19792ce660f4e139888eee68b (diff)
parent25cc1cdb59d40671e2cf3024a542c89a13880b2a (diff)
Merge pull request #16573 from Rechi/modernize/readability-redundant-smartptr-get
[modernize] readability-redundant-smartptr-get
-rw-r--r--xbmc/cdrip/CDDARipper.cpp2
-rw-r--r--xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxVobsub.cpp2
-rw-r--r--xbmc/cores/VideoPlayer/DVDFileInfo.cpp2
-rw-r--r--xbmc/cores/VideoPlayer/DVDStreamInfo.cpp4
-rw-r--r--xbmc/cores/VideoPlayer/Process/ProcessInfo.cpp2
-rw-r--r--xbmc/cores/paplayer/VideoPlayerCodec.cpp2
-rw-r--r--xbmc/dbwrappers/Database.cpp40
-rw-r--r--xbmc/filesystem/Directory.cpp12
-rw-r--r--xbmc/filesystem/File.cpp20
-rw-r--r--xbmc/filesystem/FileCache.cpp2
-rw-r--r--xbmc/filesystem/MusicDatabaseDirectory.cpp14
-rw-r--r--xbmc/filesystem/MusicDatabaseDirectory/DirectoryNode.cpp4
-rw-r--r--xbmc/filesystem/PlaylistFileDirectory.cpp4
-rw-r--r--xbmc/filesystem/VideoDatabaseDirectory.cpp16
-rw-r--r--xbmc/filesystem/VideoDatabaseDirectory/DirectoryNode.cpp4
-rw-r--r--xbmc/interfaces/builtins/PlayerBuiltins.cpp2
-rw-r--r--xbmc/interfaces/legacy/PlayList.cpp2
-rw-r--r--xbmc/listproviders/DirectoryProvider.cpp2
-rw-r--r--xbmc/music/MusicDatabase.cpp531
-rw-r--r--xbmc/music/MusicInfoLoader.cpp4
-rw-r--r--xbmc/music/MusicThumbLoader.cpp2
-rw-r--r--xbmc/music/infoscanner/MusicInfoScanner.cpp2
-rw-r--r--xbmc/music/windows/GUIWindowMusicBase.cpp8
-rw-r--r--xbmc/music/windows/GUIWindowMusicNav.cpp5
-rw-r--r--xbmc/music/windows/GUIWindowMusicPlaylist.cpp2
-rw-r--r--xbmc/pictures/GUIWindowPictures.cpp2
-rw-r--r--xbmc/playlists/PlayList.cpp2
-rw-r--r--xbmc/playlists/PlayListPLS.cpp2
-rw-r--r--xbmc/pvr/windows/GUIWindowPVRGuide.cpp4
-rw-r--r--xbmc/video/VideoDatabase.cpp650
-rw-r--r--xbmc/video/windows/GUIWindowVideoBase.cpp6
-rw-r--r--xbmc/video/windows/GUIWindowVideoNav.cpp3
-rw-r--r--xbmc/view/ViewDatabase.cpp18
-rw-r--r--xbmc/windows/GUIMediaWindow.cpp18
-rw-r--r--xbmc/windows/GUIWindowFileManager.cpp2
35 files changed, 894 insertions, 503 deletions
diff --git a/xbmc/cdrip/CDDARipper.cpp b/xbmc/cdrip/CDDARipper.cpp
index 4a0be99df2..4511e9b810 100644
--- a/xbmc/cdrip/CDDARipper.cpp
+++ b/xbmc/cdrip/CDDARipper.cpp
@@ -99,7 +99,7 @@ bool CCDDARipper::RipCD()
CFileItemPtr pItem = vecItems[i];
CMusicInfoTagLoaderFactory factory;
std::unique_ptr<IMusicInfoTagLoader> pLoader (factory.CreateLoader(*pItem));
- if (NULL != pLoader.get())
+ if (nullptr != pLoader)
{
pLoader->Load(pItem->GetPath(), *pItem->GetMusicInfoTag()); // get tag from file
if (!pItem->GetMusicInfoTag()->Loaded())
diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxVobsub.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxVobsub.cpp
index 409ec1169d..1b003239ce 100644
--- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxVobsub.cpp
+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxVobsub.cpp
@@ -61,7 +61,7 @@ bool CDVDDemuxVobsub::Open(const std::string& filename, int source, const std::s
item.SetMimeType("video/x-vobsub");
item.SetContentLookup(false);
m_Input = CDVDFactoryInputStream::CreateInputStream(NULL, item);
- if(!m_Input.get() || !m_Input->Open())
+ if (!m_Input || !m_Input->Open())
return false;
m_Demuxer.reset(new CDVDDemuxFFmpeg());
diff --git a/xbmc/cores/VideoPlayer/DVDFileInfo.cpp b/xbmc/cores/VideoPlayer/DVDFileInfo.cpp
index d12f18e8fc..6fcba20e5f 100644
--- a/xbmc/cores/VideoPlayer/DVDFileInfo.cpp
+++ b/xbmc/cores/VideoPlayer/DVDFileInfo.cpp
@@ -61,7 +61,7 @@ bool CDVDFileInfo::GetFileDuration(const std::string &path, int& duration)
return false;
demux.reset(CDVDFactoryDemuxer::CreateDemuxer(input, true));
- if (!demux.get())
+ if (!demux)
return false;
duration = demux->GetStreamLength();
diff --git a/xbmc/cores/VideoPlayer/DVDStreamInfo.cpp b/xbmc/cores/VideoPlayer/DVDStreamInfo.cpp
index e05fd321a9..e0b5b5315a 100644
--- a/xbmc/cores/VideoPlayer/DVDStreamInfo.cpp
+++ b/xbmc/cores/VideoPlayer/DVDStreamInfo.cpp
@@ -158,10 +158,10 @@ bool CDVDStreamInfo::Equal(const CDVDStreamInfo& right, bool withextradata)
// SUBTITLE
// Crypto
- if ((cryptoSession.get() == nullptr) != (right.cryptoSession.get() == nullptr))
+ if ((cryptoSession == nullptr) != (right.cryptoSession == nullptr))
return false;
- if (cryptoSession && !(*cryptoSession.get() == *right.cryptoSession.get()))
+ if (cryptoSession && !(*cryptoSession == *right.cryptoSession))
return false;
return true;
diff --git a/xbmc/cores/VideoPlayer/Process/ProcessInfo.cpp b/xbmc/cores/VideoPlayer/Process/ProcessInfo.cpp
index 7dd676f964..99d1de5b90 100644
--- a/xbmc/cores/VideoPlayer/Process/ProcessInfo.cpp
+++ b/xbmc/cores/VideoPlayer/Process/ProcessInfo.cpp
@@ -668,7 +668,7 @@ CVideoSettings CProcessInfo::GetVideoSettings()
CVideoSettingsLocked& CProcessInfo::UpdateVideoSettings()
{
CSingleLock lock(m_settingsSection);
- return *m_videoSettingsLocked.get();
+ return *m_videoSettingsLocked;
}
void CProcessInfo::SetVideoSettings(CVideoSettings &settings)
diff --git a/xbmc/cores/paplayer/VideoPlayerCodec.cpp b/xbmc/cores/paplayer/VideoPlayerCodec.cpp
index 81993ca653..9132281415 100644
--- a/xbmc/cores/paplayer/VideoPlayerCodec.cpp
+++ b/xbmc/cores/paplayer/VideoPlayerCodec.cpp
@@ -161,7 +161,7 @@ bool VideoPlayerCodec::Init(const CFileItem &file, unsigned int filecache)
CDVDStreamInfo hint(*pStream, true);
CAEStreamInfo::DataType ptStreamTye = GetPassthroughStreamType(hint.codec, hint.samplerate);
- m_pAudioCodec = CDVDFactoryCodec::CreateAudioCodec(hint, *m_processInfo.get(), true, true, ptStreamTye);
+ m_pAudioCodec = CDVDFactoryCodec::CreateAudioCodec(hint, *m_processInfo, true, true, ptStreamTye);
if (!m_pAudioCodec)
{
CLog::Log(LOGERROR, "%s: Could not create audio codec", __FUNCTION__);
diff --git a/xbmc/dbwrappers/Database.cpp b/xbmc/dbwrappers/Database.cpp
index 9389e53a95..60f4af4040 100644
--- a/xbmc/dbwrappers/Database.cpp
+++ b/xbmc/dbwrappers/Database.cpp
@@ -247,7 +247,7 @@ std::string CDatabase::PrepareSQL(std::string strStmt, ...) const
{
std::string strResult = "";
- if (NULL != m_pDB.get())
+ if (nullptr != m_pDB)
{
va_list args;
va_start(args, strStmt);
@@ -263,7 +263,7 @@ std::string CDatabase::GetSingleValue(const std::string &query, std::unique_ptr<
std::string ret;
try
{
- if (!m_pDB.get() || !ds.get())
+ if (!m_pDB || !ds)
return ret;
if (ds->query(query) && ds->num_rows() > 0)
@@ -336,8 +336,10 @@ bool CDatabase::ExecuteQuery(const std::string &strQuery)
try
{
- if (NULL == m_pDB.get()) return bReturn;
- if (NULL == m_pDS.get()) return bReturn;
+ if (nullptr == m_pDB)
+ return bReturn;
+ if (nullptr == m_pDS)
+ return bReturn;
m_pDS->exec(strQuery);
bReturn = true;
}
@@ -356,8 +358,10 @@ bool CDatabase::ResultQuery(const std::string &strQuery)
try
{
- if (NULL == m_pDB.get()) return bReturn;
- if (NULL == m_pDS.get()) return bReturn;
+ if (nullptr == m_pDB)
+ return bReturn;
+ if (nullptr == m_pDS)
+ return bReturn;
std::string strPreparedQuery = PrepareSQL(strQuery.c_str());
@@ -379,8 +383,10 @@ bool CDatabase::QueueInsertQuery(const std::string &strQuery)
if (!m_bMultiWrite)
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS2.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS2)
+ return false;
m_bMultiWrite = true;
m_pDS2->insert();
@@ -596,8 +602,10 @@ void CDatabase::Close()
m_openCount = 0;
m_multipleExecute = false;
- if (NULL == m_pDB.get() ) return ;
- if (NULL != m_pDS.get()) m_pDS->close();
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr != m_pDS)
+ m_pDS->close();
m_pDB->disconnect();
m_pDB.reset();
m_pDS.reset();
@@ -611,8 +619,10 @@ bool CDatabase::Compress(bool bForce /* =true */)
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
if (!bForce)
{
m_pDS->query("select iCompressCount from version");
@@ -649,7 +659,7 @@ void CDatabase::BeginTransaction()
{
try
{
- if (NULL != m_pDB.get())
+ if (nullptr != m_pDB)
m_pDB->start_transaction();
}
catch (...)
@@ -662,7 +672,7 @@ bool CDatabase::CommitTransaction()
{
try
{
- if (NULL != m_pDB.get())
+ if (nullptr != m_pDB)
m_pDB->commit_transaction();
}
catch (...)
@@ -677,7 +687,7 @@ void CDatabase::RollbackTransaction()
{
try
{
- if (NULL != m_pDB.get())
+ if (nullptr != m_pDB)
m_pDB->rollback_transaction();
}
catch (...)
diff --git a/xbmc/filesystem/Directory.cpp b/xbmc/filesystem/Directory.cpp
index 39cb743d14..98b524c4d4 100644
--- a/xbmc/filesystem/Directory.cpp
+++ b/xbmc/filesystem/Directory.cpp
@@ -161,7 +161,7 @@ bool CDirectory::GetDirectory(const CURL& url, std::shared_ptr<IDirectory> pDire
try
{
CURL realURL = URIUtils::SubstitutePath(url);
- if (!pDirectory.get())
+ if (!pDirectory)
return false;
// check our cache for this path
@@ -323,7 +323,7 @@ bool CDirectory::Create(const CURL& url)
CPasswordManager::GetInstance().AuthenticateURL(realURL);
std::unique_ptr<IDirectory> pDirectory(CDirectoryFactory::Create(realURL));
- if (pDirectory.get())
+ if (pDirectory)
if(pDirectory->Create(realURL))
return true;
}
@@ -362,7 +362,7 @@ bool CDirectory::Exists(const CURL& url, bool bUseCache /* = true */)
CPasswordManager::GetInstance().AuthenticateURL(realURL);
std::unique_ptr<IDirectory> pDirectory(CDirectoryFactory::Create(realURL));
- if (pDirectory.get())
+ if (pDirectory)
return pDirectory->Exists(realURL);
}
XBMCCOMMONS_HANDLE_UNCHECKED
@@ -395,7 +395,7 @@ bool CDirectory::Remove(const CURL& url)
CPasswordManager::GetInstance().AuthenticateURL(authUrl);
std::unique_ptr<IDirectory> pDirectory(CDirectoryFactory::Create(realURL));
- if (pDirectory.get())
+ if (pDirectory)
if(pDirectory->Remove(authUrl))
{
g_directoryCache.ClearFile(realURL.Get());
@@ -421,7 +421,7 @@ bool CDirectory::RemoveRecursive(const CURL& url)
CPasswordManager::GetInstance().AuthenticateURL(authUrl);
std::unique_ptr<IDirectory> pDirectory(CDirectoryFactory::Create(realURL));
- if (pDirectory.get())
+ if (pDirectory)
if(pDirectory->RemoveRecursive(authUrl))
{
g_directoryCache.ClearFile(realURL.Get());
@@ -447,7 +447,7 @@ void CDirectory::FilterFileDirectories(CFileItemList &items, const std::string &
if (!pItem->m_bIsFolder && pItem->IsFileFolder(mode))
{
std::unique_ptr<IFileDirectory> pDirectory(CFileDirectoryFactory::Create(pItem->GetURL(),pItem.get(),mask));
- if (pDirectory.get())
+ if (pDirectory)
pItem->m_bIsFolder = true;
else
if (pItem->m_bIsFolder)
diff --git a/xbmc/filesystem/File.cpp b/xbmc/filesystem/File.cpp
index a19b85f200..831f43b782 100644
--- a/xbmc/filesystem/File.cpp
+++ b/xbmc/filesystem/File.cpp
@@ -328,7 +328,7 @@ bool CFile::Open(const CURL& file, const unsigned int flags)
m_pFile = pRedirectEx->m_pNewFileImp;
delete pRedirectEx;
- if (pNewUrl.get())
+ if (pNewUrl)
{
CURL newAuthUrl(*pNewUrl);
if (CPasswordManager::GetInstance().IsURLSupported(newAuthUrl) && newAuthUrl.GetUserName().empty())
@@ -439,7 +439,7 @@ bool CFile::Exists(const CURL& file, bool bUseCache /* = true */)
}
std::unique_ptr<IFile> pFile(CFileFactory::CreateLoader(url));
- if (!pFile.get())
+ if (!pFile)
return false;
return pFile->Exists(authUrl);
@@ -456,9 +456,9 @@ bool CFile::Exists(const CURL& file, bool bUseCache /* = true */)
std::unique_ptr<CURL> pNewUrl(pRedirectEx->m_pNewUrl);
delete pRedirectEx;
- if (pImp.get())
+ if (pImp)
{
- if (pNewUrl.get())
+ if (pNewUrl)
{
if (bUseCache)
{
@@ -523,7 +523,7 @@ int CFile::Stat(const CURL& file, struct __stat64* buffer)
try
{
std::unique_ptr<IFile> pFile(CFileFactory::CreateLoader(url));
- if (!pFile.get())
+ if (!pFile)
return -1;
return pFile->Stat(authUrl, buffer);
}
@@ -539,9 +539,9 @@ int CFile::Stat(const CURL& file, struct __stat64* buffer)
std::unique_ptr<CURL> pNewUrl(pRedirectEx->m_pNewUrl);
delete pRedirectEx;
- if (pNewUrl.get())
+ if (pNewUrl)
{
- if (pImp.get())
+ if (pImp)
{
CURL newAuthUrl = *pNewUrl;
if (CPasswordManager::GetInstance().IsURLSupported(newAuthUrl) && newAuthUrl.GetUserName().empty())
@@ -869,7 +869,7 @@ bool CFile::Delete(const CURL& file)
CPasswordManager::GetInstance().AuthenticateURL(authUrl);
std::unique_ptr<IFile> pFile(CFileFactory::CreateLoader(url));
- if (!pFile.get())
+ if (!pFile)
return false;
if(pFile->Delete(authUrl))
@@ -910,7 +910,7 @@ bool CFile::Rename(const CURL& file, const CURL& newFile)
CPasswordManager::GetInstance().AuthenticateURL(authUrlNew);
std::unique_ptr<IFile> pFile(CFileFactory::CreateLoader(url));
- if (!pFile.get())
+ if (!pFile)
return false;
if(pFile->Rename(authUrl, authUrlNew))
@@ -945,7 +945,7 @@ bool CFile::SetHidden(const CURL& file, bool hidden)
CPasswordManager::GetInstance().AuthenticateURL(authUrl);
std::unique_ptr<IFile> pFile(CFileFactory::CreateLoader(url));
- if (!pFile.get())
+ if (!pFile)
return false;
return pFile->SetHidden(authUrl, hidden);
diff --git a/xbmc/filesystem/FileCache.cpp b/xbmc/filesystem/FileCache.cpp
index b0a3937d42..e9826e9bdd 100644
--- a/xbmc/filesystem/FileCache.cpp
+++ b/xbmc/filesystem/FileCache.cpp
@@ -212,7 +212,7 @@ void CFileCache::Process()
// create our read buffer
std::unique_ptr<char[]> buffer(new char[m_chunkSize]);
- if (buffer.get() == NULL)
+ if (buffer == nullptr)
{
CLog::Log(LOGERROR, "%s - failed to allocate read buffer", __FUNCTION__);
return;
diff --git a/xbmc/filesystem/MusicDatabaseDirectory.cpp b/xbmc/filesystem/MusicDatabaseDirectory.cpp
index 68f32530df..146a86684f 100644
--- a/xbmc/filesystem/MusicDatabaseDirectory.cpp
+++ b/xbmc/filesystem/MusicDatabaseDirectory.cpp
@@ -35,7 +35,7 @@ bool CMusicDatabaseDirectory::GetDirectory(const CURL& url, CFileItemList &items
std::unique_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(path));
- if (!pNode.get())
+ if (!pNode)
return false;
bool bResult = pNode->GetChilds(items);
@@ -59,7 +59,7 @@ NODE_TYPE CMusicDatabaseDirectory::GetDirectoryChildType(const std::string& strP
std::string path = CLegacyPathTranslation::TranslateMusicDbPath(strPath);
std::unique_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(path));
- if (!pNode.get())
+ if (!pNode)
return NODE_TYPE_NONE;
return pNode->GetChildType();
@@ -70,7 +70,7 @@ NODE_TYPE CMusicDatabaseDirectory::GetDirectoryType(const std::string& strPath)
std::string path = CLegacyPathTranslation::TranslateMusicDbPath(strPath);
std::unique_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(path));
- if (!pNode.get())
+ if (!pNode)
return NODE_TYPE_NONE;
return pNode->GetType();
@@ -81,7 +81,7 @@ NODE_TYPE CMusicDatabaseDirectory::GetDirectoryParentType(const std::string& str
std::string path = CLegacyPathTranslation::TranslateMusicDbPath(strPath);
std::unique_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(path));
- if (!pNode.get())
+ if (!pNode)
return NODE_TYPE_NONE;
CDirectoryNode* pParentNode=pNode->GetParent();
@@ -124,7 +124,7 @@ bool CMusicDatabaseDirectory::GetLabel(const std::string& strDirectory, std::str
std::string path = CLegacyPathTranslation::TranslateMusicDbPath(strDirectory);
std::unique_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(path));
- if (!pNode.get())
+ if (!pNode)
return false;
// first see if there's any filter criteria
@@ -237,7 +237,7 @@ bool CMusicDatabaseDirectory::Exists(const CURL& url)
std::string path = CLegacyPathTranslation::TranslateMusicDbPath(url);
std::unique_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(path));
- if (!pNode.get())
+ if (!pNode)
return false;
if (pNode->GetChildType() == MUSICDATABASEDIRECTORY::NODE_TYPE_NONE)
@@ -250,7 +250,7 @@ bool CMusicDatabaseDirectory::CanCache(const std::string& strPath)
{
std::string path = CLegacyPathTranslation::TranslateMusicDbPath(strPath);
std::unique_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(path));
- if (!pNode.get())
+ if (!pNode)
return false;
return pNode->CanCache();
}
diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNode.cpp b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNode.cpp
index 73224c89fe..cf52cb47d7 100644
--- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNode.cpp
+++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNode.cpp
@@ -82,7 +82,7 @@ void CDirectoryNode::GetDatabaseInfo(const std::string& strPath, CQueryParams& p
{
std::unique_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(strPath));
- if (!pNode.get())
+ if (!pNode)
return;
pNode->CollectQueryParams(params);
@@ -250,7 +250,7 @@ bool CDirectoryNode::GetChilds(CFileItemList& items)
std::unique_ptr<CDirectoryNode> pNode(CDirectoryNode::CreateNode(GetChildType(), "", this));
bool bSuccess=false;
- if (pNode.get())
+ if (pNode)
{
pNode->m_options = m_options;
bSuccess=pNode->GetContent(items);
diff --git a/xbmc/filesystem/PlaylistFileDirectory.cpp b/xbmc/filesystem/PlaylistFileDirectory.cpp
index 84edbb02ad..9103168562 100644
--- a/xbmc/filesystem/PlaylistFileDirectory.cpp
+++ b/xbmc/filesystem/PlaylistFileDirectory.cpp
@@ -25,7 +25,7 @@ namespace XFILE
{
const std::string pathToUrl = url.Get();
std::unique_ptr<CPlayList> pPlayList (CPlayListFactory::Create(pathToUrl));
- if ( NULL != pPlayList.get())
+ if (nullptr != pPlayList)
{
// load it
if (!pPlayList->Load(pathToUrl))
@@ -47,7 +47,7 @@ namespace XFILE
{
const std::string pathToUrl = url.Get();
std::unique_ptr<CPlayList> pPlayList (CPlayListFactory::Create(pathToUrl));
- if ( NULL != pPlayList.get())
+ if (nullptr != pPlayList)
{
// load it
if (!pPlayList->Load(pathToUrl))
diff --git a/xbmc/filesystem/VideoDatabaseDirectory.cpp b/xbmc/filesystem/VideoDatabaseDirectory.cpp
index 384ebd6277..4a53a7046b 100644
--- a/xbmc/filesystem/VideoDatabaseDirectory.cpp
+++ b/xbmc/filesystem/VideoDatabaseDirectory.cpp
@@ -36,7 +36,7 @@ bool CVideoDatabaseDirectory::GetDirectory(const CURL& url, CFileItemList &items
items.m_dwSize = -1; // No size
std::unique_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(path));
- if (!pNode.get())
+ if (!pNode)
return false;
bool bResult = pNode->GetChilds(items);
@@ -64,7 +64,7 @@ NODE_TYPE CVideoDatabaseDirectory::GetDirectoryChildType(const std::string& strP
std::string path = CLegacyPathTranslation::TranslateVideoDbPath(strPath);
std::unique_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(path));
- if (!pNode.get())
+ if (!pNode)
return NODE_TYPE_NONE;
return pNode->GetChildType();
@@ -75,7 +75,7 @@ NODE_TYPE CVideoDatabaseDirectory::GetDirectoryType(const std::string& strPath)
std::string path = CLegacyPathTranslation::TranslateVideoDbPath(strPath);
std::unique_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(path));
- if (!pNode.get())
+ if (!pNode)
return NODE_TYPE_NONE;
return pNode->GetType();
@@ -86,7 +86,7 @@ NODE_TYPE CVideoDatabaseDirectory::GetDirectoryParentType(const std::string& str
std::string path = CLegacyPathTranslation::TranslateVideoDbPath(strPath);
std::unique_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(path));
- if (!pNode.get())
+ if (!pNode)
return NODE_TYPE_NONE;
CDirectoryNode* pParentNode=pNode->GetParent();
@@ -102,7 +102,7 @@ bool CVideoDatabaseDirectory::GetQueryParams(const std::string& strPath, CQueryP
std::string path = CLegacyPathTranslation::TranslateVideoDbPath(strPath);
std::unique_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(path));
- if (!pNode.get())
+ if (!pNode)
return false;
CDirectoryNode::GetDatabaseInfo(strPath,params);
@@ -133,7 +133,7 @@ bool CVideoDatabaseDirectory::GetLabel(const std::string& strDirectory, std::str
std::string path = CLegacyPathTranslation::TranslateVideoDbPath(strDirectory);
std::unique_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(path));
- if (!pNode.get() || path.empty())
+ if (!pNode || path.empty())
return false;
// first see if there's any filter criteria
@@ -299,7 +299,7 @@ bool CVideoDatabaseDirectory::Exists(const CURL& url)
std::string path = CLegacyPathTranslation::TranslateVideoDbPath(url);
std::unique_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(path));
- if (!pNode.get())
+ if (!pNode)
return false;
if (pNode->GetChildType() == VIDEODATABASEDIRECTORY::NODE_TYPE_NONE)
@@ -312,7 +312,7 @@ bool CVideoDatabaseDirectory::CanCache(const std::string& strPath)
{
std::string path = CLegacyPathTranslation::TranslateVideoDbPath(strPath);
std::unique_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(path));
- if (!pNode.get())
+ if (!pNode)
return false;
return pNode->CanCache();
}
diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNode.cpp b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNode.cpp
index e5f95683da..7f83cffcca 100644
--- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNode.cpp
+++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNode.cpp
@@ -80,7 +80,7 @@ void CDirectoryNode::GetDatabaseInfo(const std::string& strPath, CQueryParams& p
{
std::unique_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(strPath));
- if (!pNode.get())
+ if (!pNode)
return;
pNode->CollectQueryParams(params);
@@ -245,7 +245,7 @@ bool CDirectoryNode::GetChilds(CFileItemList& items)
std::unique_ptr<CDirectoryNode> pNode(CDirectoryNode::CreateNode(GetChildType(), "", this));
bool bSuccess=false;
- if (pNode.get())
+ if (pNode)
{
pNode->m_options = m_options;
bSuccess = pNode->GetContent(items);
diff --git a/xbmc/interfaces/builtins/PlayerBuiltins.cpp b/xbmc/interfaces/builtins/PlayerBuiltins.cpp
index d3da01852d..14b9c59dec 100644
--- a/xbmc/interfaces/builtins/PlayerBuiltins.cpp
+++ b/xbmc/interfaces/builtins/PlayerBuiltins.cpp
@@ -452,7 +452,7 @@ static int PlayMedia(const std::vector<std::string>& params)
}
std::unique_ptr<CGUIViewState> state(CGUIViewState::GetViewState(containsVideo ? WINDOW_VIDEO_NAV : WINDOW_MUSIC_NAV, items));
- if (state.get())
+ if (state)
items.Sort(state->GetSortMethod());
else
items.Sort(SortByLabel, SortOrderAscending);
diff --git a/xbmc/interfaces/legacy/PlayList.cpp b/xbmc/interfaces/legacy/PlayList.cpp
index d9cfe21907..f6f8d8acf5 100644
--- a/xbmc/interfaces/legacy/PlayList.cpp
+++ b/xbmc/interfaces/legacy/PlayList.cpp
@@ -70,7 +70,7 @@ namespace XBMCAddon
// load a playlist like .m3u, .pls
// first get correct factory to load playlist
std::unique_ptr<CPlayList> pPlayList (CPlayListFactory::Create(item));
- if ( NULL != pPlayList.get())
+ if (nullptr != pPlayList)
{
// load it
if (!pPlayList->Load(item.GetPath()))
diff --git a/xbmc/listproviders/DirectoryProvider.cpp b/xbmc/listproviders/DirectoryProvider.cpp
index 2de85b9c75..9a77011328 100644
--- a/xbmc/listproviders/DirectoryProvider.cpp
+++ b/xbmc/listproviders/DirectoryProvider.cpp
@@ -428,7 +428,7 @@ bool CDirectoryProvider::OnInfo(const CGUIListItemPtr& item)
mediaType == MediaTypeVideo ||
mediaType == MediaTypeMusicVideo)
{
- CGUIDialogVideoInfo::ShowFor(*fileItem.get());
+ CGUIDialogVideoInfo::ShowFor(*fileItem);
return true;
}
}
diff --git a/xbmc/music/MusicDatabase.cpp b/xbmc/music/MusicDatabase.cpp
index 4e6d4d5a75..28e9b8b35c 100644
--- a/xbmc/music/MusicDatabase.cpp
+++ b/xbmc/music/MusicDatabase.cpp
@@ -569,8 +569,10 @@ int CMusicDatabase::AddSong(const int idAlbum,
if (strTitle.empty())
return -1;
- if (NULL == m_pDB.get()) return -1;
- if (NULL == m_pDS.get()) return -1;
+ if (nullptr == m_pDB)
+ return -1;
+ if (nullptr == m_pDS)
+ return -1;
std::string strPath, strFileName;
SplitPath(strPathAndFileName, strPath, strFileName);
@@ -659,8 +661,10 @@ bool CMusicDatabase::GetSong(int idSong, CSong& song)
{
song.Clear();
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string strSQL=PrepareSQL("SELECT songview.*,songartistview.* FROM songview "
" JOIN songartistview ON songview.idSong = songartistview.idSong "
@@ -677,10 +681,10 @@ bool CMusicDatabase::GetSong(int idSong, CSong& song)
int songArtistOffset = song_enumCount;
- song = GetSongFromDataset(m_pDS.get()->get_sql_record());
+ song = GetSongFromDataset(m_pDS->get_sql_record());
while (!m_pDS->eof())
{
- const dbiplus::sql_record* const record = m_pDS.get()->get_sql_record();
+ const dbiplus::sql_record* const record = m_pDS->get_sql_record();
int idSongArtistRole = record->at(songArtistOffset + artistCredit_idRole).get_asInt();
if (idSongArtistRole == ROLE_ARTIST)
@@ -817,8 +821,10 @@ int CMusicDatabase::AddAlbum(const std::string& strAlbum, const std::string& str
std::string strSQL;
try
{
- if (NULL == m_pDB.get()) return -1;
- if (NULL == m_pDS.get()) return -1;
+ if (nullptr == m_pDB)
+ return -1;
+ if (nullptr == m_pDS)
+ return -1;
if (!strMusicBrainzAlbumID.empty())
strSQL = PrepareSQL("SELECT * FROM album WHERE strMusicBrainzAlbumID = '%s'",
@@ -969,8 +975,10 @@ bool CMusicDatabase::GetAlbum(int idAlbum, CAlbum& album, bool getSongs /* = tru
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
if (idAlbum == -1)
return false; // not in the database
@@ -995,7 +1003,7 @@ bool CMusicDatabase::GetAlbum(int idAlbum, CAlbum& album, bool getSongs /* = tru
int albumArtistOffset = album_enumCount;
- album = GetAlbumFromDataset(m_pDS.get()->get_sql_record(), 0, true); // true to grab and parse the imageURL
+ album = GetAlbumFromDataset(m_pDS->get_sql_record(), 0, true); // true to grab and parse the imageURL
while (!m_pDS->eof())
{
const dbiplus::sql_record* const record = m_pDS->get_sql_record();
@@ -1082,8 +1090,10 @@ int CMusicDatabase::AddGenre(std::string& strGenre)
if (strGenre.empty())
strGenre=g_localizeStrings.Get(13205); // Unknown
- if (NULL == m_pDB.get()) return -1;
- if (NULL == m_pDS.get()) return -1;
+ if (nullptr == m_pDB)
+ return -1;
+ if (nullptr == m_pDS)
+ return -1;
auto it = m_genreCache.find(strGenre);
if (it != m_genreCache.end())
@@ -1168,8 +1178,10 @@ int CMusicDatabase::AddArtist(const std::string& strArtist, const std::string& s
try
{
- if (NULL == m_pDB.get()) return -1;
- if (NULL == m_pDS.get()) return -1;
+ if (nullptr == m_pDB)
+ return -1;
+ if (nullptr == m_pDS)
+ return -1;
strSQL = PrepareSQL("SELECT strArtist, strSortName FROM artist WHERE idArtist = %i", idArtist);
m_pDS->query(strSQL);
@@ -1207,8 +1219,10 @@ int CMusicDatabase::AddArtist(const std::string& strArtist, const std::string& s
std::string strSQL;
try
{
- if (NULL == m_pDB.get()) return -1;
- if (NULL == m_pDS.get()) return -1;
+ if (nullptr == m_pDB)
+ return -1;
+ if (nullptr == m_pDS)
+ return -1;
// 1) MusicBrainz
if (!strMusicBrainzArtistID.empty())
@@ -1370,8 +1384,10 @@ bool CMusicDatabase::GetArtist(int idArtist, CArtist &artist, bool fetchAll /* =
try
{
unsigned int time = XbmcThreads::SystemClockMillis();
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
if (idArtist == -1)
return false; // not in the database
@@ -1405,12 +1421,12 @@ bool CMusicDatabase::GetArtist(int idArtist, CArtist &artist, bool fetchAll /* =
int discographyOffset = artist_enumCount;
artist.discography.clear();
- artist = GetArtistFromDataset(m_pDS.get()->get_sql_record(), 0, true); // inc scraped art URLs
+ artist = GetArtistFromDataset(m_pDS->get_sql_record(), 0, true); // inc scraped art URLs
if (fetchAll)
{
while (!m_pDS->eof())
{
- const dbiplus::sql_record* const record = m_pDS.get()->get_sql_record();
+ const dbiplus::sql_record* const record = m_pDS->get_sql_record();
artist.discography.emplace_back(record->at(discographyOffset + 1).get_asString(), record->at(discographyOffset + 2).get_asString());
m_pDS->next();
@@ -1432,8 +1448,10 @@ bool CMusicDatabase::GetArtistExists(int idArtist)
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string strSQL = PrepareSQL("SELECT 1 FROM artist WHERE artist.idArtist = %i LIMIT 1", idArtist);
@@ -1495,8 +1513,10 @@ bool CMusicDatabase::GetArtistDiscography(int idArtist, CFileItemList& items)
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
// Combine entries from discography and album tables
// When title in both, album entry will be before disco entry
@@ -1568,8 +1588,10 @@ int CMusicDatabase::AddRole(const std::string &strRole)
try
{
- if (NULL == m_pDB.get()) return -1;
- if (NULL == m_pDS.get()) return -1;
+ if (nullptr == m_pDB)
+ return -1;
+ if (nullptr == m_pDS)
+ return -1;
strSQL = PrepareSQL("SELECT idRole FROM role WHERE strRole LIKE '%s'", strRole.c_str());
m_pDS->query(strSQL);
if (m_pDS->num_rows() > 0)
@@ -1613,8 +1635,10 @@ int CMusicDatabase::AddSongContributor(int idSong, const std::string& strRole, c
std::string strSQL;
try
{
- if (NULL == m_pDB.get()) return -1;
- if (NULL == m_pDS.get()) return -1;
+ if (nullptr == m_pDB)
+ return -1;
+ if (nullptr == m_pDS)
+ return -1;
int idArtist = -1;
// Add artist. As we only have name (no MBID) first try to identify artist from song
@@ -1670,8 +1694,10 @@ int CMusicDatabase::GetRoleByName(const std::string& strRole)
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string strSQL;
strSQL = PrepareSQL("SELECT idRole FROM role WHERE strRole like '%s'", strRole.c_str());
@@ -2075,8 +2101,10 @@ int CMusicDatabase::AddPath(const std::string& strPath1)
if (!URIUtils::HasSlashAtEnd(strPath))
URIUtils::AddSlashAtEnd(strPath);
- if (NULL == m_pDB.get()) return -1;
- if (NULL == m_pDS.get()) return -1;
+ if (nullptr == m_pDB)
+ return -1;
+ if (nullptr == m_pDS)
+ return -1;
auto it = m_pathCache.find(strPath);
if (it != m_pathCache.end())
@@ -2365,8 +2393,10 @@ bool CMusicDatabase::GetSongByFileName(const std::string& strFileNameAndPath, CS
return GetSong(atol(strFile.c_str()), song);
}
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string strPath, strFileName;
SplitPath(strFileNameAndPath, strPath, strFileName);
@@ -2389,8 +2419,10 @@ int CMusicDatabase::GetAlbumIdByPath(const std::string& strPath)
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string strSQL = PrepareSQL("SELECT DISTINCT idAlbum FROM song JOIN path ON song.idPath = path.idPath WHERE path.strPath='%s'", strPath.c_str());
// run query
@@ -2444,8 +2476,10 @@ bool CMusicDatabase::SearchArtists(const std::string& search, CFileItemList &art
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string strVariousArtists = g_localizeStrings.Get(340).c_str();
std::string strSQL;
@@ -2494,8 +2528,10 @@ bool CMusicDatabase::GetTop100(const std::string& strBaseDir, CFileItemList& ite
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
CMusicDbUrl baseUrl;
if (!strBaseDir.empty() && !baseUrl.FromString(strBaseDir))
@@ -2539,8 +2575,10 @@ bool CMusicDatabase::GetTop100Albums(VECALBUMS& albums)
try
{
albums.erase(albums.begin(), albums.end());
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
// Get data from album and album_artist tables to fully populate albums
std::string strSQL = "SELECT albumview.*, albumartistview.* FROM albumview "
@@ -2592,8 +2630,10 @@ bool CMusicDatabase::GetTop100AlbumSongs(const std::string& strBaseDir, CFileIte
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
CMusicDbUrl baseUrl;
if (!strBaseDir.empty() && baseUrl.FromString(strBaseDir))
@@ -2636,8 +2676,10 @@ bool CMusicDatabase::GetRecentlyPlayedAlbums(VECALBUMS& albums)
try
{
albums.erase(albums.begin(), albums.end());
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
// Get data from album and album_artist tables to fully populate albums
std::string strSQL = PrepareSQL("SELECT albumview.*, albumartistview.* FROM "
@@ -2689,8 +2731,10 @@ bool CMusicDatabase::GetRecentlyPlayedAlbumSongs(const std::string& strBaseDir,
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
CMusicDbUrl baseUrl;
if (!strBaseDir.empty() && !baseUrl.FromString(strBaseDir))
@@ -2768,8 +2812,10 @@ bool CMusicDatabase::GetRecentlyAddedAlbums(VECALBUMS& albums, unsigned int limi
try
{
albums.erase(albums.begin(), albums.end());
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
// Get data from album and album_artist tables to fully populate albums
// Use idAlbum to determine the recently added albums
@@ -2821,8 +2867,10 @@ bool CMusicDatabase::GetRecentlyAddedAlbumSongs(const std::string& strBaseDir, C
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
CMusicDbUrl baseUrl;
if (!strBaseDir.empty() && !baseUrl.FromString(strBaseDir))
@@ -2901,8 +2949,10 @@ void CMusicDatabase::IncrementPlayCount(const CFileItem& item)
{
try
{
- if (NULL == m_pDB.get()) return;
- if (NULL == m_pDS.get()) return;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
int idSong = GetSongIDFromPath(item.GetPath());
@@ -2926,8 +2976,10 @@ bool CMusicDatabase::GetSongsByPath(const std::string& strPath1, MAPSONGS& songs
if (!bAppendToMap)
songs.clear();
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string strSQL=PrepareSQL("SELECT * FROM songview WHERE strPath='%s'", strPath.c_str());
if (!m_pDS->query(strSQL)) return false;
@@ -2986,8 +3038,10 @@ bool CMusicDatabase::SearchSongs(const std::string& search, CFileItemList &items
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
CMusicDbUrl baseUrl;
if (!baseUrl.FromString("musicdb://songs/"))
@@ -3026,8 +3080,10 @@ bool CMusicDatabase::SearchAlbums(const std::string& search, CFileItemList &albu
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string strSQL;
if (search.size() >= MIN_FULL_SEARCH_LENGTH)
@@ -3064,8 +3120,10 @@ bool CMusicDatabase::CleanupSongsByIds(const std::string &strSongIds)
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
// ok, now find all idSong's
std::string strSQL=PrepareSQL("select * from song join path on song.idPath = path.idPath where song.idSong in %s", strSongIds.c_str());
if (!m_pDS->query(strSQL)) return false;
@@ -3356,8 +3414,10 @@ bool CMusicDatabase::CleanupRoles()
bool CMusicDatabase::CleanupOrphanedItems()
{
// paths aren't cleaned up here - they're cleaned up in RemoveSongsFromPath()
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
SetLibraryLastUpdated();
if (!CleanupAlbums()) return false;
if (!CleanupArtists()) return false;
@@ -3369,8 +3429,10 @@ bool CMusicDatabase::CleanupOrphanedItems()
int CMusicDatabase::Cleanup(CGUIDialogProgress* progressDialog /*= nullptr*/)
{
- if (NULL == m_pDB.get()) return ERROR_DATABASE;
- if (NULL == m_pDS.get()) return ERROR_DATABASE;
+ if (nullptr == m_pDB)
+ return ERROR_DATABASE;
+ if (nullptr == m_pDS)
+ return ERROR_DATABASE;
int ret = ERROR_OK;
unsigned int time = XbmcThreads::SystemClockMillis();
@@ -3720,8 +3782,10 @@ bool CMusicDatabase::GetGenresNav(const std::string& strBaseDir, CFileItemList&
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
// get primary genres for songs - could be simplified to just SELECT * FROM genre?
std::string strSQL = "SELECT %s FROM genre ";
@@ -3827,8 +3891,10 @@ bool CMusicDatabase::GetSourcesNav(const std::string& strBaseDir, CFileItemList&
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
// Get sources for selection list when add/edit filter or smartplaylist rule
std::string strSQL = "SELECT %s FROM source ";
@@ -3937,8 +4003,10 @@ bool CMusicDatabase::GetYearsNav(const std::string& strBaseDir, CFileItemList& i
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
Filter extFilter = filter;
CMusicDbUrl musicUrl;
@@ -4000,8 +4068,10 @@ bool CMusicDatabase::GetRolesNav(const std::string& strBaseDir, CFileItemList& i
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
Filter extFilter = filter;
CMusicDbUrl musicUrl;
@@ -4073,8 +4143,10 @@ bool CMusicDatabase::GetAlbumsByYear(const std::string& strBaseDir, CFileItemLis
bool CMusicDatabase::GetCommonNav(const std::string &strBaseDir, const std::string &table, const std::string &labelField, CFileItemList &items, const Filter &filter /* = Filter() */, bool countOnly /* = false */)
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
if (table.empty() || labelField.empty())
return false;
@@ -4166,8 +4238,10 @@ bool CMusicDatabase::GetMusicLabelsNav(const std::string &strBaseDir, CFileItemL
bool CMusicDatabase::GetArtistsNav(const std::string& strBaseDir, CFileItemList& items, bool albumArtistsOnly /* = false */, int idGenre /* = -1 */, int idAlbum /* = -1 */, int idSong /* = -1 */, const Filter &filter /* = Filter() */, const SortDescription &sortDescription /* = SortDescription() */, bool countOnly /* = false */)
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
try
{
CMusicDbUrl musicUrl;
@@ -4200,8 +4274,10 @@ bool CMusicDatabase::GetArtistsNav(const std::string& strBaseDir, CFileItemList&
bool CMusicDatabase::GetArtistsByWhere(const std::string& strBaseDir, const Filter &filter, CFileItemList& items, const SortDescription &sortDescription /* = SortDescription() */, bool countOnly /* = false */)
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
try
{
@@ -4350,8 +4426,10 @@ bool CMusicDatabase::GetAlbumFromSong(int idSong, CAlbum &album)
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string strSQL = PrepareSQL("select albumview.* from song join albumview on song.idAlbum = albumview.idAlbum where song.idSong='%i'", idSong);
if (!m_pDS->query(strSQL)) return false;
@@ -4393,7 +4471,7 @@ bool CMusicDatabase::GetAlbumsNav(const std::string& strBaseDir, CFileItemList&
bool CMusicDatabase::GetAlbumsByWhere(const std::string &baseDir, const Filter &filter, CFileItemList &items, const SortDescription &sortDescription /* = SortDescription() */, bool countOnly /* = false */)
{
- if (m_pDB.get() == NULL || m_pDS.get() == NULL)
+ if (m_pDB == nullptr || m_pDS == nullptr)
return false;
try
@@ -4515,7 +4593,7 @@ bool CMusicDatabase::GetAlbumsByWhere(const std::string &baseDir, const Filter &
bool CMusicDatabase::GetSongsFullByWhere(const std::string &baseDir, const Filter &filter, CFileItemList &items, const SortDescription &sortDescription /* = SortDescription() */, bool artistData /* = false*/)
{
- if (m_pDB.get() == NULL || m_pDS.get() == NULL)
+ if (m_pDB == nullptr || m_pDS == nullptr)
return false;
try
@@ -4674,7 +4752,7 @@ bool CMusicDatabase::GetSongsFullByWhere(const std::string &baseDir, const Filte
bool CMusicDatabase::GetSongsByWhere(const std::string &baseDir, const Filter &filter, CFileItemList &items, const SortDescription &sortDescription /* = SortDescription() */)
{
- if (m_pDB.get() == NULL || m_pDS.get() == NULL)
+ if (m_pDB == nullptr || m_pDS == nullptr)
return false;
try
@@ -4867,8 +4945,10 @@ static const size_t NUM_ARTIST_FIELDS = sizeof(JSONtoDBArtist) / sizeof(translat
bool CMusicDatabase::GetArtistsByWhereJSON(const std::set<std::string>& fields, const std::string &baseDir,
CVariant& result, int& total, const SortDescription &sortDescription /* = SortDescription() */)
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
try
{
@@ -5553,9 +5633,11 @@ static const size_t NUM_ALBUM_FIELDS = sizeof(JSONtoDBAlbum) / sizeof(translateJ
bool CMusicDatabase::GetAlbumsByWhereJSON(const std::set<std::string>& fields, const std::string &baseDir,
CVariant& result, int& total, const SortDescription &sortDescription /* = SortDescription() */)
{
-
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
try
{
@@ -6039,8 +6121,10 @@ bool CMusicDatabase::GetSongsByWhereJSON(const std::set<std::string>& fields, co
CVariant& result, int& total, const SortDescription &sortDescription /* = SortDescription() */)
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
try
{
@@ -7434,8 +7518,10 @@ int CMusicDatabase::GetMusicNeedsTagScan()
{
try
{
- if (NULL == m_pDB.get()) return -1;
- if (NULL == m_pDS.get()) return -1;
+ if (nullptr == m_pDB)
+ return -1;
+ if (nullptr == m_pDS)
+ return -1;
std::string sql = "SELECT * FROM versiontagscan";
if (!m_pDS->query(sql)) return -1;
@@ -7490,8 +7576,10 @@ unsigned int CMusicDatabase::GetRandomSongIDs(const Filter &filter, std::vector<
{
try
{
- if (NULL == m_pDB.get()) return 0;
- if (NULL == m_pDS.get()) return 0;
+ if (nullptr == m_pDB)
+ return 0;
+ if (nullptr == m_pDS)
+ return 0;
std::string strSQL = "SELECT idSong FROM songview ";
if (!CDatabase::BuildSQL(strSQL, filter, strSQL))
@@ -7525,8 +7613,10 @@ int CMusicDatabase::GetSongsCount(const Filter &filter)
{
try
{
- if (NULL == m_pDB.get()) return 0;
- if (NULL == m_pDS.get()) return 0;
+ if (nullptr == m_pDB)
+ return 0;
+ if (nullptr == m_pDS)
+ return 0;
std::string strSQL = "select count(idSong) as NumSongs from songview ";
if (!CDatabase::BuildSQL(strSQL, filter, strSQL))
@@ -7574,8 +7664,10 @@ bool CMusicDatabase::GetAlbumPaths(int idAlbum, std::vector<std::pair<std::strin
std::string strSQL;
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS2.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS2)
+ return false;
// Get the unique paths of songs on the album, providing there are no songs from
// other albums with the same path. This returns
@@ -7622,8 +7714,10 @@ int CMusicDatabase::GetDiscnumberForPathID(int idPath)
int result = -1;
try
{
- if (NULL == m_pDB.get()) return -1;
- if (NULL == m_pDS2.get()) return -1;
+ if (nullptr == m_pDB)
+ return -1;
+ if (nullptr == m_pDS2)
+ return -1;
strSQL = PrepareSQL("SELECT DISTINCT(song.iTrack >> 16) AS discnum FROM song "
"WHERE idPath = %i", idPath);
@@ -7653,8 +7747,10 @@ bool CMusicDatabase::GetOldArtistPath(int idArtist, std::string &basePath)
basePath.clear();
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS2.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS2)
+ return false;
// find all albums from this artist, and all the paths to the songs from those albums
std::string strSQL = PrepareSQL("SELECT strPath FROM album_artist "
@@ -7839,8 +7935,10 @@ int CMusicDatabase::AddSource(const std::string& strName, const std::string& str
std::string strSQL;
try
{
- if (NULL == m_pDB.get()) return -1;
- if (NULL == m_pDS.get()) return -1;
+ if (nullptr == m_pDB)
+ return -1;
+ if (nullptr == m_pDS)
+ return -1;
// Check if source name already exists
idSource = GetSourceByName(strName);
@@ -7918,8 +8016,10 @@ int CMusicDatabase::UpdateSource(const std::string& strOldName, const std::strin
std::string strSQL;
try
{
- if (NULL == m_pDB.get()) return -1;
- if (NULL == m_pDS.get()) return -1;
+ if (nullptr == m_pDB)
+ return -1;
+ if (nullptr == m_pDS)
+ return -1;
// Get details of named old source
if (!strOldName.empty())
@@ -7990,8 +8090,10 @@ int CMusicDatabase::GetSourceFromPath(const std::string& strPath1)
if (!URIUtils::HasSlashAtEnd(strPath))
URIUtils::AddSlashAtEnd(strPath);
- if (NULL == m_pDB.get()) return -1;
- if (NULL == m_pDS.get()) return -1;
+ if (nullptr == m_pDB)
+ return -1;
+ if (nullptr == m_pDS)
+ return -1;
// Check if path is a source matching on multipath
strSQL = PrepareSQL("SELECT idSource FROM source WHERE strMultipath = '%s'", strPath.c_str());
@@ -8036,8 +8138,10 @@ bool CMusicDatabase::AddAlbumSources(int idAlbum, const std::string& strPath)
std::vector<int> sourceIds;
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
if (!strPath.empty())
{
@@ -8056,7 +8160,8 @@ bool CMusicDatabase::AddAlbumSources(int idAlbum, const std::string& strPath)
else
{
// Find sources using song paths, check each source path individually
- if (NULL == m_pDS2.get()) return false;
+ if (nullptr == m_pDS2)
+ return false;
strSQL = "SELECT idSource, strPath FROM source_path";
if (!m_pDS->query(strSQL))
return false;
@@ -8114,8 +8219,10 @@ bool CMusicDatabase::CheckSources(VECSOURCES& sources)
// Check individual sources match
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string strSQL;
for (const auto& source : sources)
@@ -8221,8 +8328,10 @@ bool CMusicDatabase::GetSources(CFileItemList& items)
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
// Get music sources and individual source paths (may not be scanned or have albums etc.)
std::string strSQL = "SELECT source.idSource, source.strName, source.strMultipath, source_path.strPath "
@@ -8290,8 +8399,10 @@ bool CMusicDatabase::GetSources(CFileItemList& items)
bool CMusicDatabase::GetSourcesByArtist(int idArtist, CFileItem* item)
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
try
{
@@ -8343,8 +8454,10 @@ bool CMusicDatabase::GetSourcesByArtist(int idArtist, CFileItem* item)
bool CMusicDatabase::GetSourcesByAlbum(int idAlbum, CFileItem* item)
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
try
{
@@ -8371,8 +8484,9 @@ bool CMusicDatabase::GetSourcesByAlbum(int idAlbum, CFileItem* item)
// Check via song paths, check each source path individually
// usually fewer source paths than songs
m_pDS->close();
-
- if (NULL == m_pDS2.get()) return false;
+
+ if (nullptr == m_pDS2)
+ return false;
strSQL = "SELECT idSource, strPath FROM source_path";
if (!m_pDS->query(strSQL))
return false;
@@ -8406,8 +8520,10 @@ bool CMusicDatabase::GetSourcesByAlbum(int idAlbum, CFileItem* item)
bool CMusicDatabase::GetSourcesBySong(int idSong, const std::string& strPath1, CFileItem* item)
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
try
{
@@ -8453,8 +8569,10 @@ int CMusicDatabase::GetSourceByName(const std::string& strSource)
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string strSQL;
strSQL = PrepareSQL("SELECT idSource FROM source WHERE strName LIKE '%s'", strSource.c_str());
@@ -8484,8 +8602,10 @@ int CMusicDatabase::GetArtistByName(const std::string& strArtist)
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string strSQL=PrepareSQL("select idArtist from artist where artist.strArtist like '%s'", strArtist.c_str());
@@ -8513,7 +8633,7 @@ int CMusicDatabase::GetArtistByMatch(const CArtist& artist)
std::string strSQL;
try
{
- if (NULL == m_pDB.get() || NULL == m_pDS.get())
+ if (nullptr == m_pDB || nullptr == m_pDS)
return false;
// Match on MusicBrainz ID, definitively unique
if (!artist.strMusicBrainzArtistID.empty())
@@ -8546,8 +8666,10 @@ bool CMusicDatabase::GetArtistFromSong(int idSong, CArtist &artist)
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string strSQL = PrepareSQL(
"SELECT artistview.* FROM song_artist "
@@ -8598,8 +8720,10 @@ int CMusicDatabase::GetAlbumByName(const std::string& strAlbum, const std::strin
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string strSQL;
if (strArtist.empty())
@@ -8633,7 +8757,7 @@ int CMusicDatabase::GetAlbumByMatch(const CAlbum &album)
std::string strSQL;
try
{
- if (NULL == m_pDB.get() || NULL == m_pDS.get())
+ if (nullptr == m_pDB || nullptr == m_pDS)
return false;
// Match on MusicBrainz ID, definitively unique
if (!album.strMusicBrainzAlbumID.empty())
@@ -8769,8 +8893,10 @@ int CMusicDatabase::GetGenreByName(const std::string& strGenre)
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string strSQL;
strSQL=PrepareSQL("select idGenre from genre where genre.strGenre like '%s'", strGenre.c_str());
@@ -8796,8 +8922,10 @@ bool CMusicDatabase::GetGenresJSON(CFileItemList& items, bool bSources)
std::string strSQL;
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
strSQL = "SELECT %s FROM genre ";
Filter extFilter;
@@ -8939,8 +9067,10 @@ bool CMusicDatabase::SetPathHash(const std::string &path, const std::string &has
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
if (hash.empty())
{ // this is an empty folder - we need only add it to the path table
@@ -8968,8 +9098,10 @@ bool CMusicDatabase::GetPathHash(const std::string &path, std::string &hash)
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string strSQL=PrepareSQL("select strHash from path where strPath='%s'", path.c_str());
m_pDS->query(strSQL);
@@ -9021,8 +9153,10 @@ bool CMusicDatabase::RemoveSongsFromPath(const std::string &path1, MAPSONGS& son
if (!URIUtils::HasSlashAtEnd(path))
URIUtils::AddSlashAtEnd(path);
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string where;
if (exact)
@@ -9069,8 +9203,10 @@ bool CMusicDatabase::GetPaths(std::set<std::string> &paths)
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
paths.clear();
@@ -9102,8 +9238,10 @@ bool CMusicDatabase::SetSongUserrating(const std::string &filePath, int userrati
try
{
if (filePath.empty()) return false;
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
int songID = GetSongIDFromPath(filePath);
if (-1 == songID) return false;
@@ -9121,8 +9259,10 @@ bool CMusicDatabase::SetSongUserrating(int idSong, int userrating)
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string sql = PrepareSQL("UPDATE song SET userrating='%i' WHERE idSong = %i", userrating, idSong);
m_pDS->exec(sql);
@@ -9139,8 +9279,10 @@ bool CMusicDatabase::SetAlbumUserrating(const int idAlbum, int userrating)
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
if (-1 == idAlbum) return false;
@@ -9160,8 +9302,10 @@ bool CMusicDatabase::SetSongVotes(const std::string &filePath, int votes)
try
{
if (filePath.empty()) return false;
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
int songID = GetSongIDFromPath(filePath);
if (-1 == songID) return false;
@@ -9190,8 +9334,10 @@ int CMusicDatabase::GetSongIDFromPath(const std::string &filePath)
// hit the db
try
{
- if (NULL == m_pDB.get()) return -1;
- if (NULL == m_pDS.get()) return -1;
+ if (nullptr == m_pDB)
+ return -1;
+ if (nullptr == m_pDS)
+ return -1;
std::string strPath, strFileName;
SplitPath(filePath, strPath, strFileName);
@@ -9233,8 +9379,10 @@ bool CMusicDatabase::CommitTransaction()
bool CMusicDatabase::SetScraperAll(const std::string & strBaseDir, const ADDON::ScraperPtr scraper)
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string strSQL;
int idSetting = -1;
try
@@ -9308,8 +9456,10 @@ bool CMusicDatabase::SetScraperAll(const std::string & strBaseDir, const ADDON::
bool CMusicDatabase::SetScraper(int id, const CONTENT_TYPE &content, const ADDON::ScraperPtr scraper)
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string strSQL;
int idSetting = -1;
try
@@ -9363,8 +9513,10 @@ bool CMusicDatabase::GetScraper(int id, const CONTENT_TYPE &content, ADDON::Scra
std::string strSettings;
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string strSQL;
strSQL = "SELECT strScraperPath, strSettings FROM infosetting JOIN ";
@@ -9416,8 +9568,10 @@ bool CMusicDatabase::ScraperInUse(const std::string &scraperID) const
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string sql = PrepareSQL("SELECT COUNT(1) FROM infosetting WHERE strScraperPath='%s'",scraperID.c_str());
if (!m_pDS->query(sql) || m_pDS->num_rows() == 0)
@@ -9531,9 +9685,12 @@ void CMusicDatabase::ExportToXML(const CLibExportSettings& settings, CGUIDialog
int iFailCount = 0;
try
{
- if (NULL == m_pDB.get()) return;
- if (NULL == m_pDS.get()) return;
- if (NULL == m_pDS2.get()) return;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
+ if (nullptr == m_pDS2)
+ return;
// Create our xml document
CXBMCTinyXML xmlDoc;
@@ -9914,8 +10071,10 @@ void CMusicDatabase::ImportFromXML(const std::string& xmlFile, CGUIDialogProgres
{
try
{
- if (NULL == m_pDB.get()) return;
- if (NULL == m_pDS.get()) return;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
CXBMCTinyXML xmlDoc;
if (!xmlDoc.LoadFile(xmlFile) && progressDialog)
@@ -10412,8 +10571,10 @@ void CMusicDatabase::SetArtForItem(int mediaId, const std::string &mediaType, co
{
try
{
- if (NULL == m_pDB.get()) return;
- if (NULL == m_pDS.get()) return;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
// don't set <foo>.<bar> art types - these are derivative types from parent items
if (artType.find('.') != std::string::npos)
@@ -10447,8 +10608,10 @@ bool CMusicDatabase::GetArtForItem(int songId, int albumId, int artistId, bool b
try
{
if (!(songId > 0 || albumId > 0 || artistId > 0)) return false;
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS2.get()) return false; // using dataset 2 as we're likely called in loops on dataset 1
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS2)
+ return false; // using dataset 2 as we're likely called in loops on dataset 1
Filter filter;
if (songId > 0)
@@ -10554,8 +10717,10 @@ bool CMusicDatabase::GetArtForItem(int mediaId, const std::string &mediaType, st
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS2.get()) return false; // using dataset 2 as we're likely called in loops on dataset 1
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS2)
+ return false; // using dataset 2 as we're likely called in loops on dataset 1
std::string sql = PrepareSQL("SELECT type,url FROM art WHERE media_id=%i AND media_type='%s'", mediaId, mediaType.c_str());
m_pDS2->query(sql);
@@ -10598,8 +10763,10 @@ bool CMusicDatabase::GetArtTypes(const MediaType &mediaType, std::vector<std::st
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string strSQL = PrepareSQL("SELECT DISTINCT type FROM art WHERE media_type='%s'", mediaType.c_str());
@@ -11119,8 +11286,10 @@ void CMusicDatabase::UpdateFileDateAdded(int songId, const std::string& strFileN
CDateTime dateAdded;
try
{
- if (NULL == m_pDB.get()) return;
- if (NULL == m_pDS.get()) return;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
// 1 preferring to use the files mtime(if it's valid) and only using the file's ctime if the mtime isn't valid
if (CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_iMusicLibraryDateAdded == 1)
diff --git a/xbmc/music/MusicInfoLoader.cpp b/xbmc/music/MusicInfoLoader.cpp
index 27cf4f1286..67a8247df3 100644
--- a/xbmc/music/MusicInfoLoader.cpp
+++ b/xbmc/music/MusicInfoLoader.cpp
@@ -126,7 +126,7 @@ bool CMusicInfoLoader::LoadAdditionalTagInfo(CFileItem* pItem)
// fetch the lyrics and add it to the current music info tag
CFileItem tempItem(path, false);
std::unique_ptr<IMusicInfoTagLoader> pLoader (CMusicInfoTagLoaderFactory::CreateLoader(tempItem));
- if (NULL != pLoader.get())
+ if (nullptr != pLoader)
{
CMusicInfoTag tag;
pLoader->Load(path, tag);
@@ -226,7 +226,7 @@ bool CMusicInfoLoader::LoadItemLookup(CFileItem* pItem)
// always try to load cddb info
// get correct tag parser
std::unique_ptr<IMusicInfoTagLoader> pLoader (CMusicInfoTagLoaderFactory::CreateLoader(*pItem));
- if (NULL != pLoader.get())
+ if (nullptr != pLoader)
// get tag
pLoader->Load(pItem->GetPath(), *pItem->GetMusicInfoTag());
m_tagReads++;
diff --git a/xbmc/music/MusicThumbLoader.cpp b/xbmc/music/MusicThumbLoader.cpp
index 10ebb11b17..909b61449f 100644
--- a/xbmc/music/MusicThumbLoader.cpp
+++ b/xbmc/music/MusicThumbLoader.cpp
@@ -331,7 +331,7 @@ bool CMusicThumbLoader::GetEmbeddedThumb(const std::string &path, EmbeddedArt &a
CFileItem item(path, false);
std::unique_ptr<IMusicInfoTagLoader> pLoader (CMusicInfoTagLoaderFactory::CreateLoader(item));
CMusicInfoTag tag;
- if (NULL != pLoader.get())
+ if (nullptr != pLoader)
pLoader->Load(path, tag, &art);
return !art.Empty();
diff --git a/xbmc/music/infoscanner/MusicInfoScanner.cpp b/xbmc/music/infoscanner/MusicInfoScanner.cpp
index 862b0e4e1d..254a611fbb 100644
--- a/xbmc/music/infoscanner/MusicInfoScanner.cpp
+++ b/xbmc/music/infoscanner/MusicInfoScanner.cpp
@@ -574,7 +574,7 @@ CInfoScanner::INFO_RET CMusicInfoScanner::ScanTags(const CFileItemList& items,
if (!tag.Loaded())
{
std::unique_ptr<IMusicInfoTagLoader> pLoader (CMusicInfoTagLoaderFactory::CreateLoader(*pItem));
- if (NULL != pLoader.get())
+ if (nullptr != pLoader)
pLoader->Load(pItem->GetPath(), tag);
}
diff --git a/xbmc/music/windows/GUIWindowMusicBase.cpp b/xbmc/music/windows/GUIWindowMusicBase.cpp
index 2a7e6385c1..bb7e2f2334 100644
--- a/xbmc/music/windows/GUIWindowMusicBase.cpp
+++ b/xbmc/music/windows/GUIWindowMusicBase.cpp
@@ -399,7 +399,7 @@ void CGUIWindowMusicBase::OnQueueItem(int iItem, bool first)
CServiceBroker::GetPlaylistPlayer().Add(playlist, queuedItems);
if (CServiceBroker::GetPlaylistPlayer().GetPlaylist(playlist).size() && !g_application.GetAppPlayer().IsPlaying())
{
- if (m_guiState.get())
+ if (m_guiState)
m_guiState->SetPlaylistDirectory("playlistmusic://");
CServiceBroker::GetPlaylistPlayer().Reset();
@@ -459,7 +459,7 @@ void CGUIWindowMusicBase::AddItemToPlayList(const CFileItemPtr &pItem, CFileItem
if (pItem->IsPlayList())
{
std::unique_ptr<CPlayList> pPlayList (CPlayListFactory::Create(*pItem));
- if (pPlayList.get())
+ if (pPlayList)
{
// load it
if (!pPlayList->Load(pItem->GetPath()))
@@ -801,7 +801,7 @@ void CGUIWindowMusicBase::LoadPlayList(const std::string& strPlayList)
// load a playlist like .m3u, .pls
// first get correct factory to load playlist
std::unique_ptr<CPlayList> pPlayList (CPlayListFactory::Create(strPlayList));
- if (pPlayList.get())
+ if (pPlayList)
{
// load it
if (!pPlayList->Load(strPlayList))
@@ -814,7 +814,7 @@ void CGUIWindowMusicBase::LoadPlayList(const std::string& strPlayList)
int iSize = pPlayList->size();
if (g_application.ProcessAndStartPlaylist(strPlayList, *pPlayList, PLAYLIST_MUSIC))
{
- if (m_guiState.get())
+ if (m_guiState)
m_guiState->SetPlaylistDirectory("playlistmusic://");
// activate the playlist window if its not activated yet
if (GetID() == CServiceBroker::GetGUI()->GetWindowManager().GetActiveWindow() && iSize > 1)
diff --git a/xbmc/music/windows/GUIWindowMusicNav.cpp b/xbmc/music/windows/GUIWindowMusicNav.cpp
index 8809b8a380..c7f3ad539b 100644
--- a/xbmc/music/windows/GUIWindowMusicNav.cpp
+++ b/xbmc/music/windows/GUIWindowMusicNav.cpp
@@ -139,7 +139,8 @@ bool CGUIWindowMusicNav::OnMessage(CGUIMessage& message)
}
// Playlist directory is the root of the playlist window
- if (m_guiState.get()) m_guiState->SetPlaylistDirectory("playlistmusic://");
+ if (m_guiState)
+ m_guiState->SetPlaylistDirectory("playlistmusic://");
return true;
}
@@ -839,7 +840,7 @@ bool CGUIWindowMusicNav::GetSongsFromPlayList(const std::string& strPlayList, CF
CLog::Log(LOGDEBUG,"CGUIWindowMusicNav, opening playlist [%s]", strPlayList.c_str());
std::unique_ptr<CPlayList> pPlayList (CPlayListFactory::Create(strPlayList));
- if ( NULL != pPlayList.get())
+ if (nullptr != pPlayList)
{
// load it
if (!pPlayList->Load(strPlayList))
diff --git a/xbmc/music/windows/GUIWindowMusicPlaylist.cpp b/xbmc/music/windows/GUIWindowMusicPlaylist.cpp
index 564aca705f..bbce23fd13 100644
--- a/xbmc/music/windows/GUIWindowMusicPlaylist.cpp
+++ b/xbmc/music/windows/GUIWindowMusicPlaylist.cpp
@@ -425,7 +425,7 @@ bool CGUIWindowMusicPlayList::OnPlayMedia(int iItem, const std::string &player)
int iPlaylist=m_guiState->GetPlaylist();
if (iPlaylist!=PLAYLIST_NONE)
{
- if (m_guiState.get())
+ if (m_guiState)
m_guiState->SetPlaylistDirectory(m_vecItems->GetPath());
CServiceBroker::GetPlaylistPlayer().SetCurrentPlaylist( iPlaylist );
diff --git a/xbmc/pictures/GUIWindowPictures.cpp b/xbmc/pictures/GUIWindowPictures.cpp
index 03527c2390..4fe69a393e 100644
--- a/xbmc/pictures/GUIWindowPictures.cpp
+++ b/xbmc/pictures/GUIWindowPictures.cpp
@@ -533,7 +533,7 @@ void CGUIWindowPictures::LoadPlayList(const std::string& strPlayList)
{
CLog::Log(LOGDEBUG,"CGUIWindowPictures::LoadPlayList()... converting playlist into slideshow: %s", strPlayList.c_str());
std::unique_ptr<CPlayList> pPlayList (CPlayListFactory::Create(strPlayList));
- if ( NULL != pPlayList.get())
+ if (nullptr != pPlayList)
{
if (!pPlayList->Load(strPlayList))
{
diff --git a/xbmc/playlists/PlayList.cpp b/xbmc/playlists/PlayList.cpp
index 0a28e8edcd..45e66b47a4 100644
--- a/xbmc/playlists/PlayList.cpp
+++ b/xbmc/playlists/PlayList.cpp
@@ -452,7 +452,7 @@ bool CPlayList::Expand(int position)
{
CFileItemPtr item = m_vecItems[position];
std::unique_ptr<CPlayList> playlist (CPlayListFactory::Create(*item.get()));
- if (playlist.get() == nullptr)
+ if (playlist == nullptr)
return false;
std::string path = item->GetDynPath();
diff --git a/xbmc/playlists/PlayListPLS.cpp b/xbmc/playlists/PlayListPLS.cpp
index 335db9d1af..bfddc8b643 100644
--- a/xbmc/playlists/PlayListPLS.cpp
+++ b/xbmc/playlists/PlayListPLS.cpp
@@ -373,7 +373,7 @@ bool CPlayListASX::LoadData(std::istream& stream)
if (!value.empty())
{ // found an entryref, let's try loading that url
std::unique_ptr<CPlayList> playlist(CPlayListFactory::Create(value));
- if (NULL != playlist.get())
+ if (nullptr != playlist)
if (playlist->Load(value))
Add(*playlist);
}
diff --git a/xbmc/pvr/windows/GUIWindowPVRGuide.cpp b/xbmc/pvr/windows/GUIWindowPVRGuide.cpp
index 83b0a5e347..b6f86c0043 100644
--- a/xbmc/pvr/windows/GUIWindowPVRGuide.cpp
+++ b/xbmc/pvr/windows/GUIWindowPVRGuide.cpp
@@ -95,7 +95,7 @@ void CGUIWindowPVRGuideBase::ClearData()
void CGUIWindowPVRGuideBase::OnInitWindow()
{
- if (m_guiState.get())
+ if (m_guiState)
m_viewControl.SetCurrentView(m_guiState->GetViewAsControl(), false);
if (InitChannelGroup()) // no channels -> lazy init
@@ -684,7 +684,7 @@ bool CGUIWindowPVRGuideBase::RefreshTimelineItems()
if (endDate > maxFutureDate)
endDate = maxFutureDate;
- if (m_guiState.get())
+ if (m_guiState)
timeline->Sort(m_guiState->GetSortMethod());
// can be very expensive. never call with lock acquired.
diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp
index de4ab8a22f..dcf7ba8cbb 100644
--- a/xbmc/video/VideoDatabase.cpp
+++ b/xbmc/video/VideoDatabase.cpp
@@ -542,8 +542,10 @@ int CVideoDatabase::GetPathId(const std::string& strPath)
try
{
int idPath=-1;
- if (NULL == m_pDB.get()) return -1;
- if (NULL == m_pDS.get()) return -1;
+ if (nullptr == m_pDB)
+ return -1;
+ if (nullptr == m_pDS)
+ return -1;
std::string strPath1(strPath);
if (URIUtils::IsStack(strPath) || StringUtils::StartsWithNoCase(strPath, "rar://") || StringUtils::StartsWithNoCase(strPath, "zip://"))
@@ -570,8 +572,10 @@ bool CVideoDatabase::GetPaths(std::set<std::string> &paths)
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
paths.clear();
@@ -662,8 +666,10 @@ bool CVideoDatabase::GetPathsForTvShow(int idShow, std::set<int>& paths)
std::string strSQL;
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
// add base path
strSQL = PrepareSQL("SELECT strPath FROM tvshow_view WHERE idShow=%i", idShow);
@@ -707,7 +713,7 @@ bool CVideoDatabase::GetSubPaths(const std::string &basepath, std::vector<std::p
std::string sql;
try
{
- if (!m_pDB.get() || !m_pDS.get())
+ if (!m_pDB || !m_pDS)
return false;
std::string path(basepath);
@@ -742,8 +748,10 @@ int CVideoDatabase::AddPath(const std::string& strPath, const std::string &paren
if (idPath >= 0)
return idPath; // already have the path
- if (NULL == m_pDB.get()) return -1;
- if (NULL == m_pDS.get()) return -1;
+ if (nullptr == m_pDB)
+ return -1;
+ if (nullptr == m_pDS)
+ return -1;
std::string strPath1(strPath);
if (URIUtils::IsStack(strPath) || StringUtils::StartsWithNoCase(strPath, "rar://") || StringUtils::StartsWithNoCase(strPath, "zip://"))
@@ -783,8 +791,10 @@ bool CVideoDatabase::GetPathHash(const std::string &path, std::string &hash)
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string strSQL=PrepareSQL("select strHash from path where strPath='%s'", path.c_str());
m_pDS->query(strSQL);
@@ -811,8 +821,7 @@ bool CVideoDatabase::GetSourcePath(const std::string &path, std::string &sourceP
{
try
{
- if (path.empty() ||
- m_pDB.get() == NULL || m_pDS.get() == NULL)
+ if (path.empty() || m_pDB == nullptr || m_pDS == nullptr)
return false;
std::string strPath2;
@@ -890,8 +899,10 @@ int CVideoDatabase::AddFile(const std::string& strFileNameAndPath)
try
{
int idFile;
- if (NULL == m_pDB.get()) return -1;
- if (NULL == m_pDS.get()) return -1;
+ if (nullptr == m_pDB)
+ return -1;
+ if (nullptr == m_pDS)
+ return -1;
std::string strFileName, strPath;
SplitPath(strFileNameAndPath,strPath,strFileName);
@@ -943,8 +954,10 @@ void CVideoDatabase::UpdateFileDateAdded(int idFile, const std::string& strFileN
CDateTime finalDateAdded = dateAdded;
try
{
- if (NULL == m_pDB.get()) return;
- if (NULL == m_pDS.get()) return;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
if (!finalDateAdded.IsValid())
{
@@ -975,8 +988,10 @@ bool CVideoDatabase::SetPathHash(const std::string &path, const std::string &has
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
int idPath = AddPath(path);
if (idPath < 0) return false;
@@ -998,8 +1013,10 @@ bool CVideoDatabase::LinkMovieToTvshow(int idMovie, int idShow, bool bRemove)
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
if (bRemove) // delete link
{
@@ -1025,8 +1042,10 @@ bool CVideoDatabase::IsLinkedToTvshow(int idMovie)
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string strSQL=PrepareSQL("select * from movielinktvshow where idMovie=%i", idMovie);
m_pDS->query(strSQL);
@@ -1051,8 +1070,10 @@ bool CVideoDatabase::GetLinksToTvShow(int idMovie, std::vector<int>& ids)
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string strSQL=PrepareSQL("select * from movielinktvshow where idMovie=%i", idMovie);
m_pDS2->query(strSQL);
@@ -1079,8 +1100,10 @@ int CVideoDatabase::GetFileId(const std::string& strFilenameAndPath)
{
try
{
- if (NULL == m_pDB.get()) return -1;
- if (NULL == m_pDS.get()) return -1;
+ if (nullptr == m_pDB)
+ return -1;
+ if (nullptr == m_pDS)
+ return -1;
std::string strPath, strFileName;
SplitPath(strFilenameAndPath,strPath,strFileName);
@@ -1122,8 +1145,10 @@ int CVideoDatabase::GetMovieId(const std::string& strFilenameAndPath)
{
try
{
- if (NULL == m_pDB.get()) return -1;
- if (NULL == m_pDS.get()) return -1;
+ if (nullptr == m_pDB)
+ return -1;
+ if (nullptr == m_pDS)
+ return -1;
int idMovie = -1;
// needed for query parameters
@@ -1169,8 +1194,10 @@ int CVideoDatabase::GetTvShowId(const std::string& strPath)
{
try
{
- if (NULL == m_pDB.get()) return -1;
- if (NULL == m_pDS.get()) return -1;
+ if (nullptr == m_pDB)
+ return -1;
+ if (nullptr == m_pDS)
+ return -1;
int idTvShow = -1;
// have to join movieinfo table for correct results
@@ -1218,13 +1245,16 @@ int CVideoDatabase::GetEpisodeId(const std::string& strFilenameAndPath, int idEp
{
try
{
- if (NULL == m_pDB.get()) return -1;
- if (NULL == m_pDS.get()) return -1;
+ if (nullptr == m_pDB)
+ return -1;
+ if (nullptr == m_pDS)
+ return -1;
// need this due to the nested GetEpisodeInfo query
std::unique_ptr<Dataset> pDS;
pDS.reset(m_pDB->CreateDataset());
- if (NULL == pDS.get()) return -1;
+ if (nullptr == pDS)
+ return -1;
int idFile = GetFileId(strFilenameAndPath);
if (idFile < 0)
@@ -1274,8 +1304,10 @@ int CVideoDatabase::GetMusicVideoId(const std::string& strFilenameAndPath)
{
try
{
- if (NULL == m_pDB.get()) return -1;
- if (NULL == m_pDS.get()) return -1;
+ if (nullptr == m_pDB)
+ return -1;
+ if (nullptr == m_pDS)
+ return -1;
int idFile = GetFileId(strFilenameAndPath);
if (idFile < 0)
@@ -1304,8 +1336,10 @@ int CVideoDatabase::AddMovie(const std::string& strFilenameAndPath)
{
try
{
- if (NULL == m_pDB.get()) return -1;
- if (NULL == m_pDS.get()) return -1;
+ if (nullptr == m_pDB)
+ return -1;
+ if (nullptr == m_pDS)
+ return -1;
int idMovie = GetMovieId(strFilenameAndPath);
if (idMovie < 0)
@@ -1379,8 +1413,10 @@ int CVideoDatabase::AddEpisode(int idShow, const std::string& strFilenameAndPath
{
try
{
- if (NULL == m_pDB.get()) return -1;
- if (NULL == m_pDS.get()) return -1;
+ if (nullptr == m_pDB)
+ return -1;
+ if (nullptr == m_pDS)
+ return -1;
int idFile = AddFile(strFilenameAndPath);
if (idFile < 0)
@@ -1402,8 +1438,10 @@ int CVideoDatabase::AddMusicVideo(const std::string& strFilenameAndPath)
{
try
{
- if (NULL == m_pDB.get()) return -1;
- if (NULL == m_pDS.get()) return -1;
+ if (nullptr == m_pDB)
+ return -1;
+ if (nullptr == m_pDS)
+ return -1;
int idMVideo = GetMusicVideoId(strFilenameAndPath);
if (idMVideo < 0)
@@ -1431,8 +1469,10 @@ int CVideoDatabase::AddToTable(const std::string& table, const std::string& firs
{
try
{
- if (NULL == m_pDB.get()) return -1;
- if (NULL == m_pDS.get()) return -1;
+ if (nullptr == m_pDB)
+ return -1;
+ if (nullptr == m_pDS)
+ return -1;
std::string strSQL = PrepareSQL("select %s from %s where %s like '%s'", firstField.c_str(), table.c_str(), secondField.c_str(), value.substr(0, 255).c_str());
m_pDS->query(strSQL);
@@ -1464,8 +1504,10 @@ int CVideoDatabase::UpdateRatings(int mediaId, const char *mediaType, const Rati
{
try
{
- if (NULL == m_pDB.get()) return -1;
- if (NULL == m_pDS.get()) return -1;
+ if (nullptr == m_pDB)
+ return -1;
+ if (nullptr == m_pDS)
+ return -1;
std::string sql = PrepareSQL("DELETE FROM rating WHERE media_id=%i AND media_type='%s'", mediaId, mediaType);
m_pDS->exec(sql);
@@ -1484,8 +1526,10 @@ int CVideoDatabase::AddRatings(int mediaId, const char *mediaType, const RatingM
int ratingid = -1;
try
{
- if (NULL == m_pDB.get()) return -1;
- if (NULL == m_pDS.get()) return -1;
+ if (nullptr == m_pDB)
+ return -1;
+ if (nullptr == m_pDS)
+ return -1;
for (const auto& i : values)
{
@@ -1525,8 +1569,10 @@ int CVideoDatabase::UpdateUniqueIDs(int mediaId, const char *mediaType, const CV
{
try
{
- if (NULL == m_pDB.get()) return -1;
- if (NULL == m_pDS.get()) return -1;
+ if (nullptr == m_pDB)
+ return -1;
+ if (nullptr == m_pDS)
+ return -1;
std::string sql = PrepareSQL("DELETE FROM uniqueid WHERE media_id=%i AND media_type='%s'", mediaId, mediaType);
m_pDS->exec(sql);
@@ -1545,8 +1591,10 @@ int CVideoDatabase::AddUniqueIDs(int mediaId, const char *mediaType, const CVide
int uniqueid = -1;
try
{
- if (NULL == m_pDB.get()) return -1;
- if (NULL == m_pDS.get()) return -1;
+ if (nullptr == m_pDB)
+ return -1;
+ if (nullptr == m_pDS)
+ return -1;
for (const auto& i : details.GetUniqueIDs())
{
@@ -1589,7 +1637,7 @@ int CVideoDatabase::AddSet(const std::string& strSet, const std::string& strOver
try
{
- if (m_pDB.get() == nullptr || m_pDS.get() == nullptr)
+ if (m_pDB == nullptr || m_pDS == nullptr)
return -1;
std::string strSQL = PrepareSQL("SELECT idSet FROM sets WHERE strSet LIKE '%s'", strSet.c_str());
@@ -1629,8 +1677,10 @@ int CVideoDatabase::AddActor(const std::string& name, const std::string& thumbUR
{
try
{
- if (NULL == m_pDB.get()) return -1;
- if (NULL == m_pDS.get()) return -1;
+ if (nullptr == m_pDB)
+ return -1;
+ if (nullptr == m_pDS)
+ return -1;
int idActor = -1;
// ATTENTION: the trimming of actor names should really not be done here but after the scraping / NFO-parsing
@@ -1803,8 +1853,10 @@ bool CVideoDatabase::HasMovieInfo(const std::string& strFilenameAndPath)
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
int idMovie = GetMovieId(strFilenameAndPath);
return (idMovie > 0); // index of zero is also invalid
}
@@ -1819,8 +1871,10 @@ bool CVideoDatabase::HasTvShowInfo(const std::string& strPath)
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
int idTvShow = GetTvShowId(strPath);
return (idTvShow > 0); // index of zero is also invalid
}
@@ -1835,8 +1889,10 @@ bool CVideoDatabase::HasEpisodeInfo(const std::string& strFilenameAndPath)
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
int idEpisode = GetEpisodeId(strFilenameAndPath);
return (idEpisode > 0); // index of zero is also invalid
}
@@ -1851,8 +1907,10 @@ bool CVideoDatabase::HasMusicVideoInfo(const std::string& strFilenameAndPath)
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
int idMVideo = GetMusicVideoId(strFilenameAndPath);
return (idMVideo > 0); // index of zero is also invalid
}
@@ -1874,8 +1932,10 @@ void CVideoDatabase::DeleteDetailsForTvShow(int idTvShow)
{
try
{
- if (NULL == m_pDB.get()) return ;
- if (NULL == m_pDS.get()) return ;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
std::string strSQL;
strSQL=PrepareSQL("DELETE from genre_link WHERE media_id=%i AND media_type='tvshow'", idTvShow);
@@ -1955,8 +2015,10 @@ void CVideoDatabase::GetMusicVideosByArtist(const std::string& strArtist, CFileI
try
{
items.Clear();
- if (NULL == m_pDB.get()) return ;
- if (NULL == m_pDS.get()) return ;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
std::string strSQL;
if (strArtist.empty()) //! @todo SMARTPLAYLISTS what is this here for???
@@ -2038,7 +2100,7 @@ bool CVideoDatabase::GetSeasonInfo(int idSeason, CVideoInfoTag& details, bool al
try
{
- if (!m_pDB.get() || !m_pDS.get())
+ if (!m_pDB || !m_pDS)
return false;
std::string sql = PrepareSQL("SELECT idSeason, idShow, season, name, userrating FROM seasons WHERE idSeason=%i", idSeason);
@@ -3020,8 +3082,10 @@ void CVideoDatabase::GetFilePathById(int idMovie, std::string &filePath, VIDEODB
{
try
{
- if (NULL == m_pDB.get()) return ;
- if (NULL == m_pDS.get()) return ;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
if (idMovie < 0) return ;
@@ -3076,8 +3140,10 @@ void CVideoDatabase::GetBookMarksForFile(const std::string& strFilenameAndPath,
if (idFile < 0) return ;
if (!bAppend)
bookmarks.erase(bookmarks.begin(), bookmarks.end());
- if (NULL == m_pDB.get()) return ;
- if (NULL == m_pDS.get()) return ;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
std::string strSQL=PrepareSQL("select * from bookmark where idFile=%i and type=%i order by timeInSeconds", idFile, (int)type);
m_pDS->query( strSQL );
@@ -3126,7 +3192,7 @@ bool CVideoDatabase::GetResumeBookMark(const std::string& strFilenameAndPath, CB
void CVideoDatabase::DeleteResumeBookMark(const CFileItem& item)
{
- if (!m_pDB.get() || !m_pDS.get())
+ if (!m_pDB || !m_pDS)
return;
int fileID = item.GetVideoInfoTag()->m_iFileId;
@@ -3201,8 +3267,10 @@ void CVideoDatabase::AddBookMarkToFile(const std::string& strFilenameAndPath, co
int idFile = AddFile(strFilenameAndPath);
if (idFile < 0)
return;
- if (NULL == m_pDB.get()) return ;
- if (NULL == m_pDS.get()) return ;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
std::string strSQL;
int idBookmark=-1;
@@ -3246,8 +3314,10 @@ void CVideoDatabase::ClearBookMarkOfFile(const std::string& strFilenameAndPath,
{
int idFile = GetFileId(strFilenameAndPath);
if (idFile < 0) return ;
- if (NULL == m_pDB.get()) return ;
- if (NULL == m_pDS.get()) return ;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
/* a little bit uggly, we clear first bookmark that is within one second of given */
/* should be no problem since we never add bookmarks that are closer than that */
@@ -3291,8 +3361,10 @@ void CVideoDatabase::ClearBookMarksOfFile(int idFile, CBookmark::EType type /*=
try
{
- if (NULL == m_pDB.get()) return ;
- if (NULL == m_pDS.get()) return ;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
std::string strSQL=PrepareSQL("delete from bookmark where idFile=%i and type=%i", idFile, (int)type);
m_pDS->exec(strSQL);
@@ -3389,8 +3461,10 @@ void CVideoDatabase::DeleteMovie(int idMovie, bool bKeepId /* = false */)
try
{
- if (NULL == m_pDB.get()) return ;
- if (NULL == m_pDS.get()) return ;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
BeginTransaction();
@@ -3436,8 +3510,10 @@ void CVideoDatabase::DeleteTvShow(int idTvShow, bool bKeepId /* = false */)
try
{
- if (NULL == m_pDB.get()) return ;
- if (NULL == m_pDS.get()) return ;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
BeginTransaction();
@@ -3492,9 +3568,7 @@ void CVideoDatabase::DeleteSeason(int idSeason, bool bKeepId /* = false */)
try
{
- if (m_pDB.get() == NULL ||
- m_pDS.get() == NULL ||
- m_pDS2.get() == NULL)
+ if (m_pDB == nullptr || m_pDS == nullptr || m_pDS2 == nullptr)
return;
BeginTransaction();
@@ -3534,8 +3608,10 @@ void CVideoDatabase::DeleteEpisode(int idEpisode, bool bKeepId /* = false */)
try
{
- if (NULL == m_pDB.get()) return ;
- if (NULL == m_pDS.get()) return ;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
//! @todo move this below CommitTransaction() once UPnP doesn't rely on this anymore
if (!bKeepId)
@@ -3575,8 +3651,10 @@ void CVideoDatabase::DeleteMusicVideo(int idMVideo, bool bKeepId /* = false */)
try
{
- if (NULL == m_pDB.get()) return ;
- if (NULL == m_pDS.get()) return ;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
BeginTransaction();
@@ -3628,8 +3706,10 @@ void CVideoDatabase::DeleteSet(int idSet)
{
try
{
- if (NULL == m_pDB.get()) return ;
- if (NULL == m_pDS.get()) return ;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
std::string strSQL;
strSQL=PrepareSQL("delete from sets where idSet = %i", idSet);
@@ -3660,7 +3740,7 @@ void CVideoDatabase::DeleteTag(int idTag, VIDEODB_CONTENT_TYPE mediaType)
{
try
{
- if (m_pDB.get() == NULL || m_pDS.get() == NULL)
+ if (m_pDB == nullptr || m_pDS == nullptr)
return;
std::string type;
@@ -4207,8 +4287,10 @@ void CVideoDatabase::GetCast(int media_id, const std::string &media_type, std::v
{
try
{
- if (!m_pDB.get()) return;
- if (!m_pDS2.get()) return;
+ if (!m_pDB)
+ return;
+ if (!m_pDS2)
+ return;
std::string sql = PrepareSQL("SELECT actor.name,"
" actor_link.role,"
@@ -4258,8 +4340,10 @@ void CVideoDatabase::GetTags(int media_id, const std::string &media_type, std::v
{
try
{
- if (!m_pDB.get()) return;
- if (!m_pDS2.get()) return;
+ if (!m_pDB)
+ return;
+ if (!m_pDS2)
+ return;
std::string sql = PrepareSQL("SELECT tag.name FROM tag INNER JOIN tag_link ON tag_link.tag_id = tag.tag_id WHERE tag_link.media_id = %i AND tag_link.media_type = '%s' ORDER BY tag.tag_id", media_id, media_type.c_str());
m_pDS2->query(sql);
@@ -4280,8 +4364,10 @@ void CVideoDatabase::GetRatings(int media_id, const std::string &media_type, Rat
{
try
{
- if (!m_pDB.get()) return;
- if (!m_pDS2.get()) return;
+ if (!m_pDB)
+ return;
+ if (!m_pDS2)
+ return;
std::string sql = PrepareSQL("SELECT rating.rating_type, rating.rating, rating.votes FROM rating WHERE rating.media_id = %i AND rating.media_type = '%s'", media_id, media_type.c_str());
m_pDS2->query(sql);
@@ -4302,8 +4388,10 @@ void CVideoDatabase::GetUniqueIDs(int media_id, const std::string &media_type, C
{
try
{
- if (!m_pDB.get()) return;
- if (!m_pDS2.get()) return;
+ if (!m_pDB)
+ return;
+ if (!m_pDS2)
+ return;
std::string sql = PrepareSQL("SELECT type, value FROM uniqueid WHERE media_id = %i AND media_type = '%s'", media_id, media_type.c_str());
m_pDS2->query(sql);
@@ -4337,8 +4425,10 @@ bool CVideoDatabase::GetVideoSettings(int idFile, CVideoSettings &settings)
try
{
if (idFile < 0) return false;
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string strSQL=PrepareSQL("select * from settings where settings.idFile = '%i'", idFile);
m_pDS->query( strSQL );
@@ -4402,9 +4492,9 @@ void CVideoDatabase::SetVideoSettings(int idFile, const CVideoSettings &setting)
{
try
{
- if (NULL == m_pDB.get())
+ if (nullptr == m_pDB)
return;
- if (NULL == m_pDS.get())
+ if (nullptr == m_pDS)
return;
if (idFile < 0)
return;
@@ -4465,8 +4555,10 @@ void CVideoDatabase::SetArtForItem(int mediaId, const MediaType &mediaType, cons
{
try
{
- if (NULL == m_pDB.get()) return;
- if (NULL == m_pDS.get()) return;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
// don't set <foo>.<bar> art types - these are derivative types from parent items
if (artType.find('.') != std::string::npos)
@@ -4502,8 +4594,10 @@ bool CVideoDatabase::GetArtForItem(int mediaId, const MediaType &mediaType, std:
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS2.get()) return false; // using dataset 2 as we're likely called in loops on dataset 1
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS2)
+ return false; // using dataset 2 as we're likely called in loops on dataset 1
std::string sql = PrepareSQL("SELECT type,url FROM art WHERE media_id=%i AND media_type='%s'", mediaId, mediaType.c_str());
m_pDS2->query(sql);
@@ -4546,8 +4640,10 @@ bool CVideoDatabase::HasArtForItem(int mediaId, const MediaType &mediaType)
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS2.get()) return false; // using dataset 2 as we're likely called in loops on dataset 1
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS2)
+ return false; // using dataset 2 as we're likely called in loops on dataset 1
std::string sql = PrepareSQL("SELECT 1 FROM art WHERE media_id=%i AND media_type='%s' LIMIT 1", mediaId, mediaType.c_str());
m_pDS2->query(sql);
@@ -4566,8 +4662,10 @@ bool CVideoDatabase::GetTvShowSeasons(int showId, std::map<int, int> &seasons)
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS2.get()) return false; // using dataset 2 as we're likely called in loops on dataset 1
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS2)
+ return false; // using dataset 2 as we're likely called in loops on dataset 1
// get all seasons for this show
std::string sql = PrepareSQL("select idSeason,season from seasons where idShow=%i", showId);
@@ -4593,8 +4691,10 @@ bool CVideoDatabase::GetTvShowNamedSeasons(int showId, std::map<int, std::string
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS2.get()) return false; // using dataset 2 as we're likely called in loops on dataset 1
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS2)
+ return false; // using dataset 2 as we're likely called in loops on dataset 1
// get all named seasons for this show
std::string sql = PrepareSQL("select season, name from seasons where season > 0 and name is not null and name <> '' and idShow = %i", showId);
@@ -4620,8 +4720,10 @@ bool CVideoDatabase::GetTvShowSeasonArt(int showId, std::map<int, std::map<std::
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS2.get()) return false; // using dataset 2 as we're likely called in loops on dataset 1
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS2)
+ return false; // using dataset 2 as we're likely called in loops on dataset 1
std::map<int, int> seasons;
GetTvShowSeasons(showId, seasons);
@@ -4645,8 +4747,10 @@ bool CVideoDatabase::GetArtTypes(const MediaType &mediaType, std::vector<std::st
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string sql = PrepareSQL("SELECT DISTINCT type FROM art WHERE media_type='%s'", mediaType.c_str());
int numRows = RunQuery(sql);
@@ -4788,8 +4892,10 @@ bool CVideoDatabase::GetStackTimes(const std::string &filePath, std::vector<uint
// obtain the FileID (if it exists)
int idFile = GetFileId(filePath);
if (idFile < 0) return false;
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
// ok, now obtain the settings for this file
std::string strSQL=PrepareSQL("select times from stacktimes where idFile=%i\n", idFile);
m_pDS->query( strSQL );
@@ -4821,8 +4927,10 @@ void CVideoDatabase::SetStackTimes(const std::string& filePath, const std::vecto
{
try
{
- if (NULL == m_pDB.get()) return ;
- if (NULL == m_pDS.get()) return ;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
int idFile = AddFile(filePath);
if (idFile < 0)
return;
@@ -4856,8 +4964,10 @@ void CVideoDatabase::RemoveContentForPath(const std::string& strPath, CGUIDialog
try
{
- if (NULL == m_pDB.get()) return ;
- if (NULL == m_pDS.get()) return ;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
if (progress)
{
@@ -4939,8 +5049,10 @@ void CVideoDatabase::SetScraperForPath(const std::string& filePath, const Scrape
try
{
- if (NULL == m_pDB.get()) return ;
- if (NULL == m_pDS.get()) return ;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
int idPath = AddPath(filePath);
if (idPath < 0)
@@ -4973,8 +5085,10 @@ bool CVideoDatabase::ScraperInUse(const std::string &scraperID) const
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string sql = PrepareSQL("select count(1) from path where strScraper='%s'", scraperID.c_str());
if (!m_pDS->query(sql) || m_pDS->num_rows() == 0)
@@ -5461,7 +5575,8 @@ void CVideoDatabase::UpdateTables(int iVersion)
// need this due to the nested GetScraperPath query
std::unique_ptr<Dataset> pDS;
pDS.reset(m_pDB->CreateDataset());
- if (NULL == pDS.get()) return;
+ if (nullptr == pDS)
+ return;
pDS->exec("CREATE TABLE uniqueid (uniqueid_id INTEGER PRIMARY KEY, media_id INTEGER, media_type TEXT, value TEXT, type TEXT)");
@@ -5618,8 +5733,10 @@ bool CVideoDatabase::GetPlayCounts(const std::string &strPath, CFileItemList &it
try
{
// error!
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string sql =
"SELECT"
@@ -5698,8 +5815,10 @@ int CVideoDatabase::GetPlayCount(int iFileId)
try
{
// error!
- if (NULL == m_pDB.get()) return -1;
- if (NULL == m_pDS.get()) return -1;
+ if (nullptr == m_pDB)
+ return -1;
+ if (nullptr == m_pDS)
+ return -1;
std::string strSQL = PrepareSQL("select playCount from files WHERE idFile=%i", iFileId);
int count = 0;
@@ -5731,8 +5850,10 @@ int CVideoDatabase::GetPlayCount(const CFileItem &item)
void CVideoDatabase::UpdateFanart(const CFileItem &item, VIDEODB_CONTENT_TYPE type)
{
- if (NULL == m_pDB.get()) return;
- if (NULL == m_pDS.get()) return;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
if (!item.HasVideoInfoTag() || item.GetVideoInfoTag()->m_iDbId < 0) return;
std::string exec;
@@ -5774,8 +5895,10 @@ void CVideoDatabase::SetPlayCount(const CFileItem &item, int count, const CDateT
// and mark as watched
try
{
- if (NULL == m_pDB.get()) return ;
- if (NULL == m_pDS.get()) return ;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
std::string strSQL;
if (count)
@@ -5827,8 +5950,10 @@ void CVideoDatabase::UpdateMovieTitle(int idMovie, const std::string& strNewMovi
{
try
{
- if (NULL == m_pDB.get()) return ;
- if (NULL == m_pDS.get()) return ;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
std::string content;
if (iType == VIDEODB_CONTENT_MOVIES)
{
@@ -5873,7 +5998,7 @@ bool CVideoDatabase::UpdateVideoSortTitle(int idDb, const std::string& strNewSor
{
try
{
- if (NULL == m_pDB.get() || NULL == m_pDS.get())
+ if (nullptr == m_pDB || nullptr == m_pDS)
return false;
if (iType != VIDEODB_CONTENT_MOVIES && iType != VIDEODB_CONTENT_TVSHOWS)
return false;
@@ -5980,8 +6105,10 @@ bool CVideoDatabase::GetNavCommon(const std::string& strBaseDir, CFileItemList&
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string strSQL;
Filter extFilter = filter;
@@ -6184,8 +6311,10 @@ bool CVideoDatabase::GetSetsByWhere(const std::string& strBaseDir, const Filter
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
CVideoDbUrl videoUrl;
if (!videoUrl.FromString(strBaseDir))
@@ -6221,8 +6350,10 @@ bool CVideoDatabase::GetMusicVideoAlbumsNav(const std::string& strBaseDir, CFile
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
CVideoDbUrl videoUrl;
if (!videoUrl.FromString(strBaseDir))
@@ -6374,8 +6505,10 @@ bool CVideoDatabase::GetActorsNav(const std::string& strBaseDir, CFileItemList&
bool CVideoDatabase::GetPeopleNav(const std::string& strBaseDir, CFileItemList& items, const char *type, int idContent /* = -1 */, const Filter &filter /* = Filter() */, bool countOnly /* = false */)
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
try
{
@@ -6618,8 +6751,10 @@ bool CVideoDatabase::GetYearsNav(const std::string& strBaseDir, CFileItemList& i
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string strSQL;
Filter extFilter = filter;
@@ -6822,8 +6957,10 @@ bool CVideoDatabase::GetSeasonsByWhere(const std::string& strBaseDir, const Filt
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
int total = -1;
@@ -6945,7 +7082,7 @@ bool CVideoDatabase::GetSeasonsByWhere(const std::string& strBaseDir, const Filt
bool CVideoDatabase::GetSortedVideos(const MediaType &mediaType, const std::string& strBaseDir, const SortDescription &sortDescription, CFileItemList& items, const Filter &filter /* = Filter() */)
{
- if (NULL == m_pDB.get() || NULL == m_pDS.get())
+ if (nullptr == m_pDB || nullptr == m_pDS)
return false;
if (mediaType != MediaTypeMovie && mediaType != MediaTypeTvShow && mediaType != MediaTypeEpisode && mediaType != MediaTypeMusicVideo)
@@ -7108,8 +7245,10 @@ bool CVideoDatabase::GetMoviesByWhere(const std::string& strBaseDir, const Filte
movieTime = 0;
castTime = 0;
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
// parse the base path to get additional filters
CVideoDbUrl videoUrl;
@@ -7221,8 +7360,10 @@ bool CVideoDatabase::GetTvShowsByWhere(const std::string& strBaseDir, const Filt
{
movieTime = 0;
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
int total = -1;
@@ -7347,8 +7488,10 @@ bool CVideoDatabase::GetEpisodesByWhere(const std::string& strBaseDir, const Fil
movieTime = 0;
castTime = 0;
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
int total = -1;
@@ -7533,8 +7676,10 @@ bool CVideoDatabase::HasSets() const
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
m_pDS->query("SELECT movie_view.idSet,COUNT(1) AS c FROM movie_view "
"JOIN sets ON sets.idSet = movie_view.idSet "
@@ -7555,8 +7700,10 @@ int CVideoDatabase::GetTvShowForEpisode(int idEpisode)
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS2.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS2)
+ return false;
// make sure we use m_pDS2, as this is called in loops using m_pDS
std::string strSQL=PrepareSQL("select idShow from episode where idEpisode=%i", idEpisode);
@@ -7598,8 +7745,10 @@ bool CVideoDatabase::HasContent(VIDEODB_CONTENT_TYPE type)
bool result = false;
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string sql;
if (type == VIDEODB_CONTENT_MOVIES)
@@ -7639,7 +7788,8 @@ ScraperPtr CVideoDatabase::GetScraperForPath(const std::string& strPath, SScanSe
foundDirectly = false;
try
{
- if (strPath.empty() || !m_pDB.get() || !m_pDS.get()) return ScraperPtr();
+ if (strPath.empty() || !m_pDB || !m_pDS)
+ return ScraperPtr();
ScraperPtr scraper;
std::string strPath2;
@@ -7816,8 +7966,10 @@ void CVideoDatabase::GetMovieGenresByName(const std::string& strSearch, CFileIte
try
{
- if (NULL == m_pDB.get()) return;
- if (NULL == m_pDS.get()) return;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
if (m_profileManager.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE && !g_passwordManager.bMasterUser)
strSQL=PrepareSQL("SELECT genre.genre_id, genre.name, path.strPath FROM genre INNER JOIN genre_link ON genre_link.genre_id = genre.genre_id INNER JOIN movie ON (genre_link.media_type='movie' = genre_link.media_id=movie.idMovie) INNER JOIN files ON files.idFile=movie.idFile INNER JOIN path ON path.idPath=files.idPath WHERE genre.name LIKE '%%%s%%'",strSearch.c_str());
@@ -7856,8 +8008,10 @@ void CVideoDatabase::GetMovieCountriesByName(const std::string& strSearch, CFile
try
{
- if (NULL == m_pDB.get()) return;
- if (NULL == m_pDS.get()) return;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
if (m_profileManager.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE && !g_passwordManager.bMasterUser)
strSQL=PrepareSQL("SELECT country.country_id, country.name, path.strPath FROM country INNER JOIN country_link ON country_link.country_id=country.country_id INNER JOIN movie ON country_link.media_id=movie.idMovie INNER JOIN files ON files.idFile=movie.idFile INNER JOIN path ON path.idPath=files.idPath WHERE country_link.media_type='movie' AND country.name LIKE '%%%s%%'", strSearch.c_str());
@@ -7896,8 +8050,10 @@ void CVideoDatabase::GetTvShowGenresByName(const std::string& strSearch, CFileIt
try
{
- if (NULL == m_pDB.get()) return;
- if (NULL == m_pDS.get()) return;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
if (m_profileManager.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE && !g_passwordManager.bMasterUser)
strSQL=PrepareSQL("SELECT genre.genre_id, genre.name, path.strPath FROM genre INNER JOIN genre_link ON genre_link.genre_id=genre.genre_id INNER JOIN tvshow ON genre_link.media_id=tvshow.idShow INNER JOIN tvshowlinkpath ON tvshowlinkpath.idShow=tvshow.idShow INNER JOIN path ON path.idPath=tvshowlinkpath.idPath WHERE genre_link.media_type='tvshow' AND genre.name LIKE '%%%s%%'", strSearch.c_str());
@@ -7935,8 +8091,10 @@ void CVideoDatabase::GetMovieActorsByName(const std::string& strSearch, CFileIte
try
{
- if (NULL == m_pDB.get()) return;
- if (NULL == m_pDS.get()) return;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
if (m_profileManager.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE && !g_passwordManager.bMasterUser)
strSQL=PrepareSQL("SELECT actor.actor_id, actor.name, path.strPath FROM actor INNER JOIN actor_link ON actor_link.actor_id=actor.actor_id INNER JOIN movie ON actor_link.media_id=movie.idMovie INNER JOIN files ON files.idFile=movie.idFile INNER JOIN path ON path.idPath=files.idPath WHERE actor_link.media_type='movie' AND actor.name LIKE '%%%s%%'", strSearch.c_str());
@@ -7974,8 +8132,10 @@ void CVideoDatabase::GetTvShowsActorsByName(const std::string& strSearch, CFileI
try
{
- if (NULL == m_pDB.get()) return;
- if (NULL == m_pDS.get()) return;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
if (m_profileManager.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE && !g_passwordManager.bMasterUser)
strSQL=PrepareSQL("SELECT actor.actor_id, actor.name, path.strPath FROM actor INNER JOIN actor_link ON actor_link.actor_id=actor.actor_id INNER JOIN tvshow ON actor_link.media_id=tvshow.idShow INNER JOIN tvshowlinkpath ON tvshowlinkpath.idPath=tvshow.idShow INNER JOIN path ON path.idPath=tvshowlinkpath.idPath WHERE actor_link.media_type='tvshow' AND actor.name LIKE '%%%s%%'", strSearch.c_str());
@@ -8013,8 +8173,10 @@ void CVideoDatabase::GetMusicVideoArtistsByName(const std::string& strSearch, CF
try
{
- if (NULL == m_pDB.get()) return;
- if (NULL == m_pDS.get()) return;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
std::string strLike;
if (!strSearch.empty())
@@ -8055,8 +8217,10 @@ void CVideoDatabase::GetMusicVideoGenresByName(const std::string& strSearch, CFi
try
{
- if (NULL == m_pDB.get()) return;
- if (NULL == m_pDS.get()) return;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
if (m_profileManager.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE && !g_passwordManager.bMasterUser)
strSQL=PrepareSQL("SELECT genre.genre_id, genre.name, path.strPath FROM genre INNER JOIN genre_link ON genre_link.genre_id=genre.genre_id INNER JOIN musicvideo ON genre_link.media_id=musicvideo.idMVideo INNER JOIN files ON files.idFile=musicvideo.idFile INNER JOIN path ON path.idPath=files.idPath WHERE genre_link.media_type='musicvideo' AND genre.name LIKE '%%%s%%'", strSearch.c_str());
@@ -8094,8 +8258,10 @@ void CVideoDatabase::GetMusicVideoAlbumsByName(const std::string& strSearch, CFi
try
{
- if (NULL == m_pDB.get()) return;
- if (NULL == m_pDS.get()) return;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
strSQL = StringUtils::Format("SELECT DISTINCT"
" musicvideo.c%02d,"
@@ -8148,8 +8314,10 @@ void CVideoDatabase::GetMusicVideosByAlbum(const std::string& strSearch, CFileIt
try
{
- if (NULL == m_pDB.get()) return;
- if (NULL == m_pDS.get()) return;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
if (m_profileManager.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE && !g_passwordManager.bMasterUser)
strSQL = PrepareSQL("SELECT musicvideo.idMVideo, musicvideo.c%02d,musicvideo.c%02d, path.strPath FROM musicvideo INNER JOIN files ON files.idFile=musicvideo.idFile INNER JOIN path ON path.idPath=files.idPath WHERE musicvideo.c%02d LIKE '%%%s%%'", VIDEODB_ID_MUSICVIDEO_ALBUM, VIDEODB_ID_MUSICVIDEO_TITLE, VIDEODB_ID_MUSICVIDEO_ALBUM, strSearch.c_str());
@@ -8189,8 +8357,10 @@ bool CVideoDatabase::GetMusicVideosByWhere(const std::string &baseDir, const Fil
movieTime = 0;
castTime = 0;
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
int total = -1;
@@ -8267,8 +8437,10 @@ unsigned int CVideoDatabase::GetRandomMusicVideoIDs(const std::string& strWhere,
{
try
{
- if (NULL == m_pDB.get()) return 0;
- if (NULL == m_pDS.get()) return 0;
+ if (nullptr == m_pDB)
+ return 0;
+ if (nullptr == m_pDS)
+ return 0;
std::string strSQL = "select distinct idMVideo from musicvideo_view";
if (!strWhere.empty())
@@ -8302,8 +8474,10 @@ int CVideoDatabase::GetMatchingMusicVideo(const std::string& strArtist, const st
{
try
{
- if (NULL == m_pDB.get()) return -1;
- if (NULL == m_pDS.get()) return -1;
+ if (nullptr == m_pDB)
+ return -1;
+ if (nullptr == m_pDS)
+ return -1;
std::string strSQL;
if (strAlbum.empty() && strTitle.empty())
@@ -8349,8 +8523,10 @@ void CVideoDatabase::GetMoviesByName(const std::string& strSearch, CFileItemList
try
{
- if (NULL == m_pDB.get()) return;
- if (NULL == m_pDS.get()) return;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
if (m_profileManager.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE && !g_passwordManager.bMasterUser)
strSQL = PrepareSQL("SELECT movie.idMovie, movie.c%02d, path.strPath, movie.idSet FROM movie INNER JOIN files ON files.idFile=movie.idFile INNER JOIN path ON path.idPath=files.idPath WHERE movie.c%02d LIKE '%%%s%%'", VIDEODB_ID_TITLE, VIDEODB_ID_TITLE, strSearch.c_str());
@@ -8394,8 +8570,10 @@ void CVideoDatabase::GetTvShowsByName(const std::string& strSearch, CFileItemLis
try
{
- if (NULL == m_pDB.get()) return;
- if (NULL == m_pDS.get()) return;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
if (m_profileManager.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE && !g_passwordManager.bMasterUser)
strSQL = PrepareSQL("SELECT tvshow.idShow, tvshow.c%02d, path.strPath FROM tvshow INNER JOIN tvshowlinkpath ON tvshowlinkpath.idShow=tvshow.idShow INNER JOIN path ON path.idPath=tvshowlinkpath.idPath WHERE tvshow.c%02d LIKE '%%%s%%'", VIDEODB_ID_TV_TITLE, VIDEODB_ID_TV_TITLE, strSearch.c_str());
@@ -8435,8 +8613,10 @@ void CVideoDatabase::GetEpisodesByName(const std::string& strSearch, CFileItemLi
try
{
- if (NULL == m_pDB.get()) return;
- if (NULL == m_pDS.get()) return;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
if (m_profileManager.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE && !g_passwordManager.bMasterUser)
strSQL = PrepareSQL("SELECT episode.idEpisode, episode.c%02d, episode.c%02d, episode.idShow, tvshow.c%02d, path.strPath FROM episode INNER JOIN tvshow ON tvshow.idShow=episode.idShow INNER JOIN files ON files.idFile=episode.idFile INNER JOIN path ON path.idPath=files.idPath WHERE episode.c%02d LIKE '%%%s%%'", VIDEODB_ID_EPISODE_TITLE, VIDEODB_ID_EPISODE_SEASON, VIDEODB_ID_TV_TITLE, VIDEODB_ID_EPISODE_TITLE, strSearch.c_str());
@@ -8478,8 +8658,10 @@ void CVideoDatabase::GetMusicVideosByName(const std::string& strSearch, CFileIte
try
{
- if (NULL == m_pDB.get()) return;
- if (NULL == m_pDS.get()) return;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
if (m_profileManager.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE && !g_passwordManager.bMasterUser)
strSQL = PrepareSQL("SELECT musicvideo.idMVideo, musicvideo.c%02d, path.strPath FROM musicvideo INNER JOIN files ON files.idFile=musicvideo.idFile INNER JOIN path ON path.idPath=files.idPath WHERE musicvideo.c%02d LIKE '%%%s%%'", VIDEODB_ID_MUSICVIDEO_TITLE, VIDEODB_ID_MUSICVIDEO_TITLE, strSearch.c_str());
@@ -8525,8 +8707,10 @@ void CVideoDatabase::GetEpisodesByPlot(const std::string& strSearch, CFileItemLi
try
{
- if (NULL == m_pDB.get()) return;
- if (NULL == m_pDS.get()) return;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
if (m_profileManager.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE && !g_passwordManager.bMasterUser)
strSQL = PrepareSQL("SELECT episode.idEpisode, episode.c%02d, episode.c%02d, episode.idShow, tvshow.c%02d, path.strPath FROM episode INNER JOIN tvshow ON tvshow.idShow=episode.idShow INNER JOIN files ON files.idFile=episode.idFile INNER JOIN path ON path.idPath=files.idPath WHERE episode.c%02d LIKE '%%%s%%'", VIDEODB_ID_EPISODE_TITLE, VIDEODB_ID_EPISODE_SEASON, VIDEODB_ID_TV_TITLE, VIDEODB_ID_EPISODE_PLOT, strSearch.c_str());
@@ -8564,8 +8748,10 @@ void CVideoDatabase::GetMoviesByPlot(const std::string& strSearch, CFileItemList
try
{
- if (NULL == m_pDB.get()) return;
- if (NULL == m_pDS.get()) return;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
if (m_profileManager.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE && !g_passwordManager.bMasterUser)
strSQL = PrepareSQL("select movie.idMovie, movie.c%02d, path.strPath FROM movie INNER JOIN files ON files.idFile=movie.idFile INNER JOIN path ON path.idPath=files.idPath WHERE movie.c%02d LIKE '%%%s%%' OR movie.c%02d LIKE '%%%s%%' OR movie.c%02d LIKE '%%%s%%'", VIDEODB_ID_TITLE,VIDEODB_ID_PLOT, strSearch.c_str(), VIDEODB_ID_PLOTOUTLINE, strSearch.c_str(), VIDEODB_ID_TAGLINE,strSearch.c_str());
@@ -8606,8 +8792,10 @@ void CVideoDatabase::GetMovieDirectorsByName(const std::string& strSearch, CFile
try
{
- if (NULL == m_pDB.get()) return;
- if (NULL == m_pDS.get()) return;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
if (m_profileManager.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE && !g_passwordManager.bMasterUser)
strSQL = PrepareSQL("SELECT DISTINCT director_link.actor_id, actor.name, path.strPath FROM movie INNER JOIN director_link ON (director_link.media_id=movie.idMovie AND director_link.media_type='movie') INNER JOIN actor ON actor.actor_id=director_link.actor_id INNER JOIN files ON files.idFile=movie.idFile INNER JOIN path ON path.idPath=files.idPath WHERE actor.name LIKE '%%%s%%'", strSearch.c_str());
@@ -8647,8 +8835,10 @@ void CVideoDatabase::GetTvShowsDirectorsByName(const std::string& strSearch, CFi
try
{
- if (NULL == m_pDB.get()) return;
- if (NULL == m_pDS.get()) return;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
if (m_profileManager.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE && !g_passwordManager.bMasterUser)
strSQL = PrepareSQL("SELECT DISTINCT director_link.actor_id, actor.name, path.strPath FROM actor INNER JOIN director_link ON director_link.actor_id=actor.actor_id INNER JOIN tvshow ON director_link.media_id=tvshow.idShow INNER JOIN tvshowlinkpath ON tvshowlinkpath.idShow=tvshow.idShow INNER JOIN path ON path.idPath=tvshowlinkpath.idPath WHERE director_link.media_type='tvshow' AND actor.name LIKE '%%%s%%'", strSearch.c_str());
@@ -8688,8 +8878,10 @@ void CVideoDatabase::GetMusicVideoDirectorsByName(const std::string& strSearch,
try
{
- if (NULL == m_pDB.get()) return;
- if (NULL == m_pDS.get()) return;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
if (m_profileManager.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE && !g_passwordManager.bMasterUser)
strSQL = PrepareSQL("SELECT DISTINCT director_link.actor_id, actor.name, path.strPath FROM actor INNER JOIN director_link ON director_link.actor_id=actor.actor_id INNER JOIN musicvideo ON director_link.media_id=musicvideo.idMVideo INNER JOIN files ON files.idFile=musicvideo.idFile INNER JOIN path ON path.idPath=files.idPath WHERE director_link.media_type='musicvideo' AND actor.name LIKE '%%%s%%'", strSearch.c_str());
@@ -8728,9 +8920,12 @@ void CVideoDatabase::CleanDatabase(CGUIDialogProgressBarHandle* handle, const st
CGUIDialogProgress *progress=NULL;
try
{
- if (NULL == m_pDB.get()) return;
- if (NULL == m_pDS.get()) return;
- if (NULL == m_pDS2.get()) return;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
+ if (nullptr == m_pDS2)
+ return;
unsigned int time = XbmcThreads::SystemClockMillis();
CLog::Log(LOGNOTICE, "%s: Starting videodatabase cleanup ..", __FUNCTION__);
@@ -9244,18 +9439,23 @@ void CVideoDatabase::ExportToXML(const std::string &path, bool singleFile /* = t
CGUIDialogProgress *progress=NULL;
try
{
- if (NULL == m_pDB.get()) return;
- if (NULL == m_pDS.get()) return;
- if (NULL == m_pDS2.get()) return;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
+ if (nullptr == m_pDS2)
+ return;
// create a 3rd dataset as well as GetEpisodeDetails() etc. uses m_pDS2, and we need to do 3 nested queries on tv shows
std::unique_ptr<Dataset> pDS;
pDS.reset(m_pDB->CreateDataset());
- if (NULL == pDS.get()) return;
+ if (nullptr == pDS)
+ return;
std::unique_ptr<Dataset> pDS2;
pDS2.reset(m_pDB->CreateDataset());
- if (NULL == pDS2.get()) return;
+ if (nullptr == pDS2)
+ return;
// if we're exporting to a single folder, we export thumbs as well
std::string exportRoot = URIUtils::AddFileToFolder(path, "kodi_videodb_" + CDateTime::GetCurrentDateTime().GetAsDBDate());
@@ -9771,8 +9971,10 @@ void CVideoDatabase::ImportFromXML(const std::string &path)
CGUIDialogProgress *progress=NULL;
try
{
- if (NULL == m_pDB.get()) return;
- if (NULL == m_pDS.get()) return;
+ if (nullptr == m_pDB)
+ return;
+ if (nullptr == m_pDS)
+ return;
CXBMCTinyXML xmlDoc;
if (!xmlDoc.LoadFile(URIUtils::AddFileToFolder(path, "videodb.xml")))
@@ -10026,7 +10228,7 @@ bool CVideoDatabase::SetSingleValue(VIDEODB_CONTENT_TYPE type, int dbId, int dbF
std::string strSQL;
try
{
- if (NULL == m_pDB.get() || NULL == m_pDS.get())
+ if (nullptr == m_pDB || nullptr == m_pDS)
return false;
std::string strTable, strField;
@@ -10085,7 +10287,7 @@ bool CVideoDatabase::SetSingleValue(const std::string &table, const std::string
std::string sql;
try
{
- if (NULL == m_pDB.get() || NULL == m_pDS.get())
+ if (nullptr == m_pDB || nullptr == m_pDS)
return false;
sql = PrepareSQL("UPDATE %s SET %s='%s'", table.c_str(), fieldName.c_str(), strValue.c_str());
@@ -10422,8 +10624,10 @@ bool CVideoDatabase::SetVideoUserRating(int dbId, int rating, const MediaType& m
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
if (mediaType == MediaTypeNone)
return false;
diff --git a/xbmc/video/windows/GUIWindowVideoBase.cpp b/xbmc/video/windows/GUIWindowVideoBase.cpp
index 78787ef9e2..8c97ad98c3 100644
--- a/xbmc/video/windows/GUIWindowVideoBase.cpp
+++ b/xbmc/video/windows/GUIWindowVideoBase.cpp
@@ -533,7 +533,7 @@ void CGUIWindowVideoBase::AddItemToPlayList(const CFileItemPtr &pItem, CFileItem
if (pItem->IsPlayList())
{
std::unique_ptr<CPlayList> pPlayList (CPlayListFactory::Create(*pItem));
- if (pPlayList.get())
+ if (pPlayList)
{
// load it
if (!pPlayList->Load(pItem->GetPath()))
@@ -1204,7 +1204,7 @@ void CGUIWindowVideoBase::LoadPlayList(const std::string& strPlayList, int iPlay
// load a playlist like .m3u, .pls
// first get correct factory to load playlist
std::unique_ptr<CPlayList> pPlayList (CPlayListFactory::Create(strPlayList));
- if (pPlayList.get())
+ if (pPlayList)
{
// load it
if (!pPlayList->Load(strPlayList))
@@ -1216,7 +1216,7 @@ void CGUIWindowVideoBase::LoadPlayList(const std::string& strPlayList, int iPlay
if (g_application.ProcessAndStartPlaylist(strPlayList, *pPlayList, iPlayList))
{
- if (m_guiState.get())
+ if (m_guiState)
m_guiState->SetPlaylistDirectory("playlistvideo://");
}
}
diff --git a/xbmc/video/windows/GUIWindowVideoNav.cpp b/xbmc/video/windows/GUIWindowVideoNav.cpp
index 19a5e004ed..a1d2855120 100644
--- a/xbmc/video/windows/GUIWindowVideoNav.cpp
+++ b/xbmc/video/windows/GUIWindowVideoNav.cpp
@@ -194,7 +194,8 @@ bool CGUIWindowVideoNav::OnMessage(CGUIMessage& message)
}
// Playlist directory is the root of the playlist window
- if (m_guiState.get()) m_guiState->SetPlaylistDirectory("playlistvideo://");
+ if (m_guiState)
+ m_guiState->SetPlaylistDirectory("playlistvideo://");
return true;
}
diff --git a/xbmc/view/ViewDatabase.cpp b/xbmc/view/ViewDatabase.cpp
index 16828eea9e..403b5f1fe8 100644
--- a/xbmc/view/ViewDatabase.cpp
+++ b/xbmc/view/ViewDatabase.cpp
@@ -116,8 +116,10 @@ bool CViewDatabase::GetViewState(const std::string &path, int window, CViewState
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string path1(path);
URIUtils::AddSlashAtEnd(path1);
@@ -152,8 +154,10 @@ bool CViewDatabase::SetViewState(const std::string &path, int window, const CVie
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string path1(path);
URIUtils::AddSlashAtEnd(path1);
@@ -188,8 +192,10 @@ bool CViewDatabase::ClearViewStates(int windowID)
{
try
{
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
+ if (nullptr == m_pDB)
+ return false;
+ if (nullptr == m_pDS)
+ return false;
std::string sql = PrepareSQL("delete from view where window = %i", windowID);
m_pDS->exec(sql);
diff --git a/xbmc/windows/GUIMediaWindow.cpp b/xbmc/windows/GUIMediaWindow.cpp
index 850326154a..c48ed06f94 100644
--- a/xbmc/windows/GUIMediaWindow.cpp
+++ b/xbmc/windows/GUIMediaWindow.cpp
@@ -285,7 +285,7 @@ bool CGUIMediaWindow::OnMessage(CGUIMessage& message)
else
viewMode = m_viewControl.GetNextViewMode();
- if (m_guiState.get())
+ if (m_guiState)
m_guiState->SaveViewAsControl(viewMode);
UpdateButtons();
@@ -293,7 +293,7 @@ bool CGUIMediaWindow::OnMessage(CGUIMessage& message)
}
else if (iControl == CONTROL_BTNSORTASC) // sort asc
{
- if (m_guiState.get())
+ if (m_guiState)
m_guiState->SetNextSortOrder();
UpdateFileList();
return true;
@@ -484,7 +484,7 @@ bool CGUIMediaWindow::OnMessage(CGUIMessage& message)
else if (message.GetParam2())
viewMode = m_viewControl.GetNextViewMode(message.GetParam2());
- if (m_guiState.get())
+ if (m_guiState)
m_guiState->SaveViewAsControl(viewMode);
UpdateButtons();
return true;
@@ -492,7 +492,7 @@ bool CGUIMediaWindow::OnMessage(CGUIMessage& message)
break;
case GUI_MSG_CHANGE_SORT_METHOD:
{
- if (m_guiState.get())
+ if (m_guiState)
{
if (message.GetParam1())
m_guiState->SetCurrentSortMethod(message.GetParam1());
@@ -505,7 +505,7 @@ bool CGUIMediaWindow::OnMessage(CGUIMessage& message)
break;
case GUI_MSG_CHANGE_SORT_DIRECTION:
{
- if (m_guiState.get())
+ if (m_guiState)
m_guiState->SetNextSortOrder();
UpdateFileList();
return true;
@@ -577,7 +577,7 @@ bool CGUIMediaWindow::OnMessage(CGUIMessage& message)
*/
void CGUIMediaWindow::UpdateButtons()
{
- if (m_guiState.get())
+ if (m_guiState)
{
// Update sorting controls
if (m_guiState->GetSortOrder() == SortOrderNone)
@@ -627,7 +627,7 @@ void CGUIMediaWindow::SortItems(CFileItemList &items)
{
std::unique_ptr<CGUIViewState> guiState(CGUIViewState::GetViewState(GetID(), items));
- if (guiState.get())
+ if (guiState)
{
SortDescription sorting = guiState->GetSortMethod();
sorting.sortOrder = guiState->GetSortOrder();
@@ -691,7 +691,7 @@ void CGUIMediaWindow::FormatAndSort(CFileItemList &items)
{
std::unique_ptr<CGUIViewState> viewState(CGUIViewState::GetViewState(GetID(), items));
- if (viewState.get())
+ if (viewState)
{
LABEL_MASKS labelMasks;
viewState->GetSortMethodLabelMasks(labelMasks);
@@ -1527,7 +1527,7 @@ bool CGUIMediaWindow::OnPlayAndQueueMedia(const CFileItemPtr &item, std::string
}
// Save current window and directory to know where the selected item was
- if (m_guiState.get())
+ if (m_guiState)
m_guiState->SetPlaylistDirectory(m_vecItems->GetPath());
// figure out where we start playback
diff --git a/xbmc/windows/GUIWindowFileManager.cpp b/xbmc/windows/GUIWindowFileManager.cpp
index be83b484a7..b55dc4efcb 100644
--- a/xbmc/windows/GUIWindowFileManager.cpp
+++ b/xbmc/windows/GUIWindowFileManager.cpp
@@ -635,7 +635,7 @@ void CGUIWindowFileManager::OnStart(CFileItem *pItem, const std::string &player)
{
std::string strPlayList = pItem->GetPath();
std::unique_ptr<CPlayList> pPlayList (CPlayListFactory::Create(strPlayList));
- if (NULL != pPlayList.get())
+ if (nullptr != pPlayList)
{
if (!pPlayList->Load(strPlayList))
{