From e26331193449f59cb05b65347ac4630f96a4cca5 Mon Sep 17 00:00:00 2001 From: Matthias Kortstiege Date: Fri, 28 Aug 2015 08:44:07 +0200 Subject: [PATCH 01/22] [filesystems] use std:: instead of using namespace std --- xbmc/filesystem/AndroidAppDirectory.cpp | 3 +- xbmc/filesystem/Directory.cpp | 9 ++- xbmc/filesystem/DirectoryCache.cpp | 11 ++-- xbmc/filesystem/DirectoryHistory.cpp | 4 +- xbmc/filesystem/FTPParse.cpp | 2 - xbmc/filesystem/File.cpp | 65 +++++++++---------- xbmc/filesystem/FileDirectoryFactory.cpp | 3 +- xbmc/filesystem/ISOFile.cpp | 7 +- xbmc/filesystem/ImageFile.cpp | 1 - xbmc/filesystem/LibraryDirectory.cpp | 1 - xbmc/filesystem/MultiPathDirectory.cpp | 27 ++++---- xbmc/filesystem/MultiPathFile.cpp | 7 +- xbmc/filesystem/MusicDatabaseDirectory.cpp | 15 ++--- .../MusicDatabaseDirectory/DirectoryNode.cpp | 11 ++-- .../DirectoryNodeOverview.cpp | 1 - .../DirectoryNodeTop100.cpp | 1 - xbmc/filesystem/NFSDirectory.cpp | 1 - xbmc/filesystem/PVRDirectory.cpp | 1 - xbmc/filesystem/PVRFile.cpp | 1 - xbmc/filesystem/PlaylistFileDirectory.cpp | 5 +- xbmc/filesystem/PluginDirectory.cpp | 9 ++- xbmc/filesystem/RSSDirectory.cpp | 1 - xbmc/filesystem/RarFile.cpp | 5 +- xbmc/filesystem/RarManager.cpp | 29 ++++----- xbmc/filesystem/SAPDirectory.cpp | 2 - xbmc/filesystem/SAPFile.cpp | 15 ++--- xbmc/filesystem/SFTPFile.cpp | 13 ++-- xbmc/filesystem/SMBDirectory.cpp | 3 +- xbmc/filesystem/SpecialProtocol.cpp | 6 +- xbmc/filesystem/StackDirectory.cpp | 17 +++-- xbmc/filesystem/UDFFile.cpp | 1 - xbmc/filesystem/VideoDatabaseDirectory.cpp | 17 +++-- .../VideoDatabaseDirectory/DirectoryNode.cpp | 13 ++-- .../DirectoryNodeMoviesOverview.cpp | 1 - .../DirectoryNodeOverview.cpp | 22 +++---- xbmc/filesystem/ZipDirectory.cpp | 5 +- xbmc/filesystem/ZipFile.cpp | 3 +- xbmc/filesystem/ZipManager.cpp | 23 ++++--- xbmc/filesystem/iso9660.cpp | 19 +++--- xbmc/filesystem/posix/PosixDirectory.cpp | 1 - 40 files changed, 168 insertions(+), 213 deletions(-) diff --git a/xbmc/filesystem/AndroidAppDirectory.cpp b/xbmc/filesystem/AndroidAppDirectory.cpp index b1a07b793cb71..3317eb7c0ef36 100644 --- a/xbmc/filesystem/AndroidAppDirectory.cpp +++ b/xbmc/filesystem/AndroidAppDirectory.cpp @@ -33,7 +33,6 @@ #include "CompileInfo.h" using namespace XFILE; -using namespace std; CAndroidAppDirectory::CAndroidAppDirectory(void) { @@ -54,7 +53,7 @@ bool CAndroidAppDirectory::GetDirectory(const CURL& url, CFileItemList &items) if (dirname == "apps") { - vector applications = CXBMCApp::GetApplications(); + std::vector applications = CXBMCApp::GetApplications(); if (applications.empty()) { CLog::Log(LOGERROR, "CAndroidAppDirectory::GetDirectory Application lookup listing failed"); diff --git a/xbmc/filesystem/Directory.cpp b/xbmc/filesystem/Directory.cpp index 7d57a4fa6d312..0b3e394721ffe 100644 --- a/xbmc/filesystem/Directory.cpp +++ b/xbmc/filesystem/Directory.cpp @@ -35,7 +35,6 @@ #include "utils/URIUtils.h" #include "URL.h" -using namespace std; using namespace XFILE; #define TIME_TO_BUSY_DIALOG 500 @@ -288,7 +287,7 @@ bool CDirectory::Create(const CURL& url) try { CURL realURL = URIUtils::SubstitutePath(url); - unique_ptr pDirectory(CDirectoryFactory::Create(realURL)); + std::unique_ptr pDirectory(CDirectoryFactory::Create(realURL)); if (pDirectory.get()) if(pDirectory->Create(realURL)) return true; @@ -323,7 +322,7 @@ bool CDirectory::Exists(const CURL& url, bool bUseCache /* = true */) if (bPathInCache) return false; } - unique_ptr pDirectory(CDirectoryFactory::Create(realURL)); + std::unique_ptr pDirectory(CDirectoryFactory::Create(realURL)); if (pDirectory.get()) return pDirectory->Exists(realURL); } @@ -347,7 +346,7 @@ bool CDirectory::Remove(const CURL& url) try { CURL realURL = URIUtils::SubstitutePath(url); - unique_ptr pDirectory(CDirectoryFactory::Create(realURL)); + std::unique_ptr pDirectory(CDirectoryFactory::Create(realURL)); if (pDirectory.get()) if(pDirectory->Remove(realURL)) { @@ -371,7 +370,7 @@ void CDirectory::FilterFileDirectories(CFileItemList &items, const std::string & CFileItemPtr pItem=items[i]; if (!pItem->m_bIsFolder && pItem->IsFileFolder(EFILEFOLDER_TYPE_ALWAYS)) { - unique_ptr pDirectory(CFileDirectoryFactory::Create(pItem->GetURL(),pItem.get(),mask)); + std::unique_ptr pDirectory(CFileDirectoryFactory::Create(pItem->GetURL(),pItem.get(),mask)); if (pDirectory.get()) pItem->m_bIsFolder = true; else diff --git a/xbmc/filesystem/DirectoryCache.cpp b/xbmc/filesystem/DirectoryCache.cpp index 987760a5f46eb..a6dd06116097a 100644 --- a/xbmc/filesystem/DirectoryCache.cpp +++ b/xbmc/filesystem/DirectoryCache.cpp @@ -28,7 +28,6 @@ #include -using namespace std; using namespace XFILE; CDirectoryCache::CDir::CDir(DIR_CACHE_TYPE cacheType) @@ -115,7 +114,7 @@ void CDirectoryCache::SetDirectory(const std::string& strPath, const CFileItemLi CDir* dir = new CDir(cacheType); dir->m_Items->Copy(items); dir->SetLastAccess(m_accessCounter); - m_cache.insert(pair(storedPath, dir)); + m_cache.insert(std::pair(storedPath, dir)); } void CDirectoryCache::ClearFile(const std::string& strFile) @@ -206,9 +205,9 @@ void CDirectoryCache::Clear() Delete(i++); } -void CDirectoryCache::InitCache(set& dirs) +void CDirectoryCache::InitCache(std::set& dirs) { - set::iterator it; + std::set::iterator it; for (it = dirs.begin(); it != dirs.end(); ++it) { const std::string& strDir = *it; @@ -218,7 +217,7 @@ void CDirectoryCache::InitCache(set& dirs) } } -void CDirectoryCache::ClearCache(set& dirs) +void CDirectoryCache::ClearCache(std::set& dirs) { iCache i = m_cache.begin(); while (i != m_cache.end()) @@ -271,7 +270,7 @@ void CDirectoryCache::PrintStats() const for (ciCache i = m_cache.begin(); i != m_cache.end(); i++) { CDir *dir = i->second; - oldest = min(oldest, dir->GetLastAccess()); + oldest = std::min(oldest, dir->GetLastAccess()); numItems += dir->m_Items->Size(); numDirs++; } diff --git a/xbmc/filesystem/DirectoryHistory.cpp b/xbmc/filesystem/DirectoryHistory.cpp index 9e39c380faa63..a7a5f4da40f3b 100644 --- a/xbmc/filesystem/DirectoryHistory.cpp +++ b/xbmc/filesystem/DirectoryHistory.cpp @@ -25,8 +25,6 @@ #include -using namespace std; - const std::string& CDirectoryHistory::CPathHistoryItem::GetPath(bool filter /* = false */) const { if (filter && !m_strFilterPath.empty()) @@ -113,7 +111,7 @@ bool CDirectoryHistory::IsInHistory(const std::string &path) const { std::string slashEnded(path); URIUtils::AddSlashAtEnd(slashEnded); - for (vector::const_iterator i = m_vecPathHistory.begin(); i != m_vecPathHistory.end(); ++i) + for (std::vector::const_iterator i = m_vecPathHistory.begin(); i != m_vecPathHistory.end(); ++i) { std::string testPath(i->GetPath()); URIUtils::AddSlashAtEnd(testPath); diff --git a/xbmc/filesystem/FTPParse.cpp b/xbmc/filesystem/FTPParse.cpp index 90aee7a58175a..608752fdfd78d 100644 --- a/xbmc/filesystem/FTPParse.cpp +++ b/xbmc/filesystem/FTPParse.cpp @@ -34,8 +34,6 @@ #include #include "FTPParse.h" -using namespace std; - CFTPParse::CFTPParse() { m_flagtrycwd = 0; diff --git a/xbmc/filesystem/File.cpp b/xbmc/filesystem/File.cpp index 5c0b82dae4a6f..731b7445ef827 100644 --- a/xbmc/filesystem/File.cpp +++ b/xbmc/filesystem/File.cpp @@ -37,7 +37,6 @@ #include "commons/Exception.h" using namespace XFILE; -using namespace std; ////////////////////////////////////////////////////////////////////// // Construction/Destruction @@ -94,7 +93,7 @@ bool CFile::Copy(const CURL& url2, const CURL& dest, XFILE::IFileCallback* pCall CFile newFile; if (URIUtils::IsHD(pathToUrl)) // create possible missing dirs { - vector tokens; + std::vector tokens; std::string strDirectory = URIUtils::GetDirectory(pathToUrl); URIUtils::RemoveSlashAtEnd(strDirectory); // for the test below if (!(strDirectory.size() == 2 && strDirectory[1] == ':')) @@ -115,7 +114,7 @@ bool CFile::Copy(const CURL& url2, const CURL& dest, XFILE::IFileCallback* pCall } // If the directory has a / at the beginning, don't forget it else if (strDirectory[0] == pathsep[0]) strCurrPath += pathsep; - for (vector::iterator iter=tokens.begin();iter!=tokens.end();++iter) + for (std::vector::iterator iter=tokens.begin();iter!=tokens.end();++iter) { strCurrPath += *iter+pathsep; CDirectory::Create(strCurrPath); @@ -269,7 +268,7 @@ bool CFile::Open(const CURL& file, const unsigned int flags) SAFE_DELETE(m_pFile); if (pRedirectEx && pRedirectEx->m_pNewFileImp) { - unique_ptr pNewUrl(pRedirectEx->m_pNewUrl); + std::unique_ptr pNewUrl(pRedirectEx->m_pNewUrl); m_pFile = pRedirectEx->m_pNewFileImp; delete pRedirectEx; @@ -372,7 +371,7 @@ bool CFile::Exists(const CURL& file, bool bUseCache /* = true */) return false; } - unique_ptr pFile(CFileFactory::CreateLoader(url)); + std::unique_ptr pFile(CFileFactory::CreateLoader(url)); if (!pFile.get()) return false; @@ -386,8 +385,8 @@ bool CFile::Exists(const CURL& file, bool bUseCache /* = true */) CLog::Log(LOGDEBUG,"File::Exists - redirecting implementation for %s", file.GetRedacted().c_str()); if (pRedirectEx && pRedirectEx->m_pNewFileImp) { - unique_ptr pImp(pRedirectEx->m_pNewFileImp); - unique_ptr pNewUrl(pRedirectEx->m_pNewUrl); + std::unique_ptr pImp(pRedirectEx->m_pNewFileImp); + std::unique_ptr pNewUrl(pRedirectEx->m_pNewUrl); delete pRedirectEx; if (pImp.get()) @@ -454,7 +453,7 @@ int CFile::Stat(const CURL& file, struct __stat64* buffer) try { - unique_ptr pFile(CFileFactory::CreateLoader(url)); + std::unique_ptr pFile(CFileFactory::CreateLoader(url)); if (!pFile.get()) return -1; return pFile->Stat(url, buffer); @@ -467,8 +466,8 @@ int CFile::Stat(const CURL& file, struct __stat64* buffer) CLog::Log(LOGDEBUG,"File::Stat - redirecting implementation for %s", file.GetRedacted().c_str()); if (pRedirectEx && pRedirectEx->m_pNewFileImp) { - unique_ptr pImp(pRedirectEx->m_pNewFileImp); - unique_ptr pNewUrl(pRedirectEx->m_pNewUrl); + std::unique_ptr pImp(pRedirectEx->m_pNewFileImp); + std::unique_ptr pNewUrl(pRedirectEx->m_pNewUrl); delete pRedirectEx; if (pNewUrl.get()) @@ -519,7 +518,7 @@ ssize_t CFile::Read(void *lpBuf, size_t uiBufSize) if(m_flags & READ_TRUNCATED) { const ssize_t nBytes = m_pBuffer->sgetn( - (char *)lpBuf, min((streamsize)uiBufSize, + (char *)lpBuf, std::min((std::streamsize)uiBufSize, m_pBuffer->in_avail())); if (m_bitStreamStats && nBytes>0) m_bitStreamStats->AddSampleBytes(nBytes); @@ -615,11 +614,11 @@ int64_t CFile::Seek(int64_t iFilePosition, int iWhence) if (m_pBuffer) { if(iWhence == SEEK_CUR) - return m_pBuffer->pubseekoff(iFilePosition,ios_base::cur); + return m_pBuffer->pubseekoff(iFilePosition, std::ios_base::cur); else if(iWhence == SEEK_END) - return m_pBuffer->pubseekoff(iFilePosition,ios_base::end); + return m_pBuffer->pubseekoff(iFilePosition, std::ios_base::end); else if(iWhence == SEEK_SET) - return m_pBuffer->pubseekoff(iFilePosition,ios_base::beg); + return m_pBuffer->pubseekoff(iFilePosition, std::ios_base::beg); } try @@ -676,7 +675,7 @@ int64_t CFile::GetPosition() const return -1; if (m_pBuffer) - return m_pBuffer->pubseekoff(0, ios_base::cur); + return m_pBuffer->pubseekoff(0, std::ios_base::cur); try { @@ -792,7 +791,7 @@ bool CFile::Delete(const CURL& file) { CURL url(URIUtils::SubstitutePath(file)); - unique_ptr pFile(CFileFactory::CreateLoader(url)); + std::unique_ptr pFile(CFileFactory::CreateLoader(url)); if (!pFile.get()) return false; @@ -826,7 +825,7 @@ bool CFile::Rename(const CURL& file, const CURL& newFile) CURL url(URIUtils::SubstitutePath(file)); CURL urlnew(URIUtils::SubstitutePath(newFile)); - unique_ptr pFile(CFileFactory::CreateLoader(url)); + std::unique_ptr pFile(CFileFactory::CreateLoader(url)); if (!pFile.get()) return false; @@ -858,7 +857,7 @@ bool CFile::SetHidden(const CURL& file, bool hidden) { CURL url(URIUtils::SubstitutePath(file)); - unique_ptr pFile(CFileFactory::CreateLoader(url)); + std::unique_ptr pFile(CFileFactory::CreateLoader(url)); if (!pFile.get()) return false; @@ -990,7 +989,7 @@ CFileStreamBuffer::~CFileStreamBuffer() } CFileStreamBuffer::CFileStreamBuffer(int backsize) - : streambuf() + : std::streambuf() , m_file(NULL) , m_buffer(NULL) , m_backsize(backsize) @@ -1028,7 +1027,7 @@ CFileStreamBuffer::int_type CFileStreamBuffer::underflow() size_t backsize = 0; if(m_backsize) { - backsize = (size_t)min((ptrdiff_t)m_backsize, egptr()-eback()); + backsize = (size_t)std::min((ptrdiff_t)m_backsize, egptr()-eback()); memmove(m_buffer, egptr()-backsize, backsize); } @@ -1048,20 +1047,20 @@ CFileStreamBuffer::int_type CFileStreamBuffer::underflow() CFileStreamBuffer::pos_type CFileStreamBuffer::seekoff( off_type offset, - ios_base::seekdir way, - ios_base::openmode mode) + std::ios_base::seekdir way, + std::ios_base::openmode mode) { // calculate relative offset off_type pos = m_file->GetPosition() - (egptr() - gptr()); off_type offset2; - if(way == ios_base::cur) + if(way == std::ios_base::cur) offset2 = offset; - else if(way == ios_base::beg) + else if(way == std::ios_base::beg) offset2 = offset - pos; - else if(way == ios_base::end) + else if(way == std::ios_base::end) offset2 = offset + m_file->GetLength() - pos; else - return streampos(-1); + return std::streampos(-1); // a non seek shouldn't modify our buffer if(offset2 == 0) @@ -1080,34 +1079,34 @@ CFileStreamBuffer::pos_type CFileStreamBuffer::seekoff( setp(0,0); int64_t position = -1; - if(way == ios_base::cur) + if(way == std::ios_base::cur) position = m_file->Seek(offset, SEEK_CUR); - else if(way == ios_base::end) + else if(way == std::ios_base::end) position = m_file->Seek(offset, SEEK_END); else position = m_file->Seek(offset, SEEK_SET); if(position<0) - return streampos(-1); + return std::streampos(-1); return position; } CFileStreamBuffer::pos_type CFileStreamBuffer::seekpos( pos_type pos, - ios_base::openmode mode) + std::ios_base::openmode mode) { - return seekoff(pos, ios_base::beg, mode); + return seekoff(pos, std::ios_base::beg, mode); } -streamsize CFileStreamBuffer::showmanyc() +std::streamsize CFileStreamBuffer::showmanyc() { underflow(); return egptr() - gptr(); } CFileStream::CFileStream(int backsize /*= 0*/) : - istream(&m_buffer), + std::istream(&m_buffer), m_buffer(backsize), m_file(NULL) { diff --git a/xbmc/filesystem/FileDirectoryFactory.cpp b/xbmc/filesystem/FileDirectoryFactory.cpp index 43266e651e60b..a1d4ee4c0ede6 100644 --- a/xbmc/filesystem/FileDirectoryFactory.cpp +++ b/xbmc/filesystem/FileDirectoryFactory.cpp @@ -49,7 +49,6 @@ using namespace ADDON; using namespace XFILE; using namespace PLAYLIST; -using namespace std; CFileDirectoryFactory::CFileDirectoryFactory(void) {} @@ -135,7 +134,7 @@ IFileDirectory* CFileDirectoryFactory::Create(const CURL& url, CFileItem* pItem, } if (url.IsFileType("rar") || url.IsFileType("001")) { - vector tokens; + std::vector tokens; const std::string strPath = url.Get(); StringUtils::Tokenize(strPath,tokens,"."); if (tokens.size() > 2) diff --git a/xbmc/filesystem/ISOFile.cpp b/xbmc/filesystem/ISOFile.cpp index 4add031e7e507..9bcb344cfe958 100644 --- a/xbmc/filesystem/ISOFile.cpp +++ b/xbmc/filesystem/ISOFile.cpp @@ -27,7 +27,6 @@ #include #include -using namespace std; using namespace XFILE; ////////////////////////////////////////////////////////////////////// @@ -51,7 +50,7 @@ CISOFile::~CISOFile() //********************************************************************************************* bool CISOFile::Open(const CURL& url) { - string strFName = "\\"; + std::string strFName = "\\"; strFName += url.GetFileName(); for (int i = 0; i < (int)strFName.size(); ++i ) { @@ -141,7 +140,7 @@ int64_t CISOFile::GetPosition() bool CISOFile::Exists(const CURL& url) { - string strFName = "\\"; + std::string strFName = "\\"; strFName += url.GetFileName(); for (int i = 0; i < (int)strFName.size(); ++i ) { @@ -157,7 +156,7 @@ bool CISOFile::Exists(const CURL& url) int CISOFile::Stat(const CURL& url, struct __stat64* buffer) { - string strFName = "\\"; + std::string strFName = "\\"; strFName += url.GetFileName(); for (int i = 0; i < (int)strFName.size(); ++i ) { diff --git a/xbmc/filesystem/ImageFile.cpp b/xbmc/filesystem/ImageFile.cpp index 7bedf2e12eae5..e3a4a7b63776e 100644 --- a/xbmc/filesystem/ImageFile.cpp +++ b/xbmc/filesystem/ImageFile.cpp @@ -23,7 +23,6 @@ #include "TextureCache.h" using namespace XFILE; -using namespace std; CImageFile::CImageFile(void) { diff --git a/xbmc/filesystem/LibraryDirectory.cpp b/xbmc/filesystem/LibraryDirectory.cpp index dd4d22b8239e2..90962e5ed906a 100644 --- a/xbmc/filesystem/LibraryDirectory.cpp +++ b/xbmc/filesystem/LibraryDirectory.cpp @@ -34,7 +34,6 @@ #include "GUIInfoManager.h" #include "utils/log.h" -using namespace std; using namespace XFILE; CLibraryDirectory::CLibraryDirectory(void) diff --git a/xbmc/filesystem/MultiPathDirectory.cpp b/xbmc/filesystem/MultiPathDirectory.cpp index b9a475d6600cf..bf9320d609b27 100644 --- a/xbmc/filesystem/MultiPathDirectory.cpp +++ b/xbmc/filesystem/MultiPathDirectory.cpp @@ -31,7 +31,6 @@ #include "utils/Variant.h" #include "utils/URIUtils.h" -using namespace std; using namespace XFILE; // @@ -51,7 +50,7 @@ bool CMultiPathDirectory::GetDirectory(const CURL& url, CFileItemList &items) { CLog::Log(LOGDEBUG,"CMultiPathDirectory::GetDirectory(%s)", url.GetRedacted().c_str()); - vector vecPaths; + std::vector vecPaths; if (!GetPaths(url, vecPaths)) return false; @@ -118,7 +117,7 @@ bool CMultiPathDirectory::Exists(const CURL& url) { CLog::Log(LOGDEBUG,"Testing Existence (%s)", url.GetRedacted().c_str()); - vector vecPaths; + std::vector vecPaths; if (!GetPaths(url, vecPaths)) return false; @@ -133,7 +132,7 @@ bool CMultiPathDirectory::Exists(const CURL& url) bool CMultiPathDirectory::Remove(const CURL& url) { - vector vecPaths; + std::vector vecPaths; if (!GetPaths(url, vecPaths)) return false; @@ -154,7 +153,7 @@ std::string CMultiPathDirectory::GetFirstPath(const std::string &strPath) return ""; } -bool CMultiPathDirectory::GetPaths(const CURL& url, vector& vecPaths) +bool CMultiPathDirectory::GetPaths(const CURL& url, std::vector& vecPaths) { const std::string pathToUrl(url.Get()); return GetPaths(pathToUrl, vecPaths); @@ -169,7 +168,7 @@ bool CMultiPathDirectory::GetPaths(const std::string& path, std::vector temp = StringUtils::Split(path1, '/'); + std::vector temp = StringUtils::Split(path1, '/'); if (temp.size() == 0) return false; @@ -186,7 +185,7 @@ bool CMultiPathDirectory::HasPath(const std::string& strPath, const std::string& URIUtils::RemoveSlashAtEnd(strPath1); // split on "/" - vector vecTemp = StringUtils::Split(strPath1, '/'); + std::vector vecTemp = StringUtils::Split(strPath1, '/'); if (vecTemp.empty()) return false; @@ -199,7 +198,7 @@ bool CMultiPathDirectory::HasPath(const std::string& strPath, const std::string& return false; } -std::string CMultiPathDirectory::ConstructMultiPath(const CFileItemList& items, const vector &stack) +std::string CMultiPathDirectory::ConstructMultiPath(const CFileItemList& items, const std::vector &stack) { // we replace all instances of comma's with double comma's, then separate // the paths using " , " @@ -221,23 +220,23 @@ void CMultiPathDirectory::AddToMultiPath(std::string& strMultiPath, const std::s strMultiPath += "/"; } -std::string CMultiPathDirectory::ConstructMultiPath(const vector &vecPaths) +std::string CMultiPathDirectory::ConstructMultiPath(const std::vector &vecPaths) { // we replace all instances of comma's with double comma's, then separate // the paths using " , " //CLog::Log(LOGDEBUG, "Building multipath"); std::string newPath = "multipath://"; //CLog::Log(LOGDEBUG, "-- adding path: %s", strPath.c_str()); - for (vector::const_iterator path = vecPaths.begin(); path != vecPaths.end(); ++path) + for (std::vector::const_iterator path = vecPaths.begin(); path != vecPaths.end(); ++path) AddToMultiPath(newPath, *path); //CLog::Log(LOGDEBUG, "Final path: %s", newPath.c_str()); return newPath; } -std::string CMultiPathDirectory::ConstructMultiPath(const set &setPaths) +std::string CMultiPathDirectory::ConstructMultiPath(const std::set &setPaths) { std::string newPath = "multipath://"; - for (set::const_iterator path = setPaths.begin(); path != setPaths.end(); ++path) + for (std::set::const_iterator path = setPaths.begin(); path != setPaths.end(); ++path) AddToMultiPath(newPath, *path); return newPath; @@ -265,7 +264,7 @@ void CMultiPathDirectory::MergeItems(CFileItemList &items) if (!pItem1->m_bIsFolder) break; - vector stack; + std::vector stack; stack.push_back(i); CLog::Log(LOGDEBUG,"Testing path: [%03i] %s", i, pItem1->GetPath().c_str()); @@ -308,7 +307,7 @@ void CMultiPathDirectory::MergeItems(CFileItemList &items) bool CMultiPathDirectory::SupportsWriteFileOperations(const std::string &strPath) { - vector paths; + std::vector paths; GetPaths(strPath, paths); for (unsigned int i = 0; i < paths.size(); ++i) if (CUtil::SupportsWriteFileOperations(paths[i])) diff --git a/xbmc/filesystem/MultiPathFile.cpp b/xbmc/filesystem/MultiPathFile.cpp index f2a567bc24c7b..bffb96c44c543 100644 --- a/xbmc/filesystem/MultiPathFile.cpp +++ b/xbmc/filesystem/MultiPathFile.cpp @@ -23,7 +23,6 @@ #include "utils/URIUtils.h" #include "URL.h" -using namespace std; using namespace XFILE; CMultiPathFile::CMultiPathFile(void) @@ -38,7 +37,7 @@ bool CMultiPathFile::Open(const CURL& url) // grab the filename off the url std::string path, fileName; URIUtils::Split(url.Get(), path, fileName); - vector vecPaths; + std::vector vecPaths; if (!CMultiPathDirectory::GetPaths(path, vecPaths)) return false; @@ -57,7 +56,7 @@ bool CMultiPathFile::Exists(const CURL& url) // grab the filename off the url std::string path, fileName; URIUtils::Split(url.Get(), path, fileName); - vector vecPaths; + std::vector vecPaths; if (!CMultiPathDirectory::GetPaths(path, vecPaths)) return false; @@ -76,7 +75,7 @@ int CMultiPathFile::Stat(const CURL& url, struct __stat64* buffer) // grab the filename off the url std::string path, fileName; URIUtils::Split(url.Get(), path, fileName); - vector vecPaths; + std::vector vecPaths; if (!CMultiPathDirectory::GetPaths(path, vecPaths)) return false; diff --git a/xbmc/filesystem/MusicDatabaseDirectory.cpp b/xbmc/filesystem/MusicDatabaseDirectory.cpp index 545b1be1f71bf..4413e7a31622d 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory.cpp +++ b/xbmc/filesystem/MusicDatabaseDirectory.cpp @@ -30,7 +30,6 @@ #include "utils/LegacyPathTranslation.h" #include "utils/StringUtils.h" -using namespace std; using namespace XFILE; using namespace MUSICDATABASEDIRECTORY; @@ -46,7 +45,7 @@ bool CMusicDatabaseDirectory::GetDirectory(const CURL& url, CFileItemList &items { std::string path = CLegacyPathTranslation::TranslateMusicDbPath(url); items.SetPath(path); - unique_ptr pNode(CDirectoryNode::ParseURL(path)); + std::unique_ptr pNode(CDirectoryNode::ParseURL(path)); if (!pNode.get()) return false; @@ -70,7 +69,7 @@ bool CMusicDatabaseDirectory::GetDirectory(const CURL& url, CFileItemList &items NODE_TYPE CMusicDatabaseDirectory::GetDirectoryChildType(const std::string& strPath) { std::string path = CLegacyPathTranslation::TranslateMusicDbPath(strPath); - unique_ptr pNode(CDirectoryNode::ParseURL(path)); + std::unique_ptr pNode(CDirectoryNode::ParseURL(path)); if (!pNode.get()) return NODE_TYPE_NONE; @@ -81,7 +80,7 @@ NODE_TYPE CMusicDatabaseDirectory::GetDirectoryChildType(const std::string& strP NODE_TYPE CMusicDatabaseDirectory::GetDirectoryType(const std::string& strPath) { std::string path = CLegacyPathTranslation::TranslateMusicDbPath(strPath); - unique_ptr pNode(CDirectoryNode::ParseURL(path)); + std::unique_ptr pNode(CDirectoryNode::ParseURL(path)); if (!pNode.get()) return NODE_TYPE_NONE; @@ -92,7 +91,7 @@ NODE_TYPE CMusicDatabaseDirectory::GetDirectoryType(const std::string& strPath) NODE_TYPE CMusicDatabaseDirectory::GetDirectoryParentType(const std::string& strPath) { std::string path = CLegacyPathTranslation::TranslateMusicDbPath(strPath); - unique_ptr pNode(CDirectoryNode::ParseURL(path)); + std::unique_ptr pNode(CDirectoryNode::ParseURL(path)); if (!pNode.get()) return NODE_TYPE_NONE; @@ -142,7 +141,7 @@ bool CMusicDatabaseDirectory::GetLabel(const std::string& strDirectory, std::str strLabel = ""; std::string path = CLegacyPathTranslation::TranslateMusicDbPath(strDirectory); - unique_ptr pNode(CDirectoryNode::ParseURL(path)); + std::unique_ptr pNode(CDirectoryNode::ParseURL(path)); if (!pNode.get()) return false; @@ -248,7 +247,7 @@ bool CMusicDatabaseDirectory::ContainsSongs(const std::string &path) bool CMusicDatabaseDirectory::Exists(const CURL& url) { std::string path = CLegacyPathTranslation::TranslateMusicDbPath(url); - unique_ptr pNode(CDirectoryNode::ParseURL(path)); + std::unique_ptr pNode(CDirectoryNode::ParseURL(path)); if (!pNode.get()) return false; @@ -262,7 +261,7 @@ bool CMusicDatabaseDirectory::Exists(const CURL& url) bool CMusicDatabaseDirectory::CanCache(const std::string& strPath) { std::string path = CLegacyPathTranslation::TranslateMusicDbPath(strPath); - unique_ptr pNode(CDirectoryNode::ParseURL(path)); + std::unique_ptr pNode(CDirectoryNode::ParseURL(path)); if (!pNode.get()) return false; return pNode->CanCache(); diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNode.cpp b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNode.cpp index 9c7e9d6f0a205..d86bac6897e68 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNode.cpp +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNode.cpp @@ -48,7 +48,6 @@ #include "music/MusicDbUrl.h" #include "settings/Settings.h" -using namespace std; using namespace XFILE::MUSICDATABASEDIRECTORY; // Constructor is protected use ParseURL() @@ -72,7 +71,7 @@ CDirectoryNode* CDirectoryNode::ParseURL(const std::string& strPath) std::string strDirectory=url.GetFileName(); URIUtils::RemoveSlashAtEnd(strDirectory); - vector Path = StringUtils::Split(strDirectory, '/'); + std::vector Path = StringUtils::Split(strDirectory, '/'); Path.insert(Path.begin(), ""); CDirectoryNode* pNode=NULL; @@ -96,7 +95,7 @@ CDirectoryNode* CDirectoryNode::ParseURL(const std::string& strPath) // returns the database ids of the path, void CDirectoryNode::GetDatabaseInfo(const std::string& strPath, CQueryParams& params) { - unique_ptr pNode(CDirectoryNode::ParseURL(strPath)); + std::unique_ptr pNode(CDirectoryNode::ParseURL(strPath)); if (!pNode.get()) return; @@ -199,7 +198,7 @@ bool CDirectoryNode::GetContent(CFileItemList& items) const // Creates a musicdb url std::string CDirectoryNode::BuildPath() const { - vector array; + std::vector array; if (!m_strName.empty()) array.insert(array.begin(), m_strName); @@ -218,7 +217,7 @@ std::string CDirectoryNode::BuildPath() const for (int i=0; i<(int)array.size(); ++i) strPath+=array[i]+"/"; - string options = m_options.GetOptionsString(); + std::string options = m_options.GetOptionsString(); if (!options.empty()) strPath += "?" + options; @@ -261,7 +260,7 @@ bool CDirectoryNode::GetChilds(CFileItemList& items) if (CanCache() && items.Load()) return true; - unique_ptr pNode(CDirectoryNode::CreateNode(GetChildType(), "", this)); + std::unique_ptr pNode(CDirectoryNode::CreateNode(GetChildType(), "", this)); bool bSuccess=false; if (pNode.get()) diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeOverview.cpp b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeOverview.cpp index f1b69889f455d..1a2424c153609 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeOverview.cpp +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeOverview.cpp @@ -43,7 +43,6 @@ namespace XFILE }; }; -using namespace std; using namespace XFILE::MUSICDATABASEDIRECTORY; CDirectoryNodeOverview::CDirectoryNodeOverview(const std::string& strName, CDirectoryNode* pParent) diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeTop100.cpp b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeTop100.cpp index f8e1d3de0a90f..31420ccd1f313 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeTop100.cpp +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeTop100.cpp @@ -23,7 +23,6 @@ #include "guilib/LocalizeStrings.h" #include "utils/StringUtils.h" -using namespace std; using namespace XFILE::MUSICDATABASEDIRECTORY; Node Top100Children[] = { diff --git a/xbmc/filesystem/NFSDirectory.cpp b/xbmc/filesystem/NFSDirectory.cpp index fed93b35a6f7b..c744aa8fb481e 100644 --- a/xbmc/filesystem/NFSDirectory.cpp +++ b/xbmc/filesystem/NFSDirectory.cpp @@ -34,7 +34,6 @@ #include "utils/StringUtils.h" #include "threads/SingleLock.h" using namespace XFILE; -using namespace std; #include #include diff --git a/xbmc/filesystem/PVRDirectory.cpp b/xbmc/filesystem/PVRDirectory.cpp index fcc919024d86d..a7a24016d2258 100644 --- a/xbmc/filesystem/PVRDirectory.cpp +++ b/xbmc/filesystem/PVRDirectory.cpp @@ -31,7 +31,6 @@ #include "pvr/recordings/PVRRecordings.h" #include "pvr/timers/PVRTimers.h" -using namespace std; using namespace XFILE; using namespace PVR; diff --git a/xbmc/filesystem/PVRFile.cpp b/xbmc/filesystem/PVRFile.cpp index 536d1a46bee1a..1ea659c45e3d6 100644 --- a/xbmc/filesystem/PVRFile.cpp +++ b/xbmc/filesystem/PVRFile.cpp @@ -28,7 +28,6 @@ #include "utils/StringUtils.h" #include "URL.h" -using namespace std; using namespace XFILE; using namespace PVR; diff --git a/xbmc/filesystem/PlaylistFileDirectory.cpp b/xbmc/filesystem/PlaylistFileDirectory.cpp index 066c1141f3883..571f6a732d4df 100644 --- a/xbmc/filesystem/PlaylistFileDirectory.cpp +++ b/xbmc/filesystem/PlaylistFileDirectory.cpp @@ -24,7 +24,6 @@ #include "URL.h" #include "playlists/PlayList.h" -using namespace std; using namespace PLAYLIST; namespace XFILE @@ -40,7 +39,7 @@ namespace XFILE bool CPlaylistFileDirectory::GetDirectory(const CURL& url, CFileItemList& items) { const std::string pathToUrl = url.Get(); - unique_ptr pPlayList (CPlayListFactory::Create(pathToUrl)); + std::unique_ptr pPlayList (CPlayListFactory::Create(pathToUrl)); if ( NULL != pPlayList.get()) { // load it @@ -62,7 +61,7 @@ namespace XFILE bool CPlaylistFileDirectory::ContainsFiles(const CURL& url) { const std::string pathToUrl = url.Get(); - unique_ptr pPlayList (CPlayListFactory::Create(pathToUrl)); + std::unique_ptr pPlayList (CPlayListFactory::Create(pathToUrl)); if ( NULL != pPlayList.get()) { // load it diff --git a/xbmc/filesystem/PluginDirectory.cpp b/xbmc/filesystem/PluginDirectory.cpp index 94ba18dfe5615..db378b8cefb1e 100644 --- a/xbmc/filesystem/PluginDirectory.cpp +++ b/xbmc/filesystem/PluginDirectory.cpp @@ -39,11 +39,10 @@ #include "URL.h" using namespace XFILE; -using namespace std; using namespace ADDON; using namespace KODI::MESSAGING; -map CPluginDirectory::globalHandles; +std::map CPluginDirectory::globalHandles; int CPluginDirectory::handleCounter = 0; CCriticalSection CPluginDirectory::m_handleLock; @@ -80,7 +79,7 @@ void CPluginDirectory::removeHandle(int handle) CPluginDirectory *CPluginDirectory::dirFromHandle(int handle) { CSingleLock lock(m_handleLock); - map::iterator i = globalHandles.find(handle); + std::map::iterator i = globalHandles.find(handle); if (i != globalHandles.end()) return i->second; CLog::Log(LOGWARNING, "Attempt to use invalid handle %i", handle); @@ -121,7 +120,7 @@ bool CPluginDirectory::StartScript(const std::string& strPath, bool retrievingDi // setup our parameters to send the script std::string strHandle = StringUtils::Format("%i", handle); - vector argv; + std::vector argv; argv.push_back(basePath); argv.push_back(strHandle); argv.push_back(options); @@ -437,7 +436,7 @@ bool CPluginDirectory::RunScriptWithParams(const std::string& strPath) // setup our parameters to send the script std::string strHandle = StringUtils::Format("%i", -1); - vector argv; + std::vector argv; argv.push_back(basePath); argv.push_back(strHandle); argv.push_back(options); diff --git a/xbmc/filesystem/RSSDirectory.cpp b/xbmc/filesystem/RSSDirectory.cpp index 55a9d21b80053..5e25afb088d73 100644 --- a/xbmc/filesystem/RSSDirectory.cpp +++ b/xbmc/filesystem/RSSDirectory.cpp @@ -35,7 +35,6 @@ #include "threads/SingleLock.h" using namespace XFILE; -using namespace std; using namespace MUSIC_INFO; namespace { diff --git a/xbmc/filesystem/RarFile.cpp b/xbmc/filesystem/RarFile.cpp index 087a65c27e2a8..b7f806594b690 100644 --- a/xbmc/filesystem/RarFile.cpp +++ b/xbmc/filesystem/RarFile.cpp @@ -39,7 +39,6 @@ #endif using namespace XFILE; -using namespace std; #define SEEKTIMOUT 30000 @@ -552,13 +551,13 @@ void CRarFile::InitFromUrl(const CURL& url) m_strPassword = url.GetUserName(); m_strPathInRar = url.GetFileName(); - vector options; + std::vector options; if (!url.GetOptions().empty()) StringUtils::Tokenize(url.GetOptions().substr(1), options, "&"); m_bFileOptions = 0; - for( vector::iterator it = options.begin();it != options.end(); ++it) + for(std::vector::iterator it = options.begin();it != options.end(); ++it) { size_t iEqual = (*it).find('='); if(iEqual != std::string::npos) diff --git a/xbmc/filesystem/RarManager.cpp b/xbmc/filesystem/RarManager.cpp index e34038fa5aab5..e5396850115d9 100644 --- a/xbmc/filesystem/RarManager.cpp +++ b/xbmc/filesystem/RarManager.cpp @@ -42,7 +42,6 @@ #define EXTRACTION_WARN_SIZE 50*1024*1024 -using namespace std; using namespace XFILE; CFileInfo::CFileInfo() @@ -140,7 +139,7 @@ bool CRarManager::CacheRarredFile(std::string& strPathInCache, const std::string //If file is listed in the cache, then use listed copy or cleanup before overwriting. bool bOverwrite = (bOptions & EXFILE_OVERWRITE) != 0; - map > >::iterator j = m_ExFiles.find( strRarPath ); + std::map > >::iterator j = m_ExFiles.find( strRarPath ); CFileInfo* pFile=NULL; if( j != m_ExFiles.end() ) { @@ -271,7 +270,7 @@ bool CRarManager::CacheRarredFile(std::string& strPathInCache, const std::string ArchiveList_struct* pArchiveList; if(ListArchive(strRarPath,pArchiveList)) { - m_ExFiles.insert(make_pair(strRarPath,make_pair(pArchiveList,vector()))); + m_ExFiles.insert(std::make_pair(strRarPath, std::make_pair(pArchiveList, std::vector()))); j = m_ExFiles.find(strRarPath); } else @@ -304,11 +303,11 @@ bool CRarManager::GetFilesInRar(CFileItemList& vecpItems, const std::string& str CSingleLock lock(m_CritSection); ArchiveList_struct* pFileList = NULL; - map > >::iterator it = m_ExFiles.find(strRarPath); + std::map > >::iterator it = m_ExFiles.find(strRarPath); if (it == m_ExFiles.end()) { if( urarlib_list((char*) strRarPath.c_str(), &pFileList, NULL) ) - m_ExFiles.insert(make_pair(strRarPath,make_pair(pFileList,vector()))); + m_ExFiles.insert(std::make_pair(strRarPath, std::make_pair(pFileList, std::vector()))); else { if( pFileList ) urarlib_freelist(pFileList); @@ -319,8 +318,8 @@ bool CRarManager::GetFilesInRar(CFileItemList& vecpItems, const std::string& str pFileList = it->second.first; CFileItemPtr pFileItem; - vector vec; - set dirSet; + std::vector vec; + std::set dirSet; StringUtils::Tokenize(strPathInRar,vec,"/"); unsigned int iDepth = vec.size(); @@ -409,11 +408,11 @@ bool CRarManager::ListArchive(const std::string& strRarPath, ArchiveList_struct* CFileInfo* CRarManager::GetFileInRar(const std::string& strRarPath, const std::string& strPathInRar) { #ifdef HAS_FILESYSTEM_RAR - map > >::iterator j = m_ExFiles.find(strRarPath); + std::map > >::iterator j = m_ExFiles.find(strRarPath); if (j == m_ExFiles.end()) return NULL; - for (vector::iterator it2=j->second.second.begin(); it2 != j->second.second.end(); ++it2) + for (std::vector::iterator it2=j->second.second.begin(); it2 != j->second.second.end(); ++it2) if (it2->m_strPathInRar == strPathInRar) return &(*it2); #endif @@ -423,11 +422,11 @@ CFileInfo* CRarManager::GetFileInRar(const std::string& strRarPath, const std::s bool CRarManager::GetPathInCache(std::string& strPathInCache, const std::string& strRarPath, const std::string& strPathInRar) { #ifdef HAS_FILESYSTEM_RAR - map > >::iterator j = m_ExFiles.find(strRarPath); + std::map > >::iterator j = m_ExFiles.find(strRarPath); if (j == m_ExFiles.end()) return false; - for (vector::iterator it2=j->second.second.begin(); it2 != j->second.second.end(); ++it2) + for (std::vector::iterator it2=j->second.second.begin(); it2 != j->second.second.end(); ++it2) if (it2->m_strPathInRar == strPathInRar) return CFile::Exists(it2->m_strCachedPath); #endif @@ -462,11 +461,11 @@ void CRarManager::ClearCache(bool force) { #ifdef HAS_FILESYSTEM_RAR CSingleLock lock(m_CritSection); - map > >::iterator j; + std::map > >::iterator j; for (j = m_ExFiles.begin() ; j != m_ExFiles.end() ; ++j) { - for (vector::iterator it2 = j->second.second.begin(); it2 != j->second.second.end(); ++it2) + for (std::vector::iterator it2 = j->second.second.begin(); it2 != j->second.second.end(); ++it2) { CFileInfo* pFile = &(*it2); if (pFile->m_bAutoDel && (pFile->m_iUsed < 1 || force)) @@ -484,13 +483,13 @@ void CRarManager::ClearCachedFile(const std::string& strRarPath, const std::stri #ifdef HAS_FILESYSTEM_RAR CSingleLock lock(m_CritSection); - map > >::iterator j = m_ExFiles.find(strRarPath); + std::map > >::iterator j = m_ExFiles.find(strRarPath); if (j == m_ExFiles.end()) { return; // no such subpath } - for (vector::iterator it = j->second.second.begin(); it != j->second.second.end(); ++it) + for (std::vector::iterator it = j->second.second.begin(); it != j->second.second.end(); ++it) { if (it->m_strPathInRar == strPathInRar) if (it->m_iUsed > 0) diff --git a/xbmc/filesystem/SAPDirectory.cpp b/xbmc/filesystem/SAPDirectory.cpp index 2ab3a788279bc..d71647c1a435e 100644 --- a/xbmc/filesystem/SAPDirectory.cpp +++ b/xbmc/filesystem/SAPDirectory.cpp @@ -43,8 +43,6 @@ #include #include -//using namespace std; On VS2010, bind conflicts with std::bind - CSAPSessions g_sapsessions; namespace SDP diff --git a/xbmc/filesystem/SAPFile.cpp b/xbmc/filesystem/SAPFile.cpp index 1ca8361e8403e..29d01c9fbee0e 100644 --- a/xbmc/filesystem/SAPFile.cpp +++ b/xbmc/filesystem/SAPFile.cpp @@ -29,7 +29,6 @@ #include #include -using namespace std; using namespace XFILE; ////////////////////////////////////////////////////////////////////// @@ -49,7 +48,7 @@ bool CSAPFile::Open(const CURL& url) std::string path = url.Get(); CSingleLock lock(g_sapsessions.m_section); - for(vector::iterator it = g_sapsessions.m_sessions.begin(); it != g_sapsessions.m_sessions.end(); ++it) + for(std::vector::iterator it = g_sapsessions.m_sessions.begin(); it != g_sapsessions.m_sessions.end(); ++it) { if(it->path == path) { @@ -70,7 +69,7 @@ bool CSAPFile::Exists(const CURL& url) std::string path = url.Get(); CSingleLock lock(g_sapsessions.m_section); - for(vector::iterator it = g_sapsessions.m_sessions.begin(); it != g_sapsessions.m_sessions.end(); ++it) + for(std::vector::iterator it = g_sapsessions.m_sessions.begin(); it != g_sapsessions.m_sessions.end(); ++it) { if(it->path == path) return true; @@ -94,7 +93,7 @@ int CSAPFile::Stat(const CURL& url, struct __stat64* buffer) CSingleLock lock(g_sapsessions.m_section); - for(vector::iterator it = g_sapsessions.m_sessions.begin(); it != g_sapsessions.m_sessions.end(); ++it) + for(std::vector::iterator it = g_sapsessions.m_sessions.begin(); it != g_sapsessions.m_sessions.end(); ++it) { if(it->path == path) { @@ -131,13 +130,13 @@ int64_t CSAPFile::Seek(int64_t iFilePosition, int iWhence) switch (iWhence) { case SEEK_SET: - m_stream.seekg((int)iFilePosition, ios_base::beg); + m_stream.seekg((int)iFilePosition, std::ios_base::beg); break; case SEEK_CUR: - m_stream.seekg((int)iFilePosition, ios_base::cur); + m_stream.seekg((int)iFilePosition, std::ios_base::cur); break; case SEEK_END: - m_stream.seekg((int)iFilePosition, ios_base::end); + m_stream.seekg((int)iFilePosition, std::ios_base::end); break; default: return -1; @@ -162,7 +161,7 @@ bool CSAPFile::Delete(const CURL& url) std::string path = url.Get(); CSingleLock lock(g_sapsessions.m_section); - for(vector::iterator it = g_sapsessions.m_sessions.begin(); it != g_sapsessions.m_sessions.end(); ++it) + for(std::vector::iterator it = g_sapsessions.m_sessions.begin(); it != g_sapsessions.m_sessions.end(); ++it) { if(it->path == path) { diff --git a/xbmc/filesystem/SFTPFile.cpp b/xbmc/filesystem/SFTPFile.cpp index 186f73c811805..fdfb1afabc1bb 100644 --- a/xbmc/filesystem/SFTPFile.cpp +++ b/xbmc/filesystem/SFTPFile.cpp @@ -42,7 +42,6 @@ #endif using namespace XFILE; -using namespace std; static std::string CorrectPath(const std::string& path) @@ -530,13 +529,13 @@ bool CSFTPSession::GetItemPermissions(const char *path, uint32_t &permissions) } CCriticalSection CSFTPSessionManager::m_critSect; -map CSFTPSessionManager::sessions; +std::map CSFTPSessionManager::sessions; CSFTPSessionPtr CSFTPSessionManager::CreateSession(const CURL &url) { - string username = url.GetUserName().c_str(); - string password = url.GetPassWord().c_str(); - string hostname = url.GetHostName().c_str(); + std::string username = url.GetUserName().c_str(); + std::string password = url.GetPassWord().c_str(); + std::string hostname = url.GetHostName().c_str(); unsigned int port = url.HasPort() ? url.GetPort() : 22; return CSFTPSessionManager::CreateSession(hostname, port, username, password); @@ -545,7 +544,7 @@ CSFTPSessionPtr CSFTPSessionManager::CreateSession(const CURL &url) CSFTPSessionPtr CSFTPSessionManager::CreateSession(const std::string &host, unsigned int port, const std::string &username, const std::string &password) { // Convert port number to string - stringstream itoa; + std::stringstream itoa; itoa << port; std::string portstr = itoa.str(); @@ -564,7 +563,7 @@ CSFTPSessionPtr CSFTPSessionManager::CreateSession(const std::string &host, unsi void CSFTPSessionManager::ClearOutIdleSessions() { CSingleLock lock(m_critSect); - for(map::iterator iter = sessions.begin(); iter != sessions.end();) + for(std::map::iterator iter = sessions.begin(); iter != sessions.end();) { if (iter->second->IsIdle()) sessions.erase(iter++); diff --git a/xbmc/filesystem/SMBDirectory.cpp b/xbmc/filesystem/SMBDirectory.cpp index c80cdcdc5926d..825ae3ca432d9 100644 --- a/xbmc/filesystem/SMBDirectory.cpp +++ b/xbmc/filesystem/SMBDirectory.cpp @@ -51,7 +51,6 @@ struct CachedDirEntry }; using namespace XFILE; -using namespace std; CSMBDirectory::CSMBDirectory(void) { @@ -89,7 +88,7 @@ bool CSMBDirectory::GetDirectory(const CURL& url, CFileItemList &items) // need to keep the samba lock for as short as possible. // so we first cache all directory entries and then go over them again asking for stat // "stat" is locked each time. that way the lock is freed between stat requests - vector vecEntries; + std::vector vecEntries; struct smbc_dirent* dirEnt; lock.Enter(); diff --git a/xbmc/filesystem/SpecialProtocol.cpp b/xbmc/filesystem/SpecialProtocol.cpp index 70d7215575f8d..417bc159b0131 100644 --- a/xbmc/filesystem/SpecialProtocol.cpp +++ b/xbmc/filesystem/SpecialProtocol.cpp @@ -34,9 +34,7 @@ #include "utils/StringUtils.h" #endif -using namespace std; - -map CSpecialProtocol::m_pathMap; +std::map CSpecialProtocol::m_pathMap; void CSpecialProtocol::SetProfilePath(const std::string &dir) { @@ -263,7 +261,7 @@ void CSpecialProtocol::SetPath(const std::string &key, const std::string &path) std::string CSpecialProtocol::GetPath(const std::string &key) { - map::iterator it = m_pathMap.find(key); + std::map::iterator it = m_pathMap.find(key); if (it != m_pathMap.end()) return it->second; assert(false); diff --git a/xbmc/filesystem/StackDirectory.cpp b/xbmc/filesystem/StackDirectory.cpp index 6772ced3dc39f..61bac16a3559a 100644 --- a/xbmc/filesystem/StackDirectory.cpp +++ b/xbmc/filesystem/StackDirectory.cpp @@ -27,7 +27,6 @@ #include "settings/AdvancedSettings.h" #include "URL.h" -using namespace std; namespace XFILE { CStackDirectory::CStackDirectory() @@ -41,12 +40,12 @@ namespace XFILE bool CStackDirectory::GetDirectory(const CURL& url, CFileItemList& items) { items.Clear(); - vector files; + std::vector files; const std::string pathToUrl(url.Get()); if (!GetPaths(pathToUrl, files)) return false; // error in path - for (vector::const_iterator i = files.begin(); i != files.end(); ++i) + for (std::vector::const_iterator i = files.begin(); i != files.end(); ++i) { CFileItemPtr item(new CFileItem(*i)); item->SetPath(*i); @@ -61,8 +60,8 @@ namespace XFILE // Load up our REs VECCREGEXP RegExps; CRegExp tempRE(true, CRegExp::autoUtf8); - const vector& strRegExps = g_advancedSettings.m_videoStackRegExps; - vector::const_iterator itRegExp = strRegExps.begin(); + const std::vector& strRegExps = g_advancedSettings.m_videoStackRegExps; + std::vector::const_iterator itRegExp = strRegExps.begin(); while (itRegExp != strRegExps.end()) { (void)tempRE.RegComp(*itRegExp); @@ -174,7 +173,7 @@ namespace XFILE return URIUtils::AddFileToFolder(folder, file); } - bool CStackDirectory::GetPaths(const std::string& strPath, vector& vecPaths) + bool CStackDirectory::GetPaths(const std::string& strPath, std::vector& vecPaths) { // format is: // stack://file1 , file2 , file3 , file4 @@ -188,13 +187,13 @@ namespace XFILE return false; // because " , " is used as a seperator any "," in the real paths are double escaped - for (vector::iterator itPath = vecPaths.begin(); itPath != vecPaths.end(); ++itPath) + for (std::vector::iterator itPath = vecPaths.begin(); itPath != vecPaths.end(); ++itPath) StringUtils::Replace(*itPath, ",,", ","); return true; } - std::string CStackDirectory::ConstructStackPath(const CFileItemList &items, const vector &stack) + std::string CStackDirectory::ConstructStackPath(const CFileItemList &items, const std::vector &stack) { // no checks on the range of stack here. // we replace all instances of comma's with double comma's, then separate @@ -218,7 +217,7 @@ namespace XFILE return stackedPath; } - bool CStackDirectory::ConstructStackPath(const vector &paths, std::string& stackedPath) + bool CStackDirectory::ConstructStackPath(const std::vector &paths, std::string& stackedPath) { if (paths.size() < 2) return false; diff --git a/xbmc/filesystem/UDFFile.cpp b/xbmc/filesystem/UDFFile.cpp index 2e188e3b1c4bb..5921093b1588f 100644 --- a/xbmc/filesystem/UDFFile.cpp +++ b/xbmc/filesystem/UDFFile.cpp @@ -27,7 +27,6 @@ #include #include -using namespace std; using namespace XFILE; ////////////////////////////////////////////////////////////////////// diff --git a/xbmc/filesystem/VideoDatabaseDirectory.cpp b/xbmc/filesystem/VideoDatabaseDirectory.cpp index 2ca86df660acb..ede4b24f74067 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory.cpp +++ b/xbmc/filesystem/VideoDatabaseDirectory.cpp @@ -31,7 +31,6 @@ #include "utils/LegacyPathTranslation.h" #include "utils/StringUtils.h" -using namespace std; using namespace XFILE; using namespace VIDEODATABASEDIRECTORY; @@ -47,7 +46,7 @@ bool CVideoDatabaseDirectory::GetDirectory(const CURL& url, CFileItemList &items { std::string path = CLegacyPathTranslation::TranslateVideoDbPath(url); items.SetPath(path); - unique_ptr pNode(CDirectoryNode::ParseURL(path)); + std::unique_ptr pNode(CDirectoryNode::ParseURL(path)); if (!pNode.get()) return false; @@ -71,7 +70,7 @@ bool CVideoDatabaseDirectory::GetDirectory(const CURL& url, CFileItemList &items NODE_TYPE CVideoDatabaseDirectory::GetDirectoryChildType(const std::string& strPath) { std::string path = CLegacyPathTranslation::TranslateVideoDbPath(strPath); - unique_ptr pNode(CDirectoryNode::ParseURL(path)); + std::unique_ptr pNode(CDirectoryNode::ParseURL(path)); if (!pNode.get()) return NODE_TYPE_NONE; @@ -82,7 +81,7 @@ NODE_TYPE CVideoDatabaseDirectory::GetDirectoryChildType(const std::string& strP NODE_TYPE CVideoDatabaseDirectory::GetDirectoryType(const std::string& strPath) { std::string path = CLegacyPathTranslation::TranslateVideoDbPath(strPath); - unique_ptr pNode(CDirectoryNode::ParseURL(path)); + std::unique_ptr pNode(CDirectoryNode::ParseURL(path)); if (!pNode.get()) return NODE_TYPE_NONE; @@ -93,7 +92,7 @@ NODE_TYPE CVideoDatabaseDirectory::GetDirectoryType(const std::string& strPath) NODE_TYPE CVideoDatabaseDirectory::GetDirectoryParentType(const std::string& strPath) { std::string path = CLegacyPathTranslation::TranslateVideoDbPath(strPath); - unique_ptr pNode(CDirectoryNode::ParseURL(path)); + std::unique_ptr pNode(CDirectoryNode::ParseURL(path)); if (!pNode.get()) return NODE_TYPE_NONE; @@ -109,7 +108,7 @@ NODE_TYPE CVideoDatabaseDirectory::GetDirectoryParentType(const std::string& str bool CVideoDatabaseDirectory::GetQueryParams(const std::string& strPath, CQueryParams& params) { std::string path = CLegacyPathTranslation::TranslateVideoDbPath(strPath); - unique_ptr pNode(CDirectoryNode::ParseURL(path)); + std::unique_ptr pNode(CDirectoryNode::ParseURL(path)); if (!pNode.get()) return false; @@ -142,7 +141,7 @@ bool CVideoDatabaseDirectory::GetLabel(const std::string& strDirectory, std::str strLabel = ""; std::string path = CLegacyPathTranslation::TranslateVideoDbPath(strDirectory); - unique_ptr pNode(CDirectoryNode::ParseURL(path)); + std::unique_ptr pNode(CDirectoryNode::ParseURL(path)); if (!pNode.get() || path.empty()) return false; @@ -303,7 +302,7 @@ bool CVideoDatabaseDirectory::ContainsMovies(const std::string &path) bool CVideoDatabaseDirectory::Exists(const CURL& url) { std::string path = CLegacyPathTranslation::TranslateVideoDbPath(url); - unique_ptr pNode(CDirectoryNode::ParseURL(path)); + std::unique_ptr pNode(CDirectoryNode::ParseURL(path)); if (!pNode.get()) return false; @@ -317,7 +316,7 @@ bool CVideoDatabaseDirectory::Exists(const CURL& url) bool CVideoDatabaseDirectory::CanCache(const std::string& strPath) { std::string path = CLegacyPathTranslation::TranslateVideoDbPath(strPath); - unique_ptr pNode(CDirectoryNode::ParseURL(path)); + std::unique_ptr pNode(CDirectoryNode::ParseURL(path)); if (!pNode.get()) return false; return pNode->CanCache(); diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNode.cpp b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNode.cpp index 222a716734918..5f0b53344b469 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNode.cpp +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNode.cpp @@ -45,7 +45,6 @@ #include "video/VideoDatabase.h" #include "settings/Settings.h" -using namespace std; using namespace XFILE::VIDEODATABASEDIRECTORY; // Constructor is protected use ParseURL() @@ -69,7 +68,7 @@ CDirectoryNode* CDirectoryNode::ParseURL(const std::string& strPath) std::string strDirectory=url.GetFileName(); URIUtils::RemoveSlashAtEnd(strDirectory); - vector Path = StringUtils::Split(strDirectory, '/'); + std::vector Path = StringUtils::Split(strDirectory, '/'); Path.insert(Path.begin(), ""); CDirectoryNode* pNode=NULL; @@ -93,7 +92,7 @@ CDirectoryNode* CDirectoryNode::ParseURL(const std::string& strPath) // returns the database ids of the path, void CDirectoryNode::GetDatabaseInfo(const std::string& strPath, CQueryParams& params) { - unique_ptr pNode(CDirectoryNode::ParseURL(strPath)); + std::unique_ptr pNode(CDirectoryNode::ParseURL(strPath)); if (!pNode.get()) return; @@ -193,7 +192,7 @@ bool CDirectoryNode::GetContent(CFileItemList& items) const // Creates a videodb url std::string CDirectoryNode::BuildPath() const { - vector array; + std::vector array; if (!m_strName.empty()) array.insert(array.begin(), m_strName); @@ -212,7 +211,7 @@ std::string CDirectoryNode::BuildPath() const for (int i=0; i<(int)array.size(); ++i) strPath+=array[i]+"/"; - string options = m_options.GetOptionsString(); + std::string options = m_options.GetOptionsString(); if (!options.empty()) strPath += "?" + options; @@ -255,7 +254,7 @@ bool CDirectoryNode::GetChilds(CFileItemList& items) if (CanCache() && items.Load()) return true; - unique_ptr pNode(CDirectoryNode::CreateNode(GetChildType(), "", this)); + std::unique_ptr pNode(CDirectoryNode::CreateNode(GetChildType(), "", this)); bool bSuccess=false; if (pNode.get()) @@ -296,7 +295,7 @@ void CDirectoryNode::AddQueuingFolder(CFileItemList& items) const return; // hack - as the season node might return episodes - unique_ptr pNode(ParseURL(items.GetPath())); + std::unique_ptr pNode(ParseURL(items.GetPath())); switch (pNode->GetChildType()) { diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeMoviesOverview.cpp b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeMoviesOverview.cpp index a2e1564bb3d47..09747d70154d3 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeMoviesOverview.cpp +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeMoviesOverview.cpp @@ -26,7 +26,6 @@ #include "utils/StringUtils.h" using namespace XFILE::VIDEODATABASEDIRECTORY; -using namespace std; Node MovieChildren[] = { { NODE_TYPE_GENRE, "genres", 135 }, diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeOverview.cpp b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeOverview.cpp index 815130399f762..3dd8d6ddcacec 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeOverview.cpp +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeOverview.cpp @@ -25,8 +25,6 @@ #include "guilib/LocalizeStrings.h" using namespace XFILE::VIDEODATABASEDIRECTORY; -using namespace std; - Node OverviewChildren[] = { { NODE_TYPE_MOVIES_OVERVIEW, "movies", 342 }, @@ -67,35 +65,35 @@ bool CDirectoryNodeOverview::GetContent(CFileItemList& items) const bool hasMovies = database.HasContent(VIDEODB_CONTENT_MOVIES); bool hasTvShows = database.HasContent(VIDEODB_CONTENT_TVSHOWS); bool hasMusicVideos = database.HasContent(VIDEODB_CONTENT_MUSICVIDEOS); - vector > vec; + std::vector > vec; if (hasMovies) { if (CSettings::GetInstance().GetBool(CSettings::SETTING_MYVIDEOS_FLATTEN)) - vec.push_back(make_pair("movies/titles", 342)); + vec.push_back(std::make_pair("movies/titles", 342)); else - vec.push_back(make_pair("movies", 342)); // Movies + vec.push_back(std::make_pair("movies", 342)); // Movies } if (hasTvShows) { if (CSettings::GetInstance().GetBool(CSettings::SETTING_MYVIDEOS_FLATTEN)) - vec.push_back(make_pair("tvshows/titles", 20343)); + vec.push_back(std::make_pair("tvshows/titles", 20343)); else - vec.push_back(make_pair("tvshows", 20343)); // TV Shows + vec.push_back(std::make_pair("tvshows", 20343)); // TV Shows } if (hasMusicVideos) { if (CSettings::GetInstance().GetBool(CSettings::SETTING_MYVIDEOS_FLATTEN)) - vec.push_back(make_pair("musicvideos/titles", 20389)); + vec.push_back(std::make_pair("musicvideos/titles", 20389)); else - vec.push_back(make_pair("musicvideos", 20389)); // Music Videos + vec.push_back(std::make_pair("musicvideos", 20389)); // Music Videos } { if (hasMovies) - vec.push_back(make_pair("recentlyaddedmovies", 20386)); // Recently Added Movies + vec.push_back(std::make_pair("recentlyaddedmovies", 20386)); // Recently Added Movies if (hasTvShows) - vec.push_back(make_pair("recentlyaddedepisodes", 20387)); // Recently Added Episodes + vec.push_back(std::make_pair("recentlyaddedepisodes", 20387)); // Recently Added Episodes if (hasMusicVideos) - vec.push_back(make_pair("recentlyaddedmusicvideos", 20390)); // Recently Added Music Videos + vec.push_back(std::make_pair("recentlyaddedmusicvideos", 20390)); // Recently Added Music Videos } std::string path = BuildPath(); for (unsigned int i = 0; i < vec.size(); ++i) diff --git a/xbmc/filesystem/ZipDirectory.cpp b/xbmc/filesystem/ZipDirectory.cpp index 5557fdadc4af7..a45ae12bfd9ef 100644 --- a/xbmc/filesystem/ZipDirectory.cpp +++ b/xbmc/filesystem/ZipDirectory.cpp @@ -30,7 +30,6 @@ #include -using namespace std; namespace XFILE { @@ -62,7 +61,7 @@ namespace XFILE if (!urlOrig.IsProtocol("zip")) urlZip = URIUtils::CreateArchivePath("zip", urlOrig); - vector zipEntries; + std::vector zipEntries; if (!g_ZipManager.GetZipList(urlZip, zipEntries)) return false; @@ -80,7 +79,7 @@ namespace XFILE bool CZipDirectory::ContainsFiles(const CURL& url) { - vector items; + std::vector items; g_ZipManager.GetZipList(url, items); if (items.size()) { diff --git a/xbmc/filesystem/ZipFile.cpp b/xbmc/filesystem/ZipFile.cpp index 7fa4d6efdde41..a9af977b89ef8 100644 --- a/xbmc/filesystem/ZipFile.cpp +++ b/xbmc/filesystem/ZipFile.cpp @@ -29,7 +29,6 @@ #define ZIP_CACHE_LIMIT 4*1024*1024 using namespace XFILE; -using namespace std; CZipFile::CZipFile() { @@ -472,7 +471,7 @@ void CZipFile::DestroyBuffer(void* lpBuffer, int iBufSize) m_bFlush = false; } -int CZipFile::UnpackFromMemory(string& strDest, const string& strInput, bool isGZ) +int CZipFile::UnpackFromMemory(std::string& strDest, const std::string& strInput, bool isGZ) { unsigned int iPos=0; int iResult=0; diff --git a/xbmc/filesystem/ZipManager.cpp b/xbmc/filesystem/ZipManager.cpp index 1fd7059d15700..4daa9f76c4ebb 100644 --- a/xbmc/filesystem/ZipManager.cpp +++ b/xbmc/filesystem/ZipManager.cpp @@ -33,7 +33,6 @@ #endif using namespace XFILE; -using namespace std; CZipManager::CZipManager() { @@ -44,7 +43,7 @@ CZipManager::~CZipManager() } -bool CZipManager::GetZipList(const CURL& url, vector& items) +bool CZipManager::GetZipList(const CURL& url, std::vector& items) { CLog::Log(LOGDEBUG, "%s - Processing %s", __FUNCTION__, url.GetRedacted().c_str()); @@ -58,10 +57,10 @@ bool CZipManager::GetZipList(const CURL& url, vector& items) return false; } - map >::iterator it = mZipMap.find(strFile); + std::map >::iterator it = mZipMap.find(strFile); if (it != mZipMap.end()) // already listed, just return it if not changed, else release and reread { - map::iterator it2=mZipDate.find(strFile); + std::map::iterator it2=mZipDate.find(strFile); CLog::Log(LOGDEBUG,"statdata: %" PRId64" new: %" PRIu64, it2->second, (uint64_t)m_StatData.st_mtime); if (m_StatData.st_mtime == it2->second) @@ -202,7 +201,7 @@ bool CZipManager::GetZipList(const CURL& url, vector& items) } /* go through list and figure out file header lengths */ - for(vector::iterator it = items.begin(); it != items.end(); ++it) + for(std::vector::iterator it = items.begin(); it != items.end(); ++it) { SZipEntry& ze = *it; // Go to the local file header to get the extra field length @@ -226,8 +225,8 @@ bool CZipManager::GetZipEntry(const CURL& url, SZipEntry& item) { std::string strFile = url.GetHostName(); - map >::iterator it = mZipMap.find(strFile); - vector items; + std::map >::iterator it = mZipMap.find(strFile); + std::vector items; if (it == mZipMap.end()) // we need to list the zip { GetZipList(url,items); @@ -238,7 +237,7 @@ bool CZipManager::GetZipEntry(const CURL& url, SZipEntry& item) } std::string strFileName = url.GetFileName(); - for (vector::iterator it2=items.begin();it2 != items.end();++it2) + for (std::vector::iterator it2=items.begin();it2 != items.end();++it2) { if (std::string(it2->name) == strFileName) { @@ -257,10 +256,10 @@ bool CZipManager::ExtractArchive(const std::string& strArchive, const std::strin bool CZipManager::ExtractArchive(const CURL& archive, const std::string& strPath) { - vector entry; + std::vector entry; CURL url = URIUtils::CreateArchivePath("zip", archive); GetZipList(url, entry); - for (vector::iterator it=entry.begin();it != entry.end();++it) + for (std::vector::iterator it=entry.begin();it != entry.end();++it) { if (it->name[strlen(it->name)-1] == '/') // skip dirs continue; @@ -314,10 +313,10 @@ void CZipManager::readCHeader(const char* buffer, SZipEntry& info) void CZipManager::release(const std::string& strPath) { CURL url(strPath); - map >::iterator it= mZipMap.find(url.GetHostName()); + std::map >::iterator it= mZipMap.find(url.GetHostName()); if (it != mZipMap.end()) { - map::iterator it2=mZipDate.find(url.GetHostName()); + std::map::iterator it2=mZipDate.find(url.GetHostName()); mZipMap.erase(it); mZipDate.erase(it2); } diff --git a/xbmc/filesystem/iso9660.cpp b/xbmc/filesystem/iso9660.cpp index 409e2384980f2..3bae1fa5e5d51 100644 --- a/xbmc/filesystem/iso9660.cpp +++ b/xbmc/filesystem/iso9660.cpp @@ -61,7 +61,6 @@ class iso9660 m_isoReader; #define BUFFER_SIZE MODE2_DATA_SIZE #define RET_ERR -1 -using namespace std; #ifndef HAS_DVD_DRIVE extern "C" @@ -71,9 +70,9 @@ extern "C" #endif //****************************************************************************************************************** -const string iso9660::ParseName(struct iso9660_Directory& isodir) +const std::string iso9660::ParseName(struct iso9660_Directory& isodir) { - string temp_text = (char*)isodir.FileName; + std::string temp_text = (char*)isodir.FileName; temp_text.resize(isodir.Len_Fi); int iPos = isodir.Len_Fi; @@ -261,7 +260,7 @@ struct iso_dirtree *iso9660::ReadRecursiveDirFromSector( DWORD sector, const cha { break; } - int isize = min(sizeof(isodir), sizeof(m_info.isodir)); + int isize = std::min(sizeof(isodir), sizeof(m_info.isodir)); memcpy( &isodir, pCurr_dir_cache + iso9660searchpointer, isize); if (!isodir.ucRecordLength) continue; @@ -269,7 +268,7 @@ struct iso_dirtree *iso9660::ReadRecursiveDirFromSector( DWORD sector, const cha { if ( (!( isodir.byFlags & Flag_Directory )) && ( isodir.Len_Fi > 1) ) { - string temp_text ; + std::string temp_text ; bool bContinue = false; if ( m_info.joliet ) @@ -352,14 +351,14 @@ struct iso_dirtree *iso9660::ReadRecursiveDirFromSector( DWORD sector, const cha pCurr_dir_cache = NULL; return pDir; } - memcpy( &isodir, pCurr_dir_cache + iso9660searchpointer, min(sizeof(isodir), sizeof(m_info.isodir))); + memcpy( &isodir, pCurr_dir_cache + iso9660searchpointer, std::min(sizeof(isodir), sizeof(m_info.isodir))); if (!isodir.ucRecordLength) continue; if ( !(isodir.byFlags & Flag_NotExist) ) { if ( (( isodir.byFlags & Flag_Directory )) && ( isodir.Len_Fi > 1) ) { - string temp_text ; + std::string temp_text ; bool bContinue = false; if ( m_info.joliet ) { @@ -423,7 +422,7 @@ struct iso_dirtree *iso9660::ReadRecursiveDirFromSector( DWORD sector, const cha IsoDateTimeToFileTime(&isodir.DateTime, &pFile_Pointer->filetime); - string strPath = path; + std::string strPath = path; if ( strlen( path ) > 1 ) strPath += "\\"; strPath += temp_text; @@ -505,7 +504,7 @@ void iso9660::Scan() else iso9660searchpointer = (iso9660searchpointer - (iso9660searchpointer % wSectorSize)) + wSectorSize; - memcpy( &isodir, pCurr_dir_cache + iso9660searchpointer,min(sizeof(isodir), sizeof(m_info.isodir))); + memcpy( &isodir, pCurr_dir_cache + iso9660searchpointer, std::min(sizeof(isodir), sizeof(m_info.isodir))); free(pCurr_dir_cache); if (bResult && lpNumberOfBytesRead == wSectorSize) bResult = IsRockRidge(isodir); @@ -696,7 +695,7 @@ bool iso9660::FindClose( HANDLE szLocalFolder ) //****************************************************************************************************************** -string iso9660::GetThinText(BYTE* strTxt, int iLen ) +std::string iso9660::GetThinText(BYTE* strTxt, int iLen ) { // convert from "fat" text (UTF-16BE) to "thin" text (UTF-8) std::u16string strTxtUnicode((char16_t*)strTxt, iLen / 2); diff --git a/xbmc/filesystem/posix/PosixDirectory.cpp b/xbmc/filesystem/posix/PosixDirectory.cpp index a6e1ab0d11e8a..979861716e1ea 100644 --- a/xbmc/filesystem/posix/PosixDirectory.cpp +++ b/xbmc/filesystem/posix/PosixDirectory.cpp @@ -32,7 +32,6 @@ #include #include -using namespace std; using namespace XFILE; CPosixDirectory::CPosixDirectory(void) From d6d590318902fff3a688a9636e84d2948e360a29 Mon Sep 17 00:00:00 2001 From: Matthias Kortstiege Date: Fri, 28 Aug 2015 09:08:18 +0200 Subject: [PATCH 02/22] [music] use std:: instead of using namespace std --- xbmc/music/Album.cpp | 7 +- xbmc/music/Artist.cpp | 4 +- xbmc/music/MusicDatabase.cpp | 101 ++++++++++---------- xbmc/music/MusicDbUrl.cpp | 1 - xbmc/music/MusicInfoLoader.cpp | 5 +- xbmc/music/MusicThumbLoader.cpp | 11 +-- xbmc/music/Song.cpp | 3 +- xbmc/music/dialogs/GUIDialogMusicInfo.cpp | 9 +- xbmc/music/infoscanner/MusicAlbumInfo.cpp | 1 - xbmc/music/infoscanner/MusicArtistInfo.cpp | 1 - xbmc/music/infoscanner/MusicInfoScanner.cpp | 43 ++++----- xbmc/music/infoscanner/MusicInfoScraper.cpp | 1 - xbmc/music/tags/TagLibVFSStream.cpp | 3 +- xbmc/music/tags/TagLoaderTagLib.cpp | 31 +++--- xbmc/music/windows/GUIWindowMusicBase.cpp | 13 ++- xbmc/music/windows/GUIWindowMusicNav.cpp | 3 +- 16 files changed, 110 insertions(+), 127 deletions(-) diff --git a/xbmc/music/Album.cpp b/xbmc/music/Album.cpp index b2866e12045d5..52cfeaaac183a 100644 --- a/xbmc/music/Album.cpp +++ b/xbmc/music/Album.cpp @@ -28,7 +28,6 @@ #include -using namespace std; using namespace MUSIC_INFO; typedef struct ReleaseTypeInfo { @@ -68,7 +67,7 @@ CAlbum::CAlbum(const CFileItem& item) artistName = (i < artist.size()) ? artist[i] : artist[0]; else if (!tag.GetMusicBrainzArtistID().empty() && !tag.GetArtist().empty()) { - vector::const_iterator j = std::find(tag.GetMusicBrainzArtistID().begin(), tag.GetMusicBrainzArtistID().end(), artistId); + std::vector::const_iterator j = std::find(tag.GetMusicBrainzArtistID().begin(), tag.GetMusicBrainzArtistID().end(), artistId); if (j != tag.GetMusicBrainzArtistID().end()) { // find corresponding artist size_t d = std::distance(j,tag.GetMusicBrainzArtistID().begin()); @@ -84,7 +83,7 @@ CAlbum::CAlbum(const CFileItem& item) } else { // no musicbrainz info, so fill in directly - for (vector::const_iterator it = tag.GetAlbumArtist().begin(); it != tag.GetAlbumArtist().end(); ++it) + for (std::vector::const_iterator it = tag.GetAlbumArtist().begin(); it != tag.GetAlbumArtist().end(); ++it) { std::string strJoinPhrase = (it == --tag.GetAlbumArtist().end() ? "" : g_advancedSettings.m_musicItemSeparator); CArtistCredit artistCredit(*it, "", strJoinPhrase); @@ -295,7 +294,7 @@ bool CAlbum::Load(const TiXmlElement *album, bool append, bool prioritise) // or removed entirely in preference for better tags (MusicBrainz?) if (artistCredits.empty() && !artist.empty()) { - for (vector::const_iterator it = artist.begin(); it != artist.end(); ++it) + for (std::vector::const_iterator it = artist.begin(); it != artist.end(); ++it) { CArtistCredit artistCredit(*it, "", it == --artist.end() ? "" : g_advancedSettings.m_musicItemSeparator); diff --git a/xbmc/music/Artist.cpp b/xbmc/music/Artist.cpp index c25f271258cf9..4cae2b1733bb8 100644 --- a/xbmc/music/Artist.cpp +++ b/xbmc/music/Artist.cpp @@ -24,8 +24,6 @@ #include -using namespace std; - void CArtist::MergeScrapedArtist(const CArtist& source, bool override /* = true */) { /* @@ -175,7 +173,7 @@ bool CArtist::Save(TiXmlNode *node, const std::string &tag, const std::string& s } // albums - for (vector< pair >::const_iterator it = discography.begin(); it != discography.end(); ++it) + for (std::vector >::const_iterator it = discography.begin(); it != discography.end(); ++it) { // add a tag TiXmlElement cast("album"); diff --git a/xbmc/music/MusicDatabase.cpp b/xbmc/music/MusicDatabase.cpp index a979604d52c3f..4a8c6e3f9c14d 100644 --- a/xbmc/music/MusicDatabase.cpp +++ b/xbmc/music/MusicDatabase.cpp @@ -70,7 +70,6 @@ #include -using namespace std; using namespace AUTOPTR; using namespace XFILE; using namespace MUSICDATABASEDIRECTORY; @@ -701,7 +700,7 @@ int CMusicDatabase::AddSong(const int idAlbum, AddSongGenre(idGenre, idSong, index); AddAlbumGenre(idGenre, idAlbum, index++); } - for (vector::const_iterator i = genres.begin(); i != genres.end(); ++i) + for (std::vector::const_iterator i = genres.begin(); i != genres.end(); ++i) { // index will be wrong for albums, but ordering is not all that relevant // for genres anyway @@ -748,7 +747,7 @@ bool CMusicDatabase::GetSong(int idSong, CSong& song) int songArtistOffset = song_enumCount; - set artistcredits; + std::set artistcredits; song = GetSongFromDataset(m_pDS.get()->get_sql_record()); while (!m_pDS->eof()) { @@ -1014,10 +1013,10 @@ bool CMusicDatabase::GetAlbum(int idAlbum, CAlbum& album, bool getSongs /* = tru int songArtistOffset = songOffset + song_enumCount; int infoSongOffset = songArtistOffset + artistCredit_enumCount; - set artistcredits; - set songs; - set > songartistcredits; - set infosongs; + std::set artistcredits; + std::set songs; + std::set > songartistcredits; + std::set infosongs; album = GetAlbumFromDataset(m_pDS.get()->get_sql_record(), 0, true); // true to grab and parse the imageURL while (!m_pDS->eof()) { @@ -1046,12 +1045,12 @@ bool CMusicDatabase::GetAlbum(int idAlbum, CAlbum& album, bool getSongs /* = tru int idSongArtistSong = record->at(songArtistOffset + artistCredit_idEntity).get_asInt(); int idSongArtistArtist = record->at(songArtistOffset + artistCredit_idArtist).get_asInt(); - if (songartistcredits.find(make_pair(idSongArtistSong, idSongArtistArtist)) == songartistcredits.end()) + if (songartistcredits.find(std::make_pair(idSongArtistSong, idSongArtistArtist)) == songartistcredits.end()) { for (VECSONGS::iterator si = album.songs.begin(); si != album.songs.end(); ++si) if (si->idSong == idSongArtistSong) si->artistCredits.push_back(GetArtistCreditFromDataset(record, songArtistOffset)); - songartistcredits.insert(make_pair(idSongArtistSong, idSongArtistArtist)); + songartistcredits.insert(std::make_pair(idSongArtistSong, idSongArtistArtist)); } int idAlbumInfoSong = m_pDS.get()->get_sql_record()->at(infoSongOffset + albumInfoSong_idAlbumInfoSong).get_asInt(); @@ -1099,7 +1098,7 @@ int CMusicDatabase::AddGenre(const std::string& strGenre1) if (NULL == m_pDB.get()) return -1; if (NULL == m_pDS.get()) return -1; - map ::const_iterator it; + std::map::const_iterator it; it = m_genreCache.find(strGenre); if (it != m_genreCache.end()) @@ -1116,13 +1115,13 @@ int CMusicDatabase::AddGenre(const std::string& strGenre1) m_pDS->exec(strSQL.c_str()); int idGenre = (int)m_pDS->lastinsertid(); - m_genreCache.insert(pair(strGenre1, idGenre)); + m_genreCache.insert(std::pair(strGenre1, idGenre)); return idGenre; } else { int idGenre = m_pDS->fv("idGenre").get_asInt(); - m_genreCache.insert(pair(strGenre1, idGenre)); + m_genreCache.insert(std::pair(strGenre1, idGenre)); m_pDS->close(); return idGenre; } @@ -1315,7 +1314,7 @@ bool CMusicDatabase::GetArtist(int idArtist, CArtist &artist, bool fetchAll /* = { const dbiplus::sql_record* const record = m_pDS.get()->get_sql_record(); - artist.discography.push_back(make_pair(record->at(discographyOffset + 1).get_asString(), record->at(discographyOffset + 2).get_asString())); + artist.discography.push_back(std::make_pair(record->at(discographyOffset + 1).get_asString(), record->at(discographyOffset + 2).get_asString())); m_pDS->next(); } } @@ -1621,7 +1620,7 @@ int CMusicDatabase::AddPath(const std::string& strPath1) if (NULL == m_pDB.get()) return -1; if (NULL == m_pDS.get()) return -1; - map ::const_iterator it; + std::map::const_iterator it; it = m_pathCache.find(strPath); if (it != m_pathCache.end()) @@ -1637,13 +1636,13 @@ int CMusicDatabase::AddPath(const std::string& strPath1) m_pDS->exec(strSQL.c_str()); int idPath = (int)m_pDS->lastinsertid(); - m_pathCache.insert(pair(strPath, idPath)); + m_pathCache.insert(std::pair(strPath, idPath)); return idPath; } else { int idPath = m_pDS->fv("idPath").get_asInt(); - m_pathCache.insert(pair(strPath, idPath)); + m_pathCache.insert(std::pair(strPath, idPath)); m_pDS->close(); return idPath; } @@ -2290,7 +2289,7 @@ bool CMusicDatabase::GetSongsByPath(const std::string& strPath1, MAPSONGS& songs while (!m_pDS->eof()) { CSong song = GetSongFromDataset(); - songs.insert(make_pair(song.strFileName, song)); + songs.insert(std::make_pair(song.strFileName, song)); m_pDS->next(); } @@ -2427,7 +2426,7 @@ bool CMusicDatabase::CleanupSongsByIds(const std::string &strSongIds) m_pDS->close(); return true; } - vector songsToDelete; + std::vector songsToDelete; while (!m_pDS->eof()) { // get the full song path std::string strFileName = URIUtils::AddFileToFolder(m_pDS->fv("path.strPath").get_asString(), m_pDS->fv("song.strFileName").get_asString()); @@ -2892,7 +2891,7 @@ void CMusicDatabase::DeleteCDDBInfo() pDlg->SetHeading(CVariant{g_localizeStrings.Get(181)}); pDlg->Reset(); - map mapCDDBIds; + std::map mapCDDBIds; for (int i = 0; i < items.Size(); ++i) { if (items[i]->m_bIsFolder) @@ -2918,7 +2917,7 @@ void CMusicDatabase::DeleteCDDBInfo() str = strDiskTitle + " - " + strDiskArtist; pDlg->Add(str); - mapCDDBIds.insert(pair(lDiscId, str)); + mapCDDBIds.insert(std::pair(lDiscId, str)); } pDlg->Sort(); @@ -2933,7 +2932,7 @@ void CMusicDatabase::DeleteCDDBInfo() } std::string strSelectedAlbum = pDlg->GetSelectedLabelText(); - map::iterator it; + std::map::iterator it; for (it = mapCDDBIds.begin();it != mapCDDBIds.end();++it) { if (it->second == strSelectedAlbum) @@ -2994,12 +2993,12 @@ bool CMusicDatabase::GetGenresNav(const std::string& strBaseDir, CFileItemList& // to songview or albumview for these conditions if (extFilter.where.size() > 0) { - if (extFilter.where.find("artistview") != string::npos) + if (extFilter.where.find("artistview") != std::string::npos) extFilter.AppendJoin("JOIN song_genre ON song_genre.idGenre = genre.idGenre JOIN songview ON songview.idSong = song_genre.idSong " "JOIN song_artist ON song_artist.idSong = songview.idSong JOIN artistview ON artistview.idArtist = song_artist.idArtist"); - else if (extFilter.where.find("songview") != string::npos) + else if (extFilter.where.find("songview") != std::string::npos) extFilter.AppendJoin("JOIN song_genre ON song_genre.idGenre = genre.idGenre JOIN songview ON songview.idSong = song_genre.idSong"); - else if (extFilter.where.find("albumview") != string::npos) + else if (extFilter.where.find("albumview") != std::string::npos) extFilter.AppendJoin("JOIN album_genre ON album_genre.idGenre = genre.idGenre JOIN albumview ON albumview.idAlbum = album_genre.idAlbum"); extFilter.AppendGroup("genre.idGenre"); @@ -3199,7 +3198,7 @@ bool CMusicDatabase::GetCommonNav(const std::string &strBaseDir, const std::stri // get data from returned rows while (!m_pDS->eof()) { - string labelValue = m_pDS->fv(labelField.c_str()).get_asString(); + std::string labelValue = m_pDS->fv(labelField.c_str()).get_asString(); CFileItemPtr pItem(new CFileItem(labelValue)); CMusicDbUrl itemUrl = musicUrl; @@ -3293,12 +3292,12 @@ bool CMusicDatabase::GetArtistsByWhere(const std::string& strBaseDir, const Filt if (extFilter.where.size() > 0) { bool extended = false; - if (extFilter.where.find("songview") != string::npos) + if (extFilter.where.find("songview") != std::string::npos) { extended = true; extFilter.AppendJoin("JOIN song_artist ON song_artist.idArtist = artistview.idArtist JOIN songview ON songview.idSong = song_artist.idSong"); } - else if (extFilter.where.find("albumview") != string::npos) + else if (extFilter.where.find("albumview") != std::string::npos) { extended = true; extFilter.AppendJoin("JOIN album_artist ON album_artist.idArtist = artistview.idArtist JOIN albumview ON albumview.idAlbum = album_artist.idAlbum"); @@ -3468,7 +3467,7 @@ bool CMusicDatabase::GetAlbumsByWhere(const std::string &baseDir, const Filter & // if there are extra WHERE conditions we might need access // to songview for these conditions - if (extFilter.where.find("songview") != string::npos) + if (extFilter.where.find("songview") != std::string::npos) { extFilter.AppendJoin("JOIN songview ON songview.idAlbum = albumview.idAlbum"); extFilter.AppendGroup("albumview.idAlbum"); @@ -3581,7 +3580,7 @@ bool CMusicDatabase::GetSongsByWhere(const std::string &baseDir, const Filter &f // if there are extra WHERE conditions we might need access // to songview for these conditions - if (extFilter.where.find("albumview") != string::npos) + if (extFilter.where.find("albumview") != std::string::npos) { extFilter.AppendJoin("JOIN albumview ON albumview.idAlbum = songview.idAlbum"); extFilter.AppendGroup("songview.idSong"); @@ -3729,7 +3728,7 @@ void CMusicDatabase::UpdateTables(int version) // translate legacy musicdb:// paths if (m_pDS->query("SELECT strPath FROM content")) { - vector contentPaths; + std::vector contentPaths; while (!m_pDS->eof()) { contentPaths.push_back(m_pDS->fv(0).get_asString()); @@ -3737,7 +3736,7 @@ void CMusicDatabase::UpdateTables(int version) } m_pDS->close(); - for (vector::const_iterator it = contentPaths.begin(); it != contentPaths.end(); ++it) + for (std::vector::const_iterator it = contentPaths.begin(); it != contentPaths.end(); ++it) { std::string originalPath = *it; std::string path = CLegacyPathTranslation::TranslateMusicDbPath(originalPath); @@ -3869,7 +3868,7 @@ int CMusicDatabase::GetSchemaVersion() const return 53; } -unsigned int CMusicDatabase::GetSongIDs(const Filter &filter, vector > &songIDs) +unsigned int CMusicDatabase::GetSongIDs(const Filter &filter, std::vector > &songIDs) { try { @@ -3890,7 +3889,7 @@ unsigned int CMusicDatabase::GetSongIDs(const Filter &filter, vectornum_rows()); while (!m_pDS->eof()) { - songIDs.push_back(make_pair(1,m_pDS->fv(song_idSong).get_asInt())); + songIDs.push_back(std::make_pair(1,m_pDS->fv(song_idSong).get_asInt())); m_pDS->next(); } // cleanup m_pDS->close(); @@ -4320,7 +4319,7 @@ bool CMusicDatabase::RemoveSongsFromPath(const std::string &path1, MAPSONGS& son { CSong song = GetSongFromDataset(); song.strThumb = GetArtForItem(song.idSong, MediaTypeSong, "thumb"); - songs.insert(make_pair(song.strFileName, song)); + songs.insert(std::make_pair(song.strFileName, song)); songIds.push_back(PrepareSQL("%i", song.idSong)); m_pDS->next(); } @@ -4346,7 +4345,7 @@ bool CMusicDatabase::RemoveSongsFromPath(const std::string &path1, MAPSONGS& son return false; } -bool CMusicDatabase::GetPaths(set &paths) +bool CMusicDatabase::GetPaths(std::set &paths) { try { @@ -4636,7 +4635,7 @@ void CMusicDatabase::ExportToXML(const std::string &xmlFile, bool singleFiles, b if (NULL == m_pDS2.get()) return; // find all albums - vector albumIds; + std::vector albumIds; std::string sql = "select idAlbum FROM album WHERE lastScraped IS NOT NULL"; m_pDS->query(sql.c_str()); @@ -4675,7 +4674,7 @@ void CMusicDatabase::ExportToXML(const std::string &xmlFile, bool singleFiles, b TiXmlElement xmlMainElement("musicdb"); pMain = xmlDoc.InsertEndChild(xmlMainElement); } - for (vector::iterator albumId = albumIds.begin(); albumId != albumIds.end(); ++albumId) + for (std::vector::iterator albumId = albumIds.begin(); albumId != albumIds.end(); ++albumId) { CAlbum album; GetAlbum(*albumId, album); @@ -4701,7 +4700,7 @@ void CMusicDatabase::ExportToXML(const std::string &xmlFile, bool singleFiles, b if (images) { - string thumb = GetArtForItem(album.idAlbum, MediaTypeAlbum, "thumb"); + std::string thumb = GetArtForItem(album.idAlbum, MediaTypeAlbum, "thumb"); if (!thumb.empty() && (overwrite || !CFile::Exists(URIUtils::AddFileToFolder(strPath,"folder.jpg")))) CTextureCache::GetInstance().Export(thumb, URIUtils::AddFileToFolder(strPath,"folder.jpg")); } @@ -4727,7 +4726,7 @@ void CMusicDatabase::ExportToXML(const std::string &xmlFile, bool singleFiles, b } // find all artists - vector artistIds; + std::vector artistIds; std::string artistSQL = "SELECT idArtist FROM artist where lastScraped IS NOT NULL"; m_pDS->query(artistSQL.c_str()); total = m_pDS->num_rows(); @@ -4740,7 +4739,7 @@ void CMusicDatabase::ExportToXML(const std::string &xmlFile, bool singleFiles, b } m_pDS->close(); - for (vector::iterator artistId = artistIds.begin(); artistId != artistIds.end(); ++artistId) + for (std::vector::iterator artistId = artistIds.begin(); artistId != artistIds.end(); ++artistId) { CArtist artist; GetArtist(*artistId, artist); @@ -4748,11 +4747,11 @@ void CMusicDatabase::ExportToXML(const std::string &xmlFile, bool singleFiles, b GetArtistPath(artist.idArtist,strPath); artist.Save(pMain, "artist", strPath); - map artwork; + std::map artwork; if (GetArtForItem(artist.idArtist, MediaTypeArtist, artwork) && !singleFiles) { // append to the XML TiXmlElement additionalNode("art"); - for (map::const_iterator i = artwork.begin(); i != artwork.end(); ++i) + for (std::map::const_iterator i = artwork.begin(); i != artwork.end(); ++i) XMLUtils::SetString(&additionalNode, i->first.c_str(), i->second); pMain->LastChild()->InsertEndChild(additionalNode); } @@ -5344,13 +5343,13 @@ void CMusicDatabase::SetPropertiesForFileItem(CFileItem& item) } } -void CMusicDatabase::SetArtForItem(int mediaId, const string &mediaType, const map &art) +void CMusicDatabase::SetArtForItem(int mediaId, const std::string &mediaType, const std::map &art) { - for (map::const_iterator i = art.begin(); i != art.end(); ++i) + for (std::map::const_iterator i = art.begin(); i != art.end(); ++i) SetArtForItem(mediaId, mediaType, i->first, i->second); } -void CMusicDatabase::SetArtForItem(int mediaId, const string &mediaType, const string &artType, const string &url) +void CMusicDatabase::SetArtForItem(int mediaId, const std::string &mediaType, const std::string &artType, const std::string &url) { try { @@ -5358,7 +5357,7 @@ void CMusicDatabase::SetArtForItem(int mediaId, const string &mediaType, const s if (NULL == m_pDS.get()) return; // don't set . art types - these are derivative types from parent items - if (artType.find('.') != string::npos) + if (artType.find('.') != std::string::npos) return; std::string sql = PrepareSQL("SELECT art_id FROM art WHERE media_id=%i AND media_type='%s' AND type='%s'", mediaId, mediaType.c_str(), artType.c_str()); @@ -5383,7 +5382,7 @@ void CMusicDatabase::SetArtForItem(int mediaId, const string &mediaType, const s } } -bool CMusicDatabase::GetArtForItem(int mediaId, const string &mediaType, map &art) +bool CMusicDatabase::GetArtForItem(int mediaId, const std::string &mediaType, std::map &art) { try { @@ -5394,7 +5393,7 @@ bool CMusicDatabase::GetArtForItem(int mediaId, const string &mediaType, mapquery(sql.c_str()); while (!m_pDS2->eof()) { - art.insert(make_pair(m_pDS2->fv(0).get_asString(), m_pDS2->fv(1).get_asString())); + art.insert(std::make_pair(m_pDS2->fv(0).get_asString(), m_pDS2->fv(1).get_asString())); m_pDS2->next(); } m_pDS2->close(); @@ -5407,7 +5406,7 @@ bool CMusicDatabase::GetArtForItem(int mediaId, const string &mediaType, mapquery(sql.c_str()); while (!m_pDS2->eof()) { - art.insert(make_pair(m_pDS2->fv(0).get_asString(), m_pDS2->fv(1).get_asString())); + art.insert(std::make_pair(m_pDS2->fv(0).get_asString(), m_pDS2->fv(1).get_asString())); m_pDS2->next(); } m_pDS2->close(); @@ -5437,7 +5436,7 @@ bool CMusicDatabase::GetArtistArtForItem(int mediaId, const std::string &mediaTy return false; } -string CMusicDatabase::GetArtistArtForItem(int mediaId, const string &mediaType, const string &artType) +std::string CMusicDatabase::GetArtistArtForItem(int mediaId, const std::string &mediaType, const std::string &artType) { std::string query = PrepareSQL("SELECT url FROM art WHERE media_id=(SELECT idArtist from %s_artist WHERE id%s=%i AND iOrder=0) AND media_type='artist' AND type='%s'", mediaType.c_str(), mediaType.c_str(), mediaId, artType.c_str()); return GetSingleValue(query, m_pDS2); diff --git a/xbmc/music/MusicDbUrl.cpp b/xbmc/music/MusicDbUrl.cpp index 48612c267977d..ad789de6677ac 100644 --- a/xbmc/music/MusicDbUrl.cpp +++ b/xbmc/music/MusicDbUrl.cpp @@ -24,7 +24,6 @@ #include "utils/StringUtils.h" #include "utils/Variant.h" -using namespace std; using namespace XFILE; using namespace XFILE::MUSICDATABASEDIRECTORY; diff --git a/xbmc/music/MusicInfoLoader.cpp b/xbmc/music/MusicInfoLoader.cpp index 8159f38bc51ca..2ebe3c5e13e68 100644 --- a/xbmc/music/MusicInfoLoader.cpp +++ b/xbmc/music/MusicInfoLoader.cpp @@ -34,7 +34,6 @@ #include "Album.h" #include "MusicThumbLoader.h" -using namespace std; using namespace XFILE; using namespace MUSIC_INFO; @@ -110,7 +109,7 @@ bool CMusicInfoLoader::LoadAdditionalTagInfo(CFileItem* pItem) // we load up the actual tag for this file in order to // fetch the lyrics and add it to the current music info tag CFileItem tempItem(path, false); - unique_ptr pLoader (CMusicInfoTagLoaderFactory::CreateLoader(tempItem)); + std::unique_ptr pLoader (CMusicInfoTagLoaderFactory::CreateLoader(tempItem)); if (NULL != pLoader.get()) { CMusicInfoTag tag; @@ -195,7 +194,7 @@ bool CMusicInfoLoader::LoadItemLookup(CFileItem* pItem) { // Nothing found, load tag from file, // always try to load cddb info // get correct tag parser - unique_ptr pLoader (CMusicInfoTagLoaderFactory::CreateLoader(*pItem)); + std::unique_ptr pLoader (CMusicInfoTagLoaderFactory::CreateLoader(*pItem)); if (NULL != pLoader.get()) // get tag pLoader->Load(pItem->GetPath(), *pItem->GetMusicInfoTag()); diff --git a/xbmc/music/MusicThumbLoader.cpp b/xbmc/music/MusicThumbLoader.cpp index e622e9fd5c950..c8b47d9a02e05 100644 --- a/xbmc/music/MusicThumbLoader.cpp +++ b/xbmc/music/MusicThumbLoader.cpp @@ -26,7 +26,6 @@ #include "music/infoscanner/MusicInfoScanner.h" #include "video/VideoThumbLoader.h" -using namespace std; using namespace MUSIC_INFO; CMusicThumbLoader::CMusicThumbLoader() : CThumbLoader() @@ -103,7 +102,7 @@ bool CMusicThumbLoader::LoadItemCached(CFileItem* pItem) int idArtist = m_musicDatabase->GetArtistByName(artist); if (idArtist >= 0) { - string fanart = m_musicDatabase->GetArtForItem(idArtist, MediaTypeArtist, "fanart"); + std::string fanart = m_musicDatabase->GetArtForItem(idArtist, MediaTypeArtist, "fanart"); if (!fanart.empty()) { pItem->SetArt("artist.fanart", fanart); @@ -194,7 +193,7 @@ bool CMusicThumbLoader::FillLibraryArt(CFileItem &item) if (tag.GetDatabaseId() > -1 && !tag.GetType().empty()) { m_musicDatabase->Open(); - map artwork; + std::map artwork; if (m_musicDatabase->GetArtForItem(tag.GetDatabaseId(), tag.GetType(), artwork)) item.SetArt(artwork); else if (tag.GetType() == MediaTypeSong) @@ -208,13 +207,13 @@ bool CMusicThumbLoader::FillLibraryArt(CFileItem &item) if (i != m_albumArt.end()) { item.AppendArt(i->second, MediaTypeAlbum); - for (map::const_iterator j = i->second.begin(); j != i->second.end(); ++j) + for (std::map::const_iterator j = i->second.begin(); j != i->second.end(); ++j) item.SetArtFallback(j->first, "album." + j->first); } } if (tag.GetType() == MediaTypeSong || tag.GetType() == MediaTypeAlbum) { // fanart from the artist - string fanart = m_musicDatabase->GetArtistArtForItem(tag.GetDatabaseId(), tag.GetType(), "fanart"); + std::string fanart = m_musicDatabase->GetArtistArtForItem(tag.GetDatabaseId(), tag.GetType(), "fanart"); if (!fanart.empty()) { item.SetArt("artist.fanart", fanart); @@ -239,7 +238,7 @@ bool CMusicThumbLoader::FillLibraryArt(CFileItem &item) bool CMusicThumbLoader::GetEmbeddedThumb(const std::string &path, EmbeddedArt &art) { CFileItem item(path, false); - unique_ptr pLoader (CMusicInfoTagLoaderFactory::CreateLoader(item)); + std::unique_ptr pLoader (CMusicInfoTagLoaderFactory::CreateLoader(item)); CMusicInfoTag tag; if (NULL != pLoader.get()) pLoader->Load(path, tag, &art); diff --git a/xbmc/music/Song.cpp b/xbmc/music/Song.cpp index cdb7d8a5db2bb..9b59eeb24f08f 100644 --- a/xbmc/music/Song.cpp +++ b/xbmc/music/Song.cpp @@ -24,7 +24,6 @@ #include "FileItem.h" #include "settings/AdvancedSettings.h" -using namespace std; using namespace MUSIC_INFO; CSong::CSong(CFileItem& item) @@ -56,7 +55,7 @@ CSong::CSong(CFileItem& item) } else { // no musicbrainz info, so fill in directly - for (vector::const_iterator it = tag.GetArtist().begin(); it != tag.GetArtist().end(); ++it) + for (std::vector::const_iterator it = tag.GetArtist().begin(); it != tag.GetArtist().end(); ++it) { std::string strJoinPhrase = (it == --tag.GetArtist().end() ? "" : g_advancedSettings.m_musicItemSeparator); CArtistCredit artistCredit(*it, "", strJoinPhrase); diff --git a/xbmc/music/dialogs/GUIDialogMusicInfo.cpp b/xbmc/music/dialogs/GUIDialogMusicInfo.cpp index 46f8949754b7c..81edad0ef731a 100644 --- a/xbmc/music/dialogs/GUIDialogMusicInfo.cpp +++ b/xbmc/music/dialogs/GUIDialogMusicInfo.cpp @@ -39,7 +39,6 @@ #include "music/MusicThumbLoader.h" #include "filesystem/Directory.h" -using namespace std; using namespace XFILE; #define CONTROL_IMAGE 3 @@ -166,7 +165,7 @@ void CGUIDialogMusicInfo::SetAlbum(const CAlbum& album, const std::string &path) { CMusicDatabase db; db.Open(); - map artwork; + std::map artwork; if (db.GetArtistArtForItem(m_album.idAlbum, MediaTypeAlbum, artwork)) { if (artwork.find("thumb") != artwork.end()) @@ -218,7 +217,7 @@ void CGUIDialogMusicInfo::SetDiscography() CMusicDatabase database; database.Open(); - vector albumsByArtist; + std::vector albumsByArtist; database.GetAlbumsByArtist(m_artist.idArtist, true, albumsByArtist); for (unsigned int i=0;iSetLabel2(m_artist.discography[i].second); int idAlbum = -1; - for (vector::const_iterator album = albumsByArtist.begin(); album != albumsByArtist.end(); ++album) + for (std::vector::const_iterator album = albumsByArtist.begin(); album != albumsByArtist.end(); ++album) { if (StringUtils::EqualsNoCase(database.GetAlbumById(*album), item->GetLabel())) { @@ -354,7 +353,7 @@ void CGUIDialogMusicInfo::OnGetThumb() } // Grab the thumbnail(s) from the web - vector thumbs; + std::vector thumbs; if (m_bArtistInfo) m_artist.thumbURL.GetThumbURLs(thumbs); else diff --git a/xbmc/music/infoscanner/MusicAlbumInfo.cpp b/xbmc/music/infoscanner/MusicAlbumInfo.cpp index f94bc5d996164..7a86a5010a0e2 100644 --- a/xbmc/music/infoscanner/MusicAlbumInfo.cpp +++ b/xbmc/music/infoscanner/MusicAlbumInfo.cpp @@ -23,7 +23,6 @@ #include "utils/StringUtils.h" #include "settings/AdvancedSettings.h" -using namespace std; using namespace MUSIC_GRABBER; CMusicAlbumInfo::CMusicAlbumInfo(const std::string& strAlbumInfo, const CScraperUrl& strAlbumURL): diff --git a/xbmc/music/infoscanner/MusicArtistInfo.cpp b/xbmc/music/infoscanner/MusicArtistInfo.cpp index 00835503ff905..ae198ee3e9423 100644 --- a/xbmc/music/infoscanner/MusicArtistInfo.cpp +++ b/xbmc/music/infoscanner/MusicArtistInfo.cpp @@ -21,7 +21,6 @@ #include "MusicArtistInfo.h" #include "addons/Scraper.h" -using namespace std; using namespace XFILE; using namespace MUSIC_GRABBER; diff --git a/xbmc/music/infoscanner/MusicInfoScanner.cpp b/xbmc/music/infoscanner/MusicInfoScanner.cpp index b431135556887..7264bda871570 100644 --- a/xbmc/music/infoscanner/MusicInfoScanner.cpp +++ b/xbmc/music/infoscanner/MusicInfoScanner.cpp @@ -56,7 +56,6 @@ #include -using namespace std; using namespace MUSIC_INFO; using namespace XFILE; using namespace MUSICDATABASEDIRECTORY; @@ -438,7 +437,7 @@ bool CMusicInfoScanner::DoScan(const std::string& strDirectory) m_seenPaths.insert(strDirectory); // Discard all excluded files defined by m_musicExcludeRegExps - vector regexps = g_advancedSettings.m_audioExcludeFromScanRegExps; + std::vector regexps = g_advancedSettings.m_audioExcludeFromScanRegExps; if (CUtil::ExcludeFileOrFolder(strDirectory, regexps)) return true; @@ -513,7 +512,7 @@ bool CMusicInfoScanner::DoScan(const std::string& strDirectory) INFO_RET CMusicInfoScanner::ScanTags(const CFileItemList& items, CFileItemList& scannedItems) { - vector regexps = g_advancedSettings.m_audioExcludeFromScanRegExps; + std::vector regexps = g_advancedSettings.m_audioExcludeFromScanRegExps; for (int i = 0; i < items.Size(); ++i) { @@ -533,7 +532,7 @@ INFO_RET CMusicInfoScanner::ScanTags(const CFileItemList& items, CFileItemList& CMusicInfoTag& tag = *pItem->GetMusicInfoTag(); if (!tag.Loaded()) { - unique_ptr pLoader (CMusicInfoTagLoaderFactory::CreateLoader(*pItem)); + std::unique_ptr pLoader (CMusicInfoTagLoaderFactory::CreateLoader(*pItem)); if (NULL != pLoader.get()) pLoader->Load(pItem->GetPath(), tag); } @@ -572,7 +571,7 @@ void CMusicInfoScanner::FileItemsToAlbums(CFileItemList& items, VECALBUMS& album * If they're MB tagged, create albums directly from the FileItems. * If they're non-MB tagged, index them by album name ready for step 2. */ - map songsByAlbumNames; + std::map songsByAlbumNames; for (int i = 0; i < items.Size(); ++i) { CMusicInfoTag& tag = *items[i]->GetMusicInfoTag(); @@ -617,7 +616,7 @@ void CMusicInfoScanner::FileItemsToAlbums(CFileItemList& items, VECALBUMS& album In the case where the album artist is unknown, we use the primary artist (i.e. first artist from each song). */ - for (map::iterator songsByAlbumName = songsByAlbumNames.begin(); songsByAlbumName != songsByAlbumNames.end(); ++songsByAlbumName) + for (std::map::iterator songsByAlbumName = songsByAlbumNames.begin(); songsByAlbumName != songsByAlbumNames.end(); ++songsByAlbumName) { VECSONGS &songs = songsByAlbumName->second; // sort the songs by tracknumber to identify duplicate track numbers @@ -628,7 +627,7 @@ void CMusicInfoScanner::FileItemsToAlbums(CFileItemList& items, VECALBUMS& album bool hasAlbumArtist = false; bool isCompilation = true; - map > artists; + std::map > artists; for (VECSONGS::iterator song = songs.begin(); song != songs.end(); ++song) { // test for song overlap @@ -639,7 +638,7 @@ void CMusicInfoScanner::FileItemsToAlbums(CFileItemList& items, VECALBUMS& album isCompilation = false; // get primary artist - string primary; + std::string primary; if (!song->albumArtist.empty()) { primary = song->albumArtist[0]; @@ -663,7 +662,7 @@ void CMusicInfoScanner::FileItemsToAlbums(CFileItemList& items, VECALBUMS& album bool compilation = !songsByAlbumName->first.empty() && (isCompilation || !tracksOverlap); // 1+2b+2a if (artists.size() == 1) { - string artist = artists.begin()->first; StringUtils::ToLower(artist); + std::string artist = artists.begin()->first; StringUtils::ToLower(artist); if (!StringUtils::EqualsNoCase(artist, "various") && !StringUtils::EqualsNoCase(artist, "various artists")) // 3a compilation = false; @@ -676,7 +675,7 @@ void CMusicInfoScanner::FileItemsToAlbums(CFileItemList& items, VECALBUMS& album CLog::Log(LOGDEBUG, "Album '%s' is a compilation as there's no overlapping tracks and %s", songsByAlbumName->first.c_str(), hasAlbumArtist ? "the album artist is 'Various'" : "there is more than one unique artist"); artists.clear(); std::string various = g_localizeStrings.Get(340); // Various Artists - vector va; va.push_back(various); + std::vector va; va.push_back(various); for (VECSONGS::iterator song = songs.begin(); song != songs.end(); ++song) { song->albumArtist = va; @@ -688,15 +687,15 @@ void CMusicInfoScanner::FileItemsToAlbums(CFileItemList& items, VECALBUMS& album Step 3: Find the common albumartist for each song and assign albumartist to those tracks that don't have it set. */ - for (map >::iterator j = artists.begin(); j != artists.end(); ++j) + for (std::map >::iterator j = artists.begin(); j != artists.end(); ++j) { // find the common artist for these songs - vector &artistSongs = j->second; - vector common = artistSongs.front()->albumArtist.empty() ? artistSongs.front()->artist : artistSongs.front()->albumArtist; - for (vector::iterator k = artistSongs.begin() + 1; k != artistSongs.end(); ++k) + std::vector &artistSongs = j->second; + std::vector common = artistSongs.front()->albumArtist.empty() ? artistSongs.front()->artist : artistSongs.front()->albumArtist; + for (std::vector::iterator k = artistSongs.begin() + 1; k != artistSongs.end(); ++k) { unsigned int match = 0; - vector &compare = (*k)->albumArtist.empty() ? (*k)->artist : (*k)->albumArtist; + std::vector &compare = (*k)->albumArtist.empty() ? (*k)->artist : (*k)->albumArtist; for (; match < common.size() && match < compare.size(); match++) { if (compare[match] != common[match]) @@ -712,14 +711,14 @@ void CMusicInfoScanner::FileItemsToAlbums(CFileItemList& items, VECALBUMS& album CAlbum album; album.strAlbum = songsByAlbumName->first; album.artist = common; - for (vector::iterator it = common.begin(); it != common.end(); ++it) + for (std::vector::iterator it = common.begin(); it != common.end(); ++it) { std::string strJoinPhrase = (it == --common.end() ? "" : g_advancedSettings.m_musicItemSeparator); CArtistCredit artistCredit(*it, strJoinPhrase); album.artistCredits.push_back(artistCredit); } album.bCompilation = compilation; - for (vector::iterator k = artistSongs.begin(); k != artistSongs.end(); ++k) + for (std::vector::iterator k = artistSongs.begin(); k != artistSongs.end(); ++k) { if ((*k)->albumArtist.empty()) (*k)->albumArtist = common; @@ -1145,7 +1144,7 @@ INFO_RET CMusicInfoScanner::DownloadAlbumInfo(const CAlbum& album, const ADDON:: // if we're doing auto-selection (ie querying all albums at once, then allow 95->100% for perfect matches) // otherwise, perfect matches only - if (relevance >= max(minRelevance, bestRelevance)) + if (relevance >= std::max(minRelevance, bestRelevance)) { // we auto-select the best of these bestRelevance = relevance; iSelectedAlbum = i; @@ -1246,7 +1245,7 @@ void CMusicInfoScanner::GetAlbumArtwork(long id, const CAlbum &album) { if (m_musicDatabase.GetArtForItem(id, MediaTypeAlbum, "thumb").empty()) { - string thumb = CScraperUrl::GetThumbURL(album.thumbURL.GetFirstThumb()); + std::string thumb = CScraperUrl::GetThumbURL(album.thumbURL.GetFirstThumb()); if (!thumb.empty()) { CTextureCache::GetInstance().BackgroundCacheImage(thumb); @@ -1444,9 +1443,9 @@ bool CMusicInfoScanner::ResolveMusicBrainz(const std::string &strMusicBrainzID, return bMusicBrainz; } -map CMusicInfoScanner::GetArtistArtwork(const CArtist& artist) +std::map CMusicInfoScanner::GetArtistArtwork(const CArtist& artist) { - map artwork; + std::map artwork; // check thumb std::string strFolder; @@ -1497,7 +1496,7 @@ map CMusicInfoScanner::GetArtistArtwork(const CArtist& artist) void CMusicInfoScanner::Run() { int count = 0; - for (set::iterator it = m_pathsToScan.begin(); it != m_pathsToScan.end() && !m_bStop; ++it) + for (std::set::iterator it = m_pathsToScan.begin(); it != m_pathsToScan.end() && !m_bStop; ++it) { count+=CountFilesRecursively(*it); } diff --git a/xbmc/music/infoscanner/MusicInfoScraper.cpp b/xbmc/music/infoscanner/MusicInfoScraper.cpp index 5aa87380ea3d9..dac8579c103fc 100644 --- a/xbmc/music/infoscanner/MusicInfoScraper.cpp +++ b/xbmc/music/infoscanner/MusicInfoScraper.cpp @@ -24,7 +24,6 @@ using namespace MUSIC_GRABBER; using namespace ADDON; -using namespace std; CMusicInfoScraper::CMusicInfoScraper(const ADDON::ScraperPtr &scraper) : CThread("MusicInfoScraper") { diff --git a/xbmc/music/tags/TagLibVFSStream.cpp b/xbmc/music/tags/TagLibVFSStream.cpp index 375695d26f892..38f4c1da3bb7c 100644 --- a/xbmc/music/tags/TagLibVFSStream.cpp +++ b/xbmc/music/tags/TagLibVFSStream.cpp @@ -25,7 +25,6 @@ using namespace XFILE; using namespace TagLib; using namespace MUSIC_INFO; -using namespace std; #ifdef TARGET_WINDOWS #pragma comment(lib, "tag.lib") @@ -35,7 +34,7 @@ using namespace std; * Construct a File object and opens the \a file. \a file should be a * be an XBMC Vfile. */ -TagLibVFSStream::TagLibVFSStream(const string& strFileName, bool readOnly) +TagLibVFSStream::TagLibVFSStream(const std::string& strFileName, bool readOnly) { m_bIsOpen = true; if (readOnly) diff --git a/xbmc/music/tags/TagLoaderTagLib.cpp b/xbmc/music/tags/TagLoaderTagLib.cpp index c9db1059e681c..f6f954226219d 100644 --- a/xbmc/music/tags/TagLoaderTagLib.cpp +++ b/xbmc/music/tags/TagLoaderTagLib.cpp @@ -49,7 +49,6 @@ #include "utils/Base64.h" #include "settings/AdvancedSettings.h" -using namespace std; using namespace TagLib; using namespace MUSIC_INFO; @@ -80,9 +79,9 @@ CTagLoaderTagLib::~CTagLoaderTagLib() } -static const vector StringListToVectorString(const StringList& stringList) +static const std::vector StringListToVectorString(const StringList& stringList) { - vector values; + std::vector values; for (StringList::ConstIterator it = stringList.begin(); it != stringList.end(); ++it) values.push_back(it->to8Bit(true)); return values; @@ -519,7 +518,7 @@ bool CTagLoaderTagLib::ParseID3v2Tag(ID3v2::Tag *id3v2, EmbeddedArt *art, CMusic for (int i = 0; i < 3; ++i) if (pictures[i]) { - string mime = pictures[i]->mimeType().to8Bit(true); + std::string mime = pictures[i]->mimeType().to8Bit(true); TagLib::uint size = pictures[i]->picture().size(); tag.SetCoverArtInfo(size, mime); if (art) @@ -712,7 +711,7 @@ bool CTagLoaderTagLib::ParseXiphComment(Ogg::XiphComment *xiph, EmbeddedArt *art for (int i = 0; i < 3; ++i) if (pictures[i].data().size()) { - string mime = pictures[i].mimeType().toCString(); + std::string mime = pictures[i].mimeType().toCString(); if (mime.compare(0, 6, "image/") != 0) continue; TagLib::uint size = pictures[i].data().size(); @@ -779,7 +778,7 @@ bool CTagLoaderTagLib::ParseMP4Tag(MP4::Tag *mp4, EmbeddedArt *art, CMusicInfoTa MP4::CoverArtList coverArtList = it->second.toCoverArtList(); for (MP4::CoverArtList::ConstIterator pt = coverArtList.begin(); pt != coverArtList.end(); ++pt) { - string mime; + std::string mime; switch (pt->format()) { case MP4::CoverArt::PNG: @@ -856,23 +855,23 @@ void CTagLoaderTagLib::SetFlacArt(FLAC::File *flacFile, EmbeddedArt *art, CMusic } } -const vector CTagLoaderTagLib::GetASFStringList(const List& list) +const std::vector CTagLoaderTagLib::GetASFStringList(const List& list) { - vector values; + std::vector values; for (List::ConstIterator at = list.begin(); at != list.end(); ++at) values.push_back(at->toString().to8Bit(true)); return values; } -const vector CTagLoaderTagLib::GetID3v2StringList(const ID3v2::FrameList& frameList) const +const std::vector CTagLoaderTagLib::GetID3v2StringList(const ID3v2::FrameList& frameList) const { const ID3v2::TextIdentificationFrame *frame = dynamic_cast(frameList.front()); if (frame) return StringListToVectorString(frame->fieldList()); - return vector(); + return std::vector(); } -void CTagLoaderTagLib::SetArtist(CMusicInfoTag &tag, const vector &values) +void CTagLoaderTagLib::SetArtist(CMusicInfoTag &tag, const std::vector &values) { if (values.size() == 1) tag.SetArtist(values[0]); @@ -900,7 +899,7 @@ const std::vector CTagLoaderTagLib::SplitMBID(const std::vector &values) +void CTagLoaderTagLib::SetAlbumArtist(CMusicInfoTag &tag, const std::vector &values) { if (values.size() == 1) tag.SetAlbumArtist(values[0]); @@ -908,16 +907,16 @@ void CTagLoaderTagLib::SetAlbumArtist(CMusicInfoTag &tag, const vector & tag.SetAlbumArtist(values); } -void CTagLoaderTagLib::SetGenre(CMusicInfoTag &tag, const vector &values) +void CTagLoaderTagLib::SetGenre(CMusicInfoTag &tag, const std::vector &values) { /* TagLib doesn't resolve ID3v1 genre numbers in the case were only a number is specified, thus this workaround. */ - vector genres; - for (vector::const_iterator i = values.begin(); i != values.end(); ++i) + std::vector genres; + for (std::vector::const_iterator i = values.begin(); i != values.end(); ++i) { - string genre = *i; + std::string genre = *i; if (StringUtils::IsNaturalNumber(genre)) { int number = strtol(i->c_str(), NULL, 10); diff --git a/xbmc/music/windows/GUIWindowMusicBase.cpp b/xbmc/music/windows/GUIWindowMusicBase.cpp index 1f96166797abf..df3662fb1597c 100644 --- a/xbmc/music/windows/GUIWindowMusicBase.cpp +++ b/xbmc/music/windows/GUIWindowMusicBase.cpp @@ -62,7 +62,6 @@ #include "cores/AudioEngine/DSPAddons/ActiveAEDSP.h" -using namespace std; using namespace XFILE; using namespace MUSICDATABASEDIRECTORY; using namespace PLAYLIST; @@ -514,7 +513,7 @@ void CGUIWindowMusicBase::RetrieveMusicInfo() OnRetrieveMusicInfo(*m_vecItems); // \todo Scan for multitrack items here... - vector itemsForRemove; + std::vector itemsForRemove; CFileItemList itemsForAdd; for (int i = 0; i < m_vecItems->Size(); ++i) { @@ -652,7 +651,7 @@ void CGUIWindowMusicBase::AddItemToPlayList(const CFileItemPtr &pItem, CFileItem { if (pItem->IsPlayList()) { - unique_ptr pPlayList (CPlayListFactory::Create(*pItem)); + std::unique_ptr pPlayList (CPlayListFactory::Create(*pItem)); if (pPlayList.get()) { // load it @@ -947,7 +946,7 @@ void CGUIWindowMusicBase::LoadPlayList(const std::string& strPlayList) // load a playlist like .m3u, .pls // first get correct factory to load playlist - unique_ptr pPlayList (CPlayListFactory::Create(strPlayList)); + std::unique_ptr pPlayList (CPlayListFactory::Create(strPlayList)); if (pPlayList.get()) { // load it @@ -1131,17 +1130,17 @@ bool CGUIWindowMusicBase::GetDirectory(const std::string &strDirectory, CFileIte if (params.GetAlbumId() > 0) { - map artistArt; + std::map artistArt; if (m_musicdatabase.GetArtistArtForItem(params.GetAlbumId(), MediaTypeAlbum, artistArt)) items.AppendArt(artistArt, MediaTypeArtist); - map albumArt; + std::map albumArt; if (m_musicdatabase.GetArtForItem(params.GetAlbumId(), MediaTypeAlbum, albumArt)) items.AppendArt(albumArt, MediaTypeAlbum); } if (params.GetArtistId() > 0) { - map artistArt; + std::map artistArt; if (m_musicdatabase.GetArtForItem(params.GetArtistId(), "artist", artistArt)) items.AppendArt(artistArt, MediaTypeArtist); } diff --git a/xbmc/music/windows/GUIWindowMusicNav.cpp b/xbmc/music/windows/GUIWindowMusicNav.cpp index 98dcbd6cd4e11..3460474caea75 100644 --- a/xbmc/music/windows/GUIWindowMusicNav.cpp +++ b/xbmc/music/windows/GUIWindowMusicNav.cpp @@ -56,7 +56,6 @@ #include "URL.h" #include "ContextMenuManager.h" -using namespace std; using namespace XFILE; using namespace PLAYLIST; using namespace MUSICDATABASEDIRECTORY; @@ -754,7 +753,7 @@ bool CGUIWindowMusicNav::GetSongsFromPlayList(const std::string& strPlayList, CF items.SetPath(strPlayList); CLog::Log(LOGDEBUG,"CGUIWindowMusicNav, opening playlist [%s]", strPlayList.c_str()); - unique_ptr pPlayList (CPlayListFactory::Create(strPlayList)); + std::unique_ptr pPlayList (CPlayListFactory::Create(strPlayList)); if ( NULL != pPlayList.get()) { // load it From 28b5c0be1e1caddb8cd1067454a974364e703389 Mon Sep 17 00:00:00 2001 From: Matthias Kortstiege Date: Fri, 28 Aug 2015 09:40:34 +0200 Subject: [PATCH 03/22] [utils] use std:: instead of using namespace std --- xbmc/utils/AlarmClock.cpp | 5 +- xbmc/utils/Base64.cpp | 4 +- xbmc/utils/CPUInfo.cpp | 10 +- xbmc/utils/FileOperationJob.cpp | 1 - xbmc/utils/FileUtils.cpp | 9 +- xbmc/utils/GroupUtils.cpp | 4 +- xbmc/utils/HTMLUtil.cpp | 2 - xbmc/utils/JSONVariantWriter.cpp | 8 +- xbmc/utils/JobManager.cpp | 10 +- xbmc/utils/Mime.cpp | 960 +++++++++++++++---------------- xbmc/utils/Observer.cpp | 6 +- xbmc/utils/PerformanceSample.cpp | 4 +- xbmc/utils/PerformanceStats.cpp | 12 +- xbmc/utils/ProgressJob.cpp | 2 - xbmc/utils/RssManager.cpp | 7 +- xbmc/utils/RssReader.cpp | 11 +- xbmc/utils/ScraperParser.cpp | 3 +- xbmc/utils/ScraperUrl.cpp | 12 +- xbmc/utils/Screenshot.cpp | 3 +- xbmc/utils/SortUtils.cpp | 134 +++-- xbmc/utils/StringUtils.cpp | 70 ++- xbmc/utils/TextSearch.cpp | 2 - xbmc/utils/TimeSmoother.cpp | 32 +- xbmc/utils/URIUtils.cpp | 45 +- xbmc/utils/UrlOptions.cpp | 14 +- xbmc/utils/Variant.cpp | 60 +- xbmc/utils/Weather.cpp | 5 +- xbmc/utils/WindowsShortcut.cpp | 6 +- 28 files changed, 697 insertions(+), 744 deletions(-) diff --git a/xbmc/utils/AlarmClock.cpp b/xbmc/utils/AlarmClock.cpp index d3c53086670e4..8ef7a685d0763 100644 --- a/xbmc/utils/AlarmClock.cpp +++ b/xbmc/utils/AlarmClock.cpp @@ -29,7 +29,6 @@ #include "utils/StringUtils.h" using namespace KODI::MESSAGING; -using namespace std; CAlarmClock::CAlarmClock() : CThread("AlarmClock"), m_bIsRunning(false) { @@ -88,7 +87,7 @@ void CAlarmClock::Stop(const std::string& strName, bool bSilent /* false */) std::string lowerName(strName); StringUtils::ToLower(lowerName); // lookup as lowercase only - map::iterator iter = m_event.find(lowerName); + std::map::iterator iter = m_event.find(lowerName); if (iter == m_event.end()) return; @@ -142,7 +141,7 @@ void CAlarmClock::Process() std::string strLast; { CSingleLock lock(m_events); - for (map::iterator iter=m_event.begin();iter != m_event.end(); ++iter) + for (std::map::iterator iter=m_event.begin();iter != m_event.end(); ++iter) if ( iter->second.watch.IsRunning() && iter->second.watch.GetElapsedSeconds() >= iter->second.m_fSecs) { diff --git a/xbmc/utils/Base64.cpp b/xbmc/utils/Base64.cpp index 54e16f7836072..63e86ba593d36 100644 --- a/xbmc/utils/Base64.cpp +++ b/xbmc/utils/Base64.cpp @@ -22,8 +22,6 @@ #define PADDING '=' -using namespace std; - const std::string Base64::m_characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" "0123456789+/"; @@ -127,7 +125,7 @@ std::string Base64::Decode(const char* input, unsigned int length) void Base64::Decode(const std::string &input, std::string &output) { size_t length = input.find_first_of(PADDING); - if (length == string::npos) + if (length == std::string::npos) length = input.size(); Decode(input.c_str(), length, output); diff --git a/xbmc/utils/CPUInfo.cpp b/xbmc/utils/CPUInfo.cpp index 9e709e7bbe32a..660d3550121d1 100644 --- a/xbmc/utils/CPUInfo.cpp +++ b/xbmc/utils/CPUInfo.cpp @@ -99,8 +99,6 @@ #include "utils/StringUtils.h" -using namespace std; - // In milliseconds #define MINIMUM_TIME_BETWEEN_READS 500 @@ -634,7 +632,7 @@ bool CCPUInfo::getTemperature(CTemperature& temperature) bool CCPUInfo::HasCoreId(int nCoreId) const { - map::const_iterator iter = m_cores.find(nCoreId); + std::map::const_iterator iter = m_cores.find(nCoreId); if (iter != m_cores.end()) return true; return false; @@ -642,7 +640,7 @@ bool CCPUInfo::HasCoreId(int nCoreId) const const CoreInfo &CCPUInfo::GetCoreInfo(int nCoreId) { - map::iterator iter = m_cores.find(nCoreId); + std::map::iterator iter = m_cores.find(nCoreId); if (iter != m_cores.end()) return iter->second; @@ -731,7 +729,7 @@ bool CCPUInfo::readProcStat(unsigned long long& user, unsigned long long& nice, coreIO = cptimes[i * CPUSTATES + CP_INTR]; coreIdle = cptimes[i * CPUSTATES + CP_IDLE]; - map::iterator iter = m_cores.find(i); + std::map::iterator iter = m_cores.find(i); if (iter != m_cores.end()) { coreUser -= iter->second.m_user; @@ -789,7 +787,7 @@ bool CCPUInfo::readProcStat(unsigned long long& user, unsigned long long& nice, if (num < 6) coreIO = 0; - map::iterator iter = m_cores.find(nCpu); + std::map::iterator iter = m_cores.find(nCpu); if (num > 4 && iter != m_cores.end()) { coreUser -= iter->second.m_user; diff --git a/xbmc/utils/FileOperationJob.cpp b/xbmc/utils/FileOperationJob.cpp index c918fc03b9cb5..6f72c903134f4 100644 --- a/xbmc/utils/FileOperationJob.cpp +++ b/xbmc/utils/FileOperationJob.cpp @@ -33,7 +33,6 @@ #include "utils/StringUtils.h" #include "utils/URIUtils.h" -using namespace std; using namespace XFILE; CFileOperationJob::CFileOperationJob() diff --git a/xbmc/utils/FileUtils.cpp b/xbmc/utils/FileUtils.cpp index 632d45ec35f53..818fc8aad5419 100644 --- a/xbmc/utils/FileUtils.cpp +++ b/xbmc/utils/FileUtils.cpp @@ -37,7 +37,6 @@ #include "utils/Variant.h" using namespace XFILE; -using namespace std; bool CFileUtils::DeleteItem(const std::string &strPath, bool force) { @@ -89,7 +88,7 @@ bool CFileUtils::RenameFile(const std::string &strFile) CLog::Log(LOGINFO,"FileUtils: rename %s->%s\n", strFileAndPath.c_str(), strPath.c_str()); if (URIUtils::IsMultiPath(strFileAndPath)) { // special case for multipath renames - rename all the paths. - vector paths; + std::vector paths; CMultiPathDirectory::GetPaths(strFileAndPath, paths); bool success = false; for (unsigned int i = 0; i < paths.size(); ++i) @@ -113,7 +112,7 @@ bool CFileUtils::RemoteAccessAllowed(const std::string &strPath) const unsigned int SourcesSize = 5; std::string SourceNames[] = { "programs", "files", "video", "music", "pictures" }; - string realPath = URIUtils::GetRealPath(strPath); + std::string realPath = URIUtils::GetRealPath(strPath); // for rar:// and zip:// paths we need to extract the path to the archive // instead of using the VFS path while (URIUtils::IsInArchive(realPath)) @@ -200,10 +199,10 @@ CDateTime CFileUtils::GetModificationDate(const std::string& strFileNameAndPath, // Use the newer of the creation and modification time else { - addedTime = max((time_t)buffer.st_ctime, (time_t)buffer.st_mtime); + addedTime = std::max((time_t)buffer.st_ctime, (time_t)buffer.st_mtime); // if the newer of the two dates is in the future, we try it with the older one if (addedTime > now) - addedTime = min((time_t)buffer.st_ctime, (time_t)buffer.st_mtime); + addedTime = std::min((time_t)buffer.st_ctime, (time_t)buffer.st_mtime); } // make sure the datetime does is not in the future diff --git a/xbmc/utils/GroupUtils.cpp b/xbmc/utils/GroupUtils.cpp index b2d4fdc0e2c8c..88862bbfadbc6 100644 --- a/xbmc/utils/GroupUtils.cpp +++ b/xbmc/utils/GroupUtils.cpp @@ -29,9 +29,7 @@ #include "utils/URIUtils.h" #include "filesystem/MultiPathDirectory.h" -using namespace std; - -typedef map > SetMap; +typedef std::map > SetMap; bool GroupUtils::Group(GroupBy groupBy, const std::string &baseDir, const CFileItemList &items, CFileItemList &groupedItems, GroupAttribute groupAttributes /* = GroupAttributeNone */) { diff --git a/xbmc/utils/HTMLUtil.cpp b/xbmc/utils/HTMLUtil.cpp index a4d3148fab507..51fac223bb678 100644 --- a/xbmc/utils/HTMLUtil.cpp +++ b/xbmc/utils/HTMLUtil.cpp @@ -22,10 +22,8 @@ #include "utils/StringUtils.h" #include -using namespace std; using namespace HTML; - CHTMLUtil::CHTMLUtil(void) {} diff --git a/xbmc/utils/JSONVariantWriter.cpp b/xbmc/utils/JSONVariantWriter.cpp index f4c847f43edb1..5534b086ce7bc 100644 --- a/xbmc/utils/JSONVariantWriter.cpp +++ b/xbmc/utils/JSONVariantWriter.cpp @@ -23,11 +23,9 @@ #include "JSONVariantWriter.h" #include "utils/Variant.h" -using namespace std; - -string CJSONVariantWriter::Write(const CVariant &value, bool compact) +std::string CJSONVariantWriter::Write(const CVariant &value, bool compact) { - string output; + std::string output; yajl_gen g = yajl_gen_alloc(NULL); yajl_gen_config(g, yajl_gen_beautify, compact ? 0 : 1); @@ -58,7 +56,7 @@ string CJSONVariantWriter::Write(const CVariant &value, bool compact) size_t length; yajl_gen_get_buf(g, &buffer, &length); - output = string((const char *)buffer, length); + output = std::string((const char *)buffer, length); } // Re-set locale to what it was before using yajl diff --git a/xbmc/utils/JobManager.cpp b/xbmc/utils/JobManager.cpp index b452e0a67d638..e1d94d90068c7 100644 --- a/xbmc/utils/JobManager.cpp +++ b/xbmc/utils/JobManager.cpp @@ -27,8 +27,6 @@ #include "system.h" -using namespace std; - bool CJob::ShouldCancel(unsigned int progress, unsigned int total) const { if (m_callback) @@ -155,8 +153,8 @@ void CJobQueue::QueueNextJob() void CJobQueue::CancelJobs() { CSingleLock lock(m_section); - for_each(m_processing.begin(), m_processing.end(), mem_fun_ref(&CJobPointer::CancelJob)); - for_each(m_jobQueue.begin(), m_jobQueue.end(), mem_fun_ref(&CJobPointer::FreeJob)); + for_each(m_processing.begin(), m_processing.end(), std::mem_fun_ref(&CJobPointer::CancelJob)); + for_each(m_jobQueue.begin(), m_jobQueue.end(), std::mem_fun_ref(&CJobPointer::FreeJob)); m_jobQueue.clear(); m_processing.clear(); } @@ -202,12 +200,12 @@ void CJobManager::CancelJobs() // clear any pending jobs for (unsigned int priority = CJob::PRIORITY_LOW_PAUSABLE; priority <= CJob::PRIORITY_HIGH; ++priority) { - for_each(m_jobQueue[priority].begin(), m_jobQueue[priority].end(), mem_fun_ref(&CWorkItem::FreeJob)); + for_each(m_jobQueue[priority].begin(), m_jobQueue[priority].end(), std::mem_fun_ref(&CWorkItem::FreeJob)); m_jobQueue[priority].clear(); } // cancel any callbacks on jobs still processing - for_each(m_processing.begin(), m_processing.end(), mem_fun_ref(&CWorkItem::Cancel)); + for_each(m_processing.begin(), m_processing.end(), std::mem_fun_ref(&CWorkItem::Cancel)); // tell our workers to finish while (m_workers.size()) diff --git a/xbmc/utils/Mime.cpp b/xbmc/utils/Mime.cpp index f18d2d4438faf..06d5f50ee6178 100644 --- a/xbmc/utils/Mime.cpp +++ b/xbmc/utils/Mime.cpp @@ -29,506 +29,504 @@ #include "utils/StringUtils.h" #include "filesystem/CurlFile.h" -using namespace std; - -map fillMimeTypes() +std::map fillMimeTypes() { - map mimeTypes; - - mimeTypes.insert(pair("3dm", "x-world/x-3dmf")); - mimeTypes.insert(pair("3dmf", "x-world/x-3dmf")); - mimeTypes.insert(pair("a", "application/octet-stream")); - mimeTypes.insert(pair("aab", "application/x-authorware-bin")); - mimeTypes.insert(pair("aam", "application/x-authorware-map")); - mimeTypes.insert(pair("aas", "application/x-authorware-seg")); - mimeTypes.insert(pair("abc", "text/vnd.abc")); - mimeTypes.insert(pair("acgi", "text/html")); - mimeTypes.insert(pair("afl", "video/animaflex")); - mimeTypes.insert(pair("ai", "application/postscript")); - mimeTypes.insert(pair("aif", "audio/aiff")); - mimeTypes.insert(pair("aifc", "audio/x-aiff")); - mimeTypes.insert(pair("aiff", "audio/aiff")); - mimeTypes.insert(pair("aim", "application/x-aim")); - mimeTypes.insert(pair("aip", "text/x-audiosoft-intra")); - mimeTypes.insert(pair("ani", "application/x-navi-animation")); - mimeTypes.insert(pair("aos", "application/x-nokia-9000-communicator-add-on-software")); - mimeTypes.insert(pair("aps", "application/mime")); - mimeTypes.insert(pair("arc", "application/octet-stream")); - mimeTypes.insert(pair("arj", "application/arj")); - mimeTypes.insert(pair("art", "image/x-jg")); - mimeTypes.insert(pair("asf", "video/x-ms-asf")); - mimeTypes.insert(pair("asm", "text/x-asm")); - mimeTypes.insert(pair("asp", "text/asp")); - mimeTypes.insert(pair("asx", "video/x-ms-asf")); - mimeTypes.insert(pair("au", "audio/basic")); - mimeTypes.insert(pair("avi", "video/avi")); - mimeTypes.insert(pair("avs", "video/avs-video")); - mimeTypes.insert(pair("bcpio", "application/x-bcpio")); - mimeTypes.insert(pair("bin", "application/octet-stream")); - mimeTypes.insert(pair("bm", "image/bmp")); - mimeTypes.insert(pair("bmp", "image/bmp")); - mimeTypes.insert(pair("boo", "application/book")); - mimeTypes.insert(pair("book", "application/book")); - mimeTypes.insert(pair("boz", "application/x-bzip2")); - mimeTypes.insert(pair("bsh", "application/x-bsh")); - mimeTypes.insert(pair("bz", "application/x-bzip")); - mimeTypes.insert(pair("bz2", "application/x-bzip2")); - mimeTypes.insert(pair("c", "text/plain")); - mimeTypes.insert(pair("c++", "text/plain")); - mimeTypes.insert(pair("cat", "application/vnd.ms-pki.seccat")); - mimeTypes.insert(pair("cc", "text/plain")); - mimeTypes.insert(pair("ccad", "application/clariscad")); - mimeTypes.insert(pair("cco", "application/x-cocoa")); - mimeTypes.insert(pair("cdf", "application/cdf")); - mimeTypes.insert(pair("cer", "application/pkix-cert")); - mimeTypes.insert(pair("cer", "application/x-x509-ca-cert")); - mimeTypes.insert(pair("cha", "application/x-chat")); - mimeTypes.insert(pair("chat", "application/x-chat")); - mimeTypes.insert(pair("class", "application/java")); - mimeTypes.insert(pair("com", "application/octet-stream")); - mimeTypes.insert(pair("conf", "text/plain")); - mimeTypes.insert(pair("cpio", "application/x-cpio")); - mimeTypes.insert(pair("cpp", "text/x-c")); - mimeTypes.insert(pair("cpt", "application/x-cpt")); - mimeTypes.insert(pair("crl", "application/pkcs-crl")); - mimeTypes.insert(pair("crt", "application/pkix-cert")); - mimeTypes.insert(pair("csh", "application/x-csh")); - mimeTypes.insert(pair("css", "text/css")); - mimeTypes.insert(pair("cxx", "text/plain")); - mimeTypes.insert(pair("dcr", "application/x-director")); - mimeTypes.insert(pair("deepv", "application/x-deepv")); - mimeTypes.insert(pair("def", "text/plain")); - mimeTypes.insert(pair("der", "application/x-x509-ca-cert")); - mimeTypes.insert(pair("dif", "video/x-dv")); - mimeTypes.insert(pair("dir", "application/x-director")); - mimeTypes.insert(pair("dl", "video/dl")); - mimeTypes.insert(pair("divx", "video/x-msvideo")); - mimeTypes.insert(pair("doc", "application/msword")); - mimeTypes.insert(pair("docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document")); - mimeTypes.insert(pair("dot", "application/msword")); - mimeTypes.insert(pair("dp", "application/commonground")); - mimeTypes.insert(pair("drw", "application/drafting")); - mimeTypes.insert(pair("dump", "application/octet-stream")); - mimeTypes.insert(pair("dv", "video/x-dv")); - mimeTypes.insert(pair("dvi", "application/x-dvi")); - mimeTypes.insert(pair("dwf", "model/vnd.dwf")); - mimeTypes.insert(pair("dwg", "image/vnd.dwg")); - mimeTypes.insert(pair("dxf", "image/vnd.dwg")); - mimeTypes.insert(pair("dxr", "application/x-director")); - mimeTypes.insert(pair("el", "text/x-script.elisp")); - mimeTypes.insert(pair("elc", "application/x-elc")); - mimeTypes.insert(pair("env", "application/x-envoy")); - mimeTypes.insert(pair("eps", "application/postscript")); - mimeTypes.insert(pair("es", "application/x-esrehber")); - mimeTypes.insert(pair("etx", "text/x-setext")); - mimeTypes.insert(pair("evy", "application/envoy")); - mimeTypes.insert(pair("exe", "application/octet-stream")); - mimeTypes.insert(pair("f", "text/x-fortran")); - mimeTypes.insert(pair("f77", "text/x-fortran")); - mimeTypes.insert(pair("f90", "text/x-fortran")); - mimeTypes.insert(pair("fdf", "application/vnd.fdf")); - mimeTypes.insert(pair("fif", "image/fif")); - mimeTypes.insert(pair("flac", "audio/flac")); - mimeTypes.insert(pair("fli", "video/fli")); - mimeTypes.insert(pair("flo", "image/florian")); - mimeTypes.insert(pair("flv", "video/x-flv")); - mimeTypes.insert(pair("flx", "text/vnd.fmi.flexstor")); - mimeTypes.insert(pair("fmf", "video/x-atomic3d-feature")); - mimeTypes.insert(pair("for", "text/plain")); - mimeTypes.insert(pair("for", "text/x-fortran")); - mimeTypes.insert(pair("fpx", "image/vnd.fpx")); - mimeTypes.insert(pair("frl", "application/freeloader")); - mimeTypes.insert(pair("funk", "audio/make")); - mimeTypes.insert(pair("g", "text/plain")); - mimeTypes.insert(pair("g3", "image/g3fax")); - mimeTypes.insert(pair("gif", "image/gif")); - mimeTypes.insert(pair("gl", "video/x-gl")); - mimeTypes.insert(pair("gsd", "audio/x-gsm")); - mimeTypes.insert(pair("gsm", "audio/x-gsm")); - mimeTypes.insert(pair("gsp", "application/x-gsp")); - mimeTypes.insert(pair("gss", "application/x-gss")); - mimeTypes.insert(pair("gtar", "application/x-gtar")); - mimeTypes.insert(pair("gz", "application/x-compressed")); - mimeTypes.insert(pair("gzip", "application/x-gzip")); - mimeTypes.insert(pair("h", "text/plain")); - mimeTypes.insert(pair("hdf", "application/x-hdf")); - mimeTypes.insert(pair("help", "application/x-helpfile")); - mimeTypes.insert(pair("hgl", "application/vnd.hp-hpgl")); - mimeTypes.insert(pair("hh", "text/plain")); - mimeTypes.insert(pair("hlb", "text/x-script")); - mimeTypes.insert(pair("hlp", "application/hlp")); - mimeTypes.insert(pair("hpg", "application/vnd.hp-hpgl")); - mimeTypes.insert(pair("hpgl", "application/vnd.hp-hpgl")); - mimeTypes.insert(pair("hqx", "application/binhex")); - mimeTypes.insert(pair("hta", "application/hta")); - mimeTypes.insert(pair("htc", "text/x-component")); - mimeTypes.insert(pair("htm", "text/html")); - mimeTypes.insert(pair("html", "text/html")); - mimeTypes.insert(pair("htmls", "text/html")); - mimeTypes.insert(pair("htt", "text/webviewhtml")); - mimeTypes.insert(pair("htx", "text/html")); - mimeTypes.insert(pair("ice", "x-conference/x-cooltalk")); - mimeTypes.insert(pair("ico", "image/x-icon")); - mimeTypes.insert(pair("idc", "text/plain")); - mimeTypes.insert(pair("ief", "image/ief")); - mimeTypes.insert(pair("iefs", "image/ief")); - mimeTypes.insert(pair("iges", "application/iges")); - mimeTypes.insert(pair("igs", "application/iges")); - mimeTypes.insert(pair("igs", "model/iges")); - mimeTypes.insert(pair("ima", "application/x-ima")); - mimeTypes.insert(pair("imap", "application/x-httpd-imap")); - mimeTypes.insert(pair("inf", "application/inf")); - mimeTypes.insert(pair("ins", "application/x-internett-signup")); - mimeTypes.insert(pair("ip", "application/x-ip2")); - mimeTypes.insert(pair("isu", "video/x-isvideo")); - mimeTypes.insert(pair("it", "audio/it")); - mimeTypes.insert(pair("iv", "application/x-inventor")); - mimeTypes.insert(pair("ivr", "i-world/i-vrml")); - mimeTypes.insert(pair("ivy", "application/x-livescreen")); - mimeTypes.insert(pair("jam", "audio/x-jam")); - mimeTypes.insert(pair("jav", "text/x-java-source")); - mimeTypes.insert(pair("java", "text/x-java-source")); - mimeTypes.insert(pair("jcm", "application/x-java-commerce")); - mimeTypes.insert(pair("jfif", "image/jpeg")); - mimeTypes.insert(pair("jfif-tbnl", "image/jpeg")); - mimeTypes.insert(pair("jpe", "image/jpeg")); - mimeTypes.insert(pair("jpeg", "image/jpeg")); - mimeTypes.insert(pair("jpg", "image/jpeg")); - mimeTypes.insert(pair("jps", "image/x-jps")); - mimeTypes.insert(pair("js", "application/javascript")); - mimeTypes.insert(pair("json", "application/json")); - mimeTypes.insert(pair("jut", "image/jutvision")); - mimeTypes.insert(pair("kar", "music/x-karaoke")); - mimeTypes.insert(pair("ksh", "application/x-ksh")); - mimeTypes.insert(pair("ksh", "text/x-script.ksh")); - mimeTypes.insert(pair("la", "audio/nspaudio")); - mimeTypes.insert(pair("lam", "audio/x-liveaudio")); - mimeTypes.insert(pair("latex", "application/x-latex")); - mimeTypes.insert(pair("lha", "application/lha")); - mimeTypes.insert(pair("lhx", "application/octet-stream")); - mimeTypes.insert(pair("list", "text/plain")); - mimeTypes.insert(pair("lma", "audio/nspaudio")); - mimeTypes.insert(pair("log", "text/plain")); - mimeTypes.insert(pair("lsp", "application/x-lisp")); - mimeTypes.insert(pair("lst", "text/plain")); - mimeTypes.insert(pair("lsx", "text/x-la-asf")); - mimeTypes.insert(pair("ltx", "application/x-latex")); - mimeTypes.insert(pair("lzh", "application/x-lzh")); - mimeTypes.insert(pair("lzx", "application/lzx")); - mimeTypes.insert(pair("m", "text/x-m")); - mimeTypes.insert(pair("m1v", "video/mpeg")); - mimeTypes.insert(pair("m2a", "audio/mpeg")); - mimeTypes.insert(pair("m2v", "video/mpeg")); - mimeTypes.insert(pair("m3u", "audio/x-mpequrl")); - mimeTypes.insert(pair("man", "application/x-troff-man")); - mimeTypes.insert(pair("map", "application/x-navimap")); - mimeTypes.insert(pair("mar", "text/plain")); - mimeTypes.insert(pair("mbd", "application/mbedlet")); - mimeTypes.insert(pair("mc$", "application/x-magic-cap-package-1.0")); - mimeTypes.insert(pair("mcd", "application/x-mathcad")); - mimeTypes.insert(pair("mcf", "text/mcf")); - mimeTypes.insert(pair("mcp", "application/netmc")); - mimeTypes.insert(pair("me", "application/x-troff-me")); - mimeTypes.insert(pair("mht", "message/rfc822")); - mimeTypes.insert(pair("mhtml", "message/rfc822")); - mimeTypes.insert(pair("mid", "audio/midi")); - mimeTypes.insert(pair("midi", "audio/midi")); - mimeTypes.insert(pair("mif", "application/x-mif")); - mimeTypes.insert(pair("mime", "message/rfc822")); - mimeTypes.insert(pair("mjf", "audio/x-vnd.audioexplosion.mjuicemediafile")); - mimeTypes.insert(pair("mjpg", "video/x-motion-jpeg")); - mimeTypes.insert(pair("mka", "audio/x-matroska")); - mimeTypes.insert(pair("mkv", "video/x-matroska")); - mimeTypes.insert(pair("mk3d", "video/x-matroska-3d")); - mimeTypes.insert(pair("mm", "application/x-meme")); - mimeTypes.insert(pair("mme", "application/base64")); - mimeTypes.insert(pair("mod", "audio/mod")); - mimeTypes.insert(pair("moov", "video/quicktime")); - mimeTypes.insert(pair("mov", "video/quicktime")); - mimeTypes.insert(pair("movie", "video/x-sgi-movie")); - mimeTypes.insert(pair("mp2", "audio/mpeg")); - mimeTypes.insert(pair("mp3", "audio/mpeg3")); - mimeTypes.insert(pair("mp4", "video/mp4")); - mimeTypes.insert(pair("mpa", "audio/mpeg")); - mimeTypes.insert(pair("mpc", "application/x-project")); - mimeTypes.insert(pair("mpe", "video/mpeg")); - mimeTypes.insert(pair("mpeg", "video/mpeg")); - mimeTypes.insert(pair("mpg", "video/mpeg")); - mimeTypes.insert(pair("mpga", "audio/mpeg")); - mimeTypes.insert(pair("mpp", "application/vnd.ms-project")); - mimeTypes.insert(pair("mpt", "application/x-project")); - mimeTypes.insert(pair("mpv", "application/x-project")); - mimeTypes.insert(pair("mpx", "application/x-project")); - mimeTypes.insert(pair("mrc", "application/marc")); - mimeTypes.insert(pair("ms", "application/x-troff-ms")); - mimeTypes.insert(pair("mv", "video/x-sgi-movie")); - mimeTypes.insert(pair("my", "audio/make")); - mimeTypes.insert(pair("mzz", "application/x-vnd.audioexplosion.mzz")); - mimeTypes.insert(pair("nap", "image/naplps")); - mimeTypes.insert(pair("naplps", "image/naplps")); - mimeTypes.insert(pair("nc", "application/x-netcdf")); - mimeTypes.insert(pair("ncm", "application/vnd.nokia.configuration-message")); - mimeTypes.insert(pair("nfo", "text/xml")); - mimeTypes.insert(pair("nif", "image/x-niff")); - mimeTypes.insert(pair("niff", "image/x-niff")); - mimeTypes.insert(pair("nix", "application/x-mix-transfer")); - mimeTypes.insert(pair("nsc", "application/x-conference")); - mimeTypes.insert(pair("nvd", "application/x-navidoc")); - mimeTypes.insert(pair("o", "application/octet-stream")); - mimeTypes.insert(pair("oda", "application/oda")); - mimeTypes.insert(pair("ogg", "audio/ogg")); - mimeTypes.insert(pair("omc", "application/x-omc")); - mimeTypes.insert(pair("omcd", "application/x-omcdatamaker")); - mimeTypes.insert(pair("omcr", "application/x-omcregerator")); - mimeTypes.insert(pair("p", "text/x-pascal")); - mimeTypes.insert(pair("p10", "application/pkcs10")); - mimeTypes.insert(pair("p12", "application/pkcs-12")); - mimeTypes.insert(pair("p7a", "application/x-pkcs7-signature")); - mimeTypes.insert(pair("p7c", "application/pkcs7-mime")); - mimeTypes.insert(pair("p7m", "application/pkcs7-mime")); - mimeTypes.insert(pair("p7r", "application/x-pkcs7-certreqresp")); - mimeTypes.insert(pair("p7s", "application/pkcs7-signature")); - mimeTypes.insert(pair("part", "application/pro_eng")); - mimeTypes.insert(pair("pas", "text/pascal")); - mimeTypes.insert(pair("pbm", "image/x-portable-bitmap")); - mimeTypes.insert(pair("pcl", "application/vnd.hp-pcl")); - mimeTypes.insert(pair("pct", "image/x-pict")); - mimeTypes.insert(pair("pcx", "image/x-pcx")); - mimeTypes.insert(pair("pdb", "chemical/x-pdb")); - mimeTypes.insert(pair("pdf", "application/pdf")); - mimeTypes.insert(pair("pfunk", "audio/make.my.funk")); - mimeTypes.insert(pair("pgm", "image/x-portable-greymap")); - mimeTypes.insert(pair("pic", "image/pict")); - mimeTypes.insert(pair("pict", "image/pict")); - mimeTypes.insert(pair("pkg", "application/x-newton-compatible-pkg")); - mimeTypes.insert(pair("pko", "application/vnd.ms-pki.pko")); - mimeTypes.insert(pair("pl", "text/x-script.perl")); - mimeTypes.insert(pair("plx", "application/x-pixclscript")); - mimeTypes.insert(pair("pm", "text/x-script.perl-module")); - mimeTypes.insert(pair("pm4", "application/x-pagemaker")); - mimeTypes.insert(pair("pm5", "application/x-pagemaker")); - mimeTypes.insert(pair("png", "image/png")); - mimeTypes.insert(pair("pnm", "application/x-portable-anymap")); - mimeTypes.insert(pair("pot", "application/vnd.ms-powerpoint")); - mimeTypes.insert(pair("pov", "model/x-pov")); - mimeTypes.insert(pair("ppa", "application/vnd.ms-powerpoint")); - mimeTypes.insert(pair("ppm", "image/x-portable-pixmap")); - mimeTypes.insert(pair("pps", "application/mspowerpoint")); - mimeTypes.insert(pair("ppt", "application/mspowerpoint")); - mimeTypes.insert(pair("ppz", "application/mspowerpoint")); - mimeTypes.insert(pair("pre", "application/x-freelance")); - mimeTypes.insert(pair("prt", "application/pro_eng")); - mimeTypes.insert(pair("ps", "application/postscript")); - mimeTypes.insert(pair("psd", "application/octet-stream")); - mimeTypes.insert(pair("pvu", "paleovu/x-pv")); - mimeTypes.insert(pair("pwz", "application/vnd.ms-powerpoint")); - mimeTypes.insert(pair("py", "text/x-script.phyton")); - mimeTypes.insert(pair("pyc", "applicaiton/x-bytecode.python")); - mimeTypes.insert(pair("qcp", "audio/vnd.qcelp")); - mimeTypes.insert(pair("qd3", "x-world/x-3dmf")); - mimeTypes.insert(pair("qd3d", "x-world/x-3dmf")); - mimeTypes.insert(pair("qif", "image/x-quicktime")); - mimeTypes.insert(pair("qt", "video/quicktime")); - mimeTypes.insert(pair("qtc", "video/x-qtc")); - mimeTypes.insert(pair("qti", "image/x-quicktime")); - mimeTypes.insert(pair("qtif", "image/x-quicktime")); - mimeTypes.insert(pair("ra", "audio/x-realaudio")); - mimeTypes.insert(pair("ram", "audio/x-pn-realaudio")); - mimeTypes.insert(pair("ras", "image/cmu-raster")); - mimeTypes.insert(pair("rast", "image/cmu-raster")); - mimeTypes.insert(pair("rexx", "text/x-script.rexx")); - mimeTypes.insert(pair("rf", "image/vnd.rn-realflash")); - mimeTypes.insert(pair("rgb", "image/x-rgb")); - mimeTypes.insert(pair("rm", "audio/x-pn-realaudio")); - mimeTypes.insert(pair("rmi", "audio/mid")); - mimeTypes.insert(pair("rmm", "audio/x-pn-realaudio")); - mimeTypes.insert(pair("rmp", "audio/x-pn-realaudio")); - mimeTypes.insert(pair("rng", "application/ringing-tones")); - mimeTypes.insert(pair("rnx", "application/vnd.rn-realplayer")); - mimeTypes.insert(pair("roff", "application/x-troff")); - mimeTypes.insert(pair("rp", "image/vnd.rn-realpix")); - mimeTypes.insert(pair("rpm", "audio/x-pn-realaudio-plugin")); - mimeTypes.insert(pair("rt", "text/richtext")); - mimeTypes.insert(pair("rtf", "text/richtext")); - mimeTypes.insert(pair("rtx", "text/richtext")); - mimeTypes.insert(pair("rv", "video/vnd.rn-realvideo")); - mimeTypes.insert(pair("s", "text/x-asm")); - mimeTypes.insert(pair("s3m", "audio/s3m")); - mimeTypes.insert(pair("saveme", "application/octet-stream")); - mimeTypes.insert(pair("sbk", "application/x-tbook")); - mimeTypes.insert(pair("scm", "video/x-scm")); - mimeTypes.insert(pair("sdml", "text/plain")); - mimeTypes.insert(pair("sdp", "application/sdp")); - mimeTypes.insert(pair("sdr", "application/sounder")); - mimeTypes.insert(pair("sea", "application/sea")); - mimeTypes.insert(pair("set", "application/set")); - mimeTypes.insert(pair("sgm", "text/sgml")); - mimeTypes.insert(pair("sgml", "text/sgml")); - mimeTypes.insert(pair("sh", "text/x-script.sh")); - mimeTypes.insert(pair("shar", "application/x-bsh")); - mimeTypes.insert(pair("shtml", "text/html")); - mimeTypes.insert(pair("shtml", "text/x-server-parsed-html")); - mimeTypes.insert(pair("sid", "audio/x-psid")); - mimeTypes.insert(pair("sit", "application/x-sit")); - mimeTypes.insert(pair("sit", "application/x-stuffit")); - mimeTypes.insert(pair("skd", "application/x-koan")); - mimeTypes.insert(pair("skm", "application/x-koan")); - mimeTypes.insert(pair("skp", "application/x-koan")); - mimeTypes.insert(pair("skt", "application/x-koan")); - mimeTypes.insert(pair("sl", "application/x-seelogo")); - mimeTypes.insert(pair("smi", "application/smil")); - mimeTypes.insert(pair("smil", "application/smil")); - mimeTypes.insert(pair("snd", "audio/basic")); - mimeTypes.insert(pair("sol", "application/solids")); - mimeTypes.insert(pair("spc", "text/x-speech")); - mimeTypes.insert(pair("spl", "application/futuresplash")); - mimeTypes.insert(pair("spr", "application/x-sprite")); - mimeTypes.insert(pair("sprite", "application/x-sprite")); - mimeTypes.insert(pair("src", "application/x-wais-source")); - mimeTypes.insert(pair("ssi", "text/x-server-parsed-html")); - mimeTypes.insert(pair("ssm", "application/streamingmedia")); - mimeTypes.insert(pair("sst", "application/vnd.ms-pki.certstore")); - mimeTypes.insert(pair("step", "application/step")); - mimeTypes.insert(pair("stl", "application/sla")); - mimeTypes.insert(pair("stp", "application/step")); - mimeTypes.insert(pair("sv4cpio", "application/x-sv4cpio")); - mimeTypes.insert(pair("sv4crc", "application/x-sv4crc")); - mimeTypes.insert(pair("svf", "image/vnd.dwg")); - mimeTypes.insert(pair("svr", "application/x-world")); - mimeTypes.insert(pair("swf", "application/x-shockwave-flash")); - mimeTypes.insert(pair("t", "application/x-troff")); - mimeTypes.insert(pair("talk", "text/x-speech")); - mimeTypes.insert(pair("tar", "application/x-tar")); - mimeTypes.insert(pair("tbk", "application/toolbook")); - mimeTypes.insert(pair("tcl", "text/x-script.tcl")); - mimeTypes.insert(pair("tcsh", "text/x-script.tcsh")); - mimeTypes.insert(pair("tex", "application/x-tex")); - mimeTypes.insert(pair("texi", "application/x-texinfo")); - mimeTypes.insert(pair("texinfo", "application/x-texinfo")); - mimeTypes.insert(pair("text", "text/plain")); - mimeTypes.insert(pair("tgz", "application/x-compressed")); - mimeTypes.insert(pair("tif", "image/tiff")); - mimeTypes.insert(pair("tiff", "image/tiff")); - mimeTypes.insert(pair("tr", "application/x-troff")); - mimeTypes.insert(pair("ts", "video/mp2t")); - mimeTypes.insert(pair("tsi", "audio/tsp-audio")); - mimeTypes.insert(pair("tsp", "audio/tsplayer")); - mimeTypes.insert(pair("tsv", "text/tab-separated-values")); - mimeTypes.insert(pair("turbot", "image/florian")); - mimeTypes.insert(pair("txt", "text/plain")); - mimeTypes.insert(pair("uil", "text/x-uil")); - mimeTypes.insert(pair("uni", "text/uri-list")); - mimeTypes.insert(pair("unis", "text/uri-list")); - mimeTypes.insert(pair("unv", "application/i-deas")); - mimeTypes.insert(pair("uri", "text/uri-list")); - mimeTypes.insert(pair("uris", "text/uri-list")); - mimeTypes.insert(pair("ustar", "application/x-ustar")); - mimeTypes.insert(pair("uu", "text/x-uuencode")); - mimeTypes.insert(pair("uue", "text/x-uuencode")); - mimeTypes.insert(pair("vcd", "application/x-cdlink")); - mimeTypes.insert(pair("vcs", "text/x-vcalendar")); - mimeTypes.insert(pair("vda", "application/vda")); - mimeTypes.insert(pair("vdo", "video/vdo")); - mimeTypes.insert(pair("vew", "application/groupwise")); - mimeTypes.insert(pair("viv", "video/vivo")); - mimeTypes.insert(pair("vivo", "video/vivo")); - mimeTypes.insert(pair("vmd", "application/vocaltec-media-desc")); - mimeTypes.insert(pair("vmf", "application/vocaltec-media-file")); - mimeTypes.insert(pair("voc", "audio/voc")); - mimeTypes.insert(pair("vos", "video/vosaic")); - mimeTypes.insert(pair("vox", "audio/voxware")); - mimeTypes.insert(pair("vqe", "audio/x-twinvq-plugin")); - mimeTypes.insert(pair("vqf", "audio/x-twinvq")); - mimeTypes.insert(pair("vql", "audio/x-twinvq-plugin")); - mimeTypes.insert(pair("vrml", "application/x-vrml")); - mimeTypes.insert(pair("vrt", "x-world/x-vrt")); - mimeTypes.insert(pair("vsd", "application/x-visio")); - mimeTypes.insert(pair("vst", "application/x-visio")); - mimeTypes.insert(pair("vsw", "application/x-visio")); - mimeTypes.insert(pair("w60", "application/wordperfect6.0")); - mimeTypes.insert(pair("w61", "application/wordperfect6.1")); - mimeTypes.insert(pair("w6w", "application/msword")); - mimeTypes.insert(pair("wav", "audio/wav")); - mimeTypes.insert(pair("wb1", "application/x-qpro")); - mimeTypes.insert(pair("wbmp", "image/vnd.wap.wbmp")); - mimeTypes.insert(pair("web", "application/vnd.xara")); - mimeTypes.insert(pair("wiz", "application/msword")); - mimeTypes.insert(pair("wk1", "application/x-123")); - mimeTypes.insert(pair("wma", "audio/x-ms-wma")); - mimeTypes.insert(pair("wmf", "windows/metafile")); - mimeTypes.insert(pair("wml", "text/vnd.wap.wml")); - mimeTypes.insert(pair("wmlc", "application/vnd.wap.wmlc")); - mimeTypes.insert(pair("wmls", "text/vnd.wap.wmlscript")); - mimeTypes.insert(pair("wmlsc", "application/vnd.wap.wmlscriptc")); - mimeTypes.insert(pair("wmv", "video/x-ms-wmv")); - mimeTypes.insert(pair("word", "application/msword")); - mimeTypes.insert(pair("wp", "application/wordperfect")); - mimeTypes.insert(pair("wp5", "application/wordperfect")); - mimeTypes.insert(pair("wp6", "application/wordperfect")); - mimeTypes.insert(pair("wpd", "application/wordperfect")); - mimeTypes.insert(pair("wq1", "application/x-lotus")); - mimeTypes.insert(pair("wri", "application/mswrite")); - mimeTypes.insert(pair("wrl", "model/vrml")); - mimeTypes.insert(pair("wrz", "model/vrml")); - mimeTypes.insert(pair("wsc", "text/scriplet")); - mimeTypes.insert(pair("wsrc", "application/x-wais-source")); - mimeTypes.insert(pair("wtk", "application/x-wintalk")); - mimeTypes.insert(pair("xbm", "image/xbm")); - mimeTypes.insert(pair("xdr", "video/x-amt-demorun")); - mimeTypes.insert(pair("xgz", "xgl/drawing")); - mimeTypes.insert(pair("xif", "image/vnd.xiff")); - mimeTypes.insert(pair("xl", "application/excel")); - mimeTypes.insert(pair("xla", "application/excel")); - mimeTypes.insert(pair("xlb", "application/excel")); - mimeTypes.insert(pair("xlc", "application/excel")); - mimeTypes.insert(pair("xld", "application/excel")); - mimeTypes.insert(pair("xlk", "application/excel")); - mimeTypes.insert(pair("xll", "application/excel")); - mimeTypes.insert(pair("xlm", "application/excel")); - mimeTypes.insert(pair("xls", "application/excel")); - mimeTypes.insert(pair("xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")); - mimeTypes.insert(pair("xlt", "application/excel")); - mimeTypes.insert(pair("xlv", "application/excel")); - mimeTypes.insert(pair("xlw", "application/excel")); - mimeTypes.insert(pair("xm", "audio/xm")); - mimeTypes.insert(pair("xml", "text/xml")); - mimeTypes.insert(pair("xmz", "xgl/movie")); - mimeTypes.insert(pair("xpix", "application/x-vnd.ls-xpix")); - mimeTypes.insert(pair("xpm", "image/xpm")); - mimeTypes.insert(pair("x-png", "image/png")); - mimeTypes.insert(pair("xsr", "video/x-amt-showrun")); - mimeTypes.insert(pair("xvid", "video/x-msvideo")); - mimeTypes.insert(pair("xwd", "image/x-xwd")); - mimeTypes.insert(pair("xyz", "chemical/x-pdb")); - mimeTypes.insert(pair("z", "application/x-compressed")); - mimeTypes.insert(pair("zip", "application/zip")); - mimeTypes.insert(pair("zoo", "application/octet-stream")); - mimeTypes.insert(pair("zsh", "text/x-script.zsh")); + std::map mimeTypes; + + mimeTypes.insert(std::pair("3dm", "x-world/x-3dmf")); + mimeTypes.insert(std::pair("3dmf", "x-world/x-3dmf")); + mimeTypes.insert(std::pair("a", "application/octet-stream")); + mimeTypes.insert(std::pair("aab", "application/x-authorware-bin")); + mimeTypes.insert(std::pair("aam", "application/x-authorware-map")); + mimeTypes.insert(std::pair("aas", "application/x-authorware-seg")); + mimeTypes.insert(std::pair("abc", "text/vnd.abc")); + mimeTypes.insert(std::pair("acgi", "text/html")); + mimeTypes.insert(std::pair("afl", "video/animaflex")); + mimeTypes.insert(std::pair("ai", "application/postscript")); + mimeTypes.insert(std::pair("aif", "audio/aiff")); + mimeTypes.insert(std::pair("aifc", "audio/x-aiff")); + mimeTypes.insert(std::pair("aiff", "audio/aiff")); + mimeTypes.insert(std::pair("aim", "application/x-aim")); + mimeTypes.insert(std::pair("aip", "text/x-audiosoft-intra")); + mimeTypes.insert(std::pair("ani", "application/x-navi-animation")); + mimeTypes.insert(std::pair("aos", "application/x-nokia-9000-communicator-add-on-software")); + mimeTypes.insert(std::pair("aps", "application/mime")); + mimeTypes.insert(std::pair("arc", "application/octet-stream")); + mimeTypes.insert(std::pair("arj", "application/arj")); + mimeTypes.insert(std::pair("art", "image/x-jg")); + mimeTypes.insert(std::pair("asf", "video/x-ms-asf")); + mimeTypes.insert(std::pair("asm", "text/x-asm")); + mimeTypes.insert(std::pair("asp", "text/asp")); + mimeTypes.insert(std::pair("asx", "video/x-ms-asf")); + mimeTypes.insert(std::pair("au", "audio/basic")); + mimeTypes.insert(std::pair("avi", "video/avi")); + mimeTypes.insert(std::pair("avs", "video/avs-video")); + mimeTypes.insert(std::pair("bcpio", "application/x-bcpio")); + mimeTypes.insert(std::pair("bin", "application/octet-stream")); + mimeTypes.insert(std::pair("bm", "image/bmp")); + mimeTypes.insert(std::pair("bmp", "image/bmp")); + mimeTypes.insert(std::pair("boo", "application/book")); + mimeTypes.insert(std::pair("book", "application/book")); + mimeTypes.insert(std::pair("boz", "application/x-bzip2")); + mimeTypes.insert(std::pair("bsh", "application/x-bsh")); + mimeTypes.insert(std::pair("bz", "application/x-bzip")); + mimeTypes.insert(std::pair("bz2", "application/x-bzip2")); + mimeTypes.insert(std::pair("c", "text/plain")); + mimeTypes.insert(std::pair("c++", "text/plain")); + mimeTypes.insert(std::pair("cat", "application/vnd.ms-pki.seccat")); + mimeTypes.insert(std::pair("cc", "text/plain")); + mimeTypes.insert(std::pair("ccad", "application/clariscad")); + mimeTypes.insert(std::pair("cco", "application/x-cocoa")); + mimeTypes.insert(std::pair("cdf", "application/cdf")); + mimeTypes.insert(std::pair("cer", "application/pkix-cert")); + mimeTypes.insert(std::pair("cer", "application/x-x509-ca-cert")); + mimeTypes.insert(std::pair("cha", "application/x-chat")); + mimeTypes.insert(std::pair("chat", "application/x-chat")); + mimeTypes.insert(std::pair("class", "application/java")); + mimeTypes.insert(std::pair("com", "application/octet-stream")); + mimeTypes.insert(std::pair("conf", "text/plain")); + mimeTypes.insert(std::pair("cpio", "application/x-cpio")); + mimeTypes.insert(std::pair("cpp", "text/x-c")); + mimeTypes.insert(std::pair("cpt", "application/x-cpt")); + mimeTypes.insert(std::pair("crl", "application/pkcs-crl")); + mimeTypes.insert(std::pair("crt", "application/pkix-cert")); + mimeTypes.insert(std::pair("csh", "application/x-csh")); + mimeTypes.insert(std::pair("css", "text/css")); + mimeTypes.insert(std::pair("cxx", "text/plain")); + mimeTypes.insert(std::pair("dcr", "application/x-director")); + mimeTypes.insert(std::pair("deepv", "application/x-deepv")); + mimeTypes.insert(std::pair("def", "text/plain")); + mimeTypes.insert(std::pair("der", "application/x-x509-ca-cert")); + mimeTypes.insert(std::pair("dif", "video/x-dv")); + mimeTypes.insert(std::pair("dir", "application/x-director")); + mimeTypes.insert(std::pair("dl", "video/dl")); + mimeTypes.insert(std::pair("divx", "video/x-msvideo")); + mimeTypes.insert(std::pair("doc", "application/msword")); + mimeTypes.insert(std::pair("docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document")); + mimeTypes.insert(std::pair("dot", "application/msword")); + mimeTypes.insert(std::pair("dp", "application/commonground")); + mimeTypes.insert(std::pair("drw", "application/drafting")); + mimeTypes.insert(std::pair("dump", "application/octet-stream")); + mimeTypes.insert(std::pair("dv", "video/x-dv")); + mimeTypes.insert(std::pair("dvi", "application/x-dvi")); + mimeTypes.insert(std::pair("dwf", "model/vnd.dwf")); + mimeTypes.insert(std::pair("dwg", "image/vnd.dwg")); + mimeTypes.insert(std::pair("dxf", "image/vnd.dwg")); + mimeTypes.insert(std::pair("dxr", "application/x-director")); + mimeTypes.insert(std::pair("el", "text/x-script.elisp")); + mimeTypes.insert(std::pair("elc", "application/x-elc")); + mimeTypes.insert(std::pair("env", "application/x-envoy")); + mimeTypes.insert(std::pair("eps", "application/postscript")); + mimeTypes.insert(std::pair("es", "application/x-esrehber")); + mimeTypes.insert(std::pair("etx", "text/x-setext")); + mimeTypes.insert(std::pair("evy", "application/envoy")); + mimeTypes.insert(std::pair("exe", "application/octet-stream")); + mimeTypes.insert(std::pair("f", "text/x-fortran")); + mimeTypes.insert(std::pair("f77", "text/x-fortran")); + mimeTypes.insert(std::pair("f90", "text/x-fortran")); + mimeTypes.insert(std::pair("fdf", "application/vnd.fdf")); + mimeTypes.insert(std::pair("fif", "image/fif")); + mimeTypes.insert(std::pair("flac", "audio/flac")); + mimeTypes.insert(std::pair("fli", "video/fli")); + mimeTypes.insert(std::pair("flo", "image/florian")); + mimeTypes.insert(std::pair("flv", "video/x-flv")); + mimeTypes.insert(std::pair("flx", "text/vnd.fmi.flexstor")); + mimeTypes.insert(std::pair("fmf", "video/x-atomic3d-feature")); + mimeTypes.insert(std::pair("for", "text/plain")); + mimeTypes.insert(std::pair("for", "text/x-fortran")); + mimeTypes.insert(std::pair("fpx", "image/vnd.fpx")); + mimeTypes.insert(std::pair("frl", "application/freeloader")); + mimeTypes.insert(std::pair("funk", "audio/make")); + mimeTypes.insert(std::pair("g", "text/plain")); + mimeTypes.insert(std::pair("g3", "image/g3fax")); + mimeTypes.insert(std::pair("gif", "image/gif")); + mimeTypes.insert(std::pair("gl", "video/x-gl")); + mimeTypes.insert(std::pair("gsd", "audio/x-gsm")); + mimeTypes.insert(std::pair("gsm", "audio/x-gsm")); + mimeTypes.insert(std::pair("gsp", "application/x-gsp")); + mimeTypes.insert(std::pair("gss", "application/x-gss")); + mimeTypes.insert(std::pair("gtar", "application/x-gtar")); + mimeTypes.insert(std::pair("gz", "application/x-compressed")); + mimeTypes.insert(std::pair("gzip", "application/x-gzip")); + mimeTypes.insert(std::pair("h", "text/plain")); + mimeTypes.insert(std::pair("hdf", "application/x-hdf")); + mimeTypes.insert(std::pair("help", "application/x-helpfile")); + mimeTypes.insert(std::pair("hgl", "application/vnd.hp-hpgl")); + mimeTypes.insert(std::pair("hh", "text/plain")); + mimeTypes.insert(std::pair("hlb", "text/x-script")); + mimeTypes.insert(std::pair("hlp", "application/hlp")); + mimeTypes.insert(std::pair("hpg", "application/vnd.hp-hpgl")); + mimeTypes.insert(std::pair("hpgl", "application/vnd.hp-hpgl")); + mimeTypes.insert(std::pair("hqx", "application/binhex")); + mimeTypes.insert(std::pair("hta", "application/hta")); + mimeTypes.insert(std::pair("htc", "text/x-component")); + mimeTypes.insert(std::pair("htm", "text/html")); + mimeTypes.insert(std::pair("html", "text/html")); + mimeTypes.insert(std::pair("htmls", "text/html")); + mimeTypes.insert(std::pair("htt", "text/webviewhtml")); + mimeTypes.insert(std::pair("htx", "text/html")); + mimeTypes.insert(std::pair("ice", "x-conference/x-cooltalk")); + mimeTypes.insert(std::pair("ico", "image/x-icon")); + mimeTypes.insert(std::pair("idc", "text/plain")); + mimeTypes.insert(std::pair("ief", "image/ief")); + mimeTypes.insert(std::pair("iefs", "image/ief")); + mimeTypes.insert(std::pair("iges", "application/iges")); + mimeTypes.insert(std::pair("igs", "application/iges")); + mimeTypes.insert(std::pair("igs", "model/iges")); + mimeTypes.insert(std::pair("ima", "application/x-ima")); + mimeTypes.insert(std::pair("imap", "application/x-httpd-imap")); + mimeTypes.insert(std::pair("inf", "application/inf")); + mimeTypes.insert(std::pair("ins", "application/x-internett-signup")); + mimeTypes.insert(std::pair("ip", "application/x-ip2")); + mimeTypes.insert(std::pair("isu", "video/x-isvideo")); + mimeTypes.insert(std::pair("it", "audio/it")); + mimeTypes.insert(std::pair("iv", "application/x-inventor")); + mimeTypes.insert(std::pair("ivr", "i-world/i-vrml")); + mimeTypes.insert(std::pair("ivy", "application/x-livescreen")); + mimeTypes.insert(std::pair("jam", "audio/x-jam")); + mimeTypes.insert(std::pair("jav", "text/x-java-source")); + mimeTypes.insert(std::pair("java", "text/x-java-source")); + mimeTypes.insert(std::pair("jcm", "application/x-java-commerce")); + mimeTypes.insert(std::pair("jfif", "image/jpeg")); + mimeTypes.insert(std::pair("jfif-tbnl", "image/jpeg")); + mimeTypes.insert(std::pair("jpe", "image/jpeg")); + mimeTypes.insert(std::pair("jpeg", "image/jpeg")); + mimeTypes.insert(std::pair("jpg", "image/jpeg")); + mimeTypes.insert(std::pair("jps", "image/x-jps")); + mimeTypes.insert(std::pair("js", "application/javascript")); + mimeTypes.insert(std::pair("json", "application/json")); + mimeTypes.insert(std::pair("jut", "image/jutvision")); + mimeTypes.insert(std::pair("kar", "music/x-karaoke")); + mimeTypes.insert(std::pair("ksh", "application/x-ksh")); + mimeTypes.insert(std::pair("ksh", "text/x-script.ksh")); + mimeTypes.insert(std::pair("la", "audio/nspaudio")); + mimeTypes.insert(std::pair("lam", "audio/x-liveaudio")); + mimeTypes.insert(std::pair("latex", "application/x-latex")); + mimeTypes.insert(std::pair("lha", "application/lha")); + mimeTypes.insert(std::pair("lhx", "application/octet-stream")); + mimeTypes.insert(std::pair("list", "text/plain")); + mimeTypes.insert(std::pair("lma", "audio/nspaudio")); + mimeTypes.insert(std::pair("log", "text/plain")); + mimeTypes.insert(std::pair("lsp", "application/x-lisp")); + mimeTypes.insert(std::pair("lst", "text/plain")); + mimeTypes.insert(std::pair("lsx", "text/x-la-asf")); + mimeTypes.insert(std::pair("ltx", "application/x-latex")); + mimeTypes.insert(std::pair("lzh", "application/x-lzh")); + mimeTypes.insert(std::pair("lzx", "application/lzx")); + mimeTypes.insert(std::pair("m", "text/x-m")); + mimeTypes.insert(std::pair("m1v", "video/mpeg")); + mimeTypes.insert(std::pair("m2a", "audio/mpeg")); + mimeTypes.insert(std::pair("m2v", "video/mpeg")); + mimeTypes.insert(std::pair("m3u", "audio/x-mpequrl")); + mimeTypes.insert(std::pair("man", "application/x-troff-man")); + mimeTypes.insert(std::pair("map", "application/x-navimap")); + mimeTypes.insert(std::pair("mar", "text/plain")); + mimeTypes.insert(std::pair("mbd", "application/mbedlet")); + mimeTypes.insert(std::pair("mc$", "application/x-magic-cap-package-1.0")); + mimeTypes.insert(std::pair("mcd", "application/x-mathcad")); + mimeTypes.insert(std::pair("mcf", "text/mcf")); + mimeTypes.insert(std::pair("mcp", "application/netmc")); + mimeTypes.insert(std::pair("me", "application/x-troff-me")); + mimeTypes.insert(std::pair("mht", "message/rfc822")); + mimeTypes.insert(std::pair("mhtml", "message/rfc822")); + mimeTypes.insert(std::pair("mid", "audio/midi")); + mimeTypes.insert(std::pair("midi", "audio/midi")); + mimeTypes.insert(std::pair("mif", "application/x-mif")); + mimeTypes.insert(std::pair("mime", "message/rfc822")); + mimeTypes.insert(std::pair("mjf", "audio/x-vnd.audioexplosion.mjuicemediafile")); + mimeTypes.insert(std::pair("mjpg", "video/x-motion-jpeg")); + mimeTypes.insert(std::pair("mka", "audio/x-matroska")); + mimeTypes.insert(std::pair("mkv", "video/x-matroska")); + mimeTypes.insert(std::pair("mk3d", "video/x-matroska-3d")); + mimeTypes.insert(std::pair("mm", "application/x-meme")); + mimeTypes.insert(std::pair("mme", "application/base64")); + mimeTypes.insert(std::pair("mod", "audio/mod")); + mimeTypes.insert(std::pair("moov", "video/quicktime")); + mimeTypes.insert(std::pair("mov", "video/quicktime")); + mimeTypes.insert(std::pair("movie", "video/x-sgi-movie")); + mimeTypes.insert(std::pair("mp2", "audio/mpeg")); + mimeTypes.insert(std::pair("mp3", "audio/mpeg3")); + mimeTypes.insert(std::pair("mp4", "video/mp4")); + mimeTypes.insert(std::pair("mpa", "audio/mpeg")); + mimeTypes.insert(std::pair("mpc", "application/x-project")); + mimeTypes.insert(std::pair("mpe", "video/mpeg")); + mimeTypes.insert(std::pair("mpeg", "video/mpeg")); + mimeTypes.insert(std::pair("mpg", "video/mpeg")); + mimeTypes.insert(std::pair("mpga", "audio/mpeg")); + mimeTypes.insert(std::pair("mpp", "application/vnd.ms-project")); + mimeTypes.insert(std::pair("mpt", "application/x-project")); + mimeTypes.insert(std::pair("mpv", "application/x-project")); + mimeTypes.insert(std::pair("mpx", "application/x-project")); + mimeTypes.insert(std::pair("mrc", "application/marc")); + mimeTypes.insert(std::pair("ms", "application/x-troff-ms")); + mimeTypes.insert(std::pair("mv", "video/x-sgi-movie")); + mimeTypes.insert(std::pair("my", "audio/make")); + mimeTypes.insert(std::pair("mzz", "application/x-vnd.audioexplosion.mzz")); + mimeTypes.insert(std::pair("nap", "image/naplps")); + mimeTypes.insert(std::pair("naplps", "image/naplps")); + mimeTypes.insert(std::pair("nc", "application/x-netcdf")); + mimeTypes.insert(std::pair("ncm", "application/vnd.nokia.configuration-message")); + mimeTypes.insert(std::pair("nfo", "text/xml")); + mimeTypes.insert(std::pair("nif", "image/x-niff")); + mimeTypes.insert(std::pair("niff", "image/x-niff")); + mimeTypes.insert(std::pair("nix", "application/x-mix-transfer")); + mimeTypes.insert(std::pair("nsc", "application/x-conference")); + mimeTypes.insert(std::pair("nvd", "application/x-navidoc")); + mimeTypes.insert(std::pair("o", "application/octet-stream")); + mimeTypes.insert(std::pair("oda", "application/oda")); + mimeTypes.insert(std::pair("ogg", "audio/ogg")); + mimeTypes.insert(std::pair("omc", "application/x-omc")); + mimeTypes.insert(std::pair("omcd", "application/x-omcdatamaker")); + mimeTypes.insert(std::pair("omcr", "application/x-omcregerator")); + mimeTypes.insert(std::pair("p", "text/x-pascal")); + mimeTypes.insert(std::pair("p10", "application/pkcs10")); + mimeTypes.insert(std::pair("p12", "application/pkcs-12")); + mimeTypes.insert(std::pair("p7a", "application/x-pkcs7-signature")); + mimeTypes.insert(std::pair("p7c", "application/pkcs7-mime")); + mimeTypes.insert(std::pair("p7m", "application/pkcs7-mime")); + mimeTypes.insert(std::pair("p7r", "application/x-pkcs7-certreqresp")); + mimeTypes.insert(std::pair("p7s", "application/pkcs7-signature")); + mimeTypes.insert(std::pair("part", "application/pro_eng")); + mimeTypes.insert(std::pair("pas", "text/pascal")); + mimeTypes.insert(std::pair("pbm", "image/x-portable-bitmap")); + mimeTypes.insert(std::pair("pcl", "application/vnd.hp-pcl")); + mimeTypes.insert(std::pair("pct", "image/x-pict")); + mimeTypes.insert(std::pair("pcx", "image/x-pcx")); + mimeTypes.insert(std::pair("pdb", "chemical/x-pdb")); + mimeTypes.insert(std::pair("pdf", "application/pdf")); + mimeTypes.insert(std::pair("pfunk", "audio/make.my.funk")); + mimeTypes.insert(std::pair("pgm", "image/x-portable-greymap")); + mimeTypes.insert(std::pair("pic", "image/pict")); + mimeTypes.insert(std::pair("pict", "image/pict")); + mimeTypes.insert(std::pair("pkg", "application/x-newton-compatible-pkg")); + mimeTypes.insert(std::pair("pko", "application/vnd.ms-pki.pko")); + mimeTypes.insert(std::pair("pl", "text/x-script.perl")); + mimeTypes.insert(std::pair("plx", "application/x-pixclscript")); + mimeTypes.insert(std::pair("pm", "text/x-script.perl-module")); + mimeTypes.insert(std::pair("pm4", "application/x-pagemaker")); + mimeTypes.insert(std::pair("pm5", "application/x-pagemaker")); + mimeTypes.insert(std::pair("png", "image/png")); + mimeTypes.insert(std::pair("pnm", "application/x-portable-anymap")); + mimeTypes.insert(std::pair("pot", "application/vnd.ms-powerpoint")); + mimeTypes.insert(std::pair("pov", "model/x-pov")); + mimeTypes.insert(std::pair("ppa", "application/vnd.ms-powerpoint")); + mimeTypes.insert(std::pair("ppm", "image/x-portable-pixmap")); + mimeTypes.insert(std::pair("pps", "application/mspowerpoint")); + mimeTypes.insert(std::pair("ppt", "application/mspowerpoint")); + mimeTypes.insert(std::pair("ppz", "application/mspowerpoint")); + mimeTypes.insert(std::pair("pre", "application/x-freelance")); + mimeTypes.insert(std::pair("prt", "application/pro_eng")); + mimeTypes.insert(std::pair("ps", "application/postscript")); + mimeTypes.insert(std::pair("psd", "application/octet-stream")); + mimeTypes.insert(std::pair("pvu", "paleovu/x-pv")); + mimeTypes.insert(std::pair("pwz", "application/vnd.ms-powerpoint")); + mimeTypes.insert(std::pair("py", "text/x-script.phyton")); + mimeTypes.insert(std::pair("pyc", "applicaiton/x-bytecode.python")); + mimeTypes.insert(std::pair("qcp", "audio/vnd.qcelp")); + mimeTypes.insert(std::pair("qd3", "x-world/x-3dmf")); + mimeTypes.insert(std::pair("qd3d", "x-world/x-3dmf")); + mimeTypes.insert(std::pair("qif", "image/x-quicktime")); + mimeTypes.insert(std::pair("qt", "video/quicktime")); + mimeTypes.insert(std::pair("qtc", "video/x-qtc")); + mimeTypes.insert(std::pair("qti", "image/x-quicktime")); + mimeTypes.insert(std::pair("qtif", "image/x-quicktime")); + mimeTypes.insert(std::pair("ra", "audio/x-realaudio")); + mimeTypes.insert(std::pair("ram", "audio/x-pn-realaudio")); + mimeTypes.insert(std::pair("ras", "image/cmu-raster")); + mimeTypes.insert(std::pair("rast", "image/cmu-raster")); + mimeTypes.insert(std::pair("rexx", "text/x-script.rexx")); + mimeTypes.insert(std::pair("rf", "image/vnd.rn-realflash")); + mimeTypes.insert(std::pair("rgb", "image/x-rgb")); + mimeTypes.insert(std::pair("rm", "audio/x-pn-realaudio")); + mimeTypes.insert(std::pair("rmi", "audio/mid")); + mimeTypes.insert(std::pair("rmm", "audio/x-pn-realaudio")); + mimeTypes.insert(std::pair("rmp", "audio/x-pn-realaudio")); + mimeTypes.insert(std::pair("rng", "application/ringing-tones")); + mimeTypes.insert(std::pair("rnx", "application/vnd.rn-realplayer")); + mimeTypes.insert(std::pair("roff", "application/x-troff")); + mimeTypes.insert(std::pair("rp", "image/vnd.rn-realpix")); + mimeTypes.insert(std::pair("rpm", "audio/x-pn-realaudio-plugin")); + mimeTypes.insert(std::pair("rt", "text/richtext")); + mimeTypes.insert(std::pair("rtf", "text/richtext")); + mimeTypes.insert(std::pair("rtx", "text/richtext")); + mimeTypes.insert(std::pair("rv", "video/vnd.rn-realvideo")); + mimeTypes.insert(std::pair("s", "text/x-asm")); + mimeTypes.insert(std::pair("s3m", "audio/s3m")); + mimeTypes.insert(std::pair("saveme", "application/octet-stream")); + mimeTypes.insert(std::pair("sbk", "application/x-tbook")); + mimeTypes.insert(std::pair("scm", "video/x-scm")); + mimeTypes.insert(std::pair("sdml", "text/plain")); + mimeTypes.insert(std::pair("sdp", "application/sdp")); + mimeTypes.insert(std::pair("sdr", "application/sounder")); + mimeTypes.insert(std::pair("sea", "application/sea")); + mimeTypes.insert(std::pair("set", "application/set")); + mimeTypes.insert(std::pair("sgm", "text/sgml")); + mimeTypes.insert(std::pair("sgml", "text/sgml")); + mimeTypes.insert(std::pair("sh", "text/x-script.sh")); + mimeTypes.insert(std::pair("shar", "application/x-bsh")); + mimeTypes.insert(std::pair("shtml", "text/html")); + mimeTypes.insert(std::pair("shtml", "text/x-server-parsed-html")); + mimeTypes.insert(std::pair("sid", "audio/x-psid")); + mimeTypes.insert(std::pair("sit", "application/x-sit")); + mimeTypes.insert(std::pair("sit", "application/x-stuffit")); + mimeTypes.insert(std::pair("skd", "application/x-koan")); + mimeTypes.insert(std::pair("skm", "application/x-koan")); + mimeTypes.insert(std::pair("skp", "application/x-koan")); + mimeTypes.insert(std::pair("skt", "application/x-koan")); + mimeTypes.insert(std::pair("sl", "application/x-seelogo")); + mimeTypes.insert(std::pair("smi", "application/smil")); + mimeTypes.insert(std::pair("smil", "application/smil")); + mimeTypes.insert(std::pair("snd", "audio/basic")); + mimeTypes.insert(std::pair("sol", "application/solids")); + mimeTypes.insert(std::pair("spc", "text/x-speech")); + mimeTypes.insert(std::pair("spl", "application/futuresplash")); + mimeTypes.insert(std::pair("spr", "application/x-sprite")); + mimeTypes.insert(std::pair("sprite", "application/x-sprite")); + mimeTypes.insert(std::pair("src", "application/x-wais-source")); + mimeTypes.insert(std::pair("ssi", "text/x-server-parsed-html")); + mimeTypes.insert(std::pair("ssm", "application/streamingmedia")); + mimeTypes.insert(std::pair("sst", "application/vnd.ms-pki.certstore")); + mimeTypes.insert(std::pair("step", "application/step")); + mimeTypes.insert(std::pair("stl", "application/sla")); + mimeTypes.insert(std::pair("stp", "application/step")); + mimeTypes.insert(std::pair("sv4cpio", "application/x-sv4cpio")); + mimeTypes.insert(std::pair("sv4crc", "application/x-sv4crc")); + mimeTypes.insert(std::pair("svf", "image/vnd.dwg")); + mimeTypes.insert(std::pair("svr", "application/x-world")); + mimeTypes.insert(std::pair("swf", "application/x-shockwave-flash")); + mimeTypes.insert(std::pair("t", "application/x-troff")); + mimeTypes.insert(std::pair("talk", "text/x-speech")); + mimeTypes.insert(std::pair("tar", "application/x-tar")); + mimeTypes.insert(std::pair("tbk", "application/toolbook")); + mimeTypes.insert(std::pair("tcl", "text/x-script.tcl")); + mimeTypes.insert(std::pair("tcsh", "text/x-script.tcsh")); + mimeTypes.insert(std::pair("tex", "application/x-tex")); + mimeTypes.insert(std::pair("texi", "application/x-texinfo")); + mimeTypes.insert(std::pair("texinfo", "application/x-texinfo")); + mimeTypes.insert(std::pair("text", "text/plain")); + mimeTypes.insert(std::pair("tgz", "application/x-compressed")); + mimeTypes.insert(std::pair("tif", "image/tiff")); + mimeTypes.insert(std::pair("tiff", "image/tiff")); + mimeTypes.insert(std::pair("tr", "application/x-troff")); + mimeTypes.insert(std::pair("ts", "video/mp2t")); + mimeTypes.insert(std::pair("tsi", "audio/tsp-audio")); + mimeTypes.insert(std::pair("tsp", "audio/tsplayer")); + mimeTypes.insert(std::pair("tsv", "text/tab-separated-values")); + mimeTypes.insert(std::pair("turbot", "image/florian")); + mimeTypes.insert(std::pair("txt", "text/plain")); + mimeTypes.insert(std::pair("uil", "text/x-uil")); + mimeTypes.insert(std::pair("uni", "text/uri-list")); + mimeTypes.insert(std::pair("unis", "text/uri-list")); + mimeTypes.insert(std::pair("unv", "application/i-deas")); + mimeTypes.insert(std::pair("uri", "text/uri-list")); + mimeTypes.insert(std::pair("uris", "text/uri-list")); + mimeTypes.insert(std::pair("ustar", "application/x-ustar")); + mimeTypes.insert(std::pair("uu", "text/x-uuencode")); + mimeTypes.insert(std::pair("uue", "text/x-uuencode")); + mimeTypes.insert(std::pair("vcd", "application/x-cdlink")); + mimeTypes.insert(std::pair("vcs", "text/x-vcalendar")); + mimeTypes.insert(std::pair("vda", "application/vda")); + mimeTypes.insert(std::pair("vdo", "video/vdo")); + mimeTypes.insert(std::pair("vew", "application/groupwise")); + mimeTypes.insert(std::pair("viv", "video/vivo")); + mimeTypes.insert(std::pair("vivo", "video/vivo")); + mimeTypes.insert(std::pair("vmd", "application/vocaltec-media-desc")); + mimeTypes.insert(std::pair("vmf", "application/vocaltec-media-file")); + mimeTypes.insert(std::pair("voc", "audio/voc")); + mimeTypes.insert(std::pair("vos", "video/vosaic")); + mimeTypes.insert(std::pair("vox", "audio/voxware")); + mimeTypes.insert(std::pair("vqe", "audio/x-twinvq-plugin")); + mimeTypes.insert(std::pair("vqf", "audio/x-twinvq")); + mimeTypes.insert(std::pair("vql", "audio/x-twinvq-plugin")); + mimeTypes.insert(std::pair("vrml", "application/x-vrml")); + mimeTypes.insert(std::pair("vrt", "x-world/x-vrt")); + mimeTypes.insert(std::pair("vsd", "application/x-visio")); + mimeTypes.insert(std::pair("vst", "application/x-visio")); + mimeTypes.insert(std::pair("vsw", "application/x-visio")); + mimeTypes.insert(std::pair("w60", "application/wordperfect6.0")); + mimeTypes.insert(std::pair("w61", "application/wordperfect6.1")); + mimeTypes.insert(std::pair("w6w", "application/msword")); + mimeTypes.insert(std::pair("wav", "audio/wav")); + mimeTypes.insert(std::pair("wb1", "application/x-qpro")); + mimeTypes.insert(std::pair("wbmp", "image/vnd.wap.wbmp")); + mimeTypes.insert(std::pair("web", "application/vnd.xara")); + mimeTypes.insert(std::pair("wiz", "application/msword")); + mimeTypes.insert(std::pair("wk1", "application/x-123")); + mimeTypes.insert(std::pair("wma", "audio/x-ms-wma")); + mimeTypes.insert(std::pair("wmf", "windows/metafile")); + mimeTypes.insert(std::pair("wml", "text/vnd.wap.wml")); + mimeTypes.insert(std::pair("wmlc", "application/vnd.wap.wmlc")); + mimeTypes.insert(std::pair("wmls", "text/vnd.wap.wmlscript")); + mimeTypes.insert(std::pair("wmlsc", "application/vnd.wap.wmlscriptc")); + mimeTypes.insert(std::pair("wmv", "video/x-ms-wmv")); + mimeTypes.insert(std::pair("word", "application/msword")); + mimeTypes.insert(std::pair("wp", "application/wordperfect")); + mimeTypes.insert(std::pair("wp5", "application/wordperfect")); + mimeTypes.insert(std::pair("wp6", "application/wordperfect")); + mimeTypes.insert(std::pair("wpd", "application/wordperfect")); + mimeTypes.insert(std::pair("wq1", "application/x-lotus")); + mimeTypes.insert(std::pair("wri", "application/mswrite")); + mimeTypes.insert(std::pair("wrl", "model/vrml")); + mimeTypes.insert(std::pair("wrz", "model/vrml")); + mimeTypes.insert(std::pair("wsc", "text/scriplet")); + mimeTypes.insert(std::pair("wsrc", "application/x-wais-source")); + mimeTypes.insert(std::pair("wtk", "application/x-wintalk")); + mimeTypes.insert(std::pair("xbm", "image/xbm")); + mimeTypes.insert(std::pair("xdr", "video/x-amt-demorun")); + mimeTypes.insert(std::pair("xgz", "xgl/drawing")); + mimeTypes.insert(std::pair("xif", "image/vnd.xiff")); + mimeTypes.insert(std::pair("xl", "application/excel")); + mimeTypes.insert(std::pair("xla", "application/excel")); + mimeTypes.insert(std::pair("xlb", "application/excel")); + mimeTypes.insert(std::pair("xlc", "application/excel")); + mimeTypes.insert(std::pair("xld", "application/excel")); + mimeTypes.insert(std::pair("xlk", "application/excel")); + mimeTypes.insert(std::pair("xll", "application/excel")); + mimeTypes.insert(std::pair("xlm", "application/excel")); + mimeTypes.insert(std::pair("xls", "application/excel")); + mimeTypes.insert(std::pair("xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")); + mimeTypes.insert(std::pair("xlt", "application/excel")); + mimeTypes.insert(std::pair("xlv", "application/excel")); + mimeTypes.insert(std::pair("xlw", "application/excel")); + mimeTypes.insert(std::pair("xm", "audio/xm")); + mimeTypes.insert(std::pair("xml", "text/xml")); + mimeTypes.insert(std::pair("xmz", "xgl/movie")); + mimeTypes.insert(std::pair("xpix", "application/x-vnd.ls-xpix")); + mimeTypes.insert(std::pair("xpm", "image/xpm")); + mimeTypes.insert(std::pair("x-png", "image/png")); + mimeTypes.insert(std::pair("xsr", "video/x-amt-showrun")); + mimeTypes.insert(std::pair("xvid", "video/x-msvideo")); + mimeTypes.insert(std::pair("xwd", "image/x-xwd")); + mimeTypes.insert(std::pair("xyz", "chemical/x-pdb")); + mimeTypes.insert(std::pair("z", "application/x-compressed")); + mimeTypes.insert(std::pair("zip", "application/zip")); + mimeTypes.insert(std::pair("zoo", "application/octet-stream")); + mimeTypes.insert(std::pair("zsh", "text/x-script.zsh")); return mimeTypes; } -map CMime::m_mimetypes = fillMimeTypes(); +std::map CMime::m_mimetypes = fillMimeTypes(); -string CMime::GetMimeType(const string &extension) +std::string CMime::GetMimeType(const std::string &extension) { if (extension.empty()) return ""; - string ext = extension; + std::string ext = extension; size_t posNotPoint = ext.find_first_not_of('.'); - if (posNotPoint != string::npos && posNotPoint > 0) + if (posNotPoint != std::string::npos && posNotPoint > 0) ext = extension.substr(posNotPoint); transform(ext.begin(), ext.end(), ext.begin(), ::tolower); - map::const_iterator it = m_mimetypes.find(ext); + std::map::const_iterator it = m_mimetypes.find(ext); if (it != m_mimetypes.end()) return it->second; return ""; } -string CMime::GetMimeType(const CFileItem &item) +std::string CMime::GetMimeType(const CFileItem &item) { std::string path = item.GetPath(); if (item.HasVideoInfoTag() && !item.GetVideoInfoTag()->GetPath().empty()) @@ -539,7 +537,7 @@ string CMime::GetMimeType(const CFileItem &item) return GetMimeType(URIUtils::GetExtension(path)); } -string CMime::GetMimeType(const CURL &url, bool lookup) +std::string CMime::GetMimeType(const CURL &url, bool lookup) { std::string strMimeType; diff --git a/xbmc/utils/Observer.cpp b/xbmc/utils/Observer.cpp index 6fb4fd5a958a3..237608aceda3f 100644 --- a/xbmc/utils/Observer.cpp +++ b/xbmc/utils/Observer.cpp @@ -24,8 +24,6 @@ #include -using namespace std; - Observer::~Observer(void) { StopObserving(); @@ -55,7 +53,7 @@ void Observer::RegisterObservable(Observable *obs) void Observer::UnregisterObservable(Observable *obs) { CSingleLock lock(m_obsCritSection); - vector::iterator it = find(m_observables.begin(), m_observables.end(), obs); + std::vector::iterator it = find(m_observables.begin(), m_observables.end(), obs); if (it != m_observables.end()) m_observables.erase(it); } @@ -109,7 +107,7 @@ void Observable::RegisterObserver(Observer *obs) void Observable::UnregisterObserver(Observer *obs) { CSingleLock lock(m_obsCritSection); - vector::iterator it = find(m_observers.begin(), m_observers.end(), obs); + std::vector::iterator it = find(m_observers.begin(), m_observers.end(), obs); if (it != m_observers.end()) { obs->UnregisterObservable(this); diff --git a/xbmc/utils/PerformanceSample.cpp b/xbmc/utils/PerformanceSample.cpp index deda565076c0f..e2114eeb96996 100644 --- a/xbmc/utils/PerformanceSample.cpp +++ b/xbmc/utils/PerformanceSample.cpp @@ -32,11 +32,9 @@ #include "PerformanceStats.h" #endif -using namespace std; - int64_t CPerformanceSample::m_tmFreq; -CPerformanceSample::CPerformanceSample(const string &statName, bool bCheckWhenDone) : m_statName(statName) +CPerformanceSample::CPerformanceSample(const std::string &statName, bool bCheckWhenDone) : m_statName(statName) { m_bCheckWhenDone = bCheckWhenDone; if (m_tmFreq == 0LL) diff --git a/xbmc/utils/PerformanceStats.cpp b/xbmc/utils/PerformanceStats.cpp index 5ef8cadadfdb5..ed648245fdfde 100644 --- a/xbmc/utils/PerformanceStats.cpp +++ b/xbmc/utils/PerformanceStats.cpp @@ -22,8 +22,6 @@ #include "PerformanceSample.h" #include "log.h" -using namespace std; - CPerformanceStats::CPerformanceStats() { } @@ -31,7 +29,7 @@ CPerformanceStats::CPerformanceStats() CPerformanceStats::~CPerformanceStats() { - map::iterator iter = m_mapStats.begin(); + std::map::iterator iter = m_mapStats.begin(); while (iter != m_mapStats.end()) { delete iter->second; @@ -40,9 +38,9 @@ CPerformanceStats::~CPerformanceStats() m_mapStats.clear(); } -void CPerformanceStats::AddSample(const string &strStatName, const PerformanceCounter &perf) +void CPerformanceStats::AddSample(const std::string &strStatName, const PerformanceCounter &perf) { - map::iterator iter = m_mapStats.find(strStatName); + std::map::iterator iter = m_mapStats.find(strStatName); if (iter == m_mapStats.end()) m_mapStats[strStatName] = new PerformanceCounter(perf); else @@ -52,7 +50,7 @@ void CPerformanceStats::AddSample(const string &strStatName, const PerformanceCo } } -void CPerformanceStats::AddSample(const string &strStatName, double dTime) +void CPerformanceStats::AddSample(const std::string &strStatName, double dTime) { AddSample(strStatName, PerformanceCounter(dTime)); } @@ -63,7 +61,7 @@ void CPerformanceStats::DumpStats() CLog::Log(LOGINFO, "%s - estimated error: %f", __FUNCTION__, dError); CLog::Log(LOGINFO, "%s - ignore user/sys values when sample count is low", __FUNCTION__); - map::iterator iter = m_mapStats.begin(); + std::map::iterator iter = m_mapStats.begin(); while (iter != m_mapStats.end()) { double dAvg = iter->second->m_time / (double)iter->second->m_samples; diff --git a/xbmc/utils/ProgressJob.cpp b/xbmc/utils/ProgressJob.cpp index 2d164ac9ccc2c..faa0d5c4bbbda 100644 --- a/xbmc/utils/ProgressJob.cpp +++ b/xbmc/utils/ProgressJob.cpp @@ -26,8 +26,6 @@ #include "guilib/GUIWindowManager.h" #include "utils/Variant.h" -using namespace std; - CProgressJob::CProgressJob() : m_modal(false), m_autoClose(true), diff --git a/xbmc/utils/RssManager.cpp b/xbmc/utils/RssManager.cpp index ca646b8cb1b92..12218df785d8b 100644 --- a/xbmc/utils/RssManager.cpp +++ b/xbmc/utils/RssManager.cpp @@ -33,7 +33,6 @@ #include "utils/StringUtils.h" #include "utils/Variant.h" -using namespace std; using namespace XFILE; CRssManager::CRssManager() @@ -102,7 +101,7 @@ void CRssManager::Stop() bool CRssManager::Load() { CSingleLock lock(m_critical); - string rssXML = CProfilesManager::GetInstance().GetUserDataItem("RssFeeds.xml"); + std::string rssXML = CProfilesManager::GetInstance().GetUserDataItem("RssFeeds.xml"); if (!CFile::Exists(rssXML)) return false; @@ -143,14 +142,14 @@ bool CRssManager::Load() { // TODO: UTF-8: Do these URLs need to be converted to UTF-8? // What about the xml encoding? - string strUrl = pFeed->FirstChild()->ValueStr(); + std::string strUrl = pFeed->FirstChild()->ValueStr(); set.url.push_back(strUrl); set.interval.push_back(iInterval); } pFeed = pFeed->NextSiblingElement("feed"); } - m_mapRssUrls.insert(make_pair(iId,set)); + m_mapRssUrls.insert(std::make_pair(iId,set)); } else CLog::Log(LOGERROR, "CRssManager: found rss url set with no id in RssFeeds.xml, ignored"); diff --git a/xbmc/utils/RssReader.cpp b/xbmc/utils/RssReader.cpp index a11feeeead30f..5a07ab06ae955 100644 --- a/xbmc/utils/RssReader.cpp +++ b/xbmc/utils/RssReader.cpp @@ -40,7 +40,6 @@ #define RSS_COLOR_HEADLINE 1 #define RSS_COLOR_CHANNEL 2 -using namespace std; using namespace XFILE; ////////////////////////////////////////////////////////////////////// @@ -66,7 +65,7 @@ CRssReader::~CRssReader() delete m_vecTimeStamps[i]; } -void CRssReader::Create(IRssObserver* aObserver, const vector& aUrls, const vector ×, int spacesBetweenFeeds, bool rtl) +void CRssReader::Create(IRssObserver* aObserver, const std::vector& aUrls, const std::vector ×, int spacesBetweenFeeds, bool rtl) { CSingleLock lock(m_critical); @@ -257,9 +256,9 @@ void CRssReader::GetNewsItems(TiXmlElement* channelXmlNode, int iFeed) HTML::CHTMLUtil html; TiXmlElement * itemNode = channelXmlNode->FirstChildElement("item"); - map mTagElements; - typedef pair StrPair; - list ::iterator i; + std::map mTagElements; + typedef std::pair StrPair; + std::list::iterator i; // Add the title tag in if we didn't pass any tags in at all // Represents default behaviour before configurability @@ -303,7 +302,7 @@ void CRssReader::GetNewsItems(TiXmlElement* channelXmlNode, int iFeed) int rsscolour = RSS_COLOR_HEADLINE; for (i = m_tagSet.begin(); i != m_tagSet.end(); ++i) { - map ::iterator j = mTagElements.find(*i); + std::map::iterator j = mTagElements.find(*i); if (j == mTagElements.end()) continue; diff --git a/xbmc/utils/ScraperParser.cpp b/xbmc/utils/ScraperParser.cpp index 353ec158ab99b..7a0fb46a0c592 100644 --- a/xbmc/utils/ScraperParser.cpp +++ b/xbmc/utils/ScraperParser.cpp @@ -33,7 +33,6 @@ #include #include -using namespace std; using namespace ADDON; using namespace XFILE; @@ -578,7 +577,7 @@ void CScraperParser::GetBufferParams(bool* result, const char* attribute, bool d result[iBuf] = defvalue; if (attribute) { - vector vecBufs; + std::vector vecBufs; StringUtils::Tokenize(attribute,vecBufs,","); for (size_t nToken=0; nToken < vecBufs.size(); nToken++) { diff --git a/xbmc/utils/ScraperUrl.cpp b/xbmc/utils/ScraperUrl.cpp index 685ac0d7d1f0d..db3671110d285 100644 --- a/xbmc/utils/ScraperUrl.cpp +++ b/xbmc/utils/ScraperUrl.cpp @@ -35,8 +35,6 @@ #include #include -using namespace std; - CScraperUrl::CScraperUrl(const std::string& strUrl) { relevance = 0; @@ -78,7 +76,7 @@ bool CScraperUrl::ParseElement(const TiXmlElement* element) if (!element || !element->FirstChild() || !element->FirstChild()->Value()) return false; - stringstream stream; + std::stringstream stream; stream << *element; m_xml += stream.str(); @@ -150,7 +148,7 @@ bool CScraperUrl::ParseString(std::string strUrl) const CScraperUrl::SUrlEntry CScraperUrl::GetFirstThumb(const std::string &type) const { - for (vector::const_iterator iter=m_url.begin();iter != m_url.end();++iter) + for (std::vector::const_iterator iter=m_url.begin();iter != m_url.end();++iter) { if (iter->m_type == URL_TYPE_GENERAL && (type.empty() || type == "thumb" || iter->m_aspect == type)) return *iter; @@ -166,7 +164,7 @@ const CScraperUrl::SUrlEntry CScraperUrl::GetFirstThumb(const std::string &type) const CScraperUrl::SUrlEntry CScraperUrl::GetSeasonThumb(int season, const std::string &type) const { - for (vector::const_iterator iter=m_url.begin();iter != m_url.end();++iter) + for (std::vector::const_iterator iter=m_url.begin();iter != m_url.end();++iter) { if (iter->m_type == URL_TYPE_SEASON && iter->m_season == season && (type.empty() || type == "thumb" || iter->m_aspect == type)) @@ -184,7 +182,7 @@ const CScraperUrl::SUrlEntry CScraperUrl::GetSeasonThumb(int season, const std:: unsigned int CScraperUrl::GetMaxSeasonThumb() const { unsigned int maxSeason = 0; - for (vector::const_iterator iter=m_url.begin();iter != m_url.end();++iter) + for (std::vector::const_iterator iter=m_url.begin();iter != m_url.end();++iter) { if (iter->m_type == URL_TYPE_SEASON && iter->m_season > 0 && (unsigned int)iter->m_season > maxSeason) maxSeason = iter->m_season; @@ -351,7 +349,7 @@ std::string CScraperUrl::GetThumbURL(const CScraperUrl::SUrlEntry &entry) void CScraperUrl::GetThumbURLs(std::vector &thumbs, const std::string &type, int season) const { - for (vector::const_iterator iter = m_url.begin(); iter != m_url.end(); ++iter) + for (std::vector::const_iterator iter = m_url.begin(); iter != m_url.end(); ++iter) { if (iter->m_aspect == type || type.empty() || type == "thumb" || iter->m_aspect.empty()) { diff --git a/xbmc/utils/Screenshot.cpp b/xbmc/utils/Screenshot.cpp index 261edb3dd5f26..0d2f74c97545e 100644 --- a/xbmc/utils/Screenshot.cpp +++ b/xbmc/utils/Screenshot.cpp @@ -56,7 +56,6 @@ #include "utils/ScreenshotAML.h" #endif -using namespace std; using namespace XFILE; CScreenshotSurface::CScreenshotSurface() @@ -256,7 +255,7 @@ void CScreenShot::TakeScreenshot(const std::string &filename, bool sync) void CScreenShot::TakeScreenshot() { static bool savingScreenshots = false; - static vector screenShots; + static std::vector screenShots; bool promptUser = false; std::string strDir; diff --git a/xbmc/utils/SortUtils.cpp b/xbmc/utils/SortUtils.cpp index 2e7e656aeb7ae..397eab3fdadc8 100644 --- a/xbmc/utils/SortUtils.cpp +++ b/xbmc/utils/SortUtils.cpp @@ -29,11 +29,9 @@ #include -using namespace std; - -string ArrayToString(SortAttribute attributes, const CVariant &variant, const string &seperator = " / ") +std::string ArrayToString(SortAttribute attributes, const CVariant &variant, const std::string &seperator = " / ") { - vector strArray; + std::vector strArray; if (variant.isArray()) { for (CVariant::const_iterator_array it = variant.begin_array(); it != variant.end_array(); it++) @@ -57,7 +55,7 @@ string ArrayToString(SortAttribute attributes, const CVariant &variant, const st return ""; } -string ByLabel(SortAttribute attributes, const SortItem &values) +std::string ByLabel(SortAttribute attributes, const SortItem &values) { if (attributes & SortAttributeIgnoreArticle) return SortUtils::RemoveArticles(values.at(FieldLabel).asString()); @@ -65,49 +63,49 @@ string ByLabel(SortAttribute attributes, const SortItem &values) return values.at(FieldLabel).asString(); } -string ByFile(SortAttribute attributes, const SortItem &values) +std::string ByFile(SortAttribute attributes, const SortItem &values) { CURL url(values.at(FieldPath).asString()); return StringUtils::Format("%s %" PRId64, url.GetFileNameWithoutPath().c_str(), values.at(FieldStartOffset).asInteger()); } -string ByPath(SortAttribute attributes, const SortItem &values) +std::string ByPath(SortAttribute attributes, const SortItem &values) { return StringUtils::Format("%s %" PRId64, values.at(FieldPath).asString().c_str(), values.at(FieldStartOffset).asInteger()); } -string ByLastPlayed(SortAttribute attributes, const SortItem &values) +std::string ByLastPlayed(SortAttribute attributes, const SortItem &values) { return StringUtils::Format("%s %s", values.at(FieldLastPlayed).asString().c_str(), ByLabel(attributes, values).c_str()); } -string ByPlaycount(SortAttribute attributes, const SortItem &values) +std::string ByPlaycount(SortAttribute attributes, const SortItem &values) { return StringUtils::Format("%i %s", (int)values.at(FieldPlaycount).asInteger(), ByLabel(attributes, values).c_str()); } -string ByDate(SortAttribute attributes, const SortItem &values) +std::string ByDate(SortAttribute attributes, const SortItem &values) { return values.at(FieldDate).asString() + " " + ByLabel(attributes, values); } -string ByDateAdded(SortAttribute attributes, const SortItem &values) +std::string ByDateAdded(SortAttribute attributes, const SortItem &values) { return StringUtils::Format("%s %d", values.at(FieldDateAdded).asString().c_str(), (int)values.at(FieldId).asInteger()); } -string BySize(SortAttribute attributes, const SortItem &values) +std::string BySize(SortAttribute attributes, const SortItem &values) { return StringUtils::Format("%" PRId64, values.at(FieldSize).asInteger()); } -string ByDriveType(SortAttribute attributes, const SortItem &values) +std::string ByDriveType(SortAttribute attributes, const SortItem &values) { return StringUtils::Format("%d %s", (int)values.at(FieldDriveType).asInteger(), ByLabel(attributes, values).c_str()); } -string ByTitle(SortAttribute attributes, const SortItem &values) +std::string ByTitle(SortAttribute attributes, const SortItem &values) { if (attributes & SortAttributeIgnoreArticle) return SortUtils::RemoveArticles(values.at(FieldTitle).asString()); @@ -115,9 +113,9 @@ string ByTitle(SortAttribute attributes, const SortItem &values) return values.at(FieldTitle).asString(); } -string ByAlbum(SortAttribute attributes, const SortItem &values) +std::string ByAlbum(SortAttribute attributes, const SortItem &values) { - string album = values.at(FieldAlbum).asString(); + std::string album = values.at(FieldAlbum).asString(); if (attributes & SortAttributeIgnoreArticle) album = SortUtils::RemoveArticles(album); @@ -130,12 +128,12 @@ string ByAlbum(SortAttribute attributes, const SortItem &values) return label; } -string ByAlbumType(SortAttribute attributes, const SortItem &values) +std::string ByAlbumType(SortAttribute attributes, const SortItem &values) { return values.at(FieldAlbumType).asString() + " " + ByLabel(attributes, values); } -string ByArtist(SortAttribute attributes, const SortItem &values) +std::string ByArtist(SortAttribute attributes, const SortItem &values) { std::string label = ArrayToString(attributes, values.at(FieldArtist)); @@ -150,7 +148,7 @@ string ByArtist(SortAttribute attributes, const SortItem &values) return label; } -string ByArtistThenYear(SortAttribute attributes, const SortItem &values) +std::string ByArtistThenYear(SortAttribute attributes, const SortItem &values) { std::string label = ArrayToString(attributes, values.at(FieldArtist)); @@ -169,12 +167,12 @@ string ByArtistThenYear(SortAttribute attributes, const SortItem &values) return label; } -string ByTrackNumber(SortAttribute attributes, const SortItem &values) +std::string ByTrackNumber(SortAttribute attributes, const SortItem &values) { return StringUtils::Format("%i", (int)values.at(FieldTrackNumber).asInteger()); } -string ByTime(SortAttribute attributes, const SortItem &values) +std::string ByTime(SortAttribute attributes, const SortItem &values) { std::string label; const CVariant &time = values.at(FieldTime); @@ -185,28 +183,28 @@ string ByTime(SortAttribute attributes, const SortItem &values) return label; } -string ByProgramCount(SortAttribute attributes, const SortItem &values) +std::string ByProgramCount(SortAttribute attributes, const SortItem &values) { return StringUtils::Format("%i", (int)values.at(FieldProgramCount).asInteger()); } -string ByPlaylistOrder(SortAttribute attributes, const SortItem &values) +std::string ByPlaylistOrder(SortAttribute attributes, const SortItem &values) { // TODO: Playlist order is hacked into program count variable (not nice, but ok until 2.0) return ByProgramCount(attributes, values); } -string ByGenre(SortAttribute attributes, const SortItem &values) +std::string ByGenre(SortAttribute attributes, const SortItem &values) { return ArrayToString(attributes, values.at(FieldGenre)); } -string ByCountry(SortAttribute attributes, const SortItem &values) +std::string ByCountry(SortAttribute attributes, const SortItem &values) { return ArrayToString(attributes, values.at(FieldCountry)); } -string ByYear(SortAttribute attributes, const SortItem &values) +std::string ByYear(SortAttribute attributes, const SortItem &values) { std::string label; const CVariant &airDate = values.at(FieldAirDate); @@ -228,9 +226,9 @@ string ByYear(SortAttribute attributes, const SortItem &values) return label; } -string BySortTitle(SortAttribute attributes, const SortItem &values) +std::string BySortTitle(SortAttribute attributes, const SortItem &values) { - string title = values.at(FieldSortTitle).asString(); + std::string title = values.at(FieldSortTitle).asString(); if (title.empty()) title = values.at(FieldTitle).asString(); @@ -240,32 +238,32 @@ string BySortTitle(SortAttribute attributes, const SortItem &values) return title; } -string ByRating(SortAttribute attributes, const SortItem &values) +std::string ByRating(SortAttribute attributes, const SortItem &values) { return StringUtils::Format("%f %s", values.at(FieldRating).asFloat(), ByLabel(attributes, values).c_str()); } -string ByVotes(SortAttribute attributes, const SortItem &values) +std::string ByVotes(SortAttribute attributes, const SortItem &values) { return StringUtils::Format("%d %s", (int)values.at(FieldVotes).asInteger(), ByLabel(attributes, values).c_str()); } -string ByTop250(SortAttribute attributes, const SortItem &values) +std::string ByTop250(SortAttribute attributes, const SortItem &values) { return StringUtils::Format("%d %s", (int)values.at(FieldTop250).asInteger(), ByLabel(attributes, values).c_str()); } -string ByMPAA(SortAttribute attributes, const SortItem &values) +std::string ByMPAA(SortAttribute attributes, const SortItem &values) { return values.at(FieldMPAA).asString() + " " + ByLabel(attributes, values); } -string ByStudio(SortAttribute attributes, const SortItem &values) +std::string ByStudio(SortAttribute attributes, const SortItem &values) { return ArrayToString(attributes, values.at(FieldStudio)); } -string ByEpisodeNumber(SortAttribute attributes, const SortItem &values) +std::string ByEpisodeNumber(SortAttribute attributes, const SortItem &values) { // we calculate an offset number based on the episode's // sort season and episode values. in addition @@ -293,7 +291,7 @@ string ByEpisodeNumber(SortAttribute attributes, const SortItem &values) return StringUtils::Format("%" PRIu64" %s", num, title.c_str()); } -string BySeason(SortAttribute attributes, const SortItem &values) +std::string BySeason(SortAttribute attributes, const SortItem &values) { int season = (int)values.at(FieldSeason).asInteger(); const CVariant &specialSeason = values.at(FieldSeasonSpecialSort); @@ -303,92 +301,92 @@ string BySeason(SortAttribute attributes, const SortItem &values) return StringUtils::Format("%i %s", season, ByLabel(attributes, values).c_str()); } -string ByNumberOfEpisodes(SortAttribute attributes, const SortItem &values) +std::string ByNumberOfEpisodes(SortAttribute attributes, const SortItem &values) { return StringUtils::Format("%i %s", (int)values.at(FieldNumberOfEpisodes).asInteger(), ByLabel(attributes, values).c_str()); } -string ByNumberOfWatchedEpisodes(SortAttribute attributes, const SortItem &values) +std::string ByNumberOfWatchedEpisodes(SortAttribute attributes, const SortItem &values) { return StringUtils::Format("%i %s", (int)values.at(FieldNumberOfWatchedEpisodes).asInteger(), ByLabel(attributes, values).c_str()); } -string ByTvShowStatus(SortAttribute attributes, const SortItem &values) +std::string ByTvShowStatus(SortAttribute attributes, const SortItem &values) { return values.at(FieldTvShowStatus).asString() + " " + ByLabel(attributes, values); } -string ByTvShowTitle(SortAttribute attributes, const SortItem &values) +std::string ByTvShowTitle(SortAttribute attributes, const SortItem &values) { return values.at(FieldTvShowTitle).asString() + " " + ByLabel(attributes, values); } -string ByProductionCode(SortAttribute attributes, const SortItem &values) +std::string ByProductionCode(SortAttribute attributes, const SortItem &values) { return values.at(FieldProductionCode).asString(); } -string ByVideoResolution(SortAttribute attributes, const SortItem &values) +std::string ByVideoResolution(SortAttribute attributes, const SortItem &values) { return StringUtils::Format("%i %s", (int)values.at(FieldVideoResolution).asInteger(), ByLabel(attributes, values).c_str()); } -string ByVideoCodec(SortAttribute attributes, const SortItem &values) +std::string ByVideoCodec(SortAttribute attributes, const SortItem &values) { return StringUtils::Format("%s %s", values.at(FieldVideoCodec).asString().c_str(), ByLabel(attributes, values).c_str()); } -string ByVideoAspectRatio(SortAttribute attributes, const SortItem &values) +std::string ByVideoAspectRatio(SortAttribute attributes, const SortItem &values) { return StringUtils::Format("%.03f %s", values.at(FieldVideoAspectRatio).asFloat(), ByLabel(attributes, values).c_str()); } -string ByAudioChannels(SortAttribute attributes, const SortItem &values) +std::string ByAudioChannels(SortAttribute attributes, const SortItem &values) { return StringUtils::Format("%i %s", (int)values.at(FieldAudioChannels).asInteger(), ByLabel(attributes, values).c_str()); } -string ByAudioCodec(SortAttribute attributes, const SortItem &values) +std::string ByAudioCodec(SortAttribute attributes, const SortItem &values) { return StringUtils::Format("%s %s", values.at(FieldAudioCodec).asString().c_str(), ByLabel(attributes, values).c_str()); } -string ByAudioLanguage(SortAttribute attributes, const SortItem &values) +std::string ByAudioLanguage(SortAttribute attributes, const SortItem &values) { return StringUtils::Format("%s %s", values.at(FieldAudioLanguage).asString().c_str(), ByLabel(attributes, values).c_str()); } -string BySubtitleLanguage(SortAttribute attributes, const SortItem &values) +std::string BySubtitleLanguage(SortAttribute attributes, const SortItem &values) { return StringUtils::Format("%s %s", values.at(FieldSubtitleLanguage).asString().c_str(), ByLabel(attributes, values).c_str()); } -string ByBitrate(SortAttribute attributes, const SortItem &values) +std::string ByBitrate(SortAttribute attributes, const SortItem &values) { return StringUtils::Format("%" PRId64, values.at(FieldBitrate).asInteger()); } -string ByListeners(SortAttribute attributes, const SortItem &values) +std::string ByListeners(SortAttribute attributes, const SortItem &values) { return StringUtils::Format("%" PRId64, values.at(FieldListeners).asInteger()); } -string ByRandom(SortAttribute attributes, const SortItem &values) +std::string ByRandom(SortAttribute attributes, const SortItem &values) { return StringUtils::Format("%i", CUtil::GetRandomNumber()); } -string ByChannel(SortAttribute attributes, const SortItem &values) +std::string ByChannel(SortAttribute attributes, const SortItem &values) { return values.at(FieldChannelName).asString(); } -string ByChannelNumber(SortAttribute attributes, const SortItem &values) +std::string ByChannelNumber(SortAttribute attributes, const SortItem &values) { return StringUtils::Format("%i", (int)values.at(FieldChannelNumber).asInteger()); } -string ByDateTaken(SortAttribute attributes, const SortItem &values) +std::string ByDateTaken(SortAttribute attributes, const SortItem &values) { return values.at(FieldDateTaken).asString(); } @@ -519,9 +517,9 @@ bool SorterIndirectIgnoreFoldersDescending(const SortItemPtr &left, const SortIt return SorterIgnoreFoldersDescending(*left, *right); } -map fillPreparators() +std::map fillPreparators() { - map preparators; + std::map preparators; preparators[SortByNone] = NULL; preparators[SortByLabel] = ByLabel; @@ -575,11 +573,11 @@ map fillPreparators() return preparators; } -map fillSortingFields() +std::map fillSortingFields() { - map sortingFields; + std::map sortingFields; - sortingFields.insert(pair(SortByNone, Fields())); + sortingFields.insert(std::pair(SortByNone, Fields())); sortingFields[SortByLabel].insert(FieldLabel); sortingFields[SortByDate].insert(FieldDate); @@ -648,13 +646,13 @@ map fillSortingFields() sortingFields[SortByChannel].insert(FieldChannelName); sortingFields[SortByChannelNumber].insert(FieldChannelNumber); sortingFields[SortByDateTaken].insert(FieldDateTaken); - sortingFields.insert(pair(SortByRandom, Fields())); + sortingFields.insert(std::pair(SortByRandom, Fields())); return sortingFields; } -map SortUtils::m_preparators = fillPreparators(); -map SortUtils::m_sortingFields = fillSortingFields(); +std::map SortUtils::m_preparators = fillPreparators(); +std::map SortUtils::m_sortingFields = fillSortingFields(); void SortUtils::Sort(SortBy sortBy, SortOrder sortOrder, SortAttribute attributes, DatabaseResults& items, int limitEnd /* = -1 */, int limitStart /* = 0 */) { @@ -673,12 +671,12 @@ void SortUtils::Sort(SortBy sortBy, SortOrder sortOrder, SortAttribute attribute for (Fields::const_iterator field = sortingFields.begin(); field != sortingFields.end(); ++field) { if (item->find(*field) == item->end()) - item->insert(pair(*field, CVariant::ConstNullVariant)); + item->insert(std::pair(*field, CVariant::ConstNullVariant)); } std::wstring sortLabel; g_charsetConverter.utf8ToW(preparator(attributes, *item), sortLabel, false); - item->insert(pair(FieldSort, CVariant(sortLabel))); + item->insert(std::pair(FieldSort, CVariant(sortLabel))); } // Do the sorting @@ -712,12 +710,12 @@ void SortUtils::Sort(SortBy sortBy, SortOrder sortOrder, SortAttribute attribute for (Fields::const_iterator field = sortingFields.begin(); field != sortingFields.end(); ++field) { if ((*item)->find(*field) == (*item)->end()) - (*item)->insert(pair(*field, CVariant::ConstNullVariant)); + (*item)->insert(std::pair(*field, CVariant::ConstNullVariant)); } std::wstring sortLabel; g_charsetConverter.utf8ToW(preparator(attributes, **item), sortLabel, false); - (*item)->insert(pair(FieldSort, CVariant(sortLabel))); + (*item)->insert(std::pair(FieldSort, CVariant(sortLabel))); } // Do the sorting @@ -767,7 +765,7 @@ bool SortUtils::SortFromDataset(const SortDescription &sortDescription, const Me const SortUtils::SortPreparator& SortUtils::getPreparator(SortBy sortBy) { - map::const_iterator it = m_preparators.find(sortBy); + std::map::const_iterator it = m_preparators.find(sortBy); if (it != m_preparators.end()) return it->second; @@ -792,14 +790,14 @@ SortUtils::SorterIndirect SortUtils::getSorterIndirect(SortOrder sortOrder, Sort const Fields& SortUtils::GetFieldsForSorting(SortBy sortBy) { - map::const_iterator it = m_sortingFields.find(sortBy); + std::map::const_iterator it = m_sortingFields.find(sortBy); if (it != m_sortingFields.end()) return it->second; return m_sortingFields[SortByNone]; } -string SortUtils::RemoveArticles(const string &label) +std::string SortUtils::RemoveArticles(const std::string &label) { std::set sortTokens = g_langInfo.GetSortTokens(); for (std::set::const_iterator token = sortTokens.begin(); token != sortTokens.end(); ++token) diff --git a/xbmc/utils/StringUtils.cpp b/xbmc/utils/StringUtils.cpp index 721e067e9dd1d..34b23218ad923 100644 --- a/xbmc/utils/StringUtils.cpp +++ b/xbmc/utils/StringUtils.cpp @@ -54,8 +54,6 @@ #define FORMAT_BLOCK_SIZE 512 // # of bytes for initial allocation for printf -using namespace std; - const char* ADDON_GUID_RE = "^(\\{){0,1}[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}(\\}){0,1}$"; /* empty string for use in returns by ref */ @@ -222,17 +220,17 @@ static const wchar_t unicode_uppers[] = { (wchar_t)0xFF32, (wchar_t)0xFF33, (wchar_t)0xFF34, (wchar_t)0xFF35, (wchar_t)0xFF36, (wchar_t)0xFF37, (wchar_t)0xFF38, (wchar_t)0xFF39, (wchar_t)0xFF3A }; -string StringUtils::Format(const char *fmt, ...) +std::string StringUtils::Format(const char *fmt, ...) { va_list args; va_start(args, fmt); - string str = FormatV(fmt, args); + std::string str = FormatV(fmt, args); va_end(args); return str; } -string StringUtils::FormatV(const char *fmt, va_list args) +std::string StringUtils::FormatV(const char *fmt, va_list args) { if (!fmt || !fmt[0]) return ""; @@ -276,17 +274,17 @@ string StringUtils::FormatV(const char *fmt, va_list args) return ""; // unreachable } -wstring StringUtils::Format(const wchar_t *fmt, ...) +std::wstring StringUtils::Format(const wchar_t *fmt, ...) { va_list args; va_start(args, fmt); - wstring str = FormatV(fmt, args); + std::wstring str = FormatV(fmt, args); va_end(args); return str; } -wstring StringUtils::FormatV(const wchar_t *fmt, va_list args) +std::wstring StringUtils::FormatV(const wchar_t *fmt, va_list args) { if (!fmt || !fmt[0]) return L""; @@ -358,27 +356,27 @@ wchar_t toupperUnicode(const wchar_t& c) return c; } -void StringUtils::ToUpper(string &str) +void StringUtils::ToUpper(std::string &str) { std::transform(str.begin(), str.end(), str.begin(), ::toupper); } -void StringUtils::ToUpper(wstring &str) +void StringUtils::ToUpper(std::wstring &str) { transform(str.begin(), str.end(), str.begin(), toupperUnicode); } -void StringUtils::ToLower(string &str) +void StringUtils::ToLower(std::string &str) { transform(str.begin(), str.end(), str.begin(), ::tolower); } -void StringUtils::ToLower(wstring &str) +void StringUtils::ToLower(std::wstring &str) { transform(str.begin(), str.end(), str.begin(), tolowerUnicode); } -void StringUtils::ToCapitalize(string &str) +void StringUtils::ToCapitalize(std::string &str) { std::wstring wstr; g_charsetConverter.utf8ToW(str, wstr); @@ -444,28 +442,28 @@ int StringUtils::CompareNoCase(const char *s1, const char *s2) return 0; } -string StringUtils::Left(const string &str, size_t count) +std::string StringUtils::Left(const std::string &str, size_t count) { - count = max((size_t)0, min(count, str.size())); + count = std::max((size_t)0, std::min(count, str.size())); return str.substr(0, count); } -string StringUtils::Mid(const string &str, size_t first, size_t count /* = string::npos */) +std::string StringUtils::Mid(const std::string &str, size_t first, size_t count /* = string::npos */) { if (first + count > str.size()) count = str.size() - first; if (first > str.size()) - return string(); + return std::string(); assert(first + count <= str.size()); return str.substr(first, count); } -string StringUtils::Right(const string &str, size_t count) +std::string StringUtils::Right(const std::string &str, size_t count) { - count = max((size_t)0, min(count, str.size())); + count = std::max((size_t)0, std::min(count, str.size())); return str.substr(str.size() - count); } @@ -490,7 +488,7 @@ static int isspace_c(char c) std::string& StringUtils::TrimLeft(std::string &str) { - str.erase(str.begin(), ::find_if(str.begin(), str.end(), ::not1(::ptr_fun(isspace_c)))); + str.erase(str.begin(), std::find_if(str.begin(), str.end(), std::not1(std::ptr_fun(isspace_c)))); return str; } @@ -503,7 +501,7 @@ std::string& StringUtils::TrimLeft(std::string &str, const char* const chars) std::string& StringUtils::TrimRight(std::string &str) { - str.erase(::find_if(str.rbegin(), str.rend(), ::not1(::ptr_fun(isspace_c))).base(), str.end()); + str.erase(std::find_if(str.rbegin(), str.rend(), std::not1(std::ptr_fun(isspace_c))).base(), str.end()); return str; } @@ -541,10 +539,10 @@ std::string& StringUtils::RemoveDuplicatedSpacesAndTabs(std::string& str) return str; } -int StringUtils::Replace(string &str, char oldChar, char newChar) +int StringUtils::Replace(std::string &str, char oldChar, char newChar) { int replacedChars = 0; - for (string::iterator it = str.begin(); it != str.end(); ++it) + for (std::string::iterator it = str.begin(); it != str.end(); ++it) { if (*it == oldChar) { @@ -564,7 +562,7 @@ int StringUtils::Replace(std::string &str, const std::string &oldStr, const std: int replacedChars = 0; size_t index = 0; - while (index < str.size() && (index = str.find(oldStr, index)) != string::npos) + while (index < str.size() && (index = str.find(oldStr, index)) != std::string::npos) { str.replace(index, oldStr.size(), newStr); index += newStr.size(); @@ -582,7 +580,7 @@ int StringUtils::Replace(std::wstring &str, const std::wstring &oldStr, const st int replacedChars = 0; size_t index = 0; - while (index < str.size() && (index = str.find(oldStr, index)) != string::npos) + while (index < str.size() && (index = str.find(oldStr, index)) != std::string::npos) { str.replace(index, oldStr.size(), newStr); index += newStr.size(); @@ -683,10 +681,10 @@ bool StringUtils::EndsWithNoCase(const std::string &str1, const char *s2) return true; } -std::string StringUtils::Join(const vector &strings, const std::string& delimiter) +std::string StringUtils::Join(const std::vector &strings, const std::string& delimiter) { std::string result; - for(vector::const_iterator it = strings.begin(); it != strings.end(); ++it ) + for(std::vector::const_iterator it = strings.begin(); it != strings.end(); ++it ) result += (*it) + delimiter; if (!result.empty()) @@ -694,7 +692,7 @@ std::string StringUtils::Join(const vector &strings, const std::string& return result; } -vector StringUtils::Split(const std::string& input, const std::string& delimiter, unsigned int iMaxStrings /* = 0 */) +std::vector StringUtils::Split(const std::string& input, const std::string& delimiter, unsigned int iMaxStrings /* = 0 */) { std::vector results; if (input.empty()) @@ -770,7 +768,7 @@ int64_t StringUtils::AlphaNumericCompare(const wchar_t *left, const wchar_t *rig wchar_t *ld, *rd; wchar_t lc, rc; int64_t lnum, rnum; - const collate& coll = use_facet< collate >(g_langInfo.GetSystemLocale()); + const std::collate& coll = std::use_facet >(g_langInfo.GetSystemLocale()); int cmp_res = 0; while (*l != 0 && *r != 0) { @@ -828,7 +826,7 @@ int64_t StringUtils::AlphaNumericCompare(const wchar_t *left, const wchar_t *rig int StringUtils::DateStringToYYYYMMDD(const std::string &dateString) { - vector days = StringUtils::Split(dateString, '-'); + std::vector days = StringUtils::Split(dateString, '-'); if (days.size() == 1) return atoi(days[0].c_str()); else if (days.size() == 2) @@ -850,7 +848,7 @@ long StringUtils::TimeStringToSeconds(const std::string &timeString) } else { - vector secs = StringUtils::Split(strCopy, ':'); + std::vector secs = StringUtils::Split(strCopy, ':'); int timeInSecs = 0; for (unsigned int i = 0; i < 3 && i < secs.size(); i++) { @@ -1106,15 +1104,15 @@ double StringUtils::CompareFuzzy(const std::string &left, const std::string &rig return (0.5 + fstrcmp(left.c_str(), right.c_str(), 0.0) * (left.length() + right.length())) / 2.0; } -int StringUtils::FindBestMatch(const std::string &str, const vector &strings, double &matchscore) +int StringUtils::FindBestMatch(const std::string &str, const std::vector &strings, double &matchscore) { int best = -1; matchscore = 0; int i = 0; - for (vector::const_iterator it = strings.begin(); it != strings.end(); ++it, i++) + for (std::vector::const_iterator it = strings.begin(); it != strings.end(); ++it, i++) { - int maxlength = max(str.length(), it->length()); + int maxlength = std::max(str.length(), it->length()); double score = StringUtils::CompareFuzzy(str, *it) / maxlength; if (score > matchscore) { @@ -1125,9 +1123,9 @@ int StringUtils::FindBestMatch(const std::string &str, const vector &str return best; } -bool StringUtils::ContainsKeyword(const std::string &str, const vector &keywords) +bool StringUtils::ContainsKeyword(const std::string &str, const std::vector &keywords) { - for (vector::const_iterator it = keywords.begin(); it != keywords.end(); ++it) + for (std::vector::const_iterator it = keywords.begin(); it != keywords.end(); ++it) { if (str.find(*it) != str.npos) return true; diff --git a/xbmc/utils/TextSearch.cpp b/xbmc/utils/TextSearch.cpp index ec5bc9ba575ab..d694e7593fdc3 100644 --- a/xbmc/utils/TextSearch.cpp +++ b/xbmc/utils/TextSearch.cpp @@ -21,8 +21,6 @@ #include "TextSearch.h" #include "StringUtils.h" -using namespace std; - CTextSearch::CTextSearch(const std::string &strSearchTerms, bool bCaseSensitive /* = false */, TextSearchDefault defaultSearchMode /* = SEARCH_DEFAULT_OR */) { m_bCaseSensitive = bCaseSensitive; diff --git a/xbmc/utils/TimeSmoother.cpp b/xbmc/utils/TimeSmoother.cpp index 29143f51a713b..0580602afaac9 100644 --- a/xbmc/utils/TimeSmoother.cpp +++ b/xbmc/utils/TimeSmoother.cpp @@ -24,8 +24,6 @@ #include #include "utils/MathUtils.h" -using namespace std; - CTimeSmoother::CTimeSmoother() : m_diffs(num_diffs), m_periods(num_periods), @@ -42,17 +40,17 @@ void CTimeSmoother::AddTimeStamp(unsigned int currentTime) if (diff) m_diffs.push_back(diff); - vector bins; + std::vector bins; BinData(m_diffs, bins, 0.15, 2); if (bins.size() && m_diffs.size() == num_diffs) { // have enough data to update our estimate - vector binMultipliers; + std::vector binMultipliers; GetGCDMultipliers(bins, binMultipliers, 2); assert(binMultipliers.size() == bins.size()); - vector intRepresentation; + std::vector intRepresentation; GetIntRepresentation(m_diffs, intRepresentation, bins, binMultipliers); assert(intRepresentation.size() == m_diffs.size()); @@ -93,13 +91,13 @@ unsigned int CTimeSmoother::GetNextFrameTime(unsigned int currentTime) return currentTime; } -void CTimeSmoother::BinData(const boost::circular_buffer &data, vector &bins, const double threshold, const unsigned int minbinsize) +void CTimeSmoother::BinData(const boost::circular_buffer &data, std::vector &bins, const double threshold, const unsigned int minbinsize) { if (!data.size()) return; bins.clear(); - vector counts; + std::vector counts; for (boost::circular_buffer::const_iterator i = data.begin(); i != data.end(); ++i) { @@ -161,7 +159,7 @@ void CTimeSmoother::GetConvergent(double value, unsigned int &num, unsigned int break; // value out of range of unsigned int unsigned int new_n = f * num + old_n; unsigned int new_d = f * denom + old_d; - if (min(new_n, new_d) > maxnumden) + if (std::min(new_n, new_d) > maxnumden) break; old_n = num; old_d = denom; num = new_n; denom = new_d; @@ -173,14 +171,14 @@ void CTimeSmoother::GetConvergent(double value, unsigned int &num, unsigned int assert(num > 0 && denom > 0); } -void CTimeSmoother::GetGCDMultipliers(const vector &data, vector &multipliers, const unsigned int maxminmult) +void CTimeSmoother::GetGCDMultipliers(const std::vector &data, std::vector &multipliers, const unsigned int maxminmult) { - vector::const_iterator i = std::min_element(data.begin(), data.end()); + std::vector::const_iterator i = std::min_element(data.begin(), data.end()); multipliers.clear(); - vector num, denom; - for (vector::const_iterator j = data.begin(); j != data.end(); ++j) + std::vector num, denom; + for (std::vector::const_iterator j = data.begin(); j != data.end(); ++j) { if (j != i) { @@ -195,17 +193,17 @@ void CTimeSmoother::GetGCDMultipliers(const vector &data, vector::const_iterator k = std::max_element(num.begin(), num.end()); + std::vector::const_iterator k = std::max_element(num.begin(), num.end()); for (unsigned int i = 0; i < num.size(); ++i) multipliers.push_back(denom[i] * (*k) / num[i]); } -void CTimeSmoother::GetIntRepresentation(const boost::circular_buffer &data, vector &intData, const vector &bins, const vector &intBins) +void CTimeSmoother::GetIntRepresentation(const boost::circular_buffer &data, std::vector &intData, const std::vector &bins, const std::vector &intBins) { intData.clear(); for (boost::circular_buffer::const_iterator i = data.begin(); i != data.end(); ++i) { - double min_r2 = numeric_limits::max(); + double min_r2 = std::numeric_limits::max(); unsigned int min_j = 0; for (unsigned int j = 0; j < bins.size(); ++j) { @@ -221,7 +219,7 @@ void CTimeSmoother::GetIntRepresentation(const boost::circular_buffer &d } } -double CTimeSmoother::EstimatePeriod(const boost::circular_buffer &data, const vector &intData) +double CTimeSmoother::EstimatePeriod(const boost::circular_buffer &data, const std::vector &intData) { double sxy = 0, sxx = 0; for (unsigned int i = 0; i < data.size(); ++i) @@ -237,7 +235,7 @@ double CTimeSmoother::EstimateFrameTime(unsigned int currentTime) assert(m_prevIn.size() == m_prevOut.size()); if (m_period) { - vector outTimes; + std::vector outTimes; for (unsigned int i = 0; i < m_prevIn.size(); ++i) outTimes.push_back(m_prevOut[i] + m_period * MathUtils::round_int((currentTime - m_prevIn[i]) / m_period)); sort(outTimes.begin(), outTimes.end()); diff --git a/xbmc/utils/URIUtils.cpp b/xbmc/utils/URIUtils.cpp index f71212e3db7ff..8c76a82bfc4a3 100644 --- a/xbmc/utils/URIUtils.cpp +++ b/xbmc/utils/URIUtils.cpp @@ -34,7 +34,6 @@ #include #include -using namespace std; using namespace XFILE; bool URIUtils::IsInPath(const std::string &uri, const std::string &baseURI) @@ -60,7 +59,7 @@ std::string URIUtils::GetExtension(const std::string& strFileName) } size_t period = strFileName.find_last_of("./\\"); - if (period == string::npos || strFileName[period] != '.') + if (period == std::string::npos || strFileName[period] != '.') return std::string(); return strFileName.substr(period); @@ -75,7 +74,7 @@ bool URIUtils::HasExtension(const std::string& strFileName) } size_t iPeriod = strFileName.find_last_of("./\\"); - return iPeriod != string::npos && strFileName[iPeriod] == '.'; + return iPeriod != std::string::npos && strFileName[iPeriod] == '.'; } bool URIUtils::HasExtension(const CURL& url, const std::string& strExtensions) @@ -129,7 +128,7 @@ void URIUtils::RemoveExtension(std::string& strFileName) } size_t period = strFileName.find_last_of("./\\"); - if (period != string::npos && strFileName[period] == '.') + if (period != std::string::npos && strFileName[period] == '.') { std::string strExtension = strFileName.substr(period); StringUtils::ToLower(strExtension); @@ -230,7 +229,7 @@ std::vector URIUtils::SplitPath(const std::string& strPath) std::string sep(1, url.GetDirectorySeparator()); // split the filename portion of the URL up into separate dirs - vector dirs = StringUtils::Split(url.GetFileName(), sep); + std::vector dirs = StringUtils::Split(url.GetFileName(), sep); // we start with the root path std::string dir = url.GetWithoutFilename(); @@ -249,7 +248,7 @@ void URIUtils::GetCommonPath(std::string& strParent, const std::string& strPath) { // find the common path of parent and path unsigned int j = 1; - while (j <= min(strParent.size(), strPath.size()) && strnicmp(strParent.c_str(), strPath.c_str(), j) == 0) + while (j <= std::min(strParent.size(), strPath.size()) && strnicmp(strParent.c_str(), strPath.c_str(), j) == 0) j++; strParent.erase(j - 1); // they should at least share a / at the end, though for things such as path/cd1 and path/cd2 there won't be @@ -426,8 +425,8 @@ std::string URIUtils::GetBasePath(const std::string& strPath) std::string URLEncodePath(const std::string& strPath) { - vector segments = StringUtils::Split(strPath, "/"); - for (vector::iterator i = segments.begin(); i != segments.end(); ++i) + std::vector segments = StringUtils::Split(strPath, "/"); + for (std::vector::iterator i = segments.begin(); i != segments.end(); ++i) *i = CURL::Encode(*i); return StringUtils::Join(segments, "/"); @@ -435,8 +434,8 @@ std::string URLEncodePath(const std::string& strPath) std::string URLDecodePath(const std::string& strPath) { - vector segments = StringUtils::Split(strPath, "/"); - for (vector::iterator i = segments.begin(); i != segments.end(); ++i) + std::vector segments = StringUtils::Split(strPath, "/"); + for (std::vector::iterator i = segments.begin(); i != segments.end(); ++i) *i = CURL::Decode(*i); return StringUtils::Join(segments, "/"); @@ -549,7 +548,7 @@ bool URIUtils::IsRemote(const std::string& strFile) if(IsMultiPath(strFile)) { // virtual paths need to be checked separately - vector paths; + std::vector paths; if (CMultiPathDirectory::GetPaths(strFile, paths)) { for (unsigned int i = 0; i < paths.size(); i++) @@ -633,7 +632,7 @@ bool URIUtils::IsHostOnLAN(const std::string& host, bool offLineCheck) // assume a hostname without dot's // is local (smb netbios hostnames) - if(host.find('.') == string::npos) + if(host.find('.') == std::string::npos) return true; uint32_t address = ntohl(inet_addr(host.c_str())); @@ -1146,10 +1145,10 @@ std::string URIUtils::CanonicalizePath(const std::string& path, const char slash return path; const std::string slashStr(1, slashCharacter); - vector pathVec, resultVec; + std::vector pathVec, resultVec; StringUtils::Tokenize(path, pathVec, slashStr); - for (vector::const_iterator it = pathVec.begin(); it != pathVec.end(); ++it) + for (std::vector::const_iterator it = pathVec.begin(); it != pathVec.end(); ++it) { if (*it == ".") { /* skip - do nothing */ } @@ -1209,11 +1208,11 @@ std::string URIUtils::GetDirectory(const std::string &strFilePath) // Keeps the final slash at end and possible |option=foo options. size_t iPosSlash = strFilePath.find_last_of("/\\"); - if (iPosSlash == string::npos) + if (iPosSlash == std::string::npos) return ""; // No slash, so no path (ignore any options) size_t iPosBar = strFilePath.rfind('|'); - if (iPosBar == string::npos) + if (iPosBar == std::string::npos) return strFilePath.substr(0, iPosSlash + 1); // Only path return strFilePath.substr(0, iPosSlash + 1) + strFilePath.substr(iPosBar); // Path + options @@ -1242,7 +1241,7 @@ CURL URIUtils::CreateArchivePath(const std::string& type, return url; } -string URIUtils::GetRealPath(const string &path) +std::string URIUtils::GetRealPath(const std::string &path) { if (path.empty()) return path; @@ -1261,11 +1260,11 @@ std::string URIUtils::resolvePath(const std::string &path) size_t posSlash = path.find('/'); size_t posBackslash = path.find('\\'); - string delim = posSlash < posBackslash ? "/" : "\\"; - vector parts = StringUtils::Split(path, delim); - vector realParts; + std::string delim = posSlash < posBackslash ? "/" : "\\"; + std::vector parts = StringUtils::Split(path, delim); + std::vector realParts; - for (vector::const_iterator part = parts.begin(); part != parts.end(); ++part) + for (std::vector::const_iterator part = parts.begin(); part != parts.end(); ++part) { if (part->empty() || part->compare(".") == 0) continue; @@ -1308,11 +1307,11 @@ bool URIUtils::UpdateUrlEncoding(std::string &strFilename) // if this is a stack:// URL we need to work with its filename if (URIUtils::IsStack(strFilename)) { - vector files; + std::vector files; if (!CStackDirectory::GetPaths(strFilename, files)) return false; - for (vector::iterator file = files.begin(); file != files.end(); ++file) + for (std::vector::iterator file = files.begin(); file != files.end(); ++file) UpdateUrlEncoding(*file); std::string stackPath; diff --git a/xbmc/utils/UrlOptions.cpp b/xbmc/utils/UrlOptions.cpp index 349ce1f916c81..c7394f0c09581 100644 --- a/xbmc/utils/UrlOptions.cpp +++ b/xbmc/utils/UrlOptions.cpp @@ -25,8 +25,6 @@ #include "utils/StringUtils.h" #include "utils/log.h" -using namespace std; - CUrlOptions::CUrlOptions() : m_strLead("") { } @@ -69,7 +67,7 @@ void CUrlOptions::AddOption(const std::string &key, const char *value) if (key.empty() || value == NULL) return; - return AddOption(key, string(value)); + return AddOption(key, std::string(value)); } void CUrlOptions::AddOption(const std::string &key, const std::string &value) @@ -117,7 +115,7 @@ void CUrlOptions::AddOptions(const std::string &options) if (options.empty()) return; - string strOptions = options; + std::string strOptions = options; // if matching the preset leading str, remove from options. if (!m_strLead.empty() && strOptions.compare(0, m_strLead.length(), m_strLead) == 0) @@ -132,17 +130,17 @@ void CUrlOptions::AddOptions(const std::string &options) } // split the options by & and process them one by one - vector optionList = StringUtils::Split(strOptions, "&"); - for (vector::const_iterator option = optionList.begin(); option != optionList.end(); ++option) + std::vector optionList = StringUtils::Split(strOptions, "&"); + for (std::vector::const_iterator option = optionList.begin(); option != optionList.end(); ++option) { if (option->empty()) continue; - string key, value; + std::string key, value; size_t pos = option->find('='); key = CURL::Decode(option->substr(0, pos)); - if (pos != string::npos) + if (pos != std::string::npos) value = CURL::Decode(option->substr(pos + 1)); // the key cannot be empty diff --git a/xbmc/utils/Variant.cpp b/xbmc/utils/Variant.cpp index 05889bffbc797..3656ca43626a3 100644 --- a/xbmc/utils/Variant.cpp +++ b/xbmc/utils/Variant.cpp @@ -39,11 +39,9 @@ #endif // TARGET_WINDOWS #endif // strtoll -using namespace std; - -string trimRight(const string &str) +std::string trimRight(const std::string &str) { - string tmp = str; + std::string tmp = str; // find_last_not_of will return string::npos (which is defined as -1) // or a value between 0 and size() - 1 => find_last_not_of() + 1 will // always result in a valid index between 0 and size() @@ -52,9 +50,9 @@ string trimRight(const string &str) return tmp; } -wstring trimRight(const wstring &str) +std::wstring trimRight(const std::wstring &str) { - wstring tmp = str; + std::wstring tmp = str; // find_last_not_of will return string::npos (which is defined as -1) // or a value between 0 and size() - 1 => find_last_not_of() + 1 will // always result in a valid index between 0 and size() @@ -63,10 +61,10 @@ wstring trimRight(const wstring &str) return tmp; } -int64_t str2int64(const string &str, int64_t fallback /* = 0 */) +int64_t str2int64(const std::string &str, int64_t fallback /* = 0 */) { char *end = NULL; - string tmp = trimRight(str); + std::string tmp = trimRight(str); int64_t result = strtoll(tmp.c_str(), &end, 0); if (end == NULL || *end == '\0') return result; @@ -74,10 +72,10 @@ int64_t str2int64(const string &str, int64_t fallback /* = 0 */) return fallback; } -int64_t str2int64(const wstring &str, int64_t fallback /* = 0 */) +int64_t str2int64(const std::wstring &str, int64_t fallback /* = 0 */) { wchar_t *end = NULL; - wstring tmp = trimRight(str); + std::wstring tmp = trimRight(str); int64_t result = wcstoll(tmp.c_str(), &end, 0); if (end == NULL || *end == '\0') return result; @@ -85,10 +83,10 @@ int64_t str2int64(const wstring &str, int64_t fallback /* = 0 */) return fallback; } -uint64_t str2uint64(const string &str, uint64_t fallback /* = 0 */) +uint64_t str2uint64(const std::string &str, uint64_t fallback /* = 0 */) { char *end = NULL; - string tmp = trimRight(str); + std::string tmp = trimRight(str); uint64_t result = strtoull(tmp.c_str(), &end, 0); if (end == NULL || *end == '\0') return result; @@ -96,10 +94,10 @@ uint64_t str2uint64(const string &str, uint64_t fallback /* = 0 */) return fallback; } -uint64_t str2uint64(const wstring &str, uint64_t fallback /* = 0 */) +uint64_t str2uint64(const std::wstring &str, uint64_t fallback /* = 0 */) { wchar_t *end = NULL; - wstring tmp = trimRight(str); + std::wstring tmp = trimRight(str); uint64_t result = wcstoull(tmp.c_str(), &end, 0); if (end == NULL || *end == '\0') return result; @@ -107,10 +105,10 @@ uint64_t str2uint64(const wstring &str, uint64_t fallback /* = 0 */) return fallback; } -double str2double(const string &str, double fallback /* = 0.0 */) +double str2double(const std::string &str, double fallback /* = 0.0 */) { char *end = NULL; - string tmp = trimRight(str); + std::string tmp = trimRight(str); double result = strtod(tmp.c_str(), &end); if (end == NULL || *end == '\0') return result; @@ -118,10 +116,10 @@ double str2double(const string &str, double fallback /* = 0.0 */) return fallback; } -double str2double(const wstring &str, double fallback /* = 0.0 */) +double str2double(const std::wstring &str, double fallback /* = 0.0 */) { wchar_t *end = NULL; - wstring tmp = trimRight(str); + std::wstring tmp = trimRight(str); double result = wcstod(tmp.c_str(), &end); if (end == NULL || *end == '\0') return result; @@ -150,10 +148,10 @@ CVariant::CVariant(VariantType type) m_data.dvalue = 0.0; break; case VariantTypeString: - m_data.string = new string(); + m_data.string = new std::string(); break; case VariantTypeWideString: - m_data.wstring = new wstring(); + m_data.wstring = new std::wstring(); break; case VariantTypeArray: m_data.array = new VariantArray(); @@ -212,43 +210,43 @@ CVariant::CVariant(bool boolean) CVariant::CVariant(const char *str) { m_type = VariantTypeString; - m_data.string = new string(str); + m_data.string = new std::string(str); } CVariant::CVariant(const char *str, unsigned int length) { m_type = VariantTypeString; - m_data.string = new string(str, length); + m_data.string = new std::string(str, length); } -CVariant::CVariant(const string &str) +CVariant::CVariant(const std::string &str) { m_type = VariantTypeString; - m_data.string = new string(str); + m_data.string = new std::string(str); } CVariant::CVariant(std::string &&str) { m_type = VariantTypeString; - m_data.string = new string(std::move(str)); + m_data.string = new std::string(std::move(str)); } CVariant::CVariant(const wchar_t *str) { m_type = VariantTypeWideString; - m_data.wstring = new wstring(str); + m_data.wstring = new std::wstring(str); } CVariant::CVariant(const wchar_t *str, unsigned int length) { m_type = VariantTypeWideString; - m_data.wstring = new wstring(str, length); + m_data.wstring = new std::wstring(str, length); } -CVariant::CVariant(const wstring &str) +CVariant::CVariant(const std::wstring &str) { m_type = VariantTypeWideString; - m_data.wstring = new wstring(str); + m_data.wstring = new std::wstring(str); } CVariant::CVariant(std::wstring &&str) @@ -593,10 +591,10 @@ CVariant &CVariant::operator=(const CVariant &rhs) m_data.dvalue = rhs.m_data.dvalue; break; case VariantTypeString: - m_data.string = new string(*rhs.m_data.string); + m_data.string = new std::string(*rhs.m_data.string); break; case VariantTypeWideString: - m_data.wstring = new wstring(*rhs.m_data.wstring); + m_data.wstring = new std::wstring(*rhs.m_data.wstring); break; case VariantTypeArray: m_data.array = new VariantArray(rhs.m_data.array->begin(), rhs.m_data.array->end()); diff --git a/xbmc/utils/Weather.cpp b/xbmc/utils/Weather.cpp index d384154dbac27..83955b456240f 100644 --- a/xbmc/utils/Weather.cpp +++ b/xbmc/utils/Weather.cpp @@ -44,7 +44,6 @@ #include "interfaces/generic/ScriptInvocationManager.h" #include "addons/GUIDialogAddonSettings.h" -using namespace std; using namespace ADDON; using namespace XFILE; @@ -136,8 +135,8 @@ void CWeatherJob::LocalizeOverviewToken(std::string &token) void CWeatherJob::LocalizeOverview(std::string &str) { - vector words = StringUtils::Split(str, " "); - for (vector::iterator i = words.begin(); i != words.end(); ++i) + std::vector words = StringUtils::Split(str, " "); + for (std::vector::iterator i = words.begin(); i != words.end(); ++i) LocalizeOverviewToken(*i); str = StringUtils::Join(words, " "); } diff --git a/xbmc/utils/WindowsShortcut.cpp b/xbmc/utils/WindowsShortcut.cpp index 1ba63250fbcd2..d2d21e37854e9 100644 --- a/xbmc/utils/WindowsShortcut.cpp +++ b/xbmc/utils/WindowsShortcut.cpp @@ -43,8 +43,6 @@ static char THIS_FILE[] = __FILE__; #define VOLUME_LOCAL 1 #define VOLUME_NETWORK 2 -using namespace std; - ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// @@ -57,7 +55,7 @@ CWindowsShortcut::~CWindowsShortcut() { } -bool CWindowsShortcut::GetShortcut(const string& strFileName, string& strFileOrDir) +bool CWindowsShortcut::GetShortcut(const std::string& strFileName, std::string& strFileOrDir) { strFileOrDir = ""; if (!IsShortcut(strFileName) ) return false; @@ -117,7 +115,7 @@ bool CWindowsShortcut::GetShortcut(const string& strFileName, string& strFileOrD return true; } -bool CWindowsShortcut::IsShortcut(const string& strFileName) +bool CWindowsShortcut::IsShortcut(const std::string& strFileName) { CFile file; if (!file.Open(strFileName.c_str(), CFile::typeBinary | CFile::modeRead)) return false; From b0dd305df9fc8feeb134b1badb1b925e507d01a0 Mon Sep 17 00:00:00 2001 From: Matthias Kortstiege Date: Fri, 28 Aug 2015 09:58:49 +0200 Subject: [PATCH 04/22] [addons] use std:: instead of using namespace std --- xbmc/addons/Addon.cpp | 11 ++-- xbmc/addons/AddonCallbacksGUI.cpp | 5 +- xbmc/addons/AddonDatabase.cpp | 5 +- xbmc/addons/AddonInstaller.cpp | 7 ++- xbmc/addons/AddonManager.cpp | 9 ++-- xbmc/addons/GUIDialogAddonInfo.cpp | 7 ++- xbmc/addons/GUIDialogAddonSettings.cpp | 39 +++++++------- xbmc/addons/GUIWindowAddonBrowser.cpp | 23 ++++---- xbmc/addons/LanguageResource.cpp | 2 - xbmc/addons/PluginSource.cpp | 6 +-- xbmc/addons/Repository.cpp | 37 +++++++------ xbmc/addons/Scraper.cpp | 73 +++++++++++++------------- xbmc/addons/Service.cpp | 4 +- xbmc/addons/Skin.cpp | 37 +++++++------ xbmc/addons/Visualisation.cpp | 5 +- 15 files changed, 126 insertions(+), 144 deletions(-) diff --git a/xbmc/addons/Addon.cpp b/xbmc/addons/Addon.cpp index 366125e054e41..13edec1aa5ccf 100644 --- a/xbmc/addons/Addon.cpp +++ b/xbmc/addons/Addon.cpp @@ -47,7 +47,6 @@ using XFILE::CDirectory; using XFILE::CFile; -using namespace std; namespace ADDON { @@ -177,7 +176,7 @@ AddonProps::AddonProps(const cp_extension_t *ext) std::string language; language = CAddonMgr::GetInstance().GetExtValue(metadata->configuration, "language"); if (!language.empty()) - extrainfo.insert(make_pair("language",language)); + extrainfo.insert(std::make_pair("language",language)); broken = CAddonMgr::GetInstance().GetExtValue(metadata->configuration, "broken"); EMPTY_IF("nofanart",fanart) EMPTY_IF("noicon",icon) @@ -257,8 +256,8 @@ void AddonProps::BuildDependencies(const cp_plugin_info_t *plugin) if (!plugin) return; for (unsigned int i = 0; i < plugin->num_imports; ++i) - dependencies.insert(make_pair(std::string(plugin->imports[i].plugin_id), - make_pair(AddonVersion(SS(plugin->imports[i].version)), plugin->imports[i].optional != 0))); + dependencies.insert(std::make_pair(std::string(plugin->imports[i].plugin_id), + std::make_pair(AddonVersion(SS(plugin->imports[i].version)), plugin->imports[i].optional != 0))); } /** @@ -544,7 +543,7 @@ std::string CAddon::GetSetting(const std::string& key) if (!LoadSettings()) return ""; // no settings available - map::const_iterator i = m_settings.find(key); + std::map::const_iterator i = m_settings.find(key); if (i != m_settings.end()) return i->second; return ""; @@ -593,7 +592,7 @@ void CAddon::SettingsToXML(CXBMCTinyXML &doc) const { TiXmlElement node("settings"); doc.InsertEndChild(node); - for (map::const_iterator i = m_settings.begin(); i != m_settings.end(); ++i) + for (std::map::const_iterator i = m_settings.begin(); i != m_settings.end(); ++i) { TiXmlElement nodeSetting("setting"); nodeSetting.SetAttribute("id", i->first.c_str()); diff --git a/xbmc/addons/AddonCallbacksGUI.cpp b/xbmc/addons/AddonCallbacksGUI.cpp index 6f9dd50cb549b..ed43564417e07 100644 --- a/xbmc/addons/AddonCallbacksGUI.cpp +++ b/xbmc/addons/AddonCallbacksGUI.cpp @@ -50,7 +50,6 @@ #define CONTROL_BTNSORTASC 4 #define CONTROL_LABELFILES 12 -using namespace std; using namespace KODI::MESSAGING; namespace ADDON @@ -699,7 +698,7 @@ const char* CAddonCallbacksGUI::Window_GetProperty(void *addonData, GUIHANDLE ha StringUtils::ToLower(lowerKey); Lock(); - string value = pWindow->GetProperty(lowerKey).asString(); + std::string value = pWindow->GetProperty(lowerKey).asString(); Unlock(); return strdup(value.c_str()); @@ -1617,7 +1616,7 @@ const char* CAddonCallbacksGUI::ListItem_GetProperty(void *addonData, GUIHANDLE if (!helper || !handle) return NULL; - string string = ((CFileItem*)handle)->GetProperty(key).asString(); + std::string string = ((CFileItem*)handle)->GetProperty(key).asString(); char *buffer = (char*) malloc (string.length()+1); strcpy(buffer, string.c_str()); return buffer; diff --git a/xbmc/addons/AddonDatabase.cpp b/xbmc/addons/AddonDatabase.cpp index d830a90bdc54c..2afc0318aeb10 100644 --- a/xbmc/addons/AddonDatabase.cpp +++ b/xbmc/addons/AddonDatabase.cpp @@ -27,7 +27,6 @@ #include "dbwrappers/dataset.h" using namespace ADDON; -using namespace std; CAddonDatabase::CAddonDatabase() { @@ -310,9 +309,9 @@ bool CAddonDatabase::GetAddon(int id, AddonPtr &addon) { const dbiplus::sql_record* const record = *i; if (!record->at(addonextra_key).get_asString().empty()) - props.extrainfo.insert(make_pair(record->at(addonextra_key).get_asString(), record->at(addonextra_value).get_asString())); + props.extrainfo.insert(std::make_pair(record->at(addonextra_key).get_asString(), record->at(addonextra_value).get_asString())); if (!m_pDS2->fv(dependencies_addon).get_asString().empty()) - props.dependencies.insert(make_pair(record->at(dependencies_addon).get_asString(), make_pair(AddonVersion(record->at(dependencies_version).get_asString()), record->at(dependencies_optional).get_asBool()))); + props.dependencies.insert(std::make_pair(record->at(dependencies_addon).get_asString(), std::make_pair(AddonVersion(record->at(dependencies_version).get_asString()), record->at(dependencies_optional).get_asBool()))); } addon = CAddonMgr::AddonFromProps(props); diff --git a/xbmc/addons/AddonInstaller.cpp b/xbmc/addons/AddonInstaller.cpp index d74a74a6183b3..108b66fb3b1a4 100644 --- a/xbmc/addons/AddonInstaller.cpp +++ b/xbmc/addons/AddonInstaller.cpp @@ -46,12 +46,11 @@ #include -using namespace std; using namespace XFILE; using namespace ADDON; using namespace KODI::MESSAGING; -struct find_map : public binary_function +struct find_map : public std::binary_function { bool operator() (CAddonInstaller::JobMap::value_type t, unsigned int id) const { @@ -123,7 +122,7 @@ bool CAddonInstaller::IsDownloading() const void CAddonInstaller::GetInstallList(VECADDONS &addons) const { CSingleLock lock(m_critSection); - vector addonIDs; + std::vector addonIDs; for (JobMap::const_iterator i = m_downloadJobs.begin(); i != m_downloadJobs.end(); ++i) { if (i->second.jobID) @@ -133,7 +132,7 @@ void CAddonInstaller::GetInstallList(VECADDONS &addons) const CAddonDatabase database; database.Open(); - for (vector::iterator it = addonIDs.begin(); it != addonIDs.end(); ++it) + for (std::vector::iterator it = addonIDs.begin(); it != addonIDs.end(); ++it) { AddonPtr addon; if (database.GetAddon(*it, addon)) diff --git a/xbmc/addons/AddonManager.cpp b/xbmc/addons/AddonManager.cpp index c82393c731ead..07617e9b8239f 100644 --- a/xbmc/addons/AddonManager.cpp +++ b/xbmc/addons/AddonManager.cpp @@ -59,7 +59,6 @@ #include "Util.h" #include "addons/Webinterface.h" -using namespace std; using namespace XFILE; namespace ADDON @@ -74,7 +73,7 @@ void cp_logger(cp_log_severity_t level, const char *msg, const char *apid, void * */ -map CAddonMgr::m_managers; +std::map CAddonMgr::m_managers; AddonPtr CAddonMgr::Factory(const cp_extension_t *props) { @@ -895,10 +894,10 @@ bool CAddonMgr::PlatformSupportsAddon(const cp_plugin_info_t *plugin) const if (!metadata) return false; - vector platforms; + std::vector platforms; if (CAddonMgr::GetInstance().GetExtList(metadata->configuration, "platform", platforms)) { - for (vector::const_iterator platform = platforms.begin(); platform != platforms.end(); ++platform) + for (std::vector::const_iterator platform = platforms.begin(); platform != platforms.end(); ++platform) { if (*platform == "all") return true; @@ -974,7 +973,7 @@ std::string CAddonMgr::GetExtValue(cp_cfg_element_t *base, const char *path) con return ""; } -bool CAddonMgr::GetExtList(cp_cfg_element_t *base, const char *path, vector &result) const +bool CAddonMgr::GetExtList(cp_cfg_element_t *base, const char *path, std::vector &result) const { result.clear(); if (!base || !path) diff --git a/xbmc/addons/GUIDialogAddonInfo.cpp b/xbmc/addons/GUIDialogAddonInfo.cpp index 61302711312cd..788e3e59f718c 100644 --- a/xbmc/addons/GUIDialogAddonInfo.cpp +++ b/xbmc/addons/GUIDialogAddonInfo.cpp @@ -52,7 +52,6 @@ #define CONTROL_BTN_ROLLBACK 11 #define CONTROL_BTN_SELECT 12 -using namespace std; using namespace ADDON; using namespace XFILE; @@ -224,7 +223,7 @@ bool CGUIDialogAddonInfo::PromptIfDependency(int heading, int line2) return false; VECADDONS addons; - vector deps; + std::vector deps; CAddonMgr::GetInstance().GetAllAddons(addons); for (VECADDONS::const_iterator it = addons.begin(); it != addons.end();++it) @@ -236,8 +235,8 @@ bool CGUIDialogAddonInfo::PromptIfDependency(int heading, int line2) if (!deps.empty()) { - string line0 = StringUtils::Format(g_localizeStrings.Get(24046).c_str(), m_localAddon->Name().c_str()); - string line1 = StringUtils::Join(deps, ", "); + std::string line0 = StringUtils::Format(g_localizeStrings.Get(24046).c_str(), m_localAddon->Name().c_str()); + std::string line1 = StringUtils::Join(deps, ", "); CGUIDialogOK::ShowAndGetInput(CVariant{heading}, CVariant{std::move(line0)}, CVariant{std::move(line1)}, CVariant{line2}); return true; } diff --git a/xbmc/addons/GUIDialogAddonSettings.cpp b/xbmc/addons/GUIDialogAddonSettings.cpp index 2be7e6242a7df..4b7a7f53eceed 100644 --- a/xbmc/addons/GUIDialogAddonSettings.cpp +++ b/xbmc/addons/GUIDialogAddonSettings.cpp @@ -51,7 +51,6 @@ #include "utils/XMLUtils.h" #include "utils/Variant.h" -using namespace std; using namespace ADDON; using namespace KODI::MESSAGING; using XFILE::CDirectory; @@ -310,7 +309,7 @@ bool CGUIDialogAddonSettings::ShowVirtualKeyboard(int iControl) pDlg->Reset(); int selected = -1; - vector valuesVec; + std::vector valuesVec; if (setting->Attribute("values")) StringUtils::Tokenize(setting->Attribute("values"), valuesVec, "|"); else if (setting->Attribute("lvalues")) @@ -422,7 +421,7 @@ bool CGUIDialogAddonSettings::ShowVirtualKeyboard(int iControl) bool bUseFileDirectories = false; if (option) { - vector options = StringUtils::Split(option, '|'); + std::vector options = StringUtils::Split(option, '|'); bUseThumbs = find(options.begin(), options.end(), "usethumbs") != options.end(); bUseFileDirectories = find(options.begin(), options.end(), "treatasfolder") != options.end(); } @@ -465,9 +464,9 @@ bool CGUIDialogAddonSettings::ShowVirtualKeyboard(int iControl) const char *strType = setting->Attribute("addontype"); if (strType) { - vector addonTypes = StringUtils::Split(strType, ','); - vector types; - for (vector::iterator i = addonTypes.begin(); i != addonTypes.end(); ++i) + std::vector addonTypes = StringUtils::Split(strType, ','); + std::vector types; + for (std::vector::iterator i = addonTypes.begin(); i != addonTypes.end(); ++i) { StringUtils::Trim(*i); ADDON::TYPE type = TranslateType(*i); @@ -481,7 +480,7 @@ bool CGUIDialogAddonSettings::ShowVirtualKeyboard(int iControl) if (multiSelect) { // construct vector of addon IDs (IDs are comma seperated in single string) - vector addonIDs = StringUtils::Split(value, ','); + std::vector addonIDs = StringUtils::Split(value, ','); if (CGUIWindowAddonBrowser::SelectAddonID(types, addonIDs, false) == 1) { value = StringUtils::Join(addonIDs, ","); @@ -555,7 +554,7 @@ void CGUIDialogAddonSettings::SaveSettings(void) { UpdateFromControls(); - for (map::iterator i = m_settings.begin(); i != m_settings.end(); ++i) + for (std::map::iterator i = m_settings.begin(); i != m_settings.end(); ++i) m_addon->UpdateSetting(i->first, i->second); if (m_saveToDisk) @@ -722,7 +721,7 @@ void CGUIDialogAddonSettings::CreateControls() ((CGUIButtonControl *)pControl)->SetLabel2(GetAddonNames(value)); else if (type == "select" && !lvalues.empty()) { - vector valuesVec = StringUtils::Split(lvalues, '|'); + std::vector valuesVec = StringUtils::Split(lvalues, '|'); int selected = atoi(value.c_str()); if (selected >= 0 && selected < (int)valuesVec.size()) { @@ -748,8 +747,8 @@ void CGUIDialogAddonSettings::CreateControls() } else if ((type == "enum" || type == "labelenum") && !id.empty()) { - vector valuesVec; - vector entryVec; + std::vector valuesVec; + std::vector entryVec; pControl = new CGUISpinControlEx(*pOriginalSpin); if (!pControl) return; @@ -803,7 +802,7 @@ void CGUIDialogAddonSettings::CreateControls() ((CGUISpinControlEx *)pControl)->SetText(label); ((CGUISpinControlEx *)pControl)->SetFloatValue(1.0f); - vector items = GetFileEnumValues(values, XMLUtils::GetAttribute(setting, "mask"), XMLUtils::GetAttribute(setting, "option")); + std::vector items = GetFileEnumValues(values, XMLUtils::GetAttribute(setting, "mask"), XMLUtils::GetAttribute(setting, "option")); for (unsigned int i = 0; i < items.size(); ++i) { ((CGUISpinControlEx *)pControl)->AddLabel(items[i], i); @@ -854,7 +853,7 @@ void CGUIDialogAddonSettings::CreateControls() float fMin = 0.0f; float fMax = 100.0f; float fInc = 1.0f; - vector range = StringUtils::Split(XMLUtils::GetAttribute(setting, "range"), ','); + std::vector range = StringUtils::Split(XMLUtils::GetAttribute(setting, "range"), ','); if (range.size() > 1) { fMin = (float)atof(range[0].c_str()); @@ -911,8 +910,8 @@ void CGUIDialogAddonSettings::CreateControls() std::string CGUIDialogAddonSettings::GetAddonNames(const std::string& addonIDslist) const { std::string retVal; - vector addons = StringUtils::Split(addonIDslist, ','); - for (vector::const_iterator it = addons.begin(); it != addons.end() ; ++it) + std::vector addons = StringUtils::Split(addonIDslist, ','); + for (std::vector::const_iterator it = addons.begin(); it != addons.end() ; ++it) { if (!retVal.empty()) retVal += ", "; @@ -925,7 +924,7 @@ std::string CGUIDialogAddonSettings::GetAddonNames(const std::string& addonIDsli return retVal; } -vector CGUIDialogAddonSettings::GetFileEnumValues(const std::string &path, const std::string &mask, const std::string &options) const +std::vector CGUIDialogAddonSettings::GetFileEnumValues(const std::string &path, const std::string &mask, const std::string &options) const { // Create our base path, used for type "fileenum" settings // replace $PROFILE with the profile path of the plugin/script @@ -943,7 +942,7 @@ vector CGUIDialogAddonSettings::GetFileEnumValues(const std::string else CDirectory::GetDirectory(fullPath, items, "", XFILE::DIR_FLAG_NO_FILE_DIRS); - vector values; + std::vector values; for (int i = 0; i < items.Size(); ++i) { CFileItemPtr pItem = items[i]; @@ -992,7 +991,7 @@ bool CGUIDialogAddonSettings::GetCondition(const std::string &condition, const i bool bCondition = true; bool bCompare = true; bool bControlDependend = false;//flag if the condition depends on another control - vector conditionVec; + std::vector conditionVec; if (condition.find("+") != std::string::npos) StringUtils::Tokenize(condition, conditionVec, "+"); @@ -1005,7 +1004,7 @@ bool CGUIDialogAddonSettings::GetCondition(const std::string &condition, const i for (unsigned int i = 0; i < conditionVec.size(); i++) { - vector condVec; + std::vector condVec; if (!TranslateSingleString(conditionVec[i], condVec)) continue; const CGUIControl* control2 = GetControl(controlId + atoi(condVec[1].c_str())); @@ -1071,7 +1070,7 @@ bool CGUIDialogAddonSettings::GetCondition(const std::string &condition, const i return bCondition; } -bool CGUIDialogAddonSettings::TranslateSingleString(const std::string &strCondition, vector &condVec) +bool CGUIDialogAddonSettings::TranslateSingleString(const std::string &strCondition, std::vector &condVec) { std::string strTest = strCondition; StringUtils::ToLower(strTest); diff --git a/xbmc/addons/GUIWindowAddonBrowser.cpp b/xbmc/addons/GUIWindowAddonBrowser.cpp index 9dad7a34c196e..784814a1eb501 100644 --- a/xbmc/addons/GUIWindowAddonBrowser.cpp +++ b/xbmc/addons/GUIWindowAddonBrowser.cpp @@ -53,7 +53,6 @@ using namespace ADDON; using namespace XFILE; -using namespace std; CGUIWindowAddonBrowser::CGUIWindowAddonBrowser(void) : CGUIMediaWindow(WINDOW_ADDON_BROWSER, "AddonBrowser.xml") @@ -428,21 +427,21 @@ bool CGUIWindowAddonBrowser::Update(const std::string &strDirectory, bool update int CGUIWindowAddonBrowser::SelectAddonID(TYPE type, std::string &addonID, bool showNone /* = false */, bool showDetails /* = true */, bool showInstalled /* = true */, bool showInstallable /*= false */, bool showMore /* = true */) { - vector types; + std::vector types; types.push_back(type); return SelectAddonID(types, addonID, showNone, showDetails, showInstalled, showInstallable, showMore); } -int CGUIWindowAddonBrowser::SelectAddonID(ADDON::TYPE type, vector &addonIDs, bool showNone /* = false */, bool showDetails /* = true */, bool multipleSelection /* = true */, bool showInstalled /* = true */, bool showInstallable /* = false */, bool showMore /* = true */) +int CGUIWindowAddonBrowser::SelectAddonID(ADDON::TYPE type, std::vector &addonIDs, bool showNone /* = false */, bool showDetails /* = true */, bool multipleSelection /* = true */, bool showInstalled /* = true */, bool showInstallable /* = false */, bool showMore /* = true */) { - vector types; + std::vector types; types.push_back(type); return SelectAddonID(types, addonIDs, showNone, showDetails, multipleSelection, showInstalled, showInstallable, showMore); } -int CGUIWindowAddonBrowser::SelectAddonID(const vector &types, std::string &addonID, bool showNone /* = false */, bool showDetails /* = true */, bool showInstalled /* = true */, bool showInstallable /* = false */, bool showMore /* = true */) +int CGUIWindowAddonBrowser::SelectAddonID(const std::vector &types, std::string &addonID, bool showNone /* = false */, bool showDetails /* = true */, bool showInstalled /* = true */, bool showInstallable /* = false */, bool showMore /* = true */) { - vector addonIDs; + std::vector addonIDs; if (!addonID.empty()) addonIDs.push_back(addonID); int retval = SelectAddonID(types, addonIDs, showNone, showDetails, false, showInstalled, showInstallable, showMore); @@ -453,7 +452,7 @@ int CGUIWindowAddonBrowser::SelectAddonID(const vector &types, std: return retval; } -int CGUIWindowAddonBrowser::SelectAddonID(const vector &types, vector &addonIDs, bool showNone /* = false */, bool showDetails /* = true */, bool multipleSelection /* = true */, bool showInstalled /* = true */, bool showInstallable /* = false */, bool showMore /* = true */) +int CGUIWindowAddonBrowser::SelectAddonID(const std::vector &types, std::vector &addonIDs, bool showNone /* = false */, bool showDetails /* = true */, bool multipleSelection /* = true */, bool showInstalled /* = true */, bool showInstallable /* = false */, bool showMore /* = true */) { // if we shouldn't show neither installed nor installable addons the list will be empty if (!showInstalled && !showInstallable) @@ -468,7 +467,7 @@ int CGUIWindowAddonBrowser::SelectAddonID(const vector &types, vect return 0; // get rid of any invalid addon types - vector validTypes(types.size()); + std::vector validTypes(types.size()); std::copy_if(types.begin(), types.end(), validTypes.begin(), [](ADDON::TYPE type) { return type != ADDON_UNKNOWN; }); if (validTypes.empty()) @@ -478,7 +477,7 @@ int CGUIWindowAddonBrowser::SelectAddonID(const vector &types, vect VECADDONS addons; if (showInstalled) { - for (vector::const_iterator type = validTypes.begin(); type != validTypes.end(); ++type) + for (std::vector::const_iterator type = validTypes.begin(); type != validTypes.end(); ++type) { VECADDONS typeAddons; if (*type == ADDON_AUDIO) @@ -508,7 +507,7 @@ int CGUIWindowAddonBrowser::SelectAddonID(const vector &types, vect // check if the addon matches one of the provided addon types bool matchesType = false; - for (vector::const_iterator type = validTypes.begin(); type != validTypes.end(); ++type) + for (std::vector::const_iterator type = validTypes.begin(); type != validTypes.end(); ++type) { if (pAddon->IsType(*type)) { @@ -561,7 +560,7 @@ int CGUIWindowAddonBrowser::SelectAddonID(const vector &types, vect return 0; std::string heading; - for (vector::const_iterator type = validTypes.begin(); type != validTypes.end(); ++type) + for (std::vector::const_iterator type = validTypes.begin(); type != validTypes.end(); ++type) { if (!heading.empty()) heading += ", "; @@ -594,7 +593,7 @@ int CGUIWindowAddonBrowser::SelectAddonID(const vector &types, vect if (addonIDs.size() > 0) { - for (vector::const_iterator it = addonIDs.begin(); it != addonIDs.end() ; ++it) + for (std::vector::const_iterator it = addonIDs.begin(); it != addonIDs.end() ; ++it) { CFileItemPtr item = items.Get(*it); if (item) diff --git a/xbmc/addons/LanguageResource.cpp b/xbmc/addons/LanguageResource.cpp index 4cae4ee2c7d5a..10f570e7248c2 100644 --- a/xbmc/addons/LanguageResource.cpp +++ b/xbmc/addons/LanguageResource.cpp @@ -29,8 +29,6 @@ #define LANGUAGE_ADDON_PREFIX "resource.language." -using namespace std; - namespace ADDON { diff --git a/xbmc/addons/PluginSource.cpp b/xbmc/addons/PluginSource.cpp index 0a5c17c29727a..091e5e9e86a32 100644 --- a/xbmc/addons/PluginSource.cpp +++ b/xbmc/addons/PluginSource.cpp @@ -21,8 +21,6 @@ #include "AddonManager.h" #include "utils/StringUtils.h" -using namespace std; - namespace ADDON { @@ -58,8 +56,8 @@ void CPluginSource::SetProvides(const std::string &content) { if (!content.empty()) { - vector provides = StringUtils::Split(content, ' '); - for (vector::const_iterator i = provides.begin(); i != provides.end(); ++i) + std::vector provides = StringUtils::Split(content, ' '); + for (std::vector::const_iterator i = provides.begin(); i != provides.end(); ++i) { Content content = Translate(*i); if (content != UNKNOWN) diff --git a/xbmc/addons/Repository.cpp b/xbmc/addons/Repository.cpp index b96855aa97952..f4301c6d65b31 100644 --- a/xbmc/addons/Repository.cpp +++ b/xbmc/addons/Repository.cpp @@ -40,7 +40,6 @@ #include "TextureDatabase.h" #include "URL.h" -using namespace std; using namespace XFILE; using namespace ADDON; @@ -108,7 +107,7 @@ CRepository::~CRepository() { } -string CRepository::FetchChecksum(const string& url) +std::string CRepository::FetchChecksum(const std::string& url) { CFile file; try @@ -132,9 +131,9 @@ string CRepository::FetchChecksum(const string& url) } } -string CRepository::GetAddonHash(const AddonPtr& addon) const +std::string CRepository::GetAddonHash(const AddonPtr& addon) const { - string checksum; + std::string checksum; DirList::const_iterator it; for (it = m_dirs.begin();it != m_dirs.end(); ++it) if (URIUtils::IsInPath(addon->Path(), it->datadir)) @@ -143,7 +142,7 @@ string CRepository::GetAddonHash(const AddonPtr& addon) const { checksum = FetchChecksum(addon->Path()+".md5"); size_t pos = checksum.find_first_of(" \n"); - if (pos != string::npos) + if (pos != std::string::npos) return checksum.substr(0, pos); } return checksum; @@ -157,11 +156,11 @@ string CRepository::GetAddonHash(const AddonPtr& addon) const bool CRepository::Parse(const DirInfo& dir, VECADDONS &result) { - string file = dir.info; + std::string file = dir.info; if (dir.compressed) { CURL url(dir.info); - string opts = url.GetProtocolOptions(); + std::string opts = url.GetProtocolOptions(); if (!opts.empty()) opts += "&"; url.SetProtocolOptions(opts+"Encoding=gzip"); @@ -177,7 +176,7 @@ bool CRepository::Parse(const DirInfo& dir, VECADDONS &result) AddonPtr addon = *i; if (dir.zipped) { - string file = StringUtils::Format("%s/%s-%s.zip", addon->ID().c_str(), addon->ID().c_str(), addon->Version().asString().c_str()); + std::string file = StringUtils::Format("%s/%s-%s.zip", addon->ID().c_str(), addon->ID().c_str(), addon->Version().asString().c_str()); addon->Props().path = URIUtils::AddFileToFolder(dir.datadir,file); SET_IF_NOT_EMPTY(addon->Props().icon,URIUtils::AddFileToFolder(dir.datadir,addon->ID()+"/icon.png")) file = StringUtils::Format("%s/changelog-%s.txt", addon->ID().c_str(), addon->Version().asString().c_str()); @@ -218,11 +217,11 @@ CRepositoryUpdateJob::CRepositoryUpdateJob(const VECADDONS &repos) { } -void MergeAddons(map &addons, const VECADDONS &new_addons) +void MergeAddons(std::map &addons, const VECADDONS &new_addons) { for (VECADDONS::const_iterator it = new_addons.begin(); it != new_addons.end(); ++it) { - map::iterator existing = addons.find((*it)->ID()); + std::map::iterator existing = addons.find((*it)->ID()); if (existing != addons.end()) { // already got it - replace if we have a newer version if (existing->second->Version() < (*it)->Version()) @@ -235,7 +234,7 @@ void MergeAddons(map &addons, const VECADDONS &new_addons) bool CRepositoryUpdateJob::DoWork() { - map addons; + std::map addons; for (VECADDONS::const_iterator i = m_repos.begin(); i != m_repos.end(); ++i) { const RepositoryPtr repo = std::dynamic_pointer_cast(*i); @@ -255,7 +254,7 @@ bool CRepositoryUpdateJob::DoWork() textureDB.Open(); textureDB.BeginMultipleExecute(); VECADDONS notifications; - for (map::const_iterator i = addons.begin(); i != addons.end(); ++i) + for (std::map::const_iterator i = addons.begin(); i != addons.end(); ++i) { // manager told us to feck off if (ShouldCancel(0,0)) @@ -280,7 +279,7 @@ bool CRepositoryUpdateJob::DoWork() { if (CSettings::GetInstance().GetInt(CSettings::SETTING_GENERAL_ADDONUPDATES) == AUTO_UPDATES_ON) { - string referer; + std::string referer; if (URIUtils::IsInternetStream(newAddon->Path())) referer = StringUtils::Format("Referer=%s-%s.zip",addon->ID().c_str(),addon->Version().asString().c_str()); @@ -340,18 +339,18 @@ bool CRepositoryUpdateJob::GrabAddons(const RepositoryPtr& repo, VECADDONS& addo CAddonDatabase database; database.Open(); - string oldReposum; + std::string oldReposum; if (!database.GetRepoChecksum(repo->ID(), oldReposum)) oldReposum = ""; - string reposum; + std::string reposum; for (CRepository::DirList::const_iterator it = repo->m_dirs.begin(); it != repo->m_dirs.end(); ++it) { if (ShouldCancel(std::distance(repo->m_dirs.cbegin(), it), total)) return false; if (!it->checksum.empty()) { - const string dirsum = CRepository::FetchChecksum(it->checksum); + const std::string dirsum = CRepository::FetchChecksum(it->checksum); if (dirsum.empty()) { CLog::Log(LOGERROR, "Failed to fetch checksum for directory listing %s for repository %s. ", (*it).info.c_str(), repo->ID().c_str()); @@ -363,7 +362,7 @@ bool CRepositoryUpdateJob::GrabAddons(const RepositoryPtr& repo, VECADDONS& addo if (oldReposum != reposum || oldReposum.empty()) { - map uniqueAddons; + std::map uniqueAddons; for (CRepository::DirList::const_iterator it = repo->m_dirs.begin(); it != repo->m_dirs.end(); ++it) { if (ShouldCancel(repo->m_dirs.size() + std::distance(repo->m_dirs.cbegin(), it), total)) @@ -382,12 +381,12 @@ bool CRepositoryUpdateJob::GrabAddons(const RepositoryPtr& repo, VECADDONS& addo if (!repo->Props().libname.empty()) { CFileItemList dummy; - string s = StringUtils::Format("plugin://%s/?action=update", repo->ID().c_str()); + std::string s = StringUtils::Format("plugin://%s/?action=update", repo->ID().c_str()); add = CDirectory::GetDirectory(s, dummy); } if (add) { - for (map::const_iterator i = uniqueAddons.begin(); i != uniqueAddons.end(); ++i) + for (std::map::const_iterator i = uniqueAddons.begin(); i != uniqueAddons.end(); ++i) addons.push_back(i->second); database.AddRepository(repo->ID(), addons, reposum, repo->Version()); } diff --git a/xbmc/addons/Scraper.cpp b/xbmc/addons/Scraper.cpp index 41ca7194a8e68..0e72149407a50 100644 --- a/xbmc/addons/Scraper.cpp +++ b/xbmc/addons/Scraper.cpp @@ -44,7 +44,6 @@ #include #include -using namespace std; using namespace XFILE; using namespace MUSIC_GRABBER; using namespace VIDEO; @@ -199,7 +198,7 @@ std::string CScraper::GetPathSettings() if (!LoadSettings()) return ""; - stringstream stream; + std::stringstream stream; CXBMCTinyXML doc; SettingsToXML(doc); if (doc.RootElement()) @@ -238,10 +237,10 @@ void CScraper::ClearCache() // is XML output by chained functions, possibly recursively // the CCurlFile object is passed in so that URL fetches can be canceled from other threads // throws CScraperError abort on internal failures (e.g., parse errors) -vector CScraper::Run(const std::string& function, - const CScraperUrl& scrURL, - CCurlFile& http, - const vector* extras) +std::vector CScraper::Run(const std::string& function, + const CScraperUrl& scrURL, + CCurlFile& http, + const std::vector* extras) { if (!Load()) throw CScraperError(); @@ -265,7 +264,7 @@ vector CScraper::Run(const std::string& function, throw CScraperError(); } - vector result; + std::vector result; result.push_back(strXML); TiXmlElement* xchain = doc.RootElement()->FirstChildElement(); // skip children of the root element until or @@ -278,7 +277,7 @@ vector CScraper::Run(const std::string& function, if (szFunction) { CScraperUrl scrURL2; - vector extras; + std::vector extras; // for , pass the contained text as a parameter; for , as URL content if (strcmp(xchain->Value(),"chain")==0) { @@ -293,7 +292,7 @@ vector CScraper::Run(const std::string& function, // url or the parameters to a chain, we can safely clear it here // to fix this issue m_parser.m_param[0].clear(); - vector result2 = RunNoThrow(szFunction,scrURL2,http,&extras); + std::vector result2 = RunNoThrow(szFunction,scrURL2,http,&extras); result.insert(result.end(),result2.begin(),result2.end()); } xchain = xchain->NextSiblingElement(); @@ -307,12 +306,12 @@ vector CScraper::Run(const std::string& function, // just like Run, but returns an empty list instead of throwing in case of error // don't use in new code; errors should be handled appropriately -vector CScraper::RunNoThrow(const std::string& function, +std::vector CScraper::RunNoThrow(const std::string& function, const CScraperUrl& url, XFILE::CCurlFile& http, - const vector* extras) + const std::vector* extras) { - vector vcs; + std::vector vcs; try { vcs = Run(function, url, http, extras); @@ -327,7 +326,7 @@ vector CScraper::RunNoThrow(const std::string& function, std::string CScraper::InternalRun(const std::string& function, const CScraperUrl& scrURL, CCurlFile& http, - const vector* extras) + const std::vector* extras) { // walk the list of input URLs and fetch each into parser parameters unsigned int i; @@ -428,11 +427,11 @@ CScraperUrl CScraper::NfoUrl(const std::string &sNfoContent) return scurlRet; // scraper function takes contents of .nfo file, returns XML (see below) - vector vcsIn; + std::vector vcsIn; vcsIn.push_back(sNfoContent); CScraperUrl scurl; CCurlFile fcurl; - vector vcsOut = Run("NfoUrl", scurl, fcurl, &vcsIn); + std::vector vcsOut = Run("NfoUrl", scurl, fcurl, &vcsIn); if (vcsOut.empty() || vcsOut[0].empty()) return scurlRet; if (vcsOut.size() > 1) @@ -490,11 +489,11 @@ CScraperUrl CScraper::ResolveIDToUrl(const std::string& externalID) CScraperUrl scurlRet; // scraper function takes an external ID, returns XML (see below) - vector vcsIn; + std::vector vcsIn; vcsIn.push_back(externalID); CScraperUrl scurl; CCurlFile fcurl; - vector vcsOut = Run("ResolveIDToUrl", scurl, fcurl, &vcsIn); + std::vector vcsOut = Run("ResolveIDToUrl", scurl, fcurl, &vcsIn); if (vcsOut.empty() || vcsOut[0].empty()) return scurlRet; if (vcsOut.size() > 1) @@ -573,7 +572,7 @@ std::vector CScraper::FindMovie(XFILE::CCurlFile &fcurl, const std: if (!fFirst) StringUtils::Replace(sTitle, '-',' '); - vector vcsIn(1); + std::vector vcsIn(1); g_charsetConverter.utf8To(SearchStringEncoding(), sTitle, vcsIn[0]); vcsIn[0] = CURL::Encode(vcsIn[0]); if (fFirst && !sYear.empty()) @@ -581,7 +580,7 @@ std::vector CScraper::FindMovie(XFILE::CCurlFile &fcurl, const std: // request a search URL from the title/filename/etc. CScraperUrl scurl; - vector vcsOut = Run("CreateSearchUrl", scurl, fcurl, &vcsIn); + std::vector vcsOut = Run("CreateSearchUrl", scurl, fcurl, &vcsIn); if (vcsOut.empty()) { CLog::Log(LOGDEBUG, "%s: CreateSearchUrl failed", __FUNCTION__); @@ -597,7 +596,7 @@ std::vector CScraper::FindMovie(XFILE::CCurlFile &fcurl, const std: bool fSort(true); std::set stsDupeCheck; bool fResults(false); - for (vector::const_iterator i = vcsOut.begin(); i != vcsOut.end(); ++i) + for (std::vector::const_iterator i = vcsOut.begin(); i != vcsOut.end(); ++i) { CXBMCTinyXML doc; doc.Parse(*i, TIXML_ENCODING_UTF8); @@ -698,13 +697,13 @@ std::vector CScraper::FindAlbum(CCurlFile &fcurl, const std::st // scraper function is given the album and artist as parameters and // returns an XML element parseable by CScraperUrl - std::vector extras(2); + std::vector extras(2); g_charsetConverter.utf8To(SearchStringEncoding(), sAlbum, extras[0]); g_charsetConverter.utf8To(SearchStringEncoding(), sArtist, extras[1]); extras[0] = CURL::Encode(extras[0]); extras[1] = CURL::Encode(extras[1]); CScraperUrl scurl; - vector vcsOut = RunNoThrow("CreateAlbumSearchUrl", scurl, fcurl, &extras); + std::vector vcsOut = RunNoThrow("CreateAlbumSearchUrl", scurl, fcurl, &extras); if (vcsOut.size() > 1) CLog::Log(LOGWARNING, "%s: scraper returned multiple results; using first", __FUNCTION__); @@ -727,7 +726,7 @@ std::vector CScraper::FindAlbum(CCurlFile &fcurl, const std::st vcsOut = RunNoThrow("GetAlbumSearchResults", scurl, fcurl); // parse the returned XML into a vector of album objects - for (vector::const_iterator i = vcsOut.begin(); i != vcsOut.end(); ++i) + for (std::vector::const_iterator i = vcsOut.begin(); i != vcsOut.end(); ++i) { CXBMCTinyXML doc; doc.Parse(*i, TIXML_ENCODING_UTF8); @@ -795,11 +794,11 @@ std::vector CScraper::FindArtist(CCurlFile &fcurl, // scraper function is given the artist as parameter and // returns an XML element parseable by CScraperUrl - std::vector extras(1); + std::vector extras(1); g_charsetConverter.utf8To(SearchStringEncoding(), sArtist, extras[0]); extras[0] = CURL::Encode(extras[0]); CScraperUrl scurl; - vector vcsOut = RunNoThrow("CreateArtistSearchUrl", scurl, fcurl, &extras); + std::vector vcsOut = RunNoThrow("CreateArtistSearchUrl", scurl, fcurl, &extras); if (vcsOut.empty() || vcsOut[0].empty()) return vcari; @@ -819,7 +818,7 @@ std::vector CScraper::FindArtist(CCurlFile &fcurl, vcsOut = RunNoThrow("GetArtistSearchResults", scurl, fcurl); // parse the returned XML into a vector of artist objects - for (vector::const_iterator i = vcsOut.begin(); i != vcsOut.end(); ++i) + for (std::vector::const_iterator i = vcsOut.begin(); i != vcsOut.end(); ++i) { CXBMCTinyXML doc; doc.Parse(*i, TIXML_ENCODING_UTF8); @@ -872,12 +871,12 @@ EPISODELIST CScraper::GetEpisodeList(XFILE::CCurlFile &fcurl, const CScraperUrl scurl.m_url[0].m_url.c_str(), Name().c_str(), Path().c_str(), ADDON::TranslateContent(Content()).c_str(), Version().asString().c_str()); - vector vcsIn; + std::vector vcsIn; vcsIn.push_back(scurl.m_url[0].m_url); - vector vcsOut = RunNoThrow("GetEpisodeList", scurl, fcurl, &vcsIn); + std::vector vcsOut = RunNoThrow("GetEpisodeList", scurl, fcurl, &vcsIn); // parse the XML response - for (vector::const_iterator i = vcsOut.begin(); i != vcsOut.end(); ++i) + for (std::vector::const_iterator i = vcsOut.begin(); i != vcsOut.end(); ++i) { CXBMCTinyXML doc; doc.Parse(*i); @@ -936,14 +935,14 @@ bool CScraper::GetVideoDetails(XFILE::CCurlFile &fcurl, const CScraperUrl &scurl video.Reset(); std::string sFunc = fMovie ? "GetDetails" : "GetEpisodeDetails"; - vector vcsIn; + std::vector vcsIn; vcsIn.push_back(scurl.strId); vcsIn.push_back(scurl.m_url[0].m_url); - vector vcsOut = RunNoThrow(sFunc, scurl, fcurl, &vcsIn); + std::vector vcsOut = RunNoThrow(sFunc, scurl, fcurl, &vcsIn); // parse XML output bool fRet(false); - for (vector::const_iterator i = vcsOut.begin(); i != vcsOut.end(); ++i) + for (std::vector::const_iterator i = vcsOut.begin(); i != vcsOut.end(); ++i) { CXBMCTinyXML doc; doc.Parse(*i, TIXML_ENCODING_UTF8); @@ -974,11 +973,11 @@ bool CScraper::GetAlbumDetails(CCurlFile &fcurl, const CScraperUrl &scurl, CAlbu scurl.m_url[0].m_url.c_str(), Name().c_str(), Path().c_str(), ADDON::TranslateContent(Content()).c_str(), Version().asString().c_str()); - vector vcsOut = RunNoThrow("GetAlbumDetails", scurl, fcurl); + std::vector vcsOut = RunNoThrow("GetAlbumDetails", scurl, fcurl); // parse the returned XML into an album object (see CAlbum::Load for details) bool fRet(false); - for (vector::const_iterator i = vcsOut.begin(); i != vcsOut.end(); ++i) + for (std::vector::const_iterator i = vcsOut.begin(); i != vcsOut.end(); ++i) { CXBMCTinyXML doc; doc.Parse(*i, TIXML_ENCODING_UTF8); @@ -1006,15 +1005,15 @@ bool CScraper::GetArtistDetails(CCurlFile &fcurl, const CScraperUrl &scurl, ADDON::TranslateContent(Content()).c_str(), Version().asString().c_str()); // pass in the original search string for chaining to search other sites - vector vcIn; + std::vector vcIn; vcIn.push_back(sSearch); vcIn[0] = CURL::Encode(vcIn[0]); - vector vcsOut = RunNoThrow("GetArtistDetails", scurl, fcurl, &vcIn); + std::vector vcsOut = RunNoThrow("GetArtistDetails", scurl, fcurl, &vcIn); // ok, now parse the xml file bool fRet(false); - for (vector::const_iterator i = vcsOut.begin(); i != vcsOut.end(); ++i) + for (std::vector::const_iterator i = vcsOut.begin(); i != vcsOut.end(); ++i) { CXBMCTinyXML doc; doc.Parse(*i, TIXML_ENCODING_UTF8); diff --git a/xbmc/addons/Service.cpp b/xbmc/addons/Service.cpp index a5db09201b367..53c70b6491bad 100644 --- a/xbmc/addons/Service.cpp +++ b/xbmc/addons/Service.cpp @@ -23,8 +23,6 @@ #include "utils/log.h" #include "system.h" -using namespace std; - namespace ADDON { @@ -97,7 +95,7 @@ void CService::BuildServiceType() std::string ext; size_t p = str.find_last_of('.'); - if (p != string::npos) + if (p != std::string::npos) ext = str.substr(p + 1); #ifdef HAS_PYTHON diff --git a/xbmc/addons/Skin.cpp b/xbmc/addons/Skin.cpp index 84454bd177947..e53a3228f264f 100644 --- a/xbmc/addons/Skin.cpp +++ b/xbmc/addons/Skin.cpp @@ -44,7 +44,6 @@ #define XML_ATTR_NAME "name" #define XML_ATTR_ID "id" -using namespace std; using namespace XFILE; using namespace KODI::MESSAGING; @@ -151,7 +150,7 @@ CSkinInfo::CSkinInfo(const cp_extension_t *ext) std::string folder = CAddonMgr::GetInstance().GetExtValue(*i, "@folder"); float aspect = 0; std::string strAspect = CAddonMgr::GetInstance().GetExtValue(*i, "@aspect"); - vector fracs = StringUtils::Split(strAspect, ':'); + std::vector fracs = StringUtils::Split(strAspect, ':'); if (fracs.size() == 2) aspect = (float)(atof(fracs[0].c_str())/atof(fracs[1].c_str())); if (width > 0 && height > 0) @@ -291,7 +290,7 @@ int CSkinInfo::GetStartWindow() const { int windowID = CSettings::GetInstance().GetInt(CSettings::SETTING_LOOKANDFEEL_STARTUPWINDOW); assert(m_startupWindows.size()); - for (vector::const_iterator it = m_startupWindows.begin(); it != m_startupWindows.end(); ++it) + for (std::vector::const_iterator it = m_startupWindows.begin(); it != m_startupWindows.end(); ++it) { if (windowID == (*it).m_id) return windowID; @@ -400,11 +399,11 @@ void CSkinInfo::SettingOptionsSkinColorsFiller(const CSetting *setting, std::vec // any other *.xml files are additional color themes on top of this one. // add the default label - list.push_back(make_pair(g_localizeStrings.Get(15109), "SKINDEFAULT")); // the standard defaults.xml will be used! + list.push_back(std::make_pair(g_localizeStrings.Get(15109), "SKINDEFAULT")); // the standard defaults.xml will be used! // Search for colors in the Current skin! - vector vecColors; - string strPath = URIUtils::AddFileToFolder(g_SkinInfo->Path(), "colors"); + std::vector vecColors; + std::string strPath = URIUtils::AddFileToFolder(g_SkinInfo->Path(), "colors"); CFileItemList items; CDirectory::GetDirectory(CSpecialProtocol::TranslatePathConvertCase(strPath), items, ".xml"); @@ -422,7 +421,7 @@ void CSkinInfo::SettingOptionsSkinColorsFiller(const CSetting *setting, std::vec list.push_back(make_pair(vecColors[i], vecColors[i])); // try to find the best matching value - for (vector< pair >::const_iterator it = list.begin(); it != list.end(); ++it) + for (std::vector< std::pair >::const_iterator it = list.begin(); it != list.end(); ++it) { if (StringUtils::EqualsNoCase(it->second, settingValue)) current = settingValue; @@ -457,9 +456,9 @@ void CSkinInfo::SettingOptionsSkinFontsFiller(const CSetting *setting, std::vect if (idAttr != NULL) { if (idLocAttr) - list.push_back(make_pair(g_localizeStrings.Get(atoi(idLocAttr)), idAttr)); + list.push_back(std::make_pair(g_localizeStrings.Get(atoi(idLocAttr)), idAttr)); else - list.push_back(make_pair(idAttr, idAttr)); + list.push_back(std::make_pair(idAttr, idAttr)); if (StringUtils::EqualsNoCase(idAttr, settingValue)) currentValueSet = true; @@ -492,7 +491,7 @@ void CSkinInfo::SettingOptionsSkinThemesFiller(const CSetting *setting, std::vec list.push_back(make_pair(g_localizeStrings.Get(15109), "SKINDEFAULT")); // the standard Textures.xpr/xbt will be used // search for themes in the current skin! - vector vecTheme; + std::vector vecTheme; CUtil::GetSkinThemes(vecTheme); // sort the themes for GUI and list them @@ -500,7 +499,7 @@ void CSkinInfo::SettingOptionsSkinThemesFiller(const CSetting *setting, std::vec list.push_back(make_pair(vecTheme[i], vecTheme[i])); // try to find the best matching value - for (vector< pair >::const_iterator it = list.begin(); it != list.end(); ++it) + for (std::vector< std::pair >::const_iterator it = list.begin(); it != list.end(); ++it) { if (StringUtils::EqualsNoCase(it->second, settingValue)) current = settingValue; @@ -512,11 +511,11 @@ void CSkinInfo::SettingOptionsStartupWindowsFiller(const CSetting *setting, std: int settingValue = ((const CSettingInt *)setting)->GetValue(); current = -1; - const vector &startupWindows = g_SkinInfo->GetStartupWindows(); + const std::vector &startupWindows = g_SkinInfo->GetStartupWindows(); - for (vector::const_iterator it = startupWindows.begin(); it != startupWindows.end(); ++it) + for (std::vector::const_iterator it = startupWindows.begin(); it != startupWindows.end(); ++it) { - string windowName = it->m_name; + std::string windowName = it->m_name; if (StringUtils::IsNaturalNumber(windowName)) windowName = g_localizeStrings.Get(atoi(windowName.c_str())); int windowID = it->m_id; @@ -537,7 +536,7 @@ void CSkinInfo::ToggleDebug() m_debugging = !m_debugging; } -int CSkinInfo::TranslateString(const string &setting) +int CSkinInfo::TranslateString(const std::string &setting) { // run through and see if we have this setting for (const auto& it : m_strings) @@ -556,7 +555,7 @@ int CSkinInfo::TranslateString(const string &setting) return number; } -const string& CSkinInfo::GetString(int setting) const +const std::string& CSkinInfo::GetString(int setting) const { const auto& it = m_strings.find(setting); if (it != m_strings.end()) @@ -565,7 +564,7 @@ const string& CSkinInfo::GetString(int setting) const return StringUtils::Empty; } -void CSkinInfo::SetString(int setting, const string &label) +void CSkinInfo::SetString(int setting, const std::string &label) { auto&& it = m_strings.find(setting); if (it != m_strings.end()) @@ -578,7 +577,7 @@ void CSkinInfo::SetString(int setting, const string &label) assert(false); } -int CSkinInfo::TranslateBool(const string &setting) +int CSkinInfo::TranslateBool(const std::string &setting) { // run through and see if we have this setting for (const auto& it : m_bools) @@ -620,7 +619,7 @@ void CSkinInfo::SetBool(int setting, bool set) assert(false); } -void CSkinInfo::Reset(const string &setting) +void CSkinInfo::Reset(const std::string &setting) { // run through and see if we have this setting as a string for (auto& it : m_strings) diff --git a/xbmc/addons/Visualisation.cpp b/xbmc/addons/Visualisation.cpp index f81dcbe3ae68c..84b396d6c227f 100644 --- a/xbmc/addons/Visualisation.cpp +++ b/xbmc/addons/Visualisation.cpp @@ -35,7 +35,6 @@ #include "filesystem/SpecialProtocol.h" #endif -using namespace std; using namespace MUSIC_INFO; using namespace ADDON; @@ -263,13 +262,13 @@ void CVisualisation::OnAudioData(const float* pAudioData, int iAudioDataLength) return; // Save our audio data in the buffers - unique_ptr pBuffer ( new CAudioBuffer(AUDIO_BUFFER_SIZE) ); + std::unique_ptr pBuffer ( new CAudioBuffer(AUDIO_BUFFER_SIZE) ); pBuffer->Set(pAudioData, iAudioDataLength); m_vecBuffers.push_back( pBuffer.release() ); if ( (int)m_vecBuffers.size() < m_iNumBuffers) return ; - unique_ptr ptrAudioBuffer ( m_vecBuffers.front() ); + std::unique_ptr ptrAudioBuffer ( m_vecBuffers.front() ); m_vecBuffers.pop_front(); // Fourier transform the data if the vis wants it... if (m_bWantsFreq) From f3aa16575a5145a0021ee36b7c03a29b7470a1d4 Mon Sep 17 00:00:00 2001 From: Matthias Kortstiege Date: Fri, 28 Aug 2015 10:21:47 +0200 Subject: [PATCH 05/22] [guilib] use std:: instead of using namespace std --- xbmc/guilib/DDSImage.cpp | 4 +-- xbmc/guilib/GUIAction.cpp | 6 ++--- xbmc/guilib/GUIAudioManager.cpp | 8 +++--- xbmc/guilib/GUIBaseContainer.cpp | 4 +-- xbmc/guilib/GUIButtonControl.cpp | 8 +++--- xbmc/guilib/GUICheckMarkControl.cpp | 6 ++--- xbmc/guilib/GUIControl.cpp | 6 ++--- xbmc/guilib/GUIControlFactory.cpp | 25 +++++++++---------- xbmc/guilib/GUIControlGroup.cpp | 12 ++++----- xbmc/guilib/GUIEditControl.cpp | 2 -- xbmc/guilib/GUIFadeLabelControl.cpp | 6 ++--- xbmc/guilib/GUIFontManager.cpp | 10 +++----- xbmc/guilib/GUIFontTTF.cpp | 15 +++++------ xbmc/guilib/GUIFontTTFGL.cpp | 3 --- xbmc/guilib/GUIImage.cpp | 8 +++--- xbmc/guilib/GUIIncludes.cpp | 14 +++++------ xbmc/guilib/GUIInfoTypes.cpp | 11 ++++----- xbmc/guilib/GUILabelControl.cpp | 4 +-- xbmc/guilib/GUIListItem.cpp | 2 -- xbmc/guilib/GUIListItemLayout.cpp | 2 -- xbmc/guilib/GUIMessage.cpp | 10 +++----- xbmc/guilib/GUIMultiImage.cpp | 1 - xbmc/guilib/GUIMultiSelectText.cpp | 6 ++--- xbmc/guilib/GUIPanelContainer.cpp | 6 ++--- xbmc/guilib/GUIRSSControl.cpp | 6 ++--- xbmc/guilib/GUIRenderingControl.cpp | 2 -- xbmc/guilib/GUISpinControl.cpp | 12 ++++----- xbmc/guilib/GUIStaticItem.cpp | 12 ++++----- xbmc/guilib/GUITextBox.cpp | 2 -- xbmc/guilib/GUITextLayout.cpp | 22 ++++++++--------- xbmc/guilib/GUITexture.cpp | 2 -- xbmc/guilib/GUIToggleButtonControl.cpp | 6 ++--- xbmc/guilib/GUIVisualisationControl.cpp | 1 - xbmc/guilib/GUIWindow.cpp | 5 ++-- xbmc/guilib/GUIWindowManager.cpp | 33 ++++++++++++------------- xbmc/guilib/GraphicContext.cpp | 11 ++++----- xbmc/guilib/Shader.cpp | 3 +-- xbmc/guilib/Shader.h | 12 ++++----- xbmc/guilib/TextureGL.cpp | 2 -- xbmc/guilib/TextureManager.cpp | 9 +++---- xbmc/guilib/TexturePi.cpp | 2 -- xbmc/guilib/VisibleEffect.cpp | 24 +++++++++--------- 42 files changed, 133 insertions(+), 212 deletions(-) diff --git a/xbmc/guilib/DDSImage.cpp b/xbmc/guilib/DDSImage.cpp index c5c3106eef0f6..c2fd215029925 100644 --- a/xbmc/guilib/DDSImage.cpp +++ b/xbmc/guilib/DDSImage.cpp @@ -32,8 +32,6 @@ using namespace XFILE; #include "SimpleFS.h" #endif -using namespace std; - CDDSImage::CDDSImage() { m_data = NULL; @@ -126,7 +124,7 @@ bool CDDSImage::Create(const std::string &outputFile, unsigned int width, unsign { // use ARGB Allocate(width, height, XB_FMT_A8R8G8B8); for (unsigned int i = 0; i < height; i++) - memcpy(m_data + i * width * 4, brga + i * pitch, min(width * 4, pitch)); + memcpy(m_data + i * width * 4, brga + i * pitch, std::min(width * 4, pitch)); } return WriteFile(outputFile); } diff --git a/xbmc/guilib/GUIAction.cpp b/xbmc/guilib/GUIAction.cpp index 360e7e182f91c..d80c4f75f4416 100644 --- a/xbmc/guilib/GUIAction.cpp +++ b/xbmc/guilib/GUIAction.cpp @@ -24,8 +24,6 @@ #include "GUIControl.h" #include "GUIInfoManager.h" -using namespace std; - CGUIAction::CGUIAction() { m_sendThreadMessages = false; @@ -41,7 +39,7 @@ bool CGUIAction::ExecuteActions(int controlID, int parentID) const { if (m_actions.size() == 0) return false; // take a copy of actions that satisfy our conditions - vector actions; + std::vector actions; for (ciActions it = m_actions.begin() ; it != m_actions.end() ; ++it) { if (it->condition.empty() || g_infoManager.EvaluateBool(it->condition)) @@ -52,7 +50,7 @@ bool CGUIAction::ExecuteActions(int controlID, int parentID) const } // execute them bool retval = false; - for (vector::iterator i = actions.begin(); i != actions.end(); ++i) + for (std::vector::iterator i = actions.begin(); i != actions.end(); ++i) { CGUIMessage msg(GUI_MSG_EXECUTE, controlID, parentID); msg.SetStringParam(*i); diff --git a/xbmc/guilib/GUIAudioManager.cpp b/xbmc/guilib/GUIAudioManager.cpp index 2be09298aa52b..379ff04dff3b2 100644 --- a/xbmc/guilib/GUIAudioManager.cpp +++ b/xbmc/guilib/GUIAudioManager.cpp @@ -32,8 +32,6 @@ #include "cores/AudioEngine/AEFactory.h" #include "utils/log.h" -using namespace std; - CGUIAudioManager g_audioManager; CGUIAudioManager::CGUIAudioManager() @@ -180,7 +178,7 @@ void CGUIAudioManager::PlayPythonSound(const std::string& strFileName, bool useC if (!sound) return; - m_pythonSounds.insert(pair(strFileName, sound)); + m_pythonSounds.insert(std::pair(strFileName, sound)); sound->Play(); } @@ -296,7 +294,7 @@ bool CGUIAudioManager::Load() std::string filename = URIUtils::AddFileToFolder(m_strMediaDir, strFile); IAESound *sound = LoadSound(filename); if (sound) - m_actionSoundMap.insert(pair(id, sound)); + m_actionSoundMap.insert(std::pair(id, sound)); } pAction = pAction->NextSibling(); @@ -325,7 +323,7 @@ bool CGUIAudioManager::Load() sounds.deInitSound = LoadWindowSound(pWindow, "deactivate"); if (id > 0) - m_windowSoundMap.insert(pair(id, sounds)); + m_windowSoundMap.insert(std::pair(id, sounds)); pWindow = pWindow->NextSibling(); } diff --git a/xbmc/guilib/GUIBaseContainer.cpp b/xbmc/guilib/GUIBaseContainer.cpp index c954fc53c3915..8eddde48923db 100644 --- a/xbmc/guilib/GUIBaseContainer.cpp +++ b/xbmc/guilib/GUIBaseContainer.cpp @@ -33,8 +33,6 @@ #include "settings/Settings.h" #include "guiinfo/GUIInfoLabels.h" -using namespace std; - #define HOLD_TIME_START 100 #define HOLD_TIME_END 3000 #define SCROLLING_GAP 200U @@ -789,7 +787,7 @@ void CGUIBaseContainer::SetFocus(bool bOnOff) CGUIControl::SetFocus(bOnOff); } -void CGUIBaseContainer::SaveStates(vector &states) +void CGUIBaseContainer::SaveStates(std::vector &states) { if (!m_listProvider || !m_listProvider->AlwaysFocusDefaultItem()) states.push_back(CControlState(GetID(), GetSelectedItem())); diff --git a/xbmc/guilib/GUIButtonControl.cpp b/xbmc/guilib/GUIButtonControl.cpp index 6e4a47a433538..998bab9883fc7 100644 --- a/xbmc/guilib/GUIButtonControl.cpp +++ b/xbmc/guilib/GUIButtonControl.cpp @@ -22,8 +22,6 @@ #include "GUIFontManager.h" #include "input/Key.h" -using namespace std; - CGUIButtonControl::CGUIButtonControl(int parentID, int controlID, float posX, float posY, float width, float height, const CTextureInfo& textureFocus, const CTextureInfo& textureNoFocus, const CLabelInfo& labelInfo, bool wrapMultiline) : CGUIControl(parentID, controlID, posX, posY, width, height) , m_imgFocus(posX, posY, width, height, textureFocus) @@ -264,7 +262,7 @@ void CGUIButtonControl::SetInvalid() m_imgNoFocus.SetInvalid(); } -void CGUIButtonControl::SetLabel(const string &label) +void CGUIButtonControl::SetLabel(const std::string &label) { // NOTE: No fallback for buttons at this point if (m_info.GetLabel(GetParentID(), false) != label) { @@ -273,7 +271,7 @@ void CGUIButtonControl::SetLabel(const string &label) } } -void CGUIButtonControl::SetLabel2(const string &label2) +void CGUIButtonControl::SetLabel2(const std::string &label2) { // NOTE: No fallback for buttons at this point if (m_info2.GetLabel(GetParentID(), false) != label2) { @@ -337,7 +335,7 @@ std::string CGUIButtonControl::GetLabel2() const return strLabel; } -void CGUIButtonControl::PythonSetLabel(const std::string &strFont, const string &strText, color_t textColor, color_t shadowColor, color_t focusedColor) +void CGUIButtonControl::PythonSetLabel(const std::string &strFont, const std::string &strText, color_t textColor, color_t shadowColor, color_t focusedColor) { m_label.GetLabelInfo().font = g_fontManager.GetFont(strFont); m_label.GetLabelInfo().textColor = textColor; diff --git a/xbmc/guilib/GUICheckMarkControl.cpp b/xbmc/guilib/GUICheckMarkControl.cpp index 3c55e94e1fc36..a988ae0a68c8f 100644 --- a/xbmc/guilib/GUICheckMarkControl.cpp +++ b/xbmc/guilib/GUICheckMarkControl.cpp @@ -22,8 +22,6 @@ #include "GUIFontManager.h" #include "input/Key.h" -using namespace std; - CGUICheckMarkControl::CGUICheckMarkControl(int parentID, int controlID, float posX, float posY, float width, float height, const CTextureInfo& textureCheckMark, const CTextureInfo& textureCheckMarkNF, float checkWidth, float checkHeight, const CLabelInfo &labelInfo) : CGUIControl(parentID, controlID, posX, posY, width, height) , m_imgCheckMark(posX, posY, checkWidth, checkHeight, textureCheckMark) @@ -170,7 +168,7 @@ EVENT_RESULT CGUICheckMarkControl::OnMouseEvent(const CPoint &point, const CMous return EVENT_RESULT_UNHANDLED; } -void CGUICheckMarkControl::SetLabel(const string &label) +void CGUICheckMarkControl::SetLabel(const std::string &label) { if (m_strLabel != label) { @@ -179,7 +177,7 @@ void CGUICheckMarkControl::SetLabel(const string &label) } } -void CGUICheckMarkControl::PythonSetLabel(const std::string &strFont, const string &strText, color_t textColor) +void CGUICheckMarkControl::PythonSetLabel(const std::string &strFont, const std::string &strText, color_t textColor) { m_label.GetLabelInfo().font = g_fontManager.GetFont(strFont); m_label.GetLabelInfo().textColor = textColor; diff --git a/xbmc/guilib/GUIControl.cpp b/xbmc/guilib/GUIControl.cpp index 020c6a0d61055..68f9ff630aec0 100644 --- a/xbmc/guilib/GUIControl.cpp +++ b/xbmc/guilib/GUIControl.cpp @@ -28,8 +28,6 @@ #include "input/InputManager.h" #include "input/Key.h" -using namespace std; - CGUIControl::CGUIControl() : m_diffuseColor(0xffffffff) { @@ -642,7 +640,7 @@ void CGUIControl::SetVisibleCondition(const std::string &expression, const std:: m_allowHiddenFocus.Parse(allowHiddenFocus, GetParentID()); } -void CGUIControl::SetAnimations(const vector &animations) +void CGUIControl::SetAnimations(const std::vector &animations) { m_animations = animations; MarkDirtyRegion(); @@ -895,7 +893,7 @@ bool CGUIControl::HasVisibleID(int id) const return GetID() == id && IsVisible(); } -void CGUIControl::SaveStates(vector &states) +void CGUIControl::SaveStates(std::vector &states) { // empty for now - do nothing with the majority of controls } diff --git a/xbmc/guilib/GUIControlFactory.cpp b/xbmc/guilib/GUIControlFactory.cpp index 464b84f9b8987..3f1139b883217 100644 --- a/xbmc/guilib/GUIControlFactory.cpp +++ b/xbmc/guilib/GUIControlFactory.cpp @@ -66,7 +66,6 @@ #include "GUIAction.h" #include "Util.h" -using namespace std; using namespace EPG; typedef struct @@ -271,26 +270,26 @@ bool CGUIControlFactory::GetDimensions(const TiXmlNode *node, const char *leftTa { if (hasRight) { - width = max(0.0f, right - left); // if left=0, this fills to size of parent + width = std::max(0.0f, right - left); // if left=0, this fills to size of parent hasLeft = true; } else if (hasCenter) { if (hasLeft) { - width = max(0.0f, (center - left) * 2); + width = std::max(0.0f, (center - left) * 2); hasWidth = true; } else if (center > 0 && center < parentSize) { // centre given, so fill to edge of parent - width = max(0.0f, min(parentSize - center, center) * 2); + width = std::max(0.0f, std::min(parentSize - center, center) * 2); left = center - width/2; hasLeft = hasWidth = true; } } else if (hasLeft) // neither right nor center specified { - width = max(0.0f, parentSize - left); // if left=0, this fills to parent + width = std::max(0.0f, parentSize - left); // if left=0, this fills to parent } } return hasLeft && hasWidth; @@ -422,7 +421,7 @@ bool CGUIControlFactory::GetConditionalVisibility(const TiXmlNode* control, std: { const TiXmlElement* node = control->FirstChildElement("visible"); if (!node) return false; - vector conditions; + std::vector conditions; while (node) { const char *hidden = node->Attribute("allowhiddenfocus"); @@ -453,7 +452,7 @@ bool CGUIControlFactory::GetConditionalVisibility(const TiXmlNode *control, std: return GetConditionalVisibility(control, condition, allowHiddenFocus); } -bool CGUIControlFactory::GetAnimations(TiXmlNode *control, const CRect &rect, int context, vector &animations) +bool CGUIControlFactory::GetAnimations(TiXmlNode *control, const CRect &rect, int context, std::vector &animations) { TiXmlElement* node = control->FirstChildElement("animation"); bool ret = false; @@ -566,7 +565,7 @@ bool CGUIControlFactory::GetInfoColor(const TiXmlNode *control, const char *strT void CGUIControlFactory::GetInfoLabel(const TiXmlNode *pControlNode, const std::string &labelTag, CGUIInfoLabel &infoLabel, int parentID) { - vector labels; + std::vector labels; GetInfoLabels(pControlNode, labelTag, labels, parentID); if (labels.size()) infoLabel = labels[0]; @@ -592,7 +591,7 @@ bool CGUIControlFactory::GetInfoLabelFromElement(const TiXmlElement *element, CG return true; } -void CGUIControlFactory::GetInfoLabels(const TiXmlNode *pControlNode, const std::string &labelTag, vector &infoLabels, int parentID) +void CGUIControlFactory::GetInfoLabels(const TiXmlNode *pControlNode, const std::string &labelTag, std::vector &infoLabels, int parentID) { // we can have the following infolabels: // 1. 1234 -> direct number @@ -743,7 +742,7 @@ CGUIControl* CGUIControlFactory::Create(int parentID, const CRect &rect, TiXmlEl std::string allowHiddenFocus; std::string enableCondition; - vector animations; + std::vector animations; CGUIControl::GUISCROLLVALUE scrollValue = CGUIControl::FOCUS; bool bPulse = true; @@ -807,13 +806,13 @@ CGUIControl* CGUIControlFactory::Create(int parentID, const CRect &rect, TiXmlEl posX -= width; } if (!width) // no width specified, so compute from parent - width = max(rect.Width() - posX, 0.0f); + width = std::max(rect.Width() - posX, 0.0f); } if (!GetDimensions(pControlNode, "top", "bottom", "centertop", "centerbottom", "height", rect.Height(), posY, height, minHeight)) { GetPosition(pControlNode, "posy", rect.Height(), posY); if (!height) - height = max(rect.Height() - posY, 0.0f); + height = std::max(rect.Height() - posY, 0.0f); } XMLUtils::GetFloat(pControlNode, "offsetx", offset.x); @@ -981,7 +980,7 @@ CGUIControl* CGUIControlFactory::Create(int parentID, const CRect &rect, TiXmlEl GetTexture(pControlNode, "imagefolderfocus", imageFocus); // fade label can have a whole bunch, but most just have one - vector infoLabels; + std::vector infoLabels; GetInfoLabels(pControlNode, "label", infoLabels, parentID); GetString(pControlNode, "label", strLabel); diff --git a/xbmc/guilib/GUIControlGroup.cpp b/xbmc/guilib/GUIControlGroup.cpp index 4be2aa20bd3d6..cfb3d22f3c3c5 100644 --- a/xbmc/guilib/GUIControlGroup.cpp +++ b/xbmc/guilib/GUIControlGroup.cpp @@ -24,8 +24,6 @@ #include -using namespace std; - CGUIControlGroup::CGUIControlGroup() { m_defaultControl = 0; @@ -496,7 +494,7 @@ CGUIControl *CGUIControlGroup::GetFocusedControl() const if (m_focusedControl) { // we may have multiple controls with same id - we pick first that has focus - pair range = m_lookup.equal_range(m_focusedControl); + std::pair range = m_lookup.equal_range(m_focusedControl); for (LookupMap::const_iterator i = range.first; i != range.second; ++i) { if (i->second->HasFocus()) @@ -597,10 +595,10 @@ void CGUIControlGroup::AddLookup(CGUIControl *control) { // first add all the subitems of this group (if they exist) const LookupMap map = ((CGUIControlGroup *)control)->GetLookup(); for (LookupMap::const_iterator i = map.begin(); i != map.end(); ++i) - m_lookup.insert(m_lookup.upper_bound(i->first), make_pair(i->first, i->second)); + m_lookup.insert(m_lookup.upper_bound(i->first), std::make_pair(i->first, i->second)); } if (control->GetID()) - m_lookup.insert(m_lookup.upper_bound(control->GetID()), make_pair(control->GetID(), control)); + m_lookup.insert(m_lookup.upper_bound(control->GetID()), std::make_pair(control->GetID(), control)); // ensure that our size is what it should be if (m_parentControl) ((CGUIControlGroup *)m_parentControl)->AddLookup(control); @@ -669,7 +667,7 @@ bool CGUIControlGroup::InsertControl(CGUIControl *control, const CGUIControl *in return false; } -void CGUIControlGroup::SaveStates(vector &states) +void CGUIControlGroup::SaveStates(std::vector &states) { // save our state, and that of our children states.push_back(CControlState(GetID(), m_focusedControl)); @@ -716,7 +714,7 @@ void CGUIControlGroup::ClearAll() SetInvalid(); } -void CGUIControlGroup::GetContainers(vector &containers) const +void CGUIControlGroup::GetContainers(std::vector &containers) const { for (ciControls it = m_children.begin();it != m_children.end(); ++it) { diff --git a/xbmc/guilib/GUIEditControl.cpp b/xbmc/guilib/GUIEditControl.cpp index 7d1d2513c87f6..b45bff038a910 100644 --- a/xbmc/guilib/GUIEditControl.cpp +++ b/xbmc/guilib/GUIEditControl.cpp @@ -39,8 +39,6 @@ const char* CGUIEditControl::smsLetters[10] = { " !@#$%^&*()[]{}<>/\\|0", ".,;:\'\"-+_=?`~1", "abc2ABC", "def3DEF", "ghi4GHI", "jkl5JKL", "mno6MNO", "pqrs7PQRS", "tuv8TUV", "wxyz9WXYZ" }; const unsigned int CGUIEditControl::smsDelay = 1000; -using namespace std; - #ifdef TARGET_WINDOWS extern HWND g_hWnd; #endif diff --git a/xbmc/guilib/GUIFadeLabelControl.cpp b/xbmc/guilib/GUIFadeLabelControl.cpp index 14514220000fb..518456febd9e2 100644 --- a/xbmc/guilib/GUIFadeLabelControl.cpp +++ b/xbmc/guilib/GUIFadeLabelControl.cpp @@ -20,8 +20,6 @@ #include "GUIFadeLabelControl.h" -using namespace std; - CGUIFadeLabelControl::CGUIFadeLabelControl(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, bool scrollOut, unsigned int timeToDelayAtEnd, bool resetOnLabelChange) : CGUIControl(parentID, controlID, posX, posY, width, height), m_label(labelInfo), m_scrollInfo(50, labelInfo.offsetX, labelInfo.scrollSpeed) , m_textLayout(labelInfo.font, false) @@ -58,13 +56,13 @@ CGUIFadeLabelControl::~CGUIFadeLabelControl(void) { } -void CGUIFadeLabelControl::SetInfo(const vector &infoLabels) +void CGUIFadeLabelControl::SetInfo(const std::vector &infoLabels) { m_lastLabel = -1; m_infoLabels = infoLabels; } -void CGUIFadeLabelControl::AddLabel(const string &label) +void CGUIFadeLabelControl::AddLabel(const std::string &label) { m_infoLabels.push_back(CGUIInfoLabel(label, "", GetParentID())); } diff --git a/xbmc/guilib/GUIFontManager.cpp b/xbmc/guilib/GUIFontManager.cpp index 8030f2e385325..dc93d84a26cce 100644 --- a/xbmc/guilib/GUIFontManager.cpp +++ b/xbmc/guilib/GUIFontManager.cpp @@ -39,8 +39,6 @@ #include "filesystem/SpecialProtocol.h" #endif -using namespace std; - GUIFontManager::GUIFontManager(void) { m_canReload = true; @@ -242,7 +240,7 @@ void GUIFontManager::ReloadTTFFonts(void) void GUIFontManager::Unload(const std::string& strFontName) { - for (vector::iterator iFont = m_vecFonts.begin(); iFont != m_vecFonts.end(); ++iFont) + for (std::vector::iterator iFont = m_vecFonts.begin(); iFont != m_vecFonts.end(); ++iFont) { if (StringUtils::EqualsNoCase((*iFont)->GetFontName(), strFontName)) { @@ -255,7 +253,7 @@ void GUIFontManager::Unload(const std::string& strFontName) void GUIFontManager::FreeFontFile(CGUIFontTTFBase *pFont) { - for (vector::iterator it = m_vecFontFiles.begin(); it != m_vecFontFiles.end(); ++it) + for (std::vector::iterator it = m_vecFontFiles.begin(); it != m_vecFontFiles.end(); ++it) { if (pFont == *it) { @@ -428,8 +426,8 @@ void GUIFontManager::GetStyle(const TiXmlNode *fontNode, int &iStyle) iStyle = FONT_STYLE_NORMAL; if (XMLUtils::GetString(fontNode, "style", style)) { - vector styles = StringUtils::Tokenize(style, " "); - for (vector::const_iterator i = styles.begin(); i != styles.end(); ++i) + std::vector styles = StringUtils::Tokenize(style, " "); + for (std::vector::const_iterator i = styles.begin(); i != styles.end(); ++i) { if (*i == "bold") iStyle |= FONT_STYLE_BOLD; diff --git a/xbmc/guilib/GUIFontTTF.cpp b/xbmc/guilib/GUIFontTTF.cpp index 422bc75f3882f..0c10661e365ef 100644 --- a/xbmc/guilib/GUIFontTTF.cpp +++ b/xbmc/guilib/GUIFontTTF.cpp @@ -48,9 +48,6 @@ #pragma comment(lib, "freetype246MT.lib") #endif -using namespace std; - - #define CHARS_PER_TEXTURE_LINE 20 // number of characters to cache per texture line #define CHAR_CHUNK 64 // 64 chars allocated at a time (1024 bytes) @@ -567,7 +564,7 @@ float CGUIFontTTFBase::GetTextWidthInternal(vecText::const_iterator start, vecTe // and not advance distance - this makes sure that italic text isn't // choped on the end (as render width is larger than advance then). if (start == end) - width += max(c->right - c->left + c->offsetX, c->advance); + width += std::max(c->right - c->left + c->offsetX, c->advance); else width += c->advance; } @@ -780,13 +777,13 @@ bool CGUIFontTTFBase::CacheCharacter(wchar_t letter, uint32_t style, Character * if (!isEmptyGlyph) { // ensure our rect will stay inside the texture (it *should* but we need to be certain) - unsigned int x1 = max(m_posX + ch->offsetX, 0); - unsigned int y1 = max(m_posY + ch->offsetY, 0); - unsigned int x2 = min(x1 + bitmap.width, m_textureWidth); - unsigned int y2 = min(y1 + bitmap.rows, m_textureHeight); + unsigned int x1 = std::max(m_posX + ch->offsetX, 0); + unsigned int y1 = std::max(m_posY + ch->offsetY, 0); + unsigned int x2 = std::min(x1 + bitmap.width, m_textureWidth); + unsigned int y2 = std::min(y1 + bitmap.rows, m_textureHeight); CopyCharToTexture(bitGlyph, x1, y1, x2, y2); - m_posX += spacing_between_characters_in_texture + (unsigned short)max(ch->right - ch->left + ch->offsetX, ch->advance); + m_posX += spacing_between_characters_in_texture + (unsigned short)std::max(ch->right - ch->left + ch->offsetX, ch->advance); } m_numChars++; diff --git a/xbmc/guilib/GUIFontTTFGL.cpp b/xbmc/guilib/GUIFontTTFGL.cpp index 770431f4ea28e..d19a2e0e1a4cc 100644 --- a/xbmc/guilib/GUIFontTTFGL.cpp +++ b/xbmc/guilib/GUIFontTTFGL.cpp @@ -37,11 +37,8 @@ #include FT_GLYPH_H #include FT_OUTLINE_H -using namespace std; - #if defined(HAS_GL) || defined(HAS_GLES) - CGUIFontTTFGL::CGUIFontTTFGL(const std::string& strFileName) : CGUIFontTTFBase(strFileName) { diff --git a/xbmc/guilib/GUIImage.cpp b/xbmc/guilib/GUIImage.cpp index 2b52a56b60393..ce1b68bbbe3ec 100644 --- a/xbmc/guilib/GUIImage.cpp +++ b/xbmc/guilib/GUIImage.cpp @@ -23,8 +23,6 @@ #include -using namespace std; - CGUIImage::CGUIImage(int parentID, int controlID, float posX, float posY, float width, float height, const CTextureInfo& texture) : CGUIControl(parentID, controlID, posX, posY, width, height) , m_texture(posX, posY, width, height, texture) @@ -124,7 +122,7 @@ void CGUIImage::Process(unsigned int currentTime, CDirtyRegionList &dirtyregions if (m_fadingTextures.size()) // have some fading images { // anything other than the last old texture needs to be faded out as per usual - for (vector::iterator i = m_fadingTextures.begin(); i != m_fadingTextures.end() - 1;) + for (std::vector::iterator i = m_fadingTextures.begin(); i != m_fadingTextures.end() - 1;) { if (!ProcessFading(*i, frameTime, currentTime)) i = m_fadingTextures.erase(i); @@ -176,7 +174,7 @@ void CGUIImage::Render() { if (!IsVisible()) return; - for (vector::iterator itr = m_fadingTextures.begin(); itr != m_fadingTextures.end(); ++itr) + for (std::vector::iterator itr = m_fadingTextures.begin(); itr != m_fadingTextures.end(); ++itr) (*itr)->m_texture->Render(); m_texture.Render(); @@ -299,7 +297,7 @@ CRect CGUIImage::CalcRenderRegion() const { CRect region = m_texture.GetRenderRect(); - for (vector::const_iterator itr = m_fadingTextures.begin(); itr != m_fadingTextures.end(); ++itr) + for (std::vector::const_iterator itr = m_fadingTextures.begin(); itr != m_fadingTextures.end(); ++itr) region.Union( (*itr)->m_texture->GetRenderRect() ); return CGUIControl::CalcRenderRegion().Intersect(region); diff --git a/xbmc/guilib/GUIIncludes.cpp b/xbmc/guilib/GUIIncludes.cpp index 16124b9fd230e..3decd4ddddd41 100644 --- a/xbmc/guilib/GUIIncludes.cpp +++ b/xbmc/guilib/GUIIncludes.cpp @@ -28,8 +28,6 @@ #include "utils/StringUtils.h" #include "interfaces/info/SkinVariable.h" -using namespace std; - CGUIIncludes::CGUIIncludes() { m_constantAttributes.insert("x"); @@ -171,7 +169,7 @@ bool CGUIIncludes::LoadIncludesFromXML(const TiXmlElement *root) if (node->Attribute("type") && node->FirstChild()) { std::string tagName = node->Attribute("type"); - m_defaults.insert(pair(tagName, *node)); + m_defaults.insert(std::pair(tagName, *node)); } node = node->NextSiblingElement("default"); } @@ -233,7 +231,7 @@ void CGUIIncludes::ResolveIncludesForNode(TiXmlElement *node, std::mapValueStr() == "control") { type = XMLUtils::GetAttribute(node, "type"); - map::const_iterator it = m_defaults.find(type); + std::map::const_iterator it = m_defaults.find(type); if (it != m_defaults.end()) { // we don't insert et. al. if or is specified @@ -481,10 +479,10 @@ CGUIIncludes::ResolveParamsResult CGUIIncludes::ResolveParameters(const std::str std::string CGUIIncludes::ResolveConstant(const std::string &constant) const { - vector values = StringUtils::Split(constant, ","); - for (vector::iterator i = values.begin(); i != values.end(); ++i) + std::vector values = StringUtils::Split(constant, ","); + for (std::vector::iterator i = values.begin(); i != values.end(); ++i) { - map::const_iterator it = m_constants.find(*i); + std::map::const_iterator it = m_constants.find(*i); if (it != m_constants.end()) *i = it->second; } @@ -493,7 +491,7 @@ std::string CGUIIncludes::ResolveConstant(const std::string &constant) const const INFO::CSkinVariableString* CGUIIncludes::CreateSkinVariable(const std::string& name, int context) { - map::const_iterator it = m_skinvariables.find(name); + std::map::const_iterator it = m_skinvariables.find(name); if (it != m_skinvariables.end()) return INFO::CSkinVariable::CreateFromXML(it->second, context); return NULL; diff --git a/xbmc/guilib/GUIInfoTypes.cpp b/xbmc/guilib/GUIInfoTypes.cpp index 7d37a979f7169..5f0725c86b108 100644 --- a/xbmc/guilib/GUIInfoTypes.cpp +++ b/xbmc/guilib/GUIInfoTypes.cpp @@ -28,7 +28,6 @@ #include "utils/StringUtils.h" #include "addons/Skin.h" -using namespace std; using ADDON::CAddonMgr; CGUIInfoBool::CGUIInfoBool(bool value) @@ -150,7 +149,7 @@ const std::string &CGUIInfoLabel::GetLabel(int contextWindow, bool preferImage, bool needsUpdate = m_dirty; if (!m_info.empty()) { - for (vector::const_iterator portion = m_info.begin(); portion != m_info.end(); ++portion) + for (std::vector::const_iterator portion = m_info.begin(); portion != m_info.end(); ++portion) { if (portion->m_info) { @@ -174,7 +173,7 @@ const std::string &CGUIInfoLabel::GetItemLabel(const CGUIListItem *item, bool pr bool needsUpdate = m_dirty; if (item->IsFileItem() && !m_info.empty()) { - for (vector::const_iterator portion = m_info.begin(); portion != m_info.end(); ++portion) + for (std::vector::const_iterator portion = m_info.begin(); portion != m_info.end(); ++portion) { if (portion->m_info) { @@ -198,7 +197,7 @@ const std::string &CGUIInfoLabel::CacheLabel(bool rebuild) const if (rebuild) { m_label.clear(); - for (vector::const_iterator portion = m_info.begin(); portion != m_info.end(); ++portion) + for (std::vector::const_iterator portion = m_info.begin(); portion != m_info.end(); ++portion) m_label += portion->Get(); m_dirty = false; } @@ -334,7 +333,7 @@ void CGUIInfoLabel::Parse(const std::string &label, int context) for (size_t i = 0; i < sizeof(infoformatmap) / sizeof(infoformat); i++) { pos2 = work.find(infoformatmap[i].str); - if (pos2 != string::npos && pos2 < pos1) + if (pos2 != std::string::npos && pos2 < pos1) { pos1 = pos2; len = strlen(infoformatmap[i].str); @@ -352,7 +351,7 @@ void CGUIInfoLabel::Parse(const std::string &label, int context) { // decipher the block std::string block = work.substr(pos1 + len, pos2 - pos1 - len); - vector params = StringUtils::Split(block, ","); + std::vector params = StringUtils::Split(block, ","); if (!params.empty()) { int info; diff --git a/xbmc/guilib/GUILabelControl.cpp b/xbmc/guilib/GUILabelControl.cpp index 59cf901e45b0e..32da2e57c7b91 100644 --- a/xbmc/guilib/GUILabelControl.cpp +++ b/xbmc/guilib/GUILabelControl.cpp @@ -22,8 +22,6 @@ #include "utils/CharsetConverter.h" #include "utils/StringUtils.h" -using namespace std; - CGUILabelControl::CGUILabelControl(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, bool wrapMultiLine, bool bHasPath) : CGUIControl(parentID, controlID, posX, posY, width, height) , m_label(posX, posY, width, height, labelInfo, wrapMultiLine ? CGUILabel::OVER_FLOW_WRAP : CGUILabel::OVER_FLOW_TRUNCATE) @@ -154,7 +152,7 @@ bool CGUILabelControl::CanFocus() const return false; } -void CGUILabelControl::SetLabel(const string &strLabel) +void CGUILabelControl::SetLabel(const std::string &strLabel) { // NOTE: this optimization handles fixed labels only (i.e. not info labels). // One way it might be extended to all labels would be for GUIInfoLabel ( or here ) diff --git a/xbmc/guilib/GUIListItem.cpp b/xbmc/guilib/GUIListItem.cpp index 56b13d643f019..09de26f57b467 100644 --- a/xbmc/guilib/GUIListItem.cpp +++ b/xbmc/guilib/GUIListItem.cpp @@ -25,8 +25,6 @@ #include "utils/StringUtils.h" #include "utils/Variant.h" -using namespace std; - bool CGUIListItem::icompare::operator()(const std::string &s1, const std::string &s2) const { return StringUtils::CompareNoCase(s1, s2) < 0; diff --git a/xbmc/guilib/GUIListItemLayout.cpp b/xbmc/guilib/GUIListItemLayout.cpp index 44744c538830c..f66207a483338 100644 --- a/xbmc/guilib/GUIListItemLayout.cpp +++ b/xbmc/guilib/GUIListItemLayout.cpp @@ -27,8 +27,6 @@ #include "GUIImage.h" #include "utils/XBMCTinyXML.h" -using namespace std; - CGUIListItemLayout::CGUIListItemLayout() : m_group(0, 0, 0, 0, 0, 0) { diff --git a/xbmc/guilib/GUIMessage.cpp b/xbmc/guilib/GUIMessage.cpp index 77e0a530ad2ec..ab9a6be399601 100644 --- a/xbmc/guilib/GUIMessage.cpp +++ b/xbmc/guilib/GUIMessage.cpp @@ -21,8 +21,6 @@ #include "GUIMessage.h" #include "LocalizeStrings.h" -using namespace std; - std::string CGUIMessage::empty_string; CGUIMessage::CGUIMessage(int msg, int senderID, int controlID, int param1, int param2) @@ -133,12 +131,12 @@ void CGUIMessage::SetPointer(void* lpVoid) m_pointer = lpVoid; } -void CGUIMessage::SetLabel(const string& strLabel) +void CGUIMessage::SetLabel(const std::string& strLabel) { m_strLabel = strLabel; } -const string& CGUIMessage::GetLabel() const +const std::string& CGUIMessage::GetLabel() const { return m_strLabel; } @@ -148,14 +146,14 @@ void CGUIMessage::SetLabel(int iString) m_strLabel = g_localizeStrings.Get(iString); } -void CGUIMessage::SetStringParam(const string& strParam) +void CGUIMessage::SetStringParam(const std::string& strParam) { m_params.clear(); if (strParam.size()) m_params.push_back(strParam); } -void CGUIMessage::SetStringParams(const vector ¶ms) +void CGUIMessage::SetStringParams(const std::vector ¶ms) { m_params = params; } diff --git a/xbmc/guilib/GUIMultiImage.cpp b/xbmc/guilib/GUIMultiImage.cpp index 5ccb9fca4087b..be2327aa9973c 100644 --- a/xbmc/guilib/GUIMultiImage.cpp +++ b/xbmc/guilib/GUIMultiImage.cpp @@ -30,7 +30,6 @@ #include "WindowIDs.h" #include "utils/StringUtils.h" -using namespace std; using namespace XFILE; CGUIMultiImage::CGUIMultiImage(int parentID, int controlID, float posX, float posY, float width, float height, const CTextureInfo& texture, unsigned int timePerImage, unsigned int fadeTime, bool randomized, bool loop, unsigned int timeToPauseAtEnd) diff --git a/xbmc/guilib/GUIMultiSelectText.cpp b/xbmc/guilib/GUIMultiSelectText.cpp index edf8ce8bec273..4b6d96b948a90 100644 --- a/xbmc/guilib/GUIMultiSelectText.cpp +++ b/xbmc/guilib/GUIMultiSelectText.cpp @@ -24,8 +24,6 @@ #include "utils/log.h" #include "utils/StringUtils.h" -using namespace std; - CGUIMultiSelectTextControl::CSelectableString::CSelectableString(CGUIFont *font, const std::string &text, bool selectable, const std::string &clickAction) : m_text(font, false) , m_clickAction(clickAction) @@ -413,11 +411,11 @@ void CGUIMultiSelectTextControl::SetFocus(bool focus) } // overrides to allow anims to translate down to the focus image -void CGUIMultiSelectTextControl::SetAnimations(const vector &animations) +void CGUIMultiSelectTextControl::SetAnimations(const std::vector &animations) { // send any focus animations down to the focus image only m_animations.clear(); - vector focusAnims; + std::vector focusAnims; for (unsigned int i = 0; i < animations.size(); i++) { const CAnimation &anim = animations[i]; diff --git a/xbmc/guilib/GUIPanelContainer.cpp b/xbmc/guilib/GUIPanelContainer.cpp index 552e0236293ae..14e5b9bb4b5f6 100644 --- a/xbmc/guilib/GUIPanelContainer.cpp +++ b/xbmc/guilib/GUIPanelContainer.cpp @@ -24,8 +24,6 @@ #include -using namespace std; - CGUIPanelContainer::CGUIPanelContainer(int parentID, int controlID, float posX, float posY, float width, float height, ORIENTATION orientation, const CScroller& scroller, int preloadItems) : CGUIBaseContainer(parentID, controlID, posX, posY, width, height, orientation, scroller, preloadItems) { @@ -335,7 +333,7 @@ bool CGUIPanelContainer::MoveUp(bool wrapAround) else if (wrapAround) { // move last item in list in this column SetCursor((GetCursor() % m_itemsPerRow) + (m_itemsPerPage - 1) * m_itemsPerRow); - int offset = max((int)GetRows() - m_itemsPerPage, 0); + int offset = std::max((int)GetRows() - m_itemsPerPage, 0); // should check here whether cursor is actually allowed here, and reduce accordingly if (offset * m_itemsPerRow + GetCursor() >= (int)m_items.size()) SetCursor((int)m_items.size() - offset * m_itemsPerRow - 1); @@ -494,7 +492,7 @@ bool CGUIPanelContainer::GetCondition(int condition, int data) const int row = GetCursor() / m_itemsPerRow; int col = GetCursor() % m_itemsPerRow; if (m_orientation == HORIZONTAL) - swap(row, col); + std::swap(row, col); switch (condition) { case CONTAINER_ROW: diff --git a/xbmc/guilib/GUIRSSControl.cpp b/xbmc/guilib/GUIRSSControl.cpp index 43f3f399dc695..b75dbf6af07e0 100644 --- a/xbmc/guilib/GUIRSSControl.cpp +++ b/xbmc/guilib/GUIRSSControl.cpp @@ -25,8 +25,6 @@ #include "utils/RssReader.h" #include "utils/StringUtils.h" -using namespace std; - CGUIRSSControl::CGUIRSSControl(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, const CGUIInfoColor &channelColor, const CGUIInfoColor &headlineColor, std::string& strRSSTags) : CGUIControl(parentID, controlID, posX, posY, width, height), m_strRSSTags(strRSSTags), @@ -123,8 +121,8 @@ void CGUIRSSControl::Process(unsigned int currentTime, CDirtyRegionList &dirtyre { if (m_strRSSTags != "") { - vector tags = StringUtils::Split(m_strRSSTags, ","); - for (vector::const_iterator i = tags.begin(); i != tags.end(); ++i) + std::vector tags = StringUtils::Split(m_strRSSTags, ","); + for (std::vector::const_iterator i = tags.begin(); i != tags.end(); ++i) m_pReader->AddTag(*i); } // use half the width of the control as spacing between feeds, and double this between feed sets diff --git a/xbmc/guilib/GUIRenderingControl.cpp b/xbmc/guilib/GUIRenderingControl.cpp index 3e41b5aa70ec2..143bb8fd71491 100644 --- a/xbmc/guilib/GUIRenderingControl.cpp +++ b/xbmc/guilib/GUIRenderingControl.cpp @@ -23,8 +23,6 @@ #include "guilib/IRenderingCallback.h" #include "windowing/WindowingFactory.h" -using namespace std; - #define LABEL_ROW1 10 #define LABEL_ROW2 11 #define LABEL_ROW3 12 diff --git a/xbmc/guilib/GUISpinControl.cpp b/xbmc/guilib/GUISpinControl.cpp index dc34589eb89db..4fa5a6d0d8b1c 100644 --- a/xbmc/guilib/GUISpinControl.cpp +++ b/xbmc/guilib/GUISpinControl.cpp @@ -23,8 +23,6 @@ #include "utils/StringUtils.h" #include -using namespace std; - #define SPIN_BUTTON_DOWN 1 #define SPIN_BUTTON_UP 2 @@ -260,9 +258,9 @@ bool CGUISpinControl::OnMessage(CGUIMessage& message) case GUI_MSG_SET_LABELS: if (message.GetPointer()) { - const vector< pair > *labels = (const vector< pair > *)message.GetPointer(); + const std::vector< std::pair > *labels = (const std::vector< std::pair > *)message.GetPointer(); Clear(); - for (vector< pair >::const_iterator i = labels->begin(); i != labels->end(); ++i) + for (std::vector< std::pair >::const_iterator i = labels->begin(); i != labels->end(); ++i) AddLabel(i->first, i->second); SetValue( message.GetParam1()); } @@ -607,19 +605,19 @@ std::string CGUISpinControl::GetStringValue() const return ""; } -void CGUISpinControl::AddLabel(const string& strLabel, int iValue) +void CGUISpinControl::AddLabel(const std::string& strLabel, int iValue) { m_vecLabels.push_back(strLabel); m_vecValues.push_back(iValue); } -void CGUISpinControl::AddLabel(const string& strLabel, const string& strValue) +void CGUISpinControl::AddLabel(const std::string& strLabel, const std::string& strValue) { m_vecLabels.push_back(strLabel); m_vecStrValues.push_back(strValue); } -const string CGUISpinControl::GetLabel() const +const std::string CGUISpinControl::GetLabel() const { if (m_iValue >= 0 && m_iValue < (int)m_vecLabels.size()) { diff --git a/xbmc/guilib/GUIStaticItem.cpp b/xbmc/guilib/GUIStaticItem.cpp index 31b93147261a1..e1278b7e0e8b5 100644 --- a/xbmc/guilib/GUIStaticItem.cpp +++ b/xbmc/guilib/GUIStaticItem.cpp @@ -25,8 +25,6 @@ #include "utils/Variant.h" #include "utils/StringUtils.h" -using namespace std; - CGUIStaticItem::CGUIStaticItem(const TiXmlElement *item, int parentID) : CFileItem() { m_visState = false; @@ -51,10 +49,10 @@ CGUIStaticItem::CGUIStaticItem(const TiXmlElement *item, int parentID) : CFileIt SetLabel2(label2.GetLabel(parentID)); SetArt("thumb", thumb.GetLabel(parentID, true)); SetIconImage(icon.GetLabel(parentID, true)); - if (!label.IsConstant()) m_info.push_back(make_pair(label, "label")); - if (!label2.IsConstant()) m_info.push_back(make_pair(label2, "label2")); - if (!thumb.IsConstant()) m_info.push_back(make_pair(thumb, "thumb")); - if (!icon.IsConstant()) m_info.push_back(make_pair(icon, "icon")); + if (!label.IsConstant()) m_info.push_back(std::make_pair(label, "label")); + if (!label2.IsConstant()) m_info.push_back(std::make_pair(label2, "label2")); + if (!thumb.IsConstant()) m_info.push_back(std::make_pair(thumb, "thumb")); + if (!icon.IsConstant()) m_info.push_back(std::make_pair(icon, "icon")); m_iprogramCount = id ? atoi(id) : 0; // add any properties const TiXmlElement *property = item->FirstChildElement("property"); @@ -66,7 +64,7 @@ CGUIStaticItem::CGUIStaticItem(const TiXmlElement *item, int parentID) : CFileIt { SetProperty(name, prop.GetLabel(parentID, true).c_str()); if (!prop.IsConstant()) - m_info.push_back(make_pair(prop, name)); + m_info.push_back(std::make_pair(prop, name)); } property = property->NextSiblingElement("property"); } diff --git a/xbmc/guilib/GUITextBox.cpp b/xbmc/guilib/GUITextBox.cpp index a5cfeb9888360..d7bc1c5ba6067 100644 --- a/xbmc/guilib/GUITextBox.cpp +++ b/xbmc/guilib/GUITextBox.cpp @@ -27,8 +27,6 @@ #include -using namespace std; - CGUITextBox::CGUITextBox(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, int scrollTime) : CGUIControl(parentID, controlID, posX, posY, width, height) diff --git a/xbmc/guilib/GUITextLayout.cpp b/xbmc/guilib/GUITextLayout.cpp index 5e0bf146747cd..a9db990be23b0 100644 --- a/xbmc/guilib/GUITextLayout.cpp +++ b/xbmc/guilib/GUITextLayout.cpp @@ -25,8 +25,6 @@ #include "utils/CharsetConverter.h" #include "utils/StringUtils.h" -using namespace std; - CGUIString::CGUIString(iString start, iString end, bool carriageReturn) { m_text.assign(start, end); @@ -80,7 +78,7 @@ void CGUITextLayout::Render(float x, float y, float angle, color_t color, color_ alignment &= ~XBFONT_CENTER_Y; } m_font->Begin(); - for (vector::iterator i = m_lines.begin(); i != m_lines.end(); ++i) + for (std::vector::iterator i = m_lines.begin(); i != m_lines.end(); ++i) { const CGUIString &string = *i; uint32_t align = alignment; @@ -136,7 +134,7 @@ void CGUITextLayout::RenderScrolling(float x, float y, float angle, color_t colo // any difference to the smoothness of scrolling though which will be // jumpy with this sort of thing. It's not exactly a well used situation // though, so this hack is probably OK. - for (vector::iterator i = m_lines.begin(); i != m_lines.end(); ++i) + for (std::vector::iterator i = m_lines.begin(); i != m_lines.end(); ++i) { const CGUIString &string = *i; m_font->DrawScrollingText(x, y, m_colors, shadowColor, string.m_text, alignment, maxWidth, scrollInfo); @@ -168,7 +166,7 @@ void CGUITextLayout::RenderOutline(float x, float y, color_t color, color_t outl // adjust so the baselines of the fonts align float by = y + m_font->GetTextBaseLine() - m_borderFont->GetTextBaseLine(); m_borderFont->Begin(); - for (vector::iterator i = m_lines.begin(); i != m_lines.end(); ++i) + for (std::vector::iterator i = m_lines.begin(); i != m_lines.end(); ++i) { const CGUIString &string = *i; uint32_t align = alignment; @@ -200,7 +198,7 @@ void CGUITextLayout::RenderOutline(float x, float y, color_t color, color_t outl m_colors[0] = color; m_font->Begin(); - for (vector::iterator i = m_lines.begin(); i != m_lines.end(); ++i) + for (std::vector::iterator i = m_lines.begin(); i != m_lines.end(); ++i) { const CGUIString &string = *i; uint32_t align = alignment; @@ -272,7 +270,7 @@ void CGUITextLayout::UpdateStyled(const vecText &text, const vecColors &colors, } // BidiTransform is used to handle RTL text flipping in the string -void CGUITextLayout::BidiTransform(vector &lines, bool forceLTRReadingOrder) +void CGUITextLayout::BidiTransform(std::vector &lines, bool forceLTRReadingOrder) { for (unsigned int i=0; i colorStack; + std::stack colorStack; colorStack.push(0); // these aren't independent, but that's probably not too much of an issue @@ -498,7 +496,7 @@ void CGUITextLayout::WrapText(const vecText &text, float maxWidth) m_lines.clear(); - vector lines; + std::vector lines; LineBreakText(text, lines); for (unsigned int i = 0; i < lines.size(); i++) @@ -566,7 +564,7 @@ void CGUITextLayout::WrapText(const vecText &text, float maxWidth) } } -void CGUITextLayout::LineBreakText(const vecText &text, vector &lines) +void CGUITextLayout::LineBreakText(const vecText &text, std::vector &lines) { int nMaxLines = (m_maxHeight > 0 && m_font && m_font->GetLineHeight() > 0)?(int)ceilf(m_maxHeight / m_font->GetLineHeight()):-1; vecText::const_iterator lineStart = text.begin(); @@ -605,7 +603,7 @@ void CGUITextLayout::CalcTextExtent() m_textHeight = 0; if (!m_font) return; - for (vector::iterator i = m_lines.begin(); i != m_lines.end(); ++i) + for (std::vector::iterator i = m_lines.begin(); i != m_lines.end(); ++i) { const CGUIString &string = *i; float w = m_font->GetTextWidth(string.m_text); @@ -618,7 +616,7 @@ void CGUITextLayout::CalcTextExtent() unsigned int CGUITextLayout::GetTextLength() const { unsigned int length = 0; - for (vector::const_iterator i = m_lines.begin(); i != m_lines.end(); ++i) + for (std::vector::const_iterator i = m_lines.begin(); i != m_lines.end(); ++i) length += i->m_text.size(); return length; } diff --git a/xbmc/guilib/GUITexture.cpp b/xbmc/guilib/GUITexture.cpp index ba25ad23185db..5156d74f9622d 100644 --- a/xbmc/guilib/GUITexture.cpp +++ b/xbmc/guilib/GUITexture.cpp @@ -24,8 +24,6 @@ #include "GUILargeTextureManager.h" #include "utils/MathUtils.h" -using namespace std; - CTextureInfo::CTextureInfo() { orientation = 0; diff --git a/xbmc/guilib/GUIToggleButtonControl.cpp b/xbmc/guilib/GUIToggleButtonControl.cpp index af6c3bdb28087..976f4842b14c9 100644 --- a/xbmc/guilib/GUIToggleButtonControl.cpp +++ b/xbmc/guilib/GUIToggleButtonControl.cpp @@ -24,8 +24,6 @@ #include "GUIInfoManager.h" #include "input/Key.h" -using namespace std; - CGUIToggleButtonControl::CGUIToggleButtonControl(int parentID, int controlID, float posX, float posY, float width, float height, const CTextureInfo& textureFocus, const CTextureInfo& textureNoFocus, const CTextureInfo& altTextureFocus, const CTextureInfo& altTextureNoFocus, const CLabelInfo &labelInfo, bool wrapMultiLine) : CGUIButtonControl(parentID, controlID, posX, posY, width, height, textureFocus, textureNoFocus, labelInfo, wrapMultiLine) , m_selectButton(parentID, controlID, posX, posY, width, height, altTextureFocus, altTextureNoFocus, labelInfo, wrapMultiLine) @@ -141,13 +139,13 @@ bool CGUIToggleButtonControl::UpdateColors() return changed; } -void CGUIToggleButtonControl::SetLabel(const string &strLabel) +void CGUIToggleButtonControl::SetLabel(const std::string &strLabel) { CGUIButtonControl::SetLabel(strLabel); m_selectButton.SetLabel(strLabel); } -void CGUIToggleButtonControl::SetAltLabel(const string &label) +void CGUIToggleButtonControl::SetAltLabel(const std::string &label) { if (label.size()) m_selectButton.SetLabel(label); diff --git a/xbmc/guilib/GUIVisualisationControl.cpp b/xbmc/guilib/GUIVisualisationControl.cpp index f963c742d58e2..cde54c17dc326 100644 --- a/xbmc/guilib/GUIVisualisationControl.cpp +++ b/xbmc/guilib/GUIVisualisationControl.cpp @@ -27,7 +27,6 @@ #include "utils/log.h" #include "input/Key.h" -using namespace std; using namespace ADDON; #define LABEL_ROW1 10 diff --git a/xbmc/guilib/GUIWindow.cpp b/xbmc/guilib/GUIWindow.cpp index 2520c22f9ea8d..3ce5409699fb6 100644 --- a/xbmc/guilib/GUIWindow.cpp +++ b/xbmc/guilib/GUIWindow.cpp @@ -43,7 +43,6 @@ #include "utils/PerformanceSample.h" #endif -using namespace std; using namespace KODI::MESSAGING; bool CGUIWindow::icompare::operator()(const std::string &s1, const std::string &s2) const @@ -934,7 +933,7 @@ void CGUIWindow::SaveControlStates() void CGUIWindow::RestoreControlStates() { - for (vector::iterator it = m_controlStates.begin(); it != m_controlStates.end(); ++it) + for (std::vector::iterator it = m_controlStates.begin(); it != m_controlStates.end(); ++it) { CGUIMessage message(GUI_MSG_ITEM_SELECT, GetID(), (*it).m_id, (*it).m_data); OnMessage(message); @@ -966,7 +965,7 @@ bool CGUIWindow::OnMove(int fromControl, int moveAction) fromControl, GetID()); return false; } - vector moveHistory; + std::vector moveHistory; int nextControl = fromControl; while (control) { // grab the next control direction diff --git a/xbmc/guilib/GUIWindowManager.cpp b/xbmc/guilib/GUIWindowManager.cpp index 05a2e49aaaea2..11014f927c1c5 100644 --- a/xbmc/guilib/GUIWindowManager.cpp +++ b/xbmc/guilib/GUIWindowManager.cpp @@ -148,7 +148,6 @@ #include "peripherals/dialogs/GUIDialogPeripheralSettings.h" #include "addons/AddonCallbacksGUI.h" -using namespace std; using namespace PVR; using namespace PERIPHERALS; using namespace KODI::MESSAGING; @@ -561,8 +560,8 @@ void CGUIWindowManager::Add(CGUIWindow* pWindow) // push back all the windows if there are more than one covered by this class CSingleLock lock(g_graphicsContext); m_idCache.Invalidate(); - const vector& idRange = pWindow->GetIDRange(); - for (vector::const_iterator idIt = idRange.begin(); idIt != idRange.end() ; ++idIt) + const std::vector& idRange = pWindow->GetIDRange(); + for (std::vector::const_iterator idIt = idRange.begin(); idIt != idRange.end() ; ++idIt) { WindowMap::iterator it = m_mapWindows.find(*idIt); if (it != m_mapWindows.end()) @@ -571,7 +570,7 @@ void CGUIWindowManager::Add(CGUIWindow* pWindow) "to the window manager", *idIt); return; } - m_mapWindows.insert(pair(*idIt, pWindow)); + m_mapWindows.insert(std::pair(*idIt, pWindow)); } } @@ -601,7 +600,7 @@ void CGUIWindowManager::Remove(int id) WindowMap::iterator it = m_mapWindows.find(id); if (it != m_mapWindows.end()) { - for(vector::iterator it2 = m_activeDialogs.begin(); it2 != m_activeDialogs.end();) + for(std::vector::iterator it2 = m_activeDialogs.begin(); it2 != m_activeDialogs.end();) { if(*it2 == it->second) it2 = m_activeDialogs.erase(it2); @@ -704,7 +703,7 @@ void CGUIWindowManager::PreviousWindow() void CGUIWindowManager::ChangeActiveWindow(int newWindow, const std::string& strPath) { - vector params; + std::vector params; if (!strPath.empty()) params.push_back(strPath); ActivateWindow(newWindow, params, true); @@ -712,7 +711,7 @@ void CGUIWindowManager::ChangeActiveWindow(int newWindow, const std::string& str void CGUIWindowManager::ActivateWindow(int iWindowID, const std::string& strPath) { - vector params; + std::vector params; if (!strPath.empty()) params.push_back(strPath); ActivateWindow(iWindowID, params, false); @@ -720,13 +719,13 @@ void CGUIWindowManager::ActivateWindow(int iWindowID, const std::string& strPath void CGUIWindowManager::ForceActivateWindow(int iWindowID, const std::string& strPath) { - vector params; + std::vector params; if (!strPath.empty()) params.push_back(strPath); ActivateWindow(iWindowID, params, false, true); } -void CGUIWindowManager::ActivateWindow(int iWindowID, const vector& params, bool swappingWindows /* = false */, bool force /* = false */) +void CGUIWindowManager::ActivateWindow(int iWindowID, const std::vector& params, bool swappingWindows /* = false */, bool force /* = false */) { if (!g_application.IsCurrentThread()) { @@ -741,7 +740,7 @@ void CGUIWindowManager::ActivateWindow(int iWindowID, const vector& para } } -void CGUIWindowManager::ActivateWindow_Internal(int iWindowID, const vector& params, bool swappingWindows, bool force /* = false */) +void CGUIWindowManager::ActivateWindow_Internal(int iWindowID, const std::vector& params, bool swappingWindows, bool force /* = false */) { // translate virtual windows // virtual music window which returns the last open music window (aka the music start window) @@ -1020,7 +1019,7 @@ void CGUIWindowManager::RenderPass() const } // we render the dialogs based on their render order. - vector renderList = m_activeDialogs; + std::vector renderList = m_activeDialogs; stable_sort(renderList.begin(), renderList.end(), RenderOrderSortFunction); for (iDialog it = renderList.begin(); it != renderList.end(); ++it) @@ -1106,7 +1105,7 @@ void CGUIWindowManager::AfterRender() pWindow->AfterRender(); // make copy of vector as we may remove items from it as we go - vector activeDialogs = m_activeDialogs; + std::vector activeDialogs = m_activeDialogs; for (iDialog it = activeDialogs.begin(); it != activeDialogs.end(); ++it) { if ((*it)->IsDialogRunning()) @@ -1136,7 +1135,7 @@ void CGUIWindowManager::FrameMove() pWindow->FrameMove(); // update any dialogs - we take a copy of the vector as some dialogs may close themselves // during this call - vector dialogs = m_activeDialogs; + std::vector dialogs = m_activeDialogs; for (iDialog it = dialogs.begin(); it != dialogs.end(); ++it) (*it)->FrameMove(); @@ -1279,7 +1278,7 @@ void CGUIWindowManager::SendThreadMessage(CGUIMessage& message, int window /*= 0 CSingleLock lock(m_critSection); CGUIMessage* msg = new CGUIMessage(message); - m_vecThreadMessages.push_back( pair(msg,window) ); + m_vecThreadMessages.push_back( std::pair(msg,window) ); } void CGUIWindowManager::DispatchThreadMessages() @@ -1497,7 +1496,7 @@ void CGUIWindowManager::AddToWindowHistory(int newWindowID) // Check the window stack to see if this window is in our history, // and if so, pop all the other windows off the stack so that we // always have a predictable "Back" behaviour for each window - stack historySave = m_windowHistory; + std::stack historySave = m_windowHistory; while (!historySave.empty()) { if (historySave.top() == newWindowID) @@ -1514,7 +1513,7 @@ void CGUIWindowManager::AddToWindowHistory(int newWindowID) } } -void CGUIWindowManager::GetActiveModelessWindows(vector &ids) +void CGUIWindowManager::GetActiveModelessWindows(std::vector &ids) { // run through our modeless windows, and construct a vector of them // useful for saving and restoring the modeless windows on skin change etc. @@ -1530,7 +1529,7 @@ CGUIWindow *CGUIWindowManager::GetTopMostDialog() const { CSingleLock lock(g_graphicsContext); // find the window with the lowest render order - vector renderList = m_activeDialogs; + std::vector renderList = m_activeDialogs; stable_sort(renderList.begin(), renderList.end(), RenderOrderSortFunction); if (!renderList.size()) diff --git a/xbmc/guilib/GraphicContext.cpp b/xbmc/guilib/GraphicContext.cpp index 5d2f44717992a..9e1bdadea2efb 100644 --- a/xbmc/guilib/GraphicContext.cpp +++ b/xbmc/guilib/GraphicContext.cpp @@ -33,7 +33,6 @@ #include "GUIWindowManager.h" #include "video/VideoReferenceClock.h" -using namespace std; using namespace KODI::MESSAGING; extern bool g_fullScreen; @@ -925,10 +924,10 @@ CRect CGraphicContext::generateAABB(const CRect &rect) const ScaleFinalCoords(x4, y4, z); g_Windowing.Project(x4, y4, z); - return CRect( min(min(min(x1, x2), x3), x4), - min(min(min(y1, y2), y3), y4), - max(max(max(x1, x2), x3), x4), - max(max(max(y1, y2), y3), y4)); + return CRect( std::min(std::min(std::min(x1, x2), x3), x4), + std::min(std::min(std::min(y1, y2), y3), y4), + std::max(std::max(std::max(x1, x2), x3), x4), + std::max(std::max(std::max(y1, y2), y3), y4)); } // NOTE: This routine is currently called (twice) every time there is a @@ -1055,7 +1054,7 @@ void CGraphicContext::RestoreHardwareTransform() g_Windowing.RestoreHardwareTransform(); } -void CGraphicContext::GetAllowedResolutions(vector &res) +void CGraphicContext::GetAllowedResolutions(std::vector &res) { res.clear(); diff --git a/xbmc/guilib/Shader.cpp b/xbmc/guilib/Shader.cpp index 94d0e28c5359c..5749799f7c8ad 100644 --- a/xbmc/guilib/Shader.cpp +++ b/xbmc/guilib/Shader.cpp @@ -35,12 +35,11 @@ using namespace Shaders; using namespace XFILE; -using namespace std; ////////////////////////////////////////////////////////////////////// // CShader ////////////////////////////////////////////////////////////////////// -bool CShader::LoadSource(const string& filename, const string& prefix) +bool CShader::LoadSource(const std::string& filename, const std::string& prefix) { if(filename.empty()) return true; diff --git a/xbmc/guilib/Shader.h b/xbmc/guilib/Shader.h index 328316475c4a8..462e08047d15d 100644 --- a/xbmc/guilib/Shader.h +++ b/xbmc/guilib/Shader.h @@ -31,8 +31,6 @@ namespace Shaders { - using namespace std; - ////////////////////////////////////////////////////////////////////// // CShader - base class ////////////////////////////////////////////////////////////////////// @@ -44,14 +42,14 @@ namespace Shaders { virtual bool Compile() = 0; virtual void Free() = 0; virtual GLuint Handle() = 0; - virtual void SetSource(const string& src) { m_source = src; } - virtual bool LoadSource(const string& filename, const string& prefix = ""); + virtual void SetSource(const std::string& src) { m_source = src; } + virtual bool LoadSource(const std::string& filename, const std::string& prefix = ""); bool OK() const { return m_compiled; } protected: - string m_source; - string m_lastLog; - vector m_attr; + std::string m_source; + std::string m_lastLog; + std::vector m_attr; bool m_compiled; }; diff --git a/xbmc/guilib/TextureGL.cpp b/xbmc/guilib/TextureGL.cpp index 565b7702e7c1a..58c2b00852438 100644 --- a/xbmc/guilib/TextureGL.cpp +++ b/xbmc/guilib/TextureGL.cpp @@ -27,8 +27,6 @@ #if defined(HAS_GL) || defined(HAS_GLES) -using namespace std; - /************************************************************************/ /* CGLTexture */ /************************************************************************/ diff --git a/xbmc/guilib/TextureManager.cpp b/xbmc/guilib/TextureManager.cpp index d384aec91357e..fcfe733f78a3f 100644 --- a/xbmc/guilib/TextureManager.cpp +++ b/xbmc/guilib/TextureManager.cpp @@ -40,9 +40,6 @@ #include "windowing/WindowingFactory.h" // for g_Windowing in CGUITextureManager::FreeUnusedTextures #endif -using namespace std; - - /************************************************************************/ /* */ /************************************************************************/ @@ -443,7 +440,7 @@ void CGUITextureManager::ReleaseTexture(const std::string& strTextureName, bool { //CLog::Log(LOGINFO, " cleanup:%s", strTextureName.c_str()); // add to our textures to free - m_unusedTextures.push_back(make_pair(pMap, immediately ? 0 : XbmcThreads::SystemClockMillis())); + m_unusedTextures.push_back(std::make_pair(pMap, immediately ? 0 : XbmcThreads::SystemClockMillis())); i = m_vecTextures.erase(i); } return; @@ -568,7 +565,7 @@ void CGUITextureManager::AddTexturePath(const std::string &texturePath) void CGUITextureManager::RemoveTexturePath(const std::string &texturePath) { CSingleLock lock(m_section); - for (vector::iterator it = m_texturePaths.begin(); it != m_texturePaths.end(); ++it) + for (std::vector::iterator it = m_texturePaths.begin(); it != m_texturePaths.end(); ++it) { if (*it == texturePath) { @@ -585,7 +582,7 @@ std::string CGUITextureManager::GetTexturePath(const std::string &textureName, b else { // texture doesn't include the full path, so check all fallbacks CSingleLock lock(m_section); - for (vector::iterator it = m_texturePaths.begin(); it != m_texturePaths.end(); ++it) + for (std::vector::iterator it = m_texturePaths.begin(); it != m_texturePaths.end(); ++it) { std::string path = URIUtils::AddFileToFolder(it->c_str(), "media"); path = URIUtils::AddFileToFolder(path, textureName); diff --git a/xbmc/guilib/TexturePi.cpp b/xbmc/guilib/TexturePi.cpp index 77d408ad89c6b..b06e21d96b50d 100644 --- a/xbmc/guilib/TexturePi.cpp +++ b/xbmc/guilib/TexturePi.cpp @@ -29,8 +29,6 @@ #if defined(HAS_OMXPLAYER) #include "cores/omxplayer/OMXImage.h" -using namespace std; - /************************************************************************/ /* CPiTexture */ /************************************************************************/ diff --git a/xbmc/guilib/VisibleEffect.cpp b/xbmc/guilib/VisibleEffect.cpp index 89b98387a8836..471bf7e090ae9 100644 --- a/xbmc/guilib/VisibleEffect.cpp +++ b/xbmc/guilib/VisibleEffect.cpp @@ -27,8 +27,6 @@ #include "utils/XBMCTinyXML.h" #include "utils/XMLUtils.h" -using namespace std; - CAnimEffect::CAnimEffect(const TiXmlElement *node, EFFECT_TYPE effect) { m_effect = effect; @@ -187,7 +185,7 @@ CSlideEffect::CSlideEffect(const TiXmlElement *node) : CAnimEffect(node, EFFECT_ const char *startPos = node->Attribute("start"); if (startPos) { - vector commaSeparated = StringUtils::Split(startPos, ","); + std::vector commaSeparated = StringUtils::Split(startPos, ","); if (commaSeparated.size() > 1) m_startY = (float)atof(commaSeparated[1].c_str()); if (!commaSeparated.empty()) @@ -196,7 +194,7 @@ CSlideEffect::CSlideEffect(const TiXmlElement *node) : CAnimEffect(node, EFFECT_ const char *endPos = node->Attribute("end"); if (endPos) { - vector commaSeparated = StringUtils::Split(endPos, ","); + std::vector commaSeparated = StringUtils::Split(endPos, ","); if (commaSeparated.size() > 1) m_endY = (float)atof(commaSeparated[1].c_str()); if (!commaSeparated.empty()) @@ -227,7 +225,7 @@ CRotateEffect::CRotateEffect(const TiXmlElement *node, EFFECT_TYPE effect) : CAn m_autoCenter = true; else { - vector commaSeparated = StringUtils::Split(centerPos, ","); + std::vector commaSeparated = StringUtils::Split(centerPos, ","); if (commaSeparated.size() > 1) m_center.y = (float)atof(commaSeparated[1].c_str()); if (!commaSeparated.empty()) @@ -261,13 +259,13 @@ CZoomEffect::CZoomEffect(const TiXmlElement *node, const CRect &rect) : CAnimEff float endPosX = rect.x1; float endPosY = rect.y1; - float width = max(rect.Width(), 0.001f); - float height = max(rect.Height(),0.001f); + float width = std::max(rect.Width(), 0.001f); + float height = std::max(rect.Height(),0.001f); const char *start = node->Attribute("start"); if (start) { - vector params = StringUtils::Split(start, ","); + std::vector params = StringUtils::Split(start, ","); if (params.size() == 1) { m_startX = (float)atof(params[0].c_str()); @@ -292,7 +290,7 @@ CZoomEffect::CZoomEffect(const TiXmlElement *node, const CRect &rect) : CAnimEff const char *end = node->Attribute("end"); if (end) { - vector params = StringUtils::Split(end, ","); + std::vector params = StringUtils::Split(end, ","); if (params.size() == 1) { m_endX = (float)atof(params[0].c_str()); @@ -321,7 +319,7 @@ CZoomEffect::CZoomEffect(const TiXmlElement *node, const CRect &rect) : CAnimEff m_autoCenter = true; else { - vector commaSeparated = StringUtils::Split(centerPos, ","); + std::vector commaSeparated = StringUtils::Split(centerPos, ","); if (commaSeparated.size() > 1) m_center.y = (float)atof(commaSeparated[1].c_str()); if (!commaSeparated.empty()) @@ -673,10 +671,10 @@ void CAnimation::Create(const TiXmlElement *node, const CRect &rect, int context // compute the minimum delay and maximum length m_delay = 0xffffffff; unsigned int total = 0; - for (vector::const_iterator i = m_effects.begin(); i != m_effects.end(); ++i) + for (std::vector::const_iterator i = m_effects.begin(); i != m_effects.end(); ++i) { - m_delay = min(m_delay, (*i)->GetDelay()); - total = max(total, (*i)->GetLength()); + m_delay = std::min(m_delay, (*i)->GetDelay()); + total = std::max(total, (*i)->GetLength()); } m_length = total - m_delay; } From ec9fa0166bafc9bb6e6ceff274b7d27f5b350fcb Mon Sep 17 00:00:00 2001 From: Matthias Kortstiege Date: Fri, 28 Aug 2015 10:27:04 +0200 Subject: [PATCH 06/22] [videoshaders] use std:: instead of using namespace std --- .../VideoRenderers/VideoShaders/VideoFilterShader.cpp | 9 ++++----- xbmc/cores/VideoRenderers/VideoShaders/YUV2RGBShader.cpp | 3 +-- xbmc/cores/VideoRenderers/VideoShaders/YUV2RGBShader.h | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/xbmc/cores/VideoRenderers/VideoShaders/VideoFilterShader.cpp b/xbmc/cores/VideoRenderers/VideoShaders/VideoFilterShader.cpp index 8c2c3e034f674..18f0bad16da0d 100644 --- a/xbmc/cores/VideoRenderers/VideoShaders/VideoFilterShader.cpp +++ b/xbmc/cores/VideoRenderers/VideoShaders/VideoFilterShader.cpp @@ -38,7 +38,6 @@ #endif using namespace Shaders; -using namespace std; ////////////////////////////////////////////////////////////////////// // BaseVideoFilterShader - base class for video filter shaders @@ -56,7 +55,7 @@ BaseVideoFilterShader::BaseVideoFilterShader() m_stretch = 0.0f; - string shaderv = + std::string shaderv = "varying vec2 cord;" "void main()" "{" @@ -66,7 +65,7 @@ BaseVideoFilterShader::BaseVideoFilterShader() "}"; VertexShader()->SetSource(shaderv); - string shaderp = + std::string shaderp = "uniform sampler2D img;" "varying vec2 cord;" "void main()" @@ -82,8 +81,8 @@ ConvolutionFilterShader::ConvolutionFilterShader(ESCALINGMETHOD method, bool str m_method = method; m_kernelTex1 = 0; - string shadername; - string defines; + std::string shadername; + std::string defines; #if defined(HAS_GL) m_floattex = glewIsSupported("GL_ARB_texture_float"); diff --git a/xbmc/cores/VideoRenderers/VideoShaders/YUV2RGBShader.cpp b/xbmc/cores/VideoRenderers/VideoShaders/YUV2RGBShader.cpp index 8c95825b21dc3..6fcb09c698ab9 100644 --- a/xbmc/cores/VideoRenderers/VideoShaders/YUV2RGBShader.cpp +++ b/xbmc/cores/VideoRenderers/VideoShaders/YUV2RGBShader.cpp @@ -142,7 +142,6 @@ void CalculateYUVMatrix(TransformMatrix &matrix #if defined(HAS_GL) || HAS_GLES == 2 using namespace Shaders; -using namespace std; static void CalculateYUVMatrixGL(GLfloat res[4][4] , unsigned int flags @@ -367,7 +366,7 @@ YUV2RGBProgressiveShaderARB::YUV2RGBProgressiveShaderARB(bool rect, unsigned fla m_black = 0.0f; m_contrast = 1.0f; - string shaderfile; + std::string shaderfile; if (m_format == RENDER_FMT_YUYV422) { diff --git a/xbmc/cores/VideoRenderers/VideoShaders/YUV2RGBShader.h b/xbmc/cores/VideoRenderers/VideoShaders/YUV2RGBShader.h index cccac6f0932e5..10600b9ad3522 100644 --- a/xbmc/cores/VideoRenderers/VideoShaders/YUV2RGBShader.h +++ b/xbmc/cores/VideoRenderers/VideoShaders/YUV2RGBShader.h @@ -103,7 +103,7 @@ namespace Shaders { float m_contrast; float m_stretch; - string m_defines; + std::string m_defines; // shader attribute handles GLint m_hYTex; From 9552ccdc220a361e2a4d62142729ea87773049f6 Mon Sep 17 00:00:00 2001 From: Matthias Kortstiege Date: Fri, 28 Aug 2015 10:36:03 +0200 Subject: [PATCH 07/22] [listproviders] use std:: instead of using namespace std --- xbmc/listproviders/DirectoryProvider.cpp | 13 ++++++------- xbmc/listproviders/StaticProvider.cpp | 12 +++++------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/xbmc/listproviders/DirectoryProvider.cpp b/xbmc/listproviders/DirectoryProvider.cpp index a315f37f93478..fc840aedebf52 100644 --- a/xbmc/listproviders/DirectoryProvider.cpp +++ b/xbmc/listproviders/DirectoryProvider.cpp @@ -36,7 +36,6 @@ #include -using namespace std; using namespace XFILE; using namespace ANNOUNCEMENT; using namespace KODI::MESSAGING; @@ -66,7 +65,7 @@ class CDirectoryJob : public CJob if (CDirectory::GetDirectory(m_url, items, "")) { // limit must not exceed the number of items - int limit = (m_limit == 0) ? items.Size() : min((int) m_limit, items.Size()); + int limit = (m_limit == 0) ? items.Size() : std::min((int) m_limit, items.Size()); // convert to CGUIStaticItem's and set visibility and targets m_items.reserve(limit); for (int i = 0; i < limit; i++) @@ -181,7 +180,7 @@ bool CDirectoryProvider::Update(bool forceRefresh) if (fireJob) FireJob(); - for (vector::iterator i = m_items.begin(); i != m_items.end(); ++i) + for (std::vector::iterator i = m_items.begin(); i != m_items.end(); ++i) changed |= (*i)->UpdateVisibility(m_parentID); return changed; // TODO: Also returned changed if properties are changed (if so, need to update scroll to letter). } @@ -216,11 +215,11 @@ void CDirectoryProvider::Announce(AnnouncementFlag flag, const char *sender, con } } -void CDirectoryProvider::Fetch(vector &items) const +void CDirectoryProvider::Fetch(std::vector &items) const { CSingleLock lock(m_section); items.clear(); - for (vector::const_iterator i = m_items.begin(); i != m_items.end(); ++i) + for (std::vector::const_iterator i = m_items.begin(); i != m_items.end(); ++i) { if ((*i)->IsVisible()) items.push_back(*i); @@ -263,7 +262,7 @@ void CDirectoryProvider::OnJobComplete(unsigned int jobID, bool success, CJob *j bool CDirectoryProvider::OnClick(const CGUIListItemPtr &item) { CFileItem fileItem(*std::static_pointer_cast(item)); - string target = fileItem.GetProperty("node.target").asString(); + std::string target = fileItem.GetProperty("node.target").asString(); if (target.empty()) target = m_currentTarget; if (target.empty()) @@ -271,7 +270,7 @@ bool CDirectoryProvider::OnClick(const CGUIListItemPtr &item) if (fileItem.HasProperty("node.target_url")) fileItem.SetPath(fileItem.GetProperty("node.target_url").asString()); // grab the execute string - string execute = CFavouritesDirectory::GetExecutePath(fileItem, target); + std::string execute = CFavouritesDirectory::GetExecutePath(fileItem, target); if (!execute.empty()) { CGUIMessage message(GUI_MSG_EXECUTE, 0, 0); diff --git a/xbmc/listproviders/StaticProvider.cpp b/xbmc/listproviders/StaticProvider.cpp index 17ba5eb315a65..43ef9a372c85e 100644 --- a/xbmc/listproviders/StaticProvider.cpp +++ b/xbmc/listproviders/StaticProvider.cpp @@ -22,8 +22,6 @@ #include "utils/XMLUtils.h" #include "utils/TimeUtils.h" -using namespace std; - CStaticListProvider::CStaticListProvider(const TiXmlElement *element, int parentID) : IListProvider(parentID), m_defaultItem(-1), @@ -72,18 +70,18 @@ bool CStaticListProvider::Update(bool forceRefresh) else if (CTimeUtils::GetFrameTime() - m_updateTime > 1000) { m_updateTime = CTimeUtils::GetFrameTime(); - for (vector::iterator i = m_items.begin(); i != m_items.end(); ++i) + for (std::vector::iterator i = m_items.begin(); i != m_items.end(); ++i) (*i)->UpdateProperties(m_parentID); } - for (vector::iterator i = m_items.begin(); i != m_items.end(); ++i) + for (std::vector::iterator i = m_items.begin(); i != m_items.end(); ++i) changed |= (*i)->UpdateVisibility(m_parentID); return changed; // TODO: Also returned changed if properties are changed (if so, need to update scroll to letter). } -void CStaticListProvider::Fetch(vector &items) const +void CStaticListProvider::Fetch(std::vector &items) const { items.clear(); - for (vector::const_iterator i = m_items.begin(); i != m_items.end(); ++i) + for (std::vector::const_iterator i = m_items.begin(); i != m_items.end(); ++i) { if ((*i)->IsVisible()) items.push_back(*i); @@ -101,7 +99,7 @@ int CStaticListProvider::GetDefaultItem() const if (m_defaultItem >= 0) { unsigned int offset = 0; - for (vector::const_iterator i = m_items.begin(); i != m_items.end(); ++i) + for (std::vector::const_iterator i = m_items.begin(); i != m_items.end(); ++i) { if ((*i)->IsVisible()) { From bd63370406db249f837a9bef531dee2d061e254b Mon Sep 17 00:00:00 2001 From: Matthias Kortstiege Date: Fri, 28 Aug 2015 10:44:51 +0200 Subject: [PATCH 08/22] [dbwrappers] use std:: instead of using namespace std --- xbmc/dbwrappers/DatabaseQuery.cpp | 12 ++++---- xbmc/dbwrappers/dataset.cpp | 36 ++++++++++++------------ xbmc/dbwrappers/mysqldataset.cpp | 42 ++++++++++++++-------------- xbmc/dbwrappers/qry_dat.cpp | 12 ++++---- xbmc/dbwrappers/sqlitedataset.cpp | 46 +++++++++++++++---------------- 5 files changed, 69 insertions(+), 79 deletions(-) diff --git a/xbmc/dbwrappers/DatabaseQuery.cpp b/xbmc/dbwrappers/DatabaseQuery.cpp index e443d3dad9f99..274f8bac2114d 100644 --- a/xbmc/dbwrappers/DatabaseQuery.cpp +++ b/xbmc/dbwrappers/DatabaseQuery.cpp @@ -27,8 +27,6 @@ #include "utils/Variant.h" #include "utils/XBMCTinyXML.h" -using namespace std; - typedef struct { char string[15]; @@ -172,7 +170,7 @@ bool CDatabaseQueryRule::Save(TiXmlNode *parent) const rule.SetAttribute("field", TranslateField(m_field).c_str()); rule.SetAttribute("operator", TranslateOperator(m_operator).c_str()); - for (vector::const_iterator it = m_parameter.begin(); it != m_parameter.end(); ++it) + for (std::vector::const_iterator it = m_parameter.begin(); it != m_parameter.end(); ++it) { TiXmlElement value("value"); TiXmlText text(*it); @@ -252,8 +250,8 @@ std::string CDatabaseQueryRule::FormatParameter(const std::string &operatorStrin std::string parameter; if (GetFieldType(m_field) == TEXTIN_FIELD) { - vector split = StringUtils::Split(param, ','); - for (vector::iterator itIn = split.begin(); itIn != split.end(); ++itIn) + std::vector split = StringUtils::Split(param, ','); + for (std::vector::iterator itIn = split.begin(); itIn != split.end(); ++itIn) { if (!parameter.empty()) parameter += ","; @@ -366,7 +364,7 @@ std::string CDatabaseQueryRule::GetWhereClause(const CDatabase &db, const std::s // now the query parameter std::string wholeQuery; - for (vector::const_iterator it = m_parameter.begin(); it != m_parameter.end(); ++it) + for (std::vector::const_iterator it = m_parameter.begin(); it != m_parameter.end(); ++it) { std::string query = '(' + FormatWhereClause(negate, operatorString, *it, db, strType) + ')'; @@ -392,7 +390,7 @@ std::string CDatabaseQueryRule::FormatWhereClause(const std::string &negate, con std::string query; if (m_field != 0) { - string fmt = "%s"; + std::string fmt = "%s"; if (GetFieldType(m_field) == NUMERIC_FIELD) fmt = "CAST(%s as DECIMAL(5,1))"; else if (GetFieldType(m_field) == SECONDS_FIELD) diff --git a/xbmc/dbwrappers/dataset.cpp b/xbmc/dbwrappers/dataset.cpp index 6525cd6952ef0..cae9e251e64ea 100644 --- a/xbmc/dbwrappers/dataset.cpp +++ b/xbmc/dbwrappers/dataset.cpp @@ -35,8 +35,6 @@ #pragma warning (disable:4800) #endif -using namespace std; - namespace dbiplus { //************* Database implementation *************** @@ -74,11 +72,11 @@ int Database::connectFull(const char *newHost, const char *newPort, const char * return connect(true); } -string Database::prepare(const char *format, ...) +std::string Database::prepare(const char *format, ...) { va_list args; va_start(args, format); - string result = vprepare(format, args); + std::string result = vprepare(format, args); va_end(args); return result; @@ -167,13 +165,13 @@ void Dataset::set_select_sql(const char *sel_sql) { select_sql = sel_sql; } -void Dataset::set_select_sql(const string &sel_sql) { +void Dataset::set_select_sql(const std::string &sel_sql) { select_sql = sel_sql; } -void Dataset::parse_sql(string &sql) { - string fpattern,by_what; +void Dataset::parse_sql(std::string &sql) { + std::string fpattern,by_what; for (unsigned int i=0;i< fields_object->size();i++) { fpattern = ":OLD_"+(*fields_object)[i].props.name; by_what = "'"+(*fields_object)[i].val.get_asString()+"'"; @@ -429,10 +427,10 @@ const field_value Dataset::f_old(const char *f_name) { } int Dataset::str_compare(const char * s1, const char * s2) { - string ts1 = s1; - string ts2 = s2; - string::const_iterator p = ts1.begin(); - string::const_iterator p2 = ts2.begin(); + std::string ts1 = s1; + std::string ts2 = s2; + std::string::const_iterator p = ts1.begin(); + std::string::const_iterator p2 = ts2.begin(); while (p!=ts1.end() && p2 != ts2.end()) { if (toupper(*p)!=toupper(*p2)) return (toupper(*p)::const_iterator i; + std::map::const_iterator i; first(); while (!eof()) { result = true; @@ -477,7 +475,7 @@ bool Dataset::findNext(void) { bool result; if (plist.empty()) return false; - std::map::const_iterator i; + std::map::const_iterator i; while (!eof()) { result = true; for (i=plist.begin();i!=plist.end();++i) @@ -493,32 +491,32 @@ bool Dataset::findNext(void) { void Dataset::add_update_sql(const char *upd_sql){ - string s = upd_sql; + std::string s = upd_sql; update_sql.push_back(s); } -void Dataset::add_update_sql(const string &upd_sql){ +void Dataset::add_update_sql(const std::string &upd_sql){ update_sql.push_back(upd_sql); } void Dataset::add_insert_sql(const char *ins_sql){ - string s = ins_sql; + std::string s = ins_sql; insert_sql.push_back(s); } -void Dataset::add_insert_sql(const string &ins_sql){ +void Dataset::add_insert_sql(const std::string &ins_sql){ insert_sql.push_back(ins_sql); } void Dataset::add_delete_sql(const char *del_sql){ - string s = del_sql; + std::string s = del_sql; delete_sql.push_back(s); } -void Dataset::add_delete_sql(const string &del_sql){ +void Dataset::add_delete_sql(const std::string &del_sql){ delete_sql.push_back(del_sql); } diff --git a/xbmc/dbwrappers/mysqldataset.cpp b/xbmc/dbwrappers/mysqldataset.cpp index b45a66eaf45c1..70691bf8ed704 100644 --- a/xbmc/dbwrappers/mysqldataset.cpp +++ b/xbmc/dbwrappers/mysqldataset.cpp @@ -39,8 +39,6 @@ #define MYSQL_OK 0 #define ER_BAD_DB_ERROR 1049 -using namespace std; - namespace dbiplus { //************* MysqlDatabase implementation *************** @@ -512,17 +510,17 @@ bool MysqlDatabase::exists(void) { // methods for formatting // --------------------------------------------- -string MysqlDatabase::vprepare(const char *format, va_list args) +std::string MysqlDatabase::vprepare(const char *format, va_list args) { - string strFormat = format; - string strResult = ""; + std::string strFormat = format; + std::string strResult = ""; char *p; size_t pos; // %q is the sqlite format string for %s. // Any bad character, like "'", will be replaced with a proper one pos = 0; - while ( (pos = strFormat.find("%s", pos)) != string::npos ) + while ( (pos = strFormat.find("%s", pos)) != std::string::npos ) strFormat.replace(pos++, 2, "%q"); p = mysql_vmprintf(strFormat.c_str(), args); @@ -533,7 +531,7 @@ string MysqlDatabase::vprepare(const char *format, va_list args) // RAND() is the mysql form of RANDOM() pos = 0; - while ( (pos = strResult.find("RANDOM()", pos)) != string::npos ) + while ( (pos = strResult.find("RANDOM()", pos)) != std::string::npos ) { strResult.replace(pos++, 8, "RAND()"); pos += 6; @@ -1326,14 +1324,14 @@ MYSQL* MysqlDataset::handle(){ } void MysqlDataset::make_query(StringList &_sql) { - string query; + std::string query; int result = 0; if (db == NULL) throw DbErrors("No Database Connection"); try { if (autocommit) db->start_transaction(); - for (list::iterator i =_sql.begin(); i!=_sql.end(); ++i) + for (std::list::iterator i =_sql.begin(); i!=_sql.end(); ++i) { query = *i; Dataset::parse_sql(query); @@ -1406,8 +1404,8 @@ void MysqlDataset::fill_fields() { //------------- public functions implementation -----------------// bool MysqlDataset::dropIndex(const char *table, const char *index) { - string sql; - string sql_prepared; + std::string sql; + std::string sql_prepared; sql = "SELECT * FROM information_schema.statistics WHERE TABLE_SCHEMA=DATABASE() AND table_name='%s' AND index_name='%s'"; sql_prepared = static_cast(db)->prepare(sql.c_str(), table, index); @@ -1432,37 +1430,37 @@ static bool ci_test(char l, char r) return tolower(l) == tolower(r); } -static size_t ci_find(const string& where, const string& what) +static size_t ci_find(const std::string& where, const std::string& what) { std::string::const_iterator loc = std::search(where.begin(), where.end(), what.begin(), what.end(), ci_test); if (loc == where.end()) - return string::npos; + return std::string::npos; else return loc - where.begin(); } -int MysqlDataset::exec(const string &sql) { +int MysqlDataset::exec(const std::string &sql) { if (!handle()) throw DbErrors("No Database Connection"); - string qry = sql; + std::string qry = sql; int res = 0; exec_res.clear(); // enforce the "auto_increment" keyword to be appended to "integer primary key" size_t loc; - if ( (loc=ci_find(qry, "integer primary key")) != string::npos) + if ( (loc=ci_find(qry, "integer primary key")) != std::string::npos) { qry = qry.insert(loc + 19, " auto_increment "); } // force the charset and collation to UTF-8 - if ( ci_find(qry, "CREATE TABLE") != string::npos - || ci_find(qry, "CREATE TEMPORARY TABLE") != string::npos ) + if ( ci_find(qry, "CREATE TABLE") != std::string::npos + || ci_find(qry, "CREATE TEMPORARY TABLE") != std::string::npos ) { // If CREATE TABLE ... SELECT Syntax is used we need to add the encoding after the table before the select // e.g. CREATE TABLE x CHARACTER SET utf8 COLLATE utf8_general_ci [AS] SELECT * FROM y - if ((loc = qry.find(" AS SELECT ")) != string::npos || - (loc = qry.find(" SELECT ")) != string::npos) + if ((loc = qry.find(" AS SELECT ")) != std::string::npos || + (loc = qry.find(" SELECT ")) != std::string::npos) { qry = qry.insert(loc, " CHARACTER SET utf8 COLLATE utf8_general_ci"); } @@ -1505,7 +1503,7 @@ bool MysqlDataset::query(const std::string &query) { size_t loc; // mysql doesn't understand CAST(foo as integer) => change to CAST(foo as signed integer) - while ((loc = ci_find(qry, "as integer)")) != string::npos) + while ((loc = ci_find(qry, "as integer)")) != std::string::npos) qry = qry.insert(loc + 3, "signed "); MYSQL_RES *stmt = NULL; @@ -1591,7 +1589,7 @@ bool MysqlDataset::query(const std::string &query) { return true; } -void MysqlDataset::open(const string &sql) { +void MysqlDataset::open(const std::string &sql) { set_select_sql(sql); open(); } diff --git a/xbmc/dbwrappers/qry_dat.cpp b/xbmc/dbwrappers/qry_dat.cpp index b7b620a821c90..7c772a4e96c59 100644 --- a/xbmc/dbwrappers/qry_dat.cpp +++ b/xbmc/dbwrappers/qry_dat.cpp @@ -41,8 +41,6 @@ #pragma warning (disable:4715) #endif -using namespace std; - namespace dbiplus { //Constructors @@ -169,8 +167,8 @@ field_value::~field_value(){ //Conversations functions -string field_value::get_asString() const { - string tmp; +std::string field_value::get_asString() const { + std::string tmp; switch (field_type) { case ft_String: { tmp = str_value; @@ -655,7 +653,7 @@ void field_value::set_asString(const char *s) { str_value = s; field_type = ft_String;} -void field_value::set_asString(const string & s) { +void field_value::set_asString(const std::string & s) { str_value = s; field_type = ft_String;} @@ -702,8 +700,8 @@ fType field_value::get_field_type() { return field_type;} -string field_value::gft() { - string tmp; +std::string field_value::gft() { + std::string tmp; switch (field_type) { case ft_String: { tmp.assign("string"); diff --git a/xbmc/dbwrappers/sqlitedataset.cpp b/xbmc/dbwrappers/sqlitedataset.cpp index 112accf7cb035..96cf17b2bfb31 100644 --- a/xbmc/dbwrappers/sqlitedataset.cpp +++ b/xbmc/dbwrappers/sqlitedataset.cpp @@ -38,8 +38,6 @@ #pragma comment(lib, "sqlite3.lib") #endif -using namespace std; - namespace dbiplus { //************* Callback function *************************** @@ -120,13 +118,13 @@ void SqliteDatabase::setHostName(const char *newHost) { if ( (host[1] == ':') && isalpha(host[0])) { size_t pos = 0; - while ( (pos = host.find("/", pos)) != string::npos ) + while ( (pos = host.find("/", pos)) != std::string::npos ) host.replace(pos++, 1, "\\"); } else { size_t pos = 0; - while ( (pos = host.find("\\", pos)) != string::npos ) + while ( (pos = host.find("\\", pos)) != std::string::npos ) host.replace(pos++, 1, "/"); } } @@ -273,7 +271,7 @@ int SqliteDatabase::copy(const char *backup_name) { CLog::Log(LOGDEBUG, "Copying from %s to %s at %s", db.c_str(), backup_name, host.c_str()); int rc; - string backup_db = backup_name; + std::string backup_db = backup_name; sqlite3 *pFile; /* Database connection opened on zFilename */ sqlite3_backup *pBackup; /* Backup object used to copy data */ @@ -286,7 +284,7 @@ int SqliteDatabase::copy(const char *backup_name) { if ( backup_db.find(".db") != (backup_db.length()-3) ) backup_db += ".db"; - string backup_path = host + backup_db; + std::string backup_path = host + backup_db; /* Open the database file identified by zFilename. Exit early if this fails ** for any reason. */ @@ -415,23 +413,23 @@ void SqliteDatabase::rollback_transaction() { // methods for formatting // --------------------------------------------- -string SqliteDatabase::vprepare(const char *format, va_list args) +std::string SqliteDatabase::vprepare(const char *format, va_list args) { - string strFormat = format; - string strResult = ""; + std::string strFormat = format; + std::string strResult = ""; char *p; size_t pos; // %q is the sqlite format string for %s. // Any bad character, like "'", will be replaced with a proper one pos = 0; - while ( (pos = strFormat.find("%s", pos)) != string::npos ) + while ( (pos = strFormat.find("%s", pos)) != std::string::npos ) strFormat.replace(pos++, 2, "%q"); // the %I64 enhancement is not supported by sqlite3_vmprintf // must be %ll instead pos = 0; - while ( (pos = strFormat.find("%I64", pos)) != string::npos ) + while ( (pos = strFormat.find("%I64", pos)) != std::string::npos ) strFormat.replace(pos++, 4, "%ll"); p = sqlite3_vmprintf(strFormat.c_str(), args); @@ -483,7 +481,7 @@ sqlite3* SqliteDataset::handle(){ } void SqliteDataset::make_query(StringList &_sql) { - string query; + std::string query; if (db == NULL) throw DbErrors("No Database Connection"); try { @@ -491,7 +489,7 @@ void SqliteDataset::make_query(StringList &_sql) { if (autocommit) db->start_transaction(); - for (list::iterator i =_sql.begin(); i!=_sql.end(); ++i) { + for (std::list::iterator i =_sql.begin(); i!=_sql.end(); ++i) { query = *i; char* err=NULL; Dataset::parse_sql(query); @@ -568,7 +566,7 @@ void SqliteDataset::fill_fields() { //------------- public functions implementation -----------------// bool SqliteDataset::dropIndex(const char *table, const char *index) { - string sql; + std::string sql; sql = static_cast(db)->prepare("DROP INDEX IF EXISTS %s", index); @@ -576,9 +574,9 @@ bool SqliteDataset::dropIndex(const char *table, const char *index) } -int SqliteDataset::exec(const string &sql) { +int SqliteDataset::exec(const std::string &sql) { if (!handle()) throw DbErrors("No Database Connection"); - string qry = sql; + std::string qry = sql; int res; exec_res.clear(); @@ -589,18 +587,18 @@ int SqliteDataset::exec(const string &sql) { // after: CREATE UNIQUE INDEX ixPath ON path ( strPath ) // // NOTE: unexpected results occur if brackets are not matched - if ( qry.find("CREATE UNIQUE INDEX") != string::npos || - (qry.find("CREATE INDEX") != string::npos)) + if ( qry.find("CREATE UNIQUE INDEX") != std::string::npos || + (qry.find("CREATE INDEX") != std::string::npos)) { size_t pos = 0; size_t pos2 = 0; - if ( (pos = qry.find("(")) != string::npos ) + if ( (pos = qry.find("(")) != std::string::npos ) { pos++; - while ( (pos = qry.find("(", pos)) != string::npos ) + while ( (pos = qry.find("(", pos)) != std::string::npos ) { - if ( (pos2 = qry.find(")", pos)) != string::npos ) + if ( (pos2 = qry.find(")", pos)) != std::string::npos ) { qry.replace(pos, pos2-pos+1, ""); pos = pos2; @@ -612,11 +610,11 @@ int SqliteDataset::exec(const string &sql) { // before: DROP INDEX foo ON table // after: DROP INDEX foo size_t pos = qry.find("DROP INDEX "); - if ( pos != string::npos ) + if ( pos != std::string::npos ) { pos = qry.find(" ON ", pos+1); - if ( pos != string::npos ) + if ( pos != std::string::npos ) qry = qry.substr(0, pos); } @@ -701,7 +699,7 @@ bool SqliteDataset::query(const std::string &query) { } } -void SqliteDataset::open(const string &sql) { +void SqliteDataset::open(const std::string &sql) { set_select_sql(sql); open(); } From b9b8fad8f3eb242450e06321cbc1ef66250eef2c Mon Sep 17 00:00:00 2001 From: Matthias Kortstiege Date: Fri, 28 Aug 2015 11:03:54 +0200 Subject: [PATCH 09/22] [network] use std:: instead of using namespace std --- xbmc/network/AirPlayServer.cpp | 7 +- xbmc/network/EventClient.cpp | 34 +++++----- xbmc/network/EventServer.cpp | 15 ++--- xbmc/network/NetworkServices.cpp | 11 ++-- xbmc/network/Socket.cpp | 1 - xbmc/network/TCPServer.cpp | 1 - xbmc/network/WakeOnAccess.cpp | 26 ++++---- xbmc/network/WebServer.cpp | 72 ++++++++++----------- xbmc/network/cddb.cpp | 19 +++--- xbmc/network/linux/NetworkLinux.cpp | 6 +- xbmc/network/upnp/UPnP.cpp | 5 +- xbmc/network/upnp/UPnPServer.cpp | 29 ++++----- xbmc/network/upnp/UPnPSettings.cpp | 1 - xbmc/network/websocket/WebSocket.cpp | 4 +- xbmc/network/websocket/WebSocketManager.cpp | 4 +- xbmc/network/websocket/WebSocketV13.cpp | 14 ++-- xbmc/network/websocket/WebSocketV8.cpp | 16 ++--- xbmc/network/windows/NetworkWin32.cpp | 4 +- 18 files changed, 121 insertions(+), 148 deletions(-) diff --git a/xbmc/network/AirPlayServer.cpp b/xbmc/network/AirPlayServer.cpp index 008b1733154d6..0620b2931f36a 100644 --- a/xbmc/network/AirPlayServer.cpp +++ b/xbmc/network/AirPlayServer.cpp @@ -50,7 +50,6 @@ using namespace ANNOUNCEMENT; using namespace KODI::MESSAGING; -using namespace std; #ifdef TARGET_WINDOWS #define close closesocket @@ -642,12 +641,12 @@ std::string calcResponse(const std::string& username, //from a string field1="value1", field2="value2" it parses the value to a field std::string getFieldFromString(const std::string &str, const char* field) { - vector tmpAr1 = StringUtils::Split(str, ","); - for(vector::const_iterator i = tmpAr1.begin(); i != tmpAr1.end(); ++i) + std::vector tmpAr1 = StringUtils::Split(str, ","); + for(std::vector::const_iterator i = tmpAr1.begin(); i != tmpAr1.end(); ++i) { if (i->find(field) != std::string::npos) { - vector tmpAr2 = StringUtils::Split(*i, "="); + std::vector tmpAr2 = StringUtils::Split(*i, "="); if (tmpAr2.size() == 2) { StringUtils::Replace(tmpAr2[1], "\"", "");//remove quotes diff --git a/xbmc/network/EventClient.cpp b/xbmc/network/EventClient.cpp index fb28edf61d4c2..d299f9147da97 100644 --- a/xbmc/network/EventClient.cpp +++ b/xbmc/network/EventClient.cpp @@ -40,8 +40,6 @@ using namespace EVENTCLIENT; using namespace EVENTPACKET; -using namespace std; - struct ButtonStateFinder { @@ -59,8 +57,8 @@ struct ButtonStateFinder } private: unsigned short m_keycode; - string m_map; - string m_button; + std::string m_map; + std::string m_button; }; /************************************************************************/ @@ -92,7 +90,7 @@ void CEventButtonState::Load() (StringUtils::StartsWith(m_mapName, "LI:")) ) // starts with LI: ? { #if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) - string lircDevice = m_mapName.substr(3); + std::string lircDevice = m_mapName.substr(3); m_iKeyCode = CButtonTranslator::GetInstance().TranslateLircRemoteString( lircDevice.c_str(), m_buttonName.c_str() ); #else @@ -304,7 +302,7 @@ bool CEventClient::OnPacketHELO(CEventPacket *packet) ParseUInt32(payload, psize, reserved); // image data if any - string iconfile = "special://temp/helo"; + std::string iconfile = "special://temp/helo"; if (m_eLogoType != LT_NONE && psize>0) { switch (m_eLogoType) @@ -361,7 +359,7 @@ bool CEventClient::OnPacketBUTTON(CEventPacket *packet) unsigned char *payload = (unsigned char *)packet->Payload(); int psize = (int)packet->PayloadSize(); - string map, button; + std::string map, button; unsigned short flags; unsigned short bcode; unsigned short amount; @@ -433,7 +431,7 @@ bool CEventClient::OnPacketBUTTON(CEventPacket *packet) state.m_fAmount = 0.0; } - list::reverse_iterator it; + std::list::reverse_iterator it; it = find_if( m_buttonQueue.rbegin() , m_buttonQueue.rend(), ButtonStateFinder(state)); if(it == m_buttonQueue.rend()) @@ -446,7 +444,7 @@ bool CEventClient::OnPacketBUTTON(CEventPacket *packet) if(!active && it->m_bActive) { /* since modifying the list invalidates the referse iteratator */ - list::iterator it2 = (++it).base(); + std::list::iterator it2 = (++it).base(); /* if last event had an amount, we must resend without amount */ if(it2->m_bUseAmount && it2->m_fAmount != 0.0) @@ -551,7 +549,7 @@ bool CEventClient::OnPacketNOTIFICATION(CEventPacket *packet) { unsigned char *payload = (unsigned char *)packet->Payload(); int psize = (int)packet->PayloadSize(); - string title, message; + std::string title, message; // parse caption if (!ParseString(payload, psize, title)) @@ -572,7 +570,7 @@ bool CEventClient::OnPacketNOTIFICATION(CEventPacket *packet) ParseUInt32(payload, psize, reserved); // image data if any - string iconfile = "special://temp/notification"; + std::string iconfile = "special://temp/notification"; if (m_eLogoType != LT_NONE && psize>0) { switch (m_eLogoType) @@ -616,7 +614,7 @@ bool CEventClient::OnPacketLOG(CEventPacket *packet) { unsigned char *payload = (unsigned char *)packet->Payload(); int psize = (int)packet->PayloadSize(); - string logmsg; + std::string logmsg; unsigned char ltype; if (!ParseByte(payload, psize, ltype)) @@ -632,7 +630,7 @@ bool CEventClient::OnPacketACTION(CEventPacket *packet) { unsigned char *payload = (unsigned char *)packet->Payload(); int psize = (int)packet->PayloadSize(); - string actionString; + std::string actionString; unsigned char actionType; if (!ParseByte(payload, psize, actionType)) @@ -658,7 +656,7 @@ bool CEventClient::OnPacketACTION(CEventPacket *packet) return true; } -bool CEventClient::ParseString(unsigned char* &payload, int &psize, string& parsedVal) +bool CEventClient::ParseString(unsigned char* &payload, int &psize, std::string& parsedVal) { if (psize <= 0) return false; @@ -715,7 +713,7 @@ void CEventClient::FreePacketQueues() m_readyPackets.pop(); } - map::iterator iter = m_seqPackets.begin(); + std::map::iterator iter = m_seqPackets.begin(); while (iter != m_seqPackets.end()) { if (iter->second) @@ -727,7 +725,7 @@ void CEventClient::FreePacketQueues() m_seqPackets.clear(); } -unsigned int CEventClient::GetButtonCode(string& joystickName, bool& isAxis, float& amount) +unsigned int CEventClient::GetButtonCode(std::string& joystickName, bool& isAxis, float& amount) { CSingleLock lock(m_critSection); unsigned int bcode = 0; @@ -753,8 +751,8 @@ unsigned int CEventClient::GetButtonCode(string& joystickName, bool& isAxis, flo return 0; - list repeat; - list::iterator it; + std::list repeat; + std::list::iterator it; for(it = m_buttonQueue.begin(); bcode == 0 && it != m_buttonQueue.end(); ++it) { bcode = it->KeyCode(); diff --git a/xbmc/network/EventServer.cpp b/xbmc/network/EventServer.cpp index f781b4792e0d6..206d00ec0ceba 100644 --- a/xbmc/network/EventServer.cpp +++ b/xbmc/network/EventServer.cpp @@ -45,7 +45,6 @@ using namespace EVENTSERVER; using namespace EVENTPACKET; using namespace EVENTCLIENT; using namespace SOCKETS; -using namespace std; /************************************************************************/ /* CEventServer */ @@ -124,7 +123,7 @@ void CEventServer::Cleanup() } CSingleLock lock(m_critSection); - map::iterator iter = m_clients.begin(); + std::map::iterator iter = m_clients.begin(); while (iter != m_clients.end()) { if (iter->second) @@ -264,7 +263,7 @@ void CEventServer::ProcessPacket(CAddress& addr, int pSize) CSingleLock lock(m_critSection); // first check if we have a client for this address - map::iterator iter = m_clients.find(clientToken); + std::map::iterator iter = m_clients.find(clientToken); if ( iter == m_clients.end() ) { @@ -292,7 +291,7 @@ void CEventServer::ProcessPacket(CAddress& addr, int pSize) void CEventServer::RefreshClients() { CSingleLock lock(m_critSection); - map::iterator iter = m_clients.begin(); + std::map::iterator iter = m_clients.begin(); while ( iter != m_clients.end() ) { @@ -319,7 +318,7 @@ void CEventServer::RefreshClients() void CEventServer::ProcessEvents() { CSingleLock lock(m_critSection); - map::iterator iter = m_clients.begin(); + std::map::iterator iter = m_clients.begin(); while (iter != m_clients.end()) { @@ -333,7 +332,7 @@ bool CEventServer::ExecuteNextAction() CSingleLock lock(m_critSection); CEventAction actionEvent; - map::iterator iter = m_clients.begin(); + std::map::iterator iter = m_clients.begin(); while (iter != m_clients.end()) { @@ -368,7 +367,7 @@ bool CEventServer::ExecuteNextAction() unsigned int CEventServer::GetButtonCode(std::string& strMapName, bool& isAxis, float& fAmount) { CSingleLock lock(m_critSection); - map::iterator iter = m_clients.begin(); + std::map::iterator iter = m_clients.begin(); unsigned int bcode = 0; while (iter != m_clients.end()) @@ -384,7 +383,7 @@ unsigned int CEventServer::GetButtonCode(std::string& strMapName, bool& isAxis, bool CEventServer::GetMousePos(float &x, float &y) { CSingleLock lock(m_critSection); - map::iterator iter = m_clients.begin(); + std::map::iterator iter = m_clients.begin(); while (iter != m_clients.end()) { diff --git a/xbmc/network/NetworkServices.cpp b/xbmc/network/NetworkServices.cpp index 2c7e5a3bace85..0a8b9bceff5f3 100644 --- a/xbmc/network/NetworkServices.cpp +++ b/xbmc/network/NetworkServices.cpp @@ -85,7 +85,6 @@ #include "utils/Variant.h" using namespace KODI::MESSAGING; -using namespace std; #ifdef HAS_JSONRPC using namespace JSONRPC; #endif // HAS_JSONRPC @@ -568,9 +567,9 @@ bool CNetworkServices::StartAirPlayServer() #ifdef HAS_ZEROCONF std::vector > txt; CNetworkInterface* iface = g_application.getNetwork().GetFirstConnectedInterface(); - txt.push_back(make_pair("deviceid", iface != NULL ? iface->GetMacAddress() : "FF:FF:FF:FF:FF:F2")); - txt.push_back(make_pair("model", "Xbmc,1")); - txt.push_back(make_pair("srcvers", AIRPLAY_SERVER_VERSION_STR)); + txt.push_back(std::make_pair("deviceid", iface != NULL ? iface->GetMacAddress() : "FF:FF:FF:FF:FF:F2")); + txt.push_back(std::make_pair("model", "Xbmc,1")); + txt.push_back(std::make_pair("srcvers", AIRPLAY_SERVER_VERSION_STR)); if (CSettings::GetInstance().GetBool(CSettings::SETTING_SERVICES_AIRPLAYIOS8COMPAT)) { @@ -578,11 +577,11 @@ bool CNetworkServices::StartAirPlayServer() // else we won't get video urls anymore. // We also announce photo caching support (as it seems faster and // we have implemented it anyways). - txt.push_back(make_pair("features", "0x20F7")); + txt.push_back(std::make_pair("features", "0x20F7")); } else { - txt.push_back(make_pair("features", "0x77")); + txt.push_back(std::make_pair("features", "0x77")); } CZeroconf::GetInstance()->PublishService("servers.airplay", "_airplay._tcp", CSysInfo::GetDeviceName(), g_advancedSettings.m_airPlayPort, txt); diff --git a/xbmc/network/Socket.cpp b/xbmc/network/Socket.cpp index 06bf0805b8ade..85b5638dc4688 100644 --- a/xbmc/network/Socket.cpp +++ b/xbmc/network/Socket.cpp @@ -29,7 +29,6 @@ #include using namespace SOCKETS; -//using namespace std; On VS2010, bind conflicts with std::bind #ifdef WINSOCK_VERSION #define close closesocket diff --git a/xbmc/network/TCPServer.cpp b/xbmc/network/TCPServer.cpp index 33096f989e772..9628cd7414ea4 100644 --- a/xbmc/network/TCPServer.cpp +++ b/xbmc/network/TCPServer.cpp @@ -55,7 +55,6 @@ static const bdaddr_t bt_bdaddr_local = {{0, 0, 0, 0xff, 0xff, 0xff}}; using namespace JSONRPC; using namespace ANNOUNCEMENT; -//using namespace std; On VS2010, bind conflicts with std::bind #define RECEIVEBUFFER 1024 diff --git a/xbmc/network/WakeOnAccess.cpp b/xbmc/network/WakeOnAccess.cpp index cda5676edd7cd..e00dd45d08b3c 100644 --- a/xbmc/network/WakeOnAccess.cpp +++ b/xbmc/network/WakeOnAccess.cpp @@ -44,8 +44,6 @@ #include "WakeOnAccess.h" -using namespace std; - #define DEFAULT_NETWORK_INIT_SEC (20) // wait 20 sec for network after startup or resume #define DEFAULT_NETWORK_SETTLE_MS (500) // require 500ms of consistent network availability before trusting it @@ -108,8 +106,8 @@ bool CMACDiscoveryJob::DoWork() return false; } - vector& ifaces = g_application.getNetwork().GetInterfaceList(); - for (vector::const_iterator it = ifaces.begin(); it != ifaces.end(); ++it) + std::vector& ifaces = g_application.getNetwork().GetInterfaceList(); + for (std::vector::const_iterator it = ifaces.begin(); it != ifaces.end(); ++it) { if ((*it)->GetHostMacAddress(ipAddress, m_macAddres)) return true; @@ -221,7 +219,7 @@ class ProgressDialogHelper unsigned ms_passed = timeOutMs - end_time.MillisLeft(); int percentage = (ms_passed * 100) / timeOutMs; - m_dialog->SetPercentage(max(percentage, 1)); // avoid flickering , keep minimum 1% + m_dialog->SetPercentage(std::max(percentage, 1)); // avoid flickering , keep minimum 1% } Sleep (m_dialog ? 20 : 200); @@ -338,7 +336,7 @@ bool CWakeOnAccess::WakeUpHost(const CURL& url) return true; } -bool CWakeOnAccess::WakeUpHost (const std::string& hostName, const string& customMessage) +bool CWakeOnAccess::WakeUpHost (const std::string& hostName, const std::string& customMessage) { if (!IsEnabled()) return true; // bail if feature is turned off @@ -486,9 +484,9 @@ void CWakeOnAccess::TouchHostEntry (const std::string& hostName) } } -static void AddHost (const std::string& host, vector& hosts) +static void AddHost (const std::string& host, std::vector& hosts) { - for (vector::const_iterator it = hosts.begin(); it != hosts.end(); ++it) + for (std::vector::const_iterator it = hosts.begin(); it != hosts.end(); ++it) if (StringUtils::EqualsNoCase(host, *it)) return; // allready there .. @@ -496,7 +494,7 @@ static void AddHost (const std::string& host, vector& hosts) hosts.push_back(host); } -static void AddHostFromDatabase(const DatabaseSettings& setting, vector& hosts) +static void AddHostFromDatabase(const DatabaseSettings& setting, std::vector& hosts) { if (StringUtils::EqualsNoCase(setting.type, "mysql")) AddHost(setting.host, hosts); @@ -515,7 +513,7 @@ void CWakeOnAccess::QueueMACDiscoveryForHost(const std::string& host) static void AddHostsFromMediaSource(const CMediaSource& source, std::vector& hosts) { - for (vector::const_iterator it = source.vecPaths.begin() ; it != source.vecPaths.end(); ++it) + for (std::vector::const_iterator it = source.vecPaths.begin() ; it != source.vecPaths.end(); ++it) { CURL url(*it); @@ -523,13 +521,13 @@ static void AddHostsFromMediaSource(const CMediaSource& source, std::vector& hosts) +static void AddHostsFromVecSource(const VECSOURCES& sources, std::vector& hosts) { for (VECSOURCES::const_iterator it = sources.begin(); it != sources.end(); ++it) AddHostsFromMediaSource(*it, hosts); } -static void AddHostsFromVecSource(const VECSOURCES* sources, vector& hosts) +static void AddHostsFromVecSource(const VECSOURCES* sources, std::vector& hosts) { if (sources) AddHostsFromVecSource(*sources, hosts); @@ -537,7 +535,7 @@ static void AddHostsFromVecSource(const VECSOURCES* sources, vector& hos void CWakeOnAccess::QueueMACDiscoveryForAllRemotes() { - vector hosts; + std::vector hosts; // add media sources CMediaSourceSettings& ms = CMediaSourceSettings::GetInstance(); @@ -562,7 +560,7 @@ void CWakeOnAccess::QueueMACDiscoveryForAllRemotes() AddHost (url.GetHostName(), hosts); } - for (vector::const_iterator it = hosts.begin(); it != hosts.end(); ++it) + for (std::vector::const_iterator it = hosts.begin(); it != hosts.end(); ++it) QueueMACDiscoveryForHost(*it); } diff --git a/xbmc/network/WebServer.cpp b/xbmc/network/WebServer.cpp index 4709637464dce..11efc998ba61e 100644 --- a/xbmc/network/WebServer.cpp +++ b/xbmc/network/WebServer.cpp @@ -62,8 +62,6 @@ #define HEADER_NEWLINE "\r\n" -using namespace std; - typedef struct ConnectionHandler { std::string fullUri; @@ -76,15 +74,15 @@ typedef struct { std::shared_ptr file; CHttpRanges ranges; size_t rangeCountTotal; - string boundary; - string boundaryWithHeader; - string boundaryEnd; + std::string boundary; + std::string boundaryWithHeader; + std::string boundaryEnd; bool boundaryWritten; - string contentType; + std::string contentType; uint64_t writePosition; } HttpFileDownloadContext; -vector CWebServer::m_requestHandlers; +std::vector CWebServer::m_requestHandlers; CWebServer::CWebServer() : m_daemon_ip6(NULL), @@ -112,8 +110,8 @@ int CWebServer::FillArgumentMap(void *cls, enum MHD_ValueKind kind, const char * if (cls == NULL || key == NULL) return MHD_NO; - map *arguments = (map *)cls; - arguments->insert(make_pair(key, value != NULL ? value : "")); + std::map *arguments = (std::map *)cls; + arguments->insert(std::make_pair(key, value != NULL ? value : "")); return MHD_YES; } @@ -122,8 +120,8 @@ int CWebServer::FillArgumentMultiMap(void *cls, enum MHD_ValueKind kind, const c if (cls == NULL || key == NULL) return MHD_NO; - multimap *arguments = (multimap *)cls; - arguments->insert(make_pair(key, value != NULL ? value : "")); + std::multimap *arguments = (std::multimap *)cls; + arguments->insert(std::make_pair(key, value != NULL ? value : "")); return MHD_YES; } @@ -169,7 +167,7 @@ bool CWebServer::IsAuthenticated(CWebServer *server, struct MHD_Connection *conn return true; const char *base = "Basic "; - string authorization = GetRequestHeaderValue(connection, MHD_HEADER_KIND, MHD_HTTP_HEADER_AUTHORIZATION); + std::string authorization = GetRequestHeaderValue(connection, MHD_HEADER_KIND, MHD_HTTP_HEADER_AUTHORIZATION); if (authorization.empty() || !StringUtils::StartsWith(authorization, base)) return false; @@ -244,7 +242,7 @@ int CWebServer::AnswerToConnection(void *cls, struct MHD_Connection *connection, bool ranged = ranges.Parse(GetRequestHeaderValue(connection, MHD_HEADER_KIND, MHD_HTTP_HEADER_RANGE)); // look for a IHTTPRequestHandler which can take care of the current request - for (vector::const_iterator it = m_requestHandlers.begin(); it != m_requestHandlers.end(); ++it) + for (std::vector::const_iterator it = m_requestHandlers.begin(); it != m_requestHandlers.end(); ++it) { IHTTPRequestHandler *requestHandler = *it; if (requestHandler->CanHandleRequest(request)) @@ -260,13 +258,13 @@ int CWebServer::AnswerToConnection(void *cls, struct MHD_Connection *connection, bool cacheable = true; // handle Cache-Control - string cacheControl = GetRequestHeaderValue(connection, MHD_HEADER_KIND, MHD_HTTP_HEADER_CACHE_CONTROL); + std::string cacheControl = GetRequestHeaderValue(connection, MHD_HEADER_KIND, MHD_HTTP_HEADER_CACHE_CONTROL); if (!cacheControl.empty()) { - vector cacheControls = StringUtils::Split(cacheControl, ","); - for (vector::const_iterator it = cacheControls.begin(); it != cacheControls.end(); ++it) + std::vector cacheControls = StringUtils::Split(cacheControl, ","); + for (std::vector::const_iterator it = cacheControls.begin(); it != cacheControls.end(); ++it) { - string control = *it; + std::string control = *it; control = StringUtils::Trim(control); // handle no-cache @@ -278,7 +276,7 @@ int CWebServer::AnswerToConnection(void *cls, struct MHD_Connection *connection, if (cacheable) { // handle Pragma (but only if "Cache-Control: no-cache" hasn't been set) - string pragma = GetRequestHeaderValue(connection, MHD_HEADER_KIND, MHD_HTTP_HEADER_PRAGMA); + std::string pragma = GetRequestHeaderValue(connection, MHD_HEADER_KIND, MHD_HTTP_HEADER_PRAGMA); if (pragma.compare(HEADER_VALUE_NO_CACHE) == 0) cacheable = false; } @@ -287,8 +285,8 @@ int CWebServer::AnswerToConnection(void *cls, struct MHD_Connection *connection, if (handler->GetLastModifiedDate(lastModified) && lastModified.IsValid()) { // handle If-Modified-Since or If-Unmodified-Since - string ifModifiedSince = GetRequestHeaderValue(connection, MHD_HEADER_KIND, MHD_HTTP_HEADER_IF_MODIFIED_SINCE); - string ifUnmodifiedSince = GetRequestHeaderValue(connection, MHD_HEADER_KIND, MHD_HTTP_HEADER_IF_UNMODIFIED_SINCE); + std::string ifModifiedSince = GetRequestHeaderValue(connection, MHD_HEADER_KIND, MHD_HTTP_HEADER_IF_MODIFIED_SINCE); + std::string ifUnmodifiedSince = GetRequestHeaderValue(connection, MHD_HEADER_KIND, MHD_HTTP_HEADER_IF_UNMODIFIED_SINCE); CDateTime ifModifiedSinceDate; CDateTime ifUnmodifiedSinceDate; @@ -315,7 +313,7 @@ int CWebServer::AnswerToConnection(void *cls, struct MHD_Connection *connection, // handle If-Range header but only if the Range header is present if (ranged && lastModified.IsValid()) { - string ifRange = GetRequestHeaderValue(connection, MHD_HEADER_KIND, MHD_HTTP_HEADER_IF_RANGE); + std::string ifRange = GetRequestHeaderValue(connection, MHD_HEADER_KIND, MHD_HTTP_HEADER_IF_RANGE); if (!ifRange.empty() && lastModified.IsValid()) { CDateTime ifRangeDate; @@ -338,7 +336,7 @@ int CWebServer::AnswerToConnection(void *cls, struct MHD_Connection *connection, conHandler->requestHandler = handler; // get the content-type of the POST data - string contentType = GetRequestHeaderValue(connection, MHD_HEADER_KIND, MHD_HTTP_HEADER_CONTENT_TYPE); + std::string contentType = GetRequestHeaderValue(connection, MHD_HEADER_KIND, MHD_HTTP_HEADER_CONTENT_TYPE); if (!contentType.empty()) { // if the content-type is application/x-ww-form-urlencoded or multipart/form-data we can use MHD's POST processor @@ -414,7 +412,7 @@ int CWebServer::AnswerToConnection(void *cls, struct MHD_Connection *connection, // it's unusual to get more than one call to AnswerToConnection for none-POST requests, but let's handle it anyway else { - for (vector::const_iterator it = m_requestHandlers.begin(); it != m_requestHandlers.end(); ++it) + for (std::vector::const_iterator it = m_requestHandlers.begin(); it != m_requestHandlers.end(); ++it) { IHTTPRequestHandler *requestHandler = *it; if (requestHandler->CanHandleRequest(request)) @@ -448,7 +446,7 @@ int CWebServer::HandlePostField(void *cls, enum MHD_ValueKind kind, const char * return MHD_NO; } - conHandler->requestHandler->AddPostField(key, string(data, size)); + conHandler->requestHandler->AddPostField(key, std::string(data, size)); return MHD_YES; } @@ -572,7 +570,7 @@ int CWebServer::FinalizeRequest(IHTTPRequestHandler *handler, int responseStatus handler->AddResponseHeader(MHD_HTTP_HEADER_CONTENT_LENGTH, StringUtils::Format("%" PRIu64, responseDetails.totalLength)); // add all headers set by the request handler - for (multimap::const_iterator it = responseDetails.headers.begin(); it != responseDetails.headers.end(); ++it) + for (std::multimap::const_iterator it = responseDetails.headers.begin(); it != responseDetails.headers.end(); ++it) AddHeader(response, it->first, it->second); #ifdef WEBSERVER_DEBUG @@ -730,7 +728,7 @@ int CWebServer::CreateRangedMemoryDownloadResponse(IHTTPRequestHandler *handler, return CreateMemoryDownloadResponse(request.connection, result.c_str(), result.size(), false, true, response); } -int CWebServer::CreateRedirect(struct MHD_Connection *connection, const string &strURL, struct MHD_Response *&response) +int CWebServer::CreateRedirect(struct MHD_Connection *connection, const std::string &strURL, struct MHD_Response *&response) { response = MHD_create_response_from_data(0, NULL, MHD_NO, MHD_NO); if (response == NULL) @@ -765,7 +763,7 @@ int CWebServer::CreateFileDownloadResponse(IHTTPRequestHandler *handler, struct uint64_t fileLength = static_cast(file->GetLength()); // get the MIME type for the Content-Type header - string mimeType = responseDetails.contentType; + std::string mimeType = responseDetails.contentType; if (mimeType.empty()) { std::string ext = URIUtils::GetExtension(filePath); @@ -826,7 +824,7 @@ int CWebServer::CreateFileDownloadResponse(IHTTPRequestHandler *handler, struct for (HttpRanges::const_iterator range = context->ranges.Begin(); range != context->ranges.End(); ++range) { // we need to temporarily add the Content-Range header to the boundary to be able to determine the length - string completeBoundaryWithHeader = HttpRangeUtils::GenerateMultipartBoundaryWithHeader(context->boundaryWithHeader, &*range); + std::string completeBoundaryWithHeader = HttpRangeUtils::GenerateMultipartBoundaryWithHeader(context->boundaryWithHeader, &*range); totalLength += completeBoundaryWithHeader.size(); // add a newline before any new multipart boundary @@ -978,7 +976,7 @@ int CWebServer::ContentReaderCallback(void *cls, size_t pos, char *buf, int max) if (context->rangeCountTotal > 1 && context->ranges.IsEmpty()) { // put together the end-boundary - string endBoundary = HttpRangeUtils::GenerateMultipartBoundaryEnd(context->boundary); + std::string endBoundary = HttpRangeUtils::GenerateMultipartBoundaryEnd(context->boundary); if ((unsigned int)max != endBoundary.size()) return -1; @@ -1009,7 +1007,7 @@ int CWebServer::ContentReaderCallback(void *cls, size_t pos, char *buf, int max) } // put together the boundary for the current range - string boundary = HttpRangeUtils::GenerateMultipartBoundaryWithHeader(context->boundaryWithHeader, &range); + std::string boundary = HttpRangeUtils::GenerateMultipartBoundaryWithHeader(context->boundaryWithHeader, &range); // copy the boundary into the buffer memcpy(buf, boundary.c_str(), boundary.size()); @@ -1137,7 +1135,7 @@ struct MHD_Daemon* CWebServer::StartMHD(unsigned int flags, int port) MHD_OPTION_END); } -bool CWebServer::Start(int port, const string &username, const string &password) +bool CWebServer::Start(int port, const std::string &username, const std::string &password) { SetCredentials(username, password); if (!m_running) @@ -1185,7 +1183,7 @@ bool CWebServer::IsStarted() return m_running; } -void CWebServer::SetCredentials(const string &username, const string &password) +void CWebServer::SetCredentials(const std::string &username, const std::string &password) { CSingleLock lock(m_critSection); @@ -1199,7 +1197,7 @@ bool CWebServer::PrepareDownload(const char *path, CVariant &details, std::strin return false; protocol = "http"; - string url; + std::string url; std::string strPath = path; if (StringUtils::StartsWith(strPath, "image://") || (StringUtils::StartsWith(strPath, "special://") && StringUtils::EndsWith(strPath, ".tbn"))) @@ -1227,7 +1225,7 @@ void CWebServer::RegisterRequestHandler(IHTTPRequestHandler *handler) if (handler == NULL) return; - for (vector::iterator it = m_requestHandlers.begin(); it != m_requestHandlers.end(); ++it) + for (std::vector::iterator it = m_requestHandlers.begin(); it != m_requestHandlers.end(); ++it) { if (*it == handler) return; @@ -1247,7 +1245,7 @@ void CWebServer::UnregisterRequestHandler(IHTTPRequestHandler *handler) if (handler == NULL) return; - for (vector::iterator it = m_requestHandlers.begin(); it != m_requestHandlers.end(); ++it) + for (std::vector::iterator it = m_requestHandlers.begin(); it != m_requestHandlers.end(); ++it) { if (*it == handler) { @@ -1270,9 +1268,9 @@ std::string CWebServer::GetRequestHeaderValue(struct MHD_Connection *connection, { // Work around a bug in firefox (see https://bugzilla.mozilla.org/show_bug.cgi?id=416178) // by cutting of anything that follows a ";" in a "Content-Type" header field - string strValue(value); + std::string strValue(value); size_t pos = strValue.find(';'); - if (pos != string::npos) + if (pos != std::string::npos) strValue = strValue.substr(0, pos); return strValue; diff --git a/xbmc/network/cddb.cpp b/xbmc/network/cddb.cpp index 65654b182b683..3c8ae1d76443d 100644 --- a/xbmc/network/cddb.cpp +++ b/xbmc/network/cddb.cpp @@ -46,7 +46,6 @@ #include #include -using namespace std; using namespace MEDIA_DETECT; using namespace AUTOPTR; using namespace CDDB; @@ -160,12 +159,12 @@ bool Xcddb::Send( const char *buffer) } //------------------------------------------------------------------------------------------------------------------- -string Xcddb::Recv(bool wait4point) +std::string Xcddb::Recv(bool wait4point) { char tmpbuffer[1]; char prevChar; int counter = 0; - string str_buffer; + std::string str_buffer; //########################################################## @@ -396,7 +395,7 @@ void Xcddb::addTitle(const char *buffer) } // track artist" / "track title - vector values = StringUtils::Split(value, " / "); + std::vector values = StringUtils::Split(value, " / "); if (values.size() > 1) { g_charsetConverter.unknownToUTF8(values[0]); @@ -414,7 +413,7 @@ void Xcddb::addTitle(const char *buffer) //------------------------------------------------------------------------------------------------------------------- const std::string& Xcddb::getInexactCommand(int select) const { - typedef map::const_iterator iter; + typedef std::map::const_iterator iter; iter i = m_mapInexact_cddb_command_list.find(select); if (i == m_mapInexact_cddb_command_list.end()) return m_strNull; @@ -424,7 +423,7 @@ const std::string& Xcddb::getInexactCommand(int select) const //------------------------------------------------------------------------------------------------------------------- const std::string& Xcddb::getInexactArtist(int select) const { - typedef map::const_iterator iter; + typedef std::map::const_iterator iter; iter i = m_mapInexact_artist_list.find(select); if (i == m_mapInexact_artist_list.end()) return m_strNull; @@ -434,7 +433,7 @@ const std::string& Xcddb::getInexactArtist(int select) const //------------------------------------------------------------------------------------------------------------------- const std::string& Xcddb::getInexactTitle(int select) const { - typedef map::const_iterator iter; + typedef std::map::const_iterator iter; iter i = m_mapInexact_title_list.find(select); if (i == m_mapInexact_title_list.end()) return m_strNull; @@ -444,7 +443,7 @@ const std::string& Xcddb::getInexactTitle(int select) const //------------------------------------------------------------------------------------------------------------------- const std::string& Xcddb::getTrackArtist(int track) const { - typedef map::const_iterator iter; + typedef std::map::const_iterator iter; iter i = m_mapArtists.find(track); if (i == m_mapArtists.end()) return m_strNull; @@ -454,7 +453,7 @@ const std::string& Xcddb::getTrackArtist(int track) const //------------------------------------------------------------------------------------------------------------------- const std::string& Xcddb::getTrackTitle(int track) const { - typedef map::const_iterator iter; + typedef std::map::const_iterator iter; iter i = m_mapTitles.find(track); if (i == m_mapTitles.end()) return m_strNull; @@ -619,7 +618,7 @@ void Xcddb::addExtended(const char *buffer) //------------------------------------------------------------------------------------------------------------------- const std::string& Xcddb::getTrackExtended(int track) const { - typedef map::const_iterator iter; + typedef std::map::const_iterator iter; iter i = m_mapExtended_track.find(track); if (i == m_mapExtended_track.end()) return m_strNull; diff --git a/xbmc/network/linux/NetworkLinux.cpp b/xbmc/network/linux/NetworkLinux.cpp index a73d4d2143cf7..1230c61799d1c 100644 --- a/xbmc/network/linux/NetworkLinux.cpp +++ b/xbmc/network/linux/NetworkLinux.cpp @@ -67,8 +67,6 @@ #include "utils/log.h" #include "utils/StringUtils.h" -using namespace std; - CNetworkInterfaceLinux::CNetworkInterfaceLinux(CNetworkLinux* network, std::string interfaceName, char interfaceMacAddrRaw[6]): m_interfaceName(interfaceName), m_interfaceMacAdr(StringUtils::Format("%02X:%02X:%02X:%02X:%02X:%02X", @@ -321,7 +319,7 @@ CNetworkLinux::~CNetworkLinux(void) if (m_sock != -1) close(CNetworkLinux::m_sock); - vector::iterator it = m_interfaces.begin(); + std::vector::iterator it = m_interfaces.begin(); while(it != m_interfaces.end()) { CNetworkInterface* nInt = *it; @@ -478,7 +476,7 @@ std::vector CNetworkLinux::GetNameServers(void) Sleep(100); if (pipe) { - vector tmpStr; + std::vector tmpStr; char buffer[256] = {'\0'}; if (fread(buffer, sizeof(char), sizeof(buffer), pipe) > 0 && !ferror(pipe)) { diff --git a/xbmc/network/upnp/UPnP.cpp b/xbmc/network/upnp/UPnP.cpp index 700109e508a08..a825158100ce5 100644 --- a/xbmc/network/upnp/UPnP.cpp +++ b/xbmc/network/upnp/UPnP.cpp @@ -49,7 +49,6 @@ #include "Util.h" #include "utils/SystemInfo.h" -using namespace std; using namespace UPNP; using namespace KODI::MESSAGING; @@ -235,7 +234,7 @@ class CMediaBrowser : public PLT_SyncMediaBrowser, bool SaveFileState(const CFileItem& item, const CBookmark& bookmark, const bool updatePlayCount) { - string path = item.GetProperty("original_listitem_url").asString(); + std::string path = item.GetProperty("original_listitem_url").asString(); if (!item.HasVideoInfoTag() || path.empty()) { return false; } @@ -683,7 +682,7 @@ CUPnP::StartServer() CUPnPServer::m_MaxReturnedItems = UPNP_DEFAULT_MAX_RETURNED_ITEMS; if (CUPnPSettings::GetInstance().GetMaximumReturnedItems() > 0) { // must be > UPNP_DEFAULT_MIN_RETURNED_ITEMS - CUPnPServer::m_MaxReturnedItems = max(UPNP_DEFAULT_MIN_RETURNED_ITEMS, CUPnPSettings::GetInstance().GetMaximumReturnedItems()); + CUPnPServer::m_MaxReturnedItems = std::max(UPNP_DEFAULT_MIN_RETURNED_ITEMS, CUPnPSettings::GetInstance().GetMaximumReturnedItems()); } CUPnPSettings::GetInstance().SetMaximumReturnedItems(CUPnPServer::m_MaxReturnedItems); } diff --git a/xbmc/network/upnp/UPnPServer.cpp b/xbmc/network/upnp/UPnPServer.cpp index d4fb95719d5ed..20cd05d4dc2c2 100644 --- a/xbmc/network/upnp/UPnPServer.cpp +++ b/xbmc/network/upnp/UPnPServer.cpp @@ -50,7 +50,6 @@ NPT_SET_LOCAL_LOGGER("xbmc.upnp.server") -using namespace std; using namespace ANNOUNCEMENT; using namespace XFILE; @@ -144,13 +143,13 @@ CUPnPServer::OnScanCompleted(int type) | CUPnPServer::UpdateContainer +---------------------------------------------------------------------*/ void -CUPnPServer::UpdateContainer(const string& id) +CUPnPServer::UpdateContainer(const std::string& id) { - map >::iterator itr = m_UpdateIDs.find(id); + std::map >::iterator itr = m_UpdateIDs.find(id); unsigned long count = 0; if (itr != m_UpdateIDs.end()) count = ++itr->second.second; - m_UpdateIDs[id] = make_pair(true, count); + m_UpdateIDs[id] = std::make_pair(true, count); PropagateUpdates(); } @@ -162,8 +161,8 @@ CUPnPServer::PropagateUpdates() { PLT_Service* service = NULL; NPT_String current_ids; - string buffer; - map >::iterator itr; + std::string buffer; + std::map >::iterator itr; if (m_scanning || !CSettings::GetInstance().GetBool(CSettings::SETTING_SERVICES_UPNPANNOUNCE)) return; @@ -414,7 +413,7 @@ CUPnPServer::Announce(AnnouncementFlag flag, const char *sender, const char *mes { NPT_String path; int item_id; - string item_type; + std::string item_type; if (strcmp(sender, "xbmc")) return; @@ -677,10 +676,10 @@ CUPnPServer::OnBrowseDirectChildren(PLT_ActionReference& action, // this is the only way to hide unplayable items in the 'files' // view as we cannot tell what context (eg music vs video) the // request came from - string supported = g_advancedSettings.m_pictureExtensions + "|" - + g_advancedSettings.m_videoExtensions + "|" - + g_advancedSettings.GetMusicExtensions() + "|" - + g_advancedSettings.m_discStubExtensions; + std::string supported = g_advancedSettings.m_pictureExtensions + "|" + + g_advancedSettings.m_videoExtensions + "|" + + g_advancedSettings.GetMusicExtensions() + "|" + + g_advancedSettings.m_discStubExtensions; CDirectory::GetDirectory((const char*)parent_id, items, supported); DefaultSortItems(items); } @@ -771,8 +770,8 @@ CUPnPServer::BuildResponse(PLT_ActionReference& action, // won't return more than UPNP_MAX_RETURNED_ITEMS items at a time to keep things smooth // 0 requested means as many as possible - NPT_UInt32 max_count = (requested_count == 0)?m_MaxReturnedItems:min((unsigned long)requested_count, (unsigned long)m_MaxReturnedItems); - NPT_UInt32 stop_index = min((unsigned long)(starting_index + max_count), (unsigned long)items.Size()); // don't return more than we can + NPT_UInt32 max_count = (requested_count == 0)?m_MaxReturnedItems:std::min((unsigned long)requested_count, (unsigned long)m_MaxReturnedItems); + NPT_UInt32 stop_index = std::min((unsigned long)(starting_index + max_count), (unsigned long)items.Size()); // don't return more than we can NPT_Cardinal count = 0; NPT_Cardinal total = items.Size(); @@ -1234,8 +1233,8 @@ CUPnPServer::SortItems(CFileItemList& items, const char* sort_criteria) } bool sorted = false; - vector tokens = StringUtils::Split(criteria, ","); - for (vector::reverse_iterator itr = tokens.rbegin(); itr != tokens.rend(); ++itr) { + std::vector tokens = StringUtils::Split(criteria, ","); + for (std::vector::reverse_iterator itr = tokens.rbegin(); itr != tokens.rend(); ++itr) { SortDescription sorting; /* Platinum guarantees 1st char is - or + */ sorting.sortOrder = StringUtils::StartsWith(*itr, "+") ? SortOrderAscending : SortOrderDescending; diff --git a/xbmc/network/upnp/UPnPSettings.cpp b/xbmc/network/upnp/UPnPSettings.cpp index 7d18d16f38fbe..5809356e8d9ee 100644 --- a/xbmc/network/upnp/UPnPSettings.cpp +++ b/xbmc/network/upnp/UPnPSettings.cpp @@ -33,7 +33,6 @@ #define XML_RENDERER_UUID "UUIDRenderer" #define XML_RENDERER_PORT "PortRenderer" -using namespace std; using namespace XFILE; CUPnPSettings::CUPnPSettings() diff --git a/xbmc/network/websocket/WebSocket.cpp b/xbmc/network/websocket/WebSocket.cpp index 498cbb10b845c..d999e94b242af 100644 --- a/xbmc/network/websocket/WebSocket.cpp +++ b/xbmc/network/websocket/WebSocket.cpp @@ -42,8 +42,6 @@ #define LENGTH_MIN 0x2 -using namespace std; - CWebSocketFrame::CWebSocketFrame(const char* data, uint64_t length) { reset(); @@ -160,7 +158,7 @@ CWebSocketFrame::CWebSocketFrame(WebSocketFrameOpcode opcode, const char* data / m_final = final; m_extension = extension; - string buffer; + std::string buffer; char dataByte = 0; // Set the FIN flag diff --git a/xbmc/network/websocket/WebSocketManager.cpp b/xbmc/network/websocket/WebSocketManager.cpp index 5b508f847e215..b1be009b44e52 100644 --- a/xbmc/network/websocket/WebSocketManager.cpp +++ b/xbmc/network/websocket/WebSocketManager.cpp @@ -35,9 +35,7 @@ #define WS_HEADER_VERSION "Sec-WebSocket-Version" #define WS_HEADER_VERSION_LC "sec-websocket-version" // "Sec-WebSocket-Version" -using namespace std; - -CWebSocket* CWebSocketManager::Handle(const char* data, unsigned int length, string &response) +CWebSocket* CWebSocketManager::Handle(const char* data, unsigned int length, std::string &response) { if (data == NULL || length <= 0) return NULL; diff --git a/xbmc/network/websocket/WebSocketV13.cpp b/xbmc/network/websocket/WebSocketV13.cpp index b0c2800d4abaa..d540974f8034f 100644 --- a/xbmc/network/websocket/WebSocketV13.cpp +++ b/xbmc/network/websocket/WebSocketV13.cpp @@ -45,11 +45,9 @@ #define WS_PROTOCOL_JSONRPC "jsonrpc.xbmc.org" #define WS_HEADER_UPGRADE_VALUE "websocket" -using namespace std; - bool CWebSocketV13::Handshake(const char* data, size_t length, std::string &response) { - string strHeader(data, length); + std::string strHeader(data, length); const char *value; HttpParser header; if (header.addBytes(data, length) != HttpParser::Done) @@ -68,14 +66,14 @@ bool CWebSocketV13::Handshake(const char* data, size_t length, std::string &resp // The request must be HTTP/1.1 or higher size_t pos; - if ((pos = strHeader.find(WS_HTTP_TAG)) == string::npos) + if ((pos = strHeader.find(WS_HTTP_TAG)) == std::string::npos) { CLog::Log(LOGINFO, "WebSocket [RFC6455]: invalid handshake received"); return false; } pos += strlen(WS_HTTP_TAG); - istringstream converter(strHeader.substr(pos, strHeader.find_first_of(" \r\n\t", pos) - pos)); + std::istringstream converter(strHeader.substr(pos, strHeader.find_first_of(" \r\n\t", pos) - pos)); float fVersion; converter >> fVersion; @@ -85,7 +83,7 @@ bool CWebSocketV13::Handshake(const char* data, size_t length, std::string &resp return false; } - string websocketKey, websocketProtocol; + std::string websocketKey, websocketProtocol; // There must be a "Host" header value = header.getValue("host"); if (value == NULL || strlen(value) == 0) @@ -122,8 +120,8 @@ bool CWebSocketV13::Handshake(const char* data, size_t length, std::string &resp value = header.getValue(WS_HEADER_PROTOCOL_LC); if (value && strlen(value) > 0) { - vector protocols = StringUtils::Split(value, ","); - for (vector::iterator protocol = protocols.begin(); protocol != protocols.end(); ++protocol) + std::vector protocols = StringUtils::Split(value, ","); + for (std::vector::iterator protocol = protocols.begin(); protocol != protocols.end(); ++protocol) { StringUtils::Trim(*protocol); if (*protocol == WS_PROTOCOL_JSONRPC) diff --git a/xbmc/network/websocket/WebSocketV8.cpp b/xbmc/network/websocket/WebSocketV8.cpp index 3b232d4777421..7d8ba398c0617 100644 --- a/xbmc/network/websocket/WebSocketV8.cpp +++ b/xbmc/network/websocket/WebSocketV8.cpp @@ -46,11 +46,9 @@ #define WS_HEADER_UPGRADE_VALUE "websocket" #define WS_KEY_MAGICSTRING "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" -using namespace std; - bool CWebSocketV8::Handshake(const char* data, size_t length, std::string &response) { - string strHeader(data, length); + std::string strHeader(data, length); const char *value; HttpParser header; if (header.addBytes(data, length) != HttpParser::Done) @@ -69,14 +67,14 @@ bool CWebSocketV8::Handshake(const char* data, size_t length, std::string &respo // The request must be HTTP/1.1 or higher size_t pos; - if ((pos = strHeader.find(WS_HTTP_TAG)) == string::npos) + if ((pos = strHeader.find(WS_HTTP_TAG)) == std::string::npos) { CLog::Log(LOGINFO, "WebSocket [hybi-10]: invalid handshake received"); return false; } pos += strlen(WS_HTTP_TAG); - istringstream converter(strHeader.substr(pos, strHeader.find_first_of(" \r\n\t", pos) - pos)); + std::istringstream converter(strHeader.substr(pos, strHeader.find_first_of(" \r\n\t", pos) - pos)); float fVersion; converter >> fVersion; @@ -86,7 +84,7 @@ bool CWebSocketV8::Handshake(const char* data, size_t length, std::string &respo return false; } - string websocketKey, websocketProtocol; + std::string websocketKey, websocketProtocol; // There must be a "Host" header value = header.getValue("host"); if (value == NULL || strlen(value) == 0) @@ -107,8 +105,8 @@ bool CWebSocketV8::Handshake(const char* data, size_t length, std::string &respo value = header.getValue(WS_HEADER_PROTOCOL_LC); if (value && strlen(value) > 0) { - vector protocols = StringUtils::Split(value, ","); - for (vector::iterator protocol = protocols.begin(); protocol != protocols.end(); ++protocol) + std::vector protocols = StringUtils::Split(value, ","); + for (std::vector::iterator protocol = protocols.begin(); protocol != protocols.end(); ++protocol) { StringUtils::Trim(*protocol); if (*protocol == WS_PROTOCOL_JSONRPC) @@ -190,7 +188,7 @@ const CWebSocketFrame* CWebSocketV8::close(WebSocketCloseReason reason /* = WebS std::string CWebSocketV8::calculateKey(const std::string &key) { - string acceptKey = key; + std::string acceptKey = key; acceptKey.append(WS_KEY_MAGICSTRING); boost::uuids::detail::sha1 hash; diff --git a/xbmc/network/windows/NetworkWin32.cpp b/xbmc/network/windows/NetworkWin32.cpp index 922c88b799a23..c7a406ff53175 100644 --- a/xbmc/network/windows/NetworkWin32.cpp +++ b/xbmc/network/windows/NetworkWin32.cpp @@ -39,8 +39,6 @@ #endif -using namespace std; - CNetworkInterfaceWin32::CNetworkInterfaceWin32(CNetworkWin32* network, IP_ADAPTER_INFO adapter): m_adaptername(adapter.Description) { @@ -162,7 +160,7 @@ CNetworkWin32::~CNetworkWin32(void) void CNetworkWin32::CleanInterfaceList() { - vector::iterator it = m_interfaces.begin(); + std::vector::iterator it = m_interfaces.begin(); while(it != m_interfaces.end()) { CNetworkInterface* nInt = *it; From b271fdf51f1d279c4dd178336c94315a9244b368 Mon Sep 17 00:00:00 2001 From: Matthias Kortstiege Date: Fri, 28 Aug 2015 11:05:58 +0200 Subject: [PATCH 10/22] [pictures] use std:: instead of using namespace std --- xbmc/pictures/GUIWindowPictures.cpp | 3 +-- xbmc/pictures/PictureInfoTag.cpp | 6 ++---- xbmc/pictures/PictureThumbLoader.cpp | 3 +-- xbmc/pictures/SlideShowPicture.cpp | 4 +--- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/xbmc/pictures/GUIWindowPictures.cpp b/xbmc/pictures/GUIWindowPictures.cpp index 7e44c9fae80c9..871dd2fe7410d 100644 --- a/xbmc/pictures/GUIWindowPictures.cpp +++ b/xbmc/pictures/GUIWindowPictures.cpp @@ -51,7 +51,6 @@ #define CONTROL_BTNSORTASC 4 #define CONTROL_LABELFILES 12 -using namespace std; using namespace XFILE; using namespace PLAYLIST; @@ -562,7 +561,7 @@ void CGUIWindowPictures::OnItemLoaded(CFileItem *pItem) void CGUIWindowPictures::LoadPlayList(const std::string& strPlayList) { CLog::Log(LOGDEBUG,"CGUIWindowPictures::LoadPlayList()... converting playlist into slideshow: %s", strPlayList.c_str()); - unique_ptr pPlayList (CPlayListFactory::Create(strPlayList)); + std::unique_ptr pPlayList (CPlayListFactory::Create(strPlayList)); if ( NULL != pPlayList.get()) { if (!pPlayList->Load(strPlayList)) diff --git a/xbmc/pictures/PictureInfoTag.cpp b/xbmc/pictures/PictureInfoTag.cpp index b011072b15b94..03973d2dacb2f 100644 --- a/xbmc/pictures/PictureInfoTag.cpp +++ b/xbmc/pictures/PictureInfoTag.cpp @@ -28,8 +28,6 @@ #include "utils/StringUtils.h" #include "utils/Archive.h" -using namespace std; - void CPictureInfoTag::Reset() { memset(&m_exifInfo, 0, sizeof(m_exifInfo)); @@ -283,7 +281,7 @@ void CPictureInfoTag::GetStringFromArchive(CArchive &ar, char *string, size_t le { std::string temp; ar >> temp; - length = min((size_t)temp.size(), length - 1); + length = std::min((size_t)temp.size(), length - 1); if (!temp.empty()) memcpy(string, temp.c_str(), length); string[length] = 0; @@ -626,7 +624,7 @@ void CPictureInfoTag::SetInfo(int info, const std::string& value) { case SLIDE_RESOLUTION: { - vector dimension; + std::vector dimension; StringUtils::Tokenize(value, dimension, ","); if (dimension.size() == 2) { diff --git a/xbmc/pictures/PictureThumbLoader.cpp b/xbmc/pictures/PictureThumbLoader.cpp index 142d2ac274a70..18acf0437fd90 100644 --- a/xbmc/pictures/PictureThumbLoader.cpp +++ b/xbmc/pictures/PictureThumbLoader.cpp @@ -34,7 +34,6 @@ #include "URL.h" using namespace XFILE; -using namespace std; CPictureThumbLoader::CPictureThumbLoader() : CThumbLoader(), CJobQueue(true, 1, CJob::PRIORITY_LOW_PAUSABLE) { @@ -233,7 +232,7 @@ void CPictureThumbLoader::ProcessFoldersAndArchives(CFileItem *pItem) { // ok, now we've got the files to get the thumbs from, lets create it... // we basically load the 4 images and combine them - vector files; + std::vector files; for (int thumb = 0; thumb < 4; thumb++) files.push_back(items[thumb]->GetPath()); std::string thumb = CTextureUtils::GetWrappedImageURL(pItem->GetPath(), "picturefolder"); diff --git a/xbmc/pictures/SlideShowPicture.cpp b/xbmc/pictures/SlideShowPicture.cpp index 127254a3b94a1..a9f4daa8b7565 100644 --- a/xbmc/pictures/SlideShowPicture.cpp +++ b/xbmc/pictures/SlideShowPicture.cpp @@ -31,8 +31,6 @@ #endif #include -using namespace std; - #define IMMEDIATE_TRANSISTION_TIME 20 #define PICTURE_MOVE_AMOUNT 0.02f @@ -163,7 +161,7 @@ void CSlideShowPic::SetTexture_Internal(int iSlideNumber, CBaseTexture* pTexture m_fPosX = m_fPosY = 0.0f; m_fPosZ = 1.0f; m_fVelocityX = m_fVelocityY = m_fVelocityZ = 0.0f; - int iFrames = max((int)(g_graphicsContext.GetFPS() * CSettings::GetInstance().GetInt(CSettings::SETTING_SLIDESHOW_STAYTIME)), 1); + int iFrames = std::max((int)(g_graphicsContext.GetFPS() * CSettings::GetInstance().GetInt(CSettings::SETTING_SLIDESHOW_STAYTIME)), 1); if (m_displayEffect == EFFECT_PANORAMA) { RESOLUTION_INFO res = g_graphicsContext.GetResInfo(); From a5a4b5b478c9d67935b10ff329c64d7ec119cf93 Mon Sep 17 00:00:00 2001 From: Matthias Kortstiege Date: Fri, 28 Aug 2015 11:08:34 +0200 Subject: [PATCH 11/22] [audiodsp] use std:: instead of using namespace std --- .../dialogs/GUIDialogAudioDSPManager.cpp | 19 +++++++------ .../dialogs/GUIDialogAudioDSPSettings.cpp | 27 +++++++++---------- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/xbmc/settings/dialogs/GUIDialogAudioDSPManager.cpp b/xbmc/settings/dialogs/GUIDialogAudioDSPManager.cpp index a312c40773b5b..5a59653e0565c 100644 --- a/xbmc/settings/dialogs/GUIDialogAudioDSPManager.cpp +++ b/xbmc/settings/dialogs/GUIDialogAudioDSPManager.cpp @@ -49,7 +49,6 @@ #define LIST_POST_PROCESS 3 #define LIST_OUTPUT_RESAMPLE 4 -using namespace std; using namespace ActiveAE; typedef struct @@ -143,7 +142,7 @@ bool CGUIDialogAudioDSPManager::OnActionMove(const CAction &action) iLines = m_activeItems[m_iCurrentType]->Size() - 1; } - string strNumber; + std::string strNumber; for (unsigned int iLine = 0; iLine < iLines; iLine++) { unsigned int iNewSelect = bMoveUp ? m_iSelected[LIST_ACTIVE] - 1 : m_iSelected[LIST_ACTIVE] + 1; @@ -411,7 +410,7 @@ bool CGUIDialogAudioDSPManager::OnMessage(CGUIMessage& message) CGUIListItemPtr modeListItem = modeListPtr->GetListItem(0); // get current selected list item if (modeListItem) { - string currentModeString = modeListItem->GetProperty("currentMode").asString(); + std::string currentModeString = modeListItem->GetProperty("currentMode").asString(); int newModeType = helper_TranslateModeType(currentModeString); if (m_iCurrentType != newModeType) @@ -914,7 +913,7 @@ void CGUIDialogAudioDSPManager::SetItemsUnchanged() void CGUIDialogAudioDSPManager::Renumber(void) { int iNextModeNumber(0); - string strNumber; + std::string strNumber; CFileItemPtr pItem; for (int iModePtr = 0; iModePtr < m_activeItems[m_iCurrentType]->Size(); iModePtr++) @@ -933,7 +932,7 @@ void CGUIDialogAudioDSPManager::helper_LogError(const char *function) CLog::Log(LOGERROR, "DSP Manager - %s - GUI value error", function); } -int CGUIDialogAudioDSPManager::helper_TranslateModeType(string ModeString) +int CGUIDialogAudioDSPManager::helper_TranslateModeType(std::string ModeString) { int iType = AE_DSP_MODE_TYPE_UNDEFINED; for (unsigned int ii = 0; ii < ARRAY_SIZE(dsp_mode_types) && iType == AE_DSP_MODE_TYPE_UNDEFINED; ii++) @@ -959,7 +958,7 @@ CFileItem *CGUIDialogAudioDSPManager::helper_CreateModeListItem(CActiveAEDSPMode // start to get Addon and Mode properties const int AddonID = ModePointer->AddonID(); - string addonName; + std::string addonName; if (!CActiveAEDSP::GetInstance().GetAudioDSPAddonName(AddonID, addonName)) { return pItem; @@ -971,9 +970,9 @@ CFileItem *CGUIDialogAudioDSPManager::helper_CreateModeListItem(CActiveAEDSPMode return pItem; } - string modeName = addon->GetString(ModePointer->ModeName()); + std::string modeName = addon->GetString(ModePointer->ModeName()); - string description; + std::string description; if (ModePointer->ModeDescription() > -1) { description = addon->GetString(ModePointer->ModeDescription()); @@ -996,7 +995,7 @@ CFileItem *CGUIDialogAudioDSPManager::helper_CreateModeListItem(CActiveAEDSPMode (*ContinuesNo)++; } - string str = StringUtils::Format("%i:%i:%i:%s", + std::string str = StringUtils::Format("%i:%i:%i:%s", number, AddonID, ModePointer->AddonModeNumber(), @@ -1025,7 +1024,7 @@ CFileItem *CGUIDialogAudioDSPManager::helper_CreateModeListItem(CActiveAEDSPMode return pItem; } -int CGUIDialogAudioDSPManager::helper_GetDialogId(CActiveAEDSPModePtr &ModePointer, AE_DSP_MENUHOOK_CAT &MenuHook, AE_DSP_ADDON &Addon, string AddonName) +int CGUIDialogAudioDSPManager::helper_GetDialogId(CActiveAEDSPModePtr &ModePointer, AE_DSP_MENUHOOK_CAT &MenuHook, AE_DSP_ADDON &Addon, std::string AddonName) { int dialogId = 0; diff --git a/xbmc/settings/dialogs/GUIDialogAudioDSPSettings.cpp b/xbmc/settings/dialogs/GUIDialogAudioDSPSettings.cpp index 5f3d82f2b34bc..b18db5c6e55ab 100644 --- a/xbmc/settings/dialogs/GUIDialogAudioDSPSettings.cpp +++ b/xbmc/settings/dialogs/GUIDialogAudioDSPSettings.cpp @@ -81,7 +81,6 @@ #define CONTROL_SETTINGS_LABEL 2 -using namespace std; using namespace ActiveAE; CGUIDialogAudioDSPSettings::CGUIDialogAudioDSPSettings() @@ -273,7 +272,7 @@ void CGUIDialogAudioDSPSettings::FrameMove() m_settingsManager->SetString(SETTING_STREAM_INFO_CPU_USAGE, m_CPUUsage); for (unsigned int i = 0; i < m_ActiveModes.size(); i++) { - string settingId = StringUtils::Format("%s%i", SETTING_STREAM_INFO_MODE_CPU_USAGE, i); + std::string settingId = StringUtils::Format("%s%i", SETTING_STREAM_INFO_MODE_CPU_USAGE, i); m_ActiveModesData[i].CPUUsage = StringUtils::Format("%.02f %%", m_ActiveModes[i]->CPUUsage()); m_settingsManager->SetString(settingId, m_ActiveModesData[i].CPUUsage); } @@ -472,21 +471,21 @@ void CGUIDialogAudioDSPSettings::InitializeSettings() /* about size() > 1, it is always the fallback (ignore of master processing) present. */ StaticIntegerSettingOptions modeEntries; if (m_MasterModes[AE_DSP_ASTREAM_BASIC].size() > 1) - modeEntries.push_back(pair(CActiveAEDSP::GetInstance().GetStreamTypeName(AE_DSP_ASTREAM_BASIC), AE_DSP_ASTREAM_BASIC)); + modeEntries.push_back(std::pair(CActiveAEDSP::GetInstance().GetStreamTypeName(AE_DSP_ASTREAM_BASIC), AE_DSP_ASTREAM_BASIC)); if (m_MasterModes[AE_DSP_ASTREAM_MUSIC].size() > 1) - modeEntries.push_back(pair(CActiveAEDSP::GetInstance().GetStreamTypeName(AE_DSP_ASTREAM_MUSIC), AE_DSP_ASTREAM_MUSIC)); + modeEntries.push_back(std::pair(CActiveAEDSP::GetInstance().GetStreamTypeName(AE_DSP_ASTREAM_MUSIC), AE_DSP_ASTREAM_MUSIC)); if (m_MasterModes[AE_DSP_ASTREAM_MOVIE].size() > 1) - modeEntries.push_back(pair(CActiveAEDSP::GetInstance().GetStreamTypeName(AE_DSP_ASTREAM_MOVIE), AE_DSP_ASTREAM_MOVIE)); + modeEntries.push_back(std::pair(CActiveAEDSP::GetInstance().GetStreamTypeName(AE_DSP_ASTREAM_MOVIE), AE_DSP_ASTREAM_MOVIE)); if (m_MasterModes[AE_DSP_ASTREAM_GAME].size() > 1) - modeEntries.push_back(pair(CActiveAEDSP::GetInstance().GetStreamTypeName(AE_DSP_ASTREAM_GAME), AE_DSP_ASTREAM_GAME)); + modeEntries.push_back(std::pair(CActiveAEDSP::GetInstance().GetStreamTypeName(AE_DSP_ASTREAM_GAME), AE_DSP_ASTREAM_GAME)); if (m_MasterModes[AE_DSP_ASTREAM_APP].size() > 1) - modeEntries.push_back(pair(CActiveAEDSP::GetInstance().GetStreamTypeName(AE_DSP_ASTREAM_APP), AE_DSP_ASTREAM_APP)); + modeEntries.push_back(std::pair(CActiveAEDSP::GetInstance().GetStreamTypeName(AE_DSP_ASTREAM_APP), AE_DSP_ASTREAM_APP)); if (m_MasterModes[AE_DSP_ASTREAM_MESSAGE].size() > 1) - modeEntries.push_back(pair(CActiveAEDSP::GetInstance().GetStreamTypeName(AE_DSP_ASTREAM_MESSAGE), AE_DSP_ASTREAM_MESSAGE)); + modeEntries.push_back(std::pair(CActiveAEDSP::GetInstance().GetStreamTypeName(AE_DSP_ASTREAM_MESSAGE), AE_DSP_ASTREAM_MESSAGE)); if (m_MasterModes[AE_DSP_ASTREAM_PHONE].size() > 1) - modeEntries.push_back(pair(CActiveAEDSP::GetInstance().GetStreamTypeName(AE_DSP_ASTREAM_PHONE), AE_DSP_ASTREAM_PHONE)); + modeEntries.push_back(std::pair(CActiveAEDSP::GetInstance().GetStreamTypeName(AE_DSP_ASTREAM_PHONE), AE_DSP_ASTREAM_PHONE)); if (modesAvailable > 1 && m_MasterModes[m_streamTypeUsed].size() > 1) - modeEntries.insert(modeEntries.begin(), pair(CActiveAEDSP::GetInstance().GetStreamTypeName(AE_DSP_ASTREAM_AUTO), AE_DSP_ASTREAM_AUTO)); + modeEntries.insert(modeEntries.begin(), std::pair(CActiveAEDSP::GetInstance().GetStreamTypeName(AE_DSP_ASTREAM_AUTO), AE_DSP_ASTREAM_AUTO)); AddSpinner(groupAudioModeSel, SETTING_AUDIO_MAIN_STREAMTYPE, 15021, 0, @@ -590,7 +589,7 @@ void CGUIDialogAudioDSPSettings::InitializeSettings() menu.hook.iRelevantModeId = hooks[j].iRelevantModeId; m_Menus.push_back(menu); - string setting = StringUtils::Format("%s%i", SETTING_AUDIO_MASTER_SETTINGS_MENUS, (int)m_Menus.size()-1); + std::string setting = StringUtils::Format("%s%i", SETTING_AUDIO_MASTER_SETTINGS_MENUS, (int)m_Menus.size()-1); AddButton(groupMasterMode, setting, 15041, 0); break; } @@ -813,7 +812,7 @@ void CGUIDialogAudioDSPSettings::InitializeSettings() } m_ActiveModesData[i].MenuName = label; - string settingId = StringUtils::Format("%s%i", SETTING_STREAM_INFO_MODE_CPU_USAGE, i); + std::string settingId = StringUtils::Format("%s%i", SETTING_STREAM_INFO_MODE_CPU_USAGE, i); AddInfoLabelButton(group, settingId, 15041, 0, m_ActiveModesData[i].CPUUsage); } } @@ -898,7 +897,7 @@ bool CGUIDialogAudioDSPSettings::HaveActiveMenuHooks(AE_DSP_MENUHOOK_CAT categor return false; } -string CGUIDialogAudioDSPSettings::GetSettingsLabel(CSetting *pSetting) +std::string CGUIDialogAudioDSPSettings::GetSettingsLabel(CSetting *pSetting) { if (pSetting->GetLabel() == 15041) { @@ -964,7 +963,7 @@ void CGUIDialogAudioDSPSettings::GetAudioDSPMenus(CSettingGroup *group, AE_DSP_M if (modeName.empty()) modeName = g_localizeStrings.Get(15041); - string setting = StringUtils::Format("%s%i", SETTING_AUDIO_PROC_SETTINGS_MENUS, i); + std::string setting = StringUtils::Format("%s%i", SETTING_AUDIO_PROC_SETTINGS_MENUS, i); AddButton(group, setting, 15041, 0); } } From b23e4bd9b73c19dceebb69f6fb55c1aeac84f5b4 Mon Sep 17 00:00:00 2001 From: Matthias Kortstiege Date: Fri, 28 Aug 2015 11:19:23 +0200 Subject: [PATCH 12/22] [interfaces] use std:: instead of using namespace std --- xbmc/interfaces/AnnouncementManager.cpp | 1 - xbmc/interfaces/Builtins.cpp | 19 ++++++------ .../generic/ScriptInvocationManager.cpp | 25 ++++++++-------- xbmc/interfaces/info/InfoExpression.cpp | 1 - xbmc/interfaces/info/SkinVariable.cpp | 1 - xbmc/interfaces/json-rpc/AddonsOperations.cpp | 15 +++++----- .../json-rpc/FavouritesOperations.cpp | 13 ++++----- xbmc/interfaces/json-rpc/GUIOperations.cpp | 7 ++--- xbmc/interfaces/json-rpc/JSONRPC.cpp | 7 ++--- .../json-rpc/JSONServiceDescription.cpp | 29 +++++++++---------- xbmc/interfaces/json-rpc/PVROperations.cpp | 3 +- .../json-rpc/PlaylistOperations.cpp | 5 ++-- .../json-rpc/SettingsOperations.cpp | 21 +++++++------- xbmc/interfaces/python/AddonPythonInvoker.cpp | 3 +- xbmc/interfaces/python/PythonInvoker.cpp | 1 - 15 files changed, 68 insertions(+), 83 deletions(-) diff --git a/xbmc/interfaces/AnnouncementManager.cpp b/xbmc/interfaces/AnnouncementManager.cpp index d5e1ff81d685b..138bf0980eddb 100644 --- a/xbmc/interfaces/AnnouncementManager.cpp +++ b/xbmc/interfaces/AnnouncementManager.cpp @@ -33,7 +33,6 @@ #define LOOKUP_PROPERTY "database-lookup" -using namespace std; using namespace ANNOUNCEMENT; CAnnouncementManager::CAnnouncementManager() diff --git a/xbmc/interfaces/Builtins.cpp b/xbmc/interfaces/Builtins.cpp index 72aab41a7ca5a..248bc1e3d926e 100644 --- a/xbmc/interfaces/Builtins.cpp +++ b/xbmc/interfaces/Builtins.cpp @@ -108,7 +108,6 @@ #include "powermanagement/PowerManager.h" #include "filesystem/Directory.h" -using namespace std; using namespace XFILE; using namespace ADDON; using namespace KODI::MESSAGING; @@ -251,7 +250,7 @@ const BUILT_IN commands[] = { bool CBuiltins::HasCommand(const std::string& execString) { std::string function; - vector parameters; + std::vector parameters; CUtil::SplitExecFunction(execString, function, parameters); for (unsigned int i = 0; i < sizeof(commands)/sizeof(BUILT_IN); i++) { @@ -264,7 +263,7 @@ bool CBuiltins::HasCommand(const std::string& execString) bool CBuiltins::IsSystemPowerdownCommand(const std::string& execString) { std::string execute; - vector params; + std::vector params; CUtil::SplitExecFunction(execString, execute, params); StringUtils::ToLower(execute); @@ -318,7 +317,7 @@ int CBuiltins::Execute(const std::string& execString) { // Deprecated. Get the text after the "XBMC." std::string execute; - vector params; + std::vector params; CUtil::SplitExecFunction(execString, execute, params); StringUtils::ToLower(execute); std::string parameter = params.size() ? params[0] : ""; @@ -544,7 +543,7 @@ int CBuiltins::Execute(const std::string& execString) scriptpath = params[0]; // split the path up to find the filename - vector argv = params; + std::vector argv = params; std::string filename = URIUtils::GetFileName(scriptpath); if (!filename.empty()) argv[0] = filename; @@ -647,7 +646,7 @@ int CBuiltins::Execute(const std::string& execString) PluginPtr plugin = std::dynamic_pointer_cast(addon); std::string addonid = params[0]; std::string urlParameters; - vector parameters; + std::vector parameters; if (params.size() == 2 && (StringUtils::StartsWith(params[1], "/") || StringUtils::StartsWith(params[1], "?"))) urlParameters = params[1]; @@ -781,7 +780,7 @@ int CBuiltins::Execute(const std::string& execString) break; } - unique_ptr state(CGUIViewState::GetViewState(containsVideo ? WINDOW_VIDEO_NAV : WINDOW_MUSIC, items)); + std::unique_ptr state(CGUIViewState::GetViewState(containsVideo ? WINDOW_VIDEO_NAV : WINDOW_MUSIC, items)); if (state.get()) items.Sort(state->GetSortMethod()); else @@ -872,7 +871,7 @@ int CBuiltins::Execute(const std::string& execString) } CGUIMessage msg(GUI_MSG_START_SLIDESHOW, 0, 0, flags); - vector strParams; + std::vector strParams; strParams.push_back(params[0]); strParams.push_back(beginSlidePath); msg.SetStringParams(strParams); @@ -1289,7 +1288,7 @@ int CBuiltins::Execute(const std::string& execString) else if (execute == "skin.theme") { // enumerate themes - vector vecTheme; + std::vector vecTheme; CUtil::GetSkinThemes(vecTheme); int iTheme = -1; @@ -1460,7 +1459,7 @@ int CBuiltins::Execute(const std::string& execString) else if (execute == "skin.setaddon" && params.size() > 1) { int string = CSkinSettings::GetInstance().TranslateString(params[0]); - vector types; + std::vector types; for (unsigned int i = 1 ; i < params.size() ; i++) { ADDON::TYPE type = TranslateType(params[i]); diff --git a/xbmc/interfaces/generic/ScriptInvocationManager.cpp b/xbmc/interfaces/generic/ScriptInvocationManager.cpp index 20f9449a1f9ac..53d676ddde51f 100644 --- a/xbmc/interfaces/generic/ScriptInvocationManager.cpp +++ b/xbmc/interfaces/generic/ScriptInvocationManager.cpp @@ -31,7 +31,6 @@ #include "utils/URIUtils.h" #include "utils/log.h" -using namespace std; using namespace XFILE; CScriptInvocationManager::CScriptInvocationManager() @@ -53,7 +52,7 @@ void CScriptInvocationManager::Process() { CSingleLock lock(m_critSection); // go through all active threads and find and remove all which are done - vector tempList; + std::vector tempList; for (LanguageInvokerThreadMap::iterator it = m_scripts.begin(); it != m_scripts.end(); ) { if (it->second.done) @@ -66,7 +65,7 @@ void CScriptInvocationManager::Process() } // remove the finished scripts from the script path map as well - for (vector::const_iterator it = tempList.begin(); it != tempList.end(); ++it) + for (std::vector::const_iterator it = tempList.begin(); it != tempList.end(); ++it) m_scriptPaths.erase(it->script); // we can leave the lock now @@ -89,7 +88,7 @@ void CScriptInvocationManager::Uninitialize() Process(); // make sure all scripts are done - vector tempList; + std::vector tempList; for (LanguageInvokerThreadMap::iterator script = m_scripts.begin(); script != m_scripts.end(); ++script) tempList.push_back(script->second); @@ -102,7 +101,7 @@ void CScriptInvocationManager::Uninitialize() // finally stop and remove the finished threads but we do it outside of any // locks in case of any callbacks from the stop or destruction logic of // CLanguageInvokerThread or the ILanguageInvoker implementation - for (vector::iterator it = tempList.begin(); it != tempList.end(); ++it) + for (std::vector::iterator it = tempList.begin(); it != tempList.end(); ++it) { if (!it->done) it->thread->Stop(true); @@ -122,7 +121,7 @@ void CScriptInvocationManager::RegisterLanguageInvocationHandler(ILanguageInvoca if (invocationHandler == NULL || extension.empty()) return; - string ext = extension; + std::string ext = extension; StringUtils::ToLower(ext); if (!StringUtils::StartsWithNoCase(ext, ".")) ext = "." + ext; @@ -131,7 +130,7 @@ void CScriptInvocationManager::RegisterLanguageInvocationHandler(ILanguageInvoca if (m_invocationHandlers.find(ext) != m_invocationHandlers.end()) return; - m_invocationHandlers.insert(make_pair(extension, invocationHandler)); + m_invocationHandlers.insert(std::make_pair(extension, invocationHandler)); bool known = false; for (std::map::const_iterator it = m_invocationHandlers.begin(); it != m_invocationHandlers.end(); ++it) @@ -153,7 +152,7 @@ void CScriptInvocationManager::RegisterLanguageInvocationHandler(ILanguageInvoca if (invocationHandler == NULL || extensions.empty()) return; - for (set::const_iterator extension = extensions.begin(); extension != extensions.end(); ++extension) + for (std::set::const_iterator extension = extensions.begin(); extension != extensions.end(); ++extension) RegisterLanguageInvocationHandler(invocationHandler, *extension); } @@ -164,7 +163,7 @@ void CScriptInvocationManager::UnregisterLanguageInvocationHandler(ILanguageInvo CSingleLock lock(m_critSection); // get all extensions of the given language invoker - for (map::iterator it = m_invocationHandlers.begin(); it != m_invocationHandlers.end(); ) + for (std::map::iterator it = m_invocationHandlers.begin(); it != m_invocationHandlers.end(); ) { if (it->second == invocationHandler) m_invocationHandlers.erase(it++); @@ -182,7 +181,7 @@ bool CScriptInvocationManager::HasLanguageInvoker(const std::string &script) con StringUtils::ToLower(extension); CSingleLock lock(m_critSection); - map::const_iterator it = m_invocationHandlers.find(extension); + std::map::const_iterator it = m_invocationHandlers.find(extension); return it != m_invocationHandlers.end() && it->second != NULL; } @@ -192,7 +191,7 @@ LanguageInvokerPtr CScriptInvocationManager::GetLanguageInvoker(const std::strin StringUtils::ToLower(extension); CSingleLock lock(m_critSection); - map::const_iterator it = m_invocationHandlers.find(extension); + std::map::const_iterator it = m_invocationHandlers.find(extension); if (it != m_invocationHandlers.end() && it->second != NULL) return LanguageInvokerPtr(it->second->CreateInvoker()); @@ -237,8 +236,8 @@ int CScriptInvocationManager::ExecuteAsync(const std::string &script, LanguageIn lock.Leave(); LanguageInvokerThread thread = { invokerThread, script, false }; - m_scripts.insert(make_pair(invokerThread->GetId(), thread)); - m_scriptPaths.insert(make_pair(script, invokerThread->GetId())); + m_scripts.insert(std::make_pair(invokerThread->GetId(), thread)); + m_scriptPaths.insert(std::make_pair(script, invokerThread->GetId())); invokerThread->Execute(script, arguments); return invokerThread->GetId(); diff --git a/xbmc/interfaces/info/InfoExpression.cpp b/xbmc/interfaces/info/InfoExpression.cpp index da6fefdfc84f9..2be4b2c9bdf0d 100644 --- a/xbmc/interfaces/info/InfoExpression.cpp +++ b/xbmc/interfaces/info/InfoExpression.cpp @@ -25,7 +25,6 @@ #include #include -using namespace std; using namespace INFO; InfoSingle::InfoSingle(const std::string &expression, int context) diff --git a/xbmc/interfaces/info/SkinVariable.cpp b/xbmc/interfaces/info/SkinVariable.cpp index 496e8ef79cb9b..732b79c21fe02 100644 --- a/xbmc/interfaces/info/SkinVariable.cpp +++ b/xbmc/interfaces/info/SkinVariable.cpp @@ -22,7 +22,6 @@ #include "GUIInfoManager.h" #include "utils/XBMCTinyXML.h" -using namespace std; using namespace INFO; const CSkinVariableString* CSkinVariable::CreateFromXML(const TiXmlElement& node, int context) diff --git a/xbmc/interfaces/json-rpc/AddonsOperations.cpp b/xbmc/interfaces/json-rpc/AddonsOperations.cpp index d00d05866302d..2f469b150d9e4 100644 --- a/xbmc/interfaces/json-rpc/AddonsOperations.cpp +++ b/xbmc/interfaces/json-rpc/AddonsOperations.cpp @@ -29,7 +29,6 @@ #include "utils/StringUtils.h" #include "utils/Variant.h" -using namespace std; using namespace JSONRPC; using namespace ADDON; using namespace XFILE; @@ -37,7 +36,7 @@ using namespace KODI::MESSAGING; JSONRPC_STATUS CAddonsOperations::GetAddons(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { - vector addonTypes; + std::vector addonTypes; TYPE addonType = TranslateType(parameterObject["type"].asString()); CPluginSource::Content content = CPluginSource::Translate(parameterObject["content"].asString()); CVariant enabled = parameterObject["enabled"]; @@ -74,7 +73,7 @@ JSONRPC_STATUS CAddonsOperations::GetAddons(const std::string &method, ITranspor addonTypes.push_back(addonType); VECADDONS addons; - for (vector::const_iterator typeIt = addonTypes.begin(); typeIt != addonTypes.end(); ++typeIt) + for (std::vector::const_iterator typeIt = addonTypes.begin(); typeIt != addonTypes.end(); ++typeIt) { VECADDONS typeAddons; if (*typeIt == ADDON_UNKNOWN) @@ -130,7 +129,7 @@ JSONRPC_STATUS CAddonsOperations::GetAddons(const std::string &method, ITranspor JSONRPC_STATUS CAddonsOperations::GetAddonDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { - string id = parameterObject["addonid"].asString(); + std::string id = parameterObject["addonid"].asString(); AddonPtr addon; if (!CAddonMgr::GetInstance().GetAddon(id, addon, ADDON::ADDON_UNKNOWN, false) || addon.get() == NULL || addon->Type() <= ADDON_UNKNOWN || addon->Type() >= ADDON_MAX) @@ -144,7 +143,7 @@ JSONRPC_STATUS CAddonsOperations::GetAddonDetails(const std::string &method, ITr JSONRPC_STATUS CAddonsOperations::SetAddonEnabled(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { - string id = parameterObject["addonid"].asString(); + std::string id = parameterObject["addonid"].asString(); bool disabled = false; if (parameterObject["enabled"].isBoolean()) disabled = !parameterObject["enabled"].asBoolean(); @@ -160,13 +159,13 @@ JSONRPC_STATUS CAddonsOperations::SetAddonEnabled(const std::string &method, ITr JSONRPC_STATUS CAddonsOperations::ExecuteAddon(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { - string id = parameterObject["addonid"].asString(); + std::string id = parameterObject["addonid"].asString(); AddonPtr addon; if (!CAddonMgr::GetInstance().GetAddon(id, addon) || addon.get() == NULL || addon->Type() < ADDON_VIZ || addon->Type() >= ADDON_MAX) return InvalidParams; - string argv; + std::string argv; CVariant params = parameterObject["params"]; if (params.isObject()) { @@ -220,7 +219,7 @@ void CAddonsOperations::FillDetails(AddonPtr addon, const CVariant& fields, CVar for (unsigned int index = 0; index < fields.size(); index++) { - string field = fields[index].asString(); + std::string field = fields[index].asString(); // we need to manually retrieve the enabled state of every addon // from the addon database because it can't be read from addon.xml diff --git a/xbmc/interfaces/json-rpc/FavouritesOperations.cpp b/xbmc/interfaces/json-rpc/FavouritesOperations.cpp index 8023c1200c80e..1977845b4fb57 100644 --- a/xbmc/interfaces/json-rpc/FavouritesOperations.cpp +++ b/xbmc/interfaces/json-rpc/FavouritesOperations.cpp @@ -28,7 +28,6 @@ #include "guilib/WindowIDs.h" #include -using namespace std; using namespace JSONRPC; using namespace XFILE; @@ -37,9 +36,9 @@ JSONRPC_STATUS CFavouritesOperations::GetFavourites(const std::string &method, I CFileItemList favourites; CFavouritesDirectory::Load(favourites); - string type = !parameterObject["type"].isNull() ? parameterObject["type"].asString() : ""; + std::string type = !parameterObject["type"].isNull() ? parameterObject["type"].asString() : ""; - set fields; + std::set fields; if (parameterObject.isMember("properties") && parameterObject["properties"].isArray()) { for (CVariant::const_iterator_array field = parameterObject["properties"].begin_array(); field != parameterObject["properties"].end_array(); field++) @@ -52,7 +51,7 @@ JSONRPC_STATUS CFavouritesOperations::GetFavourites(const std::string &method, I CFileItemPtr item = favourites.Get(i); std::string function; - vector parameters; + std::vector parameters; CUtil::SplitExecFunction(item->GetPath(), function, parameters); if (parameters.size() == 0) continue; @@ -106,7 +105,7 @@ JSONRPC_STATUS CFavouritesOperations::GetFavourites(const std::string &method, I JSONRPC_STATUS CFavouritesOperations::AddFavourite(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { - string type = parameterObject["type"].asString(); + std::string type = parameterObject["type"].asString(); if (type.compare("unknown") == 0) return InvalidParams; @@ -129,8 +128,8 @@ JSONRPC_STATUS CFavouritesOperations::AddFavourite(const std::string &method, IT return InvalidParams; } - string title = parameterObject["title"].asString(); - string path = parameterObject["path"].asString(); + std::string title = parameterObject["title"].asString(); + std::string path = parameterObject["path"].asString(); CFileItem item; int contextWindow = 0; diff --git a/xbmc/interfaces/json-rpc/GUIOperations.cpp b/xbmc/interfaces/json-rpc/GUIOperations.cpp index 8a156dc7b1932..35daef19fbcae 100644 --- a/xbmc/interfaces/json-rpc/GUIOperations.cpp +++ b/xbmc/interfaces/json-rpc/GUIOperations.cpp @@ -32,7 +32,6 @@ #include "guilib/StereoscopicsManager.h" #include "windowing/WindowingFactory.h" -using namespace std; using namespace JSONRPC; using namespace ADDON; using namespace KODI::MESSAGING; @@ -73,9 +72,9 @@ JSONRPC_STATUS CGUIOperations::ActivateWindow(const std::string &method, ITransp JSONRPC_STATUS CGUIOperations::ShowNotification(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { - string image = parameterObject["image"].asString(); - string title = parameterObject["title"].asString(); - string message = parameterObject["message"].asString(); + std::string image = parameterObject["image"].asString(); + std::string title = parameterObject["title"].asString(); + std::string message = parameterObject["message"].asString(); unsigned int displaytime = (unsigned int)parameterObject["displaytime"].asUnsignedInteger(); if (image.compare("info") == 0) diff --git a/xbmc/interfaces/json-rpc/JSONRPC.cpp b/xbmc/interfaces/json-rpc/JSONRPC.cpp index 1baffca3d3fc3..00455349fa650 100644 --- a/xbmc/interfaces/json-rpc/JSONRPC.cpp +++ b/xbmc/interfaces/json-rpc/JSONRPC.cpp @@ -36,7 +36,6 @@ using namespace ANNOUNCEMENT; using namespace JSONRPC; -using namespace std; bool CJSONRPC::m_initialized = false; @@ -46,7 +45,7 @@ void CJSONRPC::Initialize() return; // Add some types/enums at runtime - vector enumList; + std::vector enumList; for (int addonType = ADDON::ADDON_UNKNOWN; addonType < ADDON::ADDON_MAX; addonType++) enumList.push_back(ADDON::TranslateType(static_cast(addonType), false)); CJSONServiceDescription::AddEnum("Addon.Types", enumList); @@ -60,7 +59,7 @@ void CJSONRPC::Initialize() CJSONServiceDescription::AddEnum("GUI.Window", enumList); // filter-related enums - vector smartplaylistList; + std::vector smartplaylistList; CDatabaseQueryRule::GetAvailableOperators(smartplaylistList); CJSONServiceDescription::AddEnum("List.Filter.Operators", smartplaylistList); @@ -137,7 +136,7 @@ JSONRPC_STATUS CJSONRPC::Version(const std::string &method, ITransportLayer *tra const char* version = CJSONServiceDescription::GetVersion(); if (version != NULL) { - vector parts = StringUtils::Split(version, "."); + std::vector parts = StringUtils::Split(version, "."); if (parts.size() > 0) result["version"]["major"] = (int)strtol(parts[0].c_str(), NULL, 10); if (parts.size() > 1) diff --git a/xbmc/interfaces/json-rpc/JSONServiceDescription.cpp b/xbmc/interfaces/json-rpc/JSONServiceDescription.cpp index 66e02d8e862b8..f2f0350c5e197 100644 --- a/xbmc/interfaces/json-rpc/JSONServiceDescription.cpp +++ b/xbmc/interfaces/json-rpc/JSONServiceDescription.cpp @@ -41,12 +41,11 @@ #include "TextureOperations.h" #include "SettingsOperations.h" -using namespace std; using namespace JSONRPC; -map CJSONServiceDescription::m_notifications = map(); +std::map CJSONServiceDescription::m_notifications = std::map(); CJSONServiceDescription::CJsonRpcMethodMap CJSONServiceDescription::m_actionMap; -map CJSONServiceDescription::m_types = map(); +std::map CJSONServiceDescription::m_types = std::map(); CJSONServiceDescription::IncompleteSchemaDefinitionMap CJSONServiceDescription::m_incompleteDefinitions = CJSONServiceDescription::IncompleteSchemaDefinitionMap(); JsonRpcMethodMap CJSONServiceDescription::m_methodMaps[] = { @@ -527,13 +526,13 @@ bool JSONSchemaTypeDefinition::Parse(const CVariant &value, bool isParameter /* { if ((type & NumberValue) == NumberValue) { - minimum = value["minimum"].asDouble(-numeric_limits::max()); - maximum = value["maximum"].asDouble(numeric_limits::max()); + minimum = value["minimum"].asDouble(-std::numeric_limits::max()); + maximum = value["maximum"].asDouble(std::numeric_limits::max()); } else if ((type & IntegerValue) == IntegerValue) { - minimum = (double)value["minimum"].asInteger(numeric_limits::min()); - maximum = (double)value["maximum"].asInteger(numeric_limits::max()); + minimum = (double)value["minimum"].asInteger(std::numeric_limits::min()); + maximum = (double)value["maximum"].asInteger(std::numeric_limits::max()); } exclusiveMinimum = value["exclusiveMinimum"].asBoolean(false); @@ -748,7 +747,7 @@ JSONRPC_STATUS JSONSchemaTypeDefinition::Check(const CVariant &value, CVariant & // are either no more schemas in the "items" // array or no more elements in the value's array unsigned int arrayIndex; - for (arrayIndex = 0; arrayIndex < min(items.size(), (size_t)value.size()); arrayIndex++) + for (arrayIndex = 0; arrayIndex < std::min(items.size(), (size_t)value.size()); arrayIndex++) { JSONRPC_STATUS status = items.at(arrayIndex)->Check(value[arrayIndex], outputValue[arrayIndex], errorData["property"]); if (status != OK) @@ -1032,16 +1031,16 @@ void JSONSchemaTypeDefinition::Print(bool isParameter, bool isGlobal, bool print { if (CJSONUtils::HasType(type, NumberValue)) { - if (minimum > -numeric_limits::max()) + if (minimum > -std::numeric_limits::max()) output["minimum"] = minimum; - if (maximum < numeric_limits::max()) + if (maximum < std::numeric_limits::max()) output["maximum"] = maximum; } else { - if (minimum > numeric_limits::min()) + if (minimum > std::numeric_limits::min()) output["minimum"] = (int)minimum; - if (maximum < numeric_limits::max()) + if (maximum < std::numeric_limits::max()) output["maximum"] = (int)maximum; } @@ -1130,8 +1129,8 @@ void JSONSchemaTypeDefinition::Set(const JSONSchemaTypeDefinitionPtr typeDefinit if (typeDefinition.get() == NULL) return; - string origName = name; - string origDescription = description; + std::string origName = name; + std::string origDescription = description; bool origOptional = optional; CVariant origDefaultValue = defaultValue; JSONSchemaTypeDefinitionPtr referencedTypeDef = referencedType; @@ -1959,7 +1958,7 @@ void CJSONServiceDescription::removeReferenceTypeDefinition(const std::string &t if (typeID.empty()) return; - map::iterator type = m_types.find(typeID); + std::map::iterator type = m_types.find(typeID); if (type != m_types.end()) m_types.erase(type); } diff --git a/xbmc/interfaces/json-rpc/PVROperations.cpp b/xbmc/interfaces/json-rpc/PVROperations.cpp index b794c6d240105..11a4d30225d36 100644 --- a/xbmc/interfaces/json-rpc/PVROperations.cpp +++ b/xbmc/interfaces/json-rpc/PVROperations.cpp @@ -30,7 +30,6 @@ #include "epg/EpgContainer.h" #include "utils/Variant.h" -using namespace std; using namespace JSONRPC; using namespace PVR; using namespace EPG; @@ -73,7 +72,7 @@ JSONRPC_STATUS CPVROperations::GetChannelGroups(const std::string &method, ITran int start, end; - vector groupList = channelGroups->GetMembers(); + std::vector groupList = channelGroups->GetMembers(); HandleLimits(parameterObject, result, groupList.size(), start, end); for (int index = start; index < end; index++) FillChannelGroupDetails(groupList.at(index), parameterObject, result["channelgroups"], true); diff --git a/xbmc/interfaces/json-rpc/PlaylistOperations.cpp b/xbmc/interfaces/json-rpc/PlaylistOperations.cpp index 0f460af743e7d..aed443e5322cf 100644 --- a/xbmc/interfaces/json-rpc/PlaylistOperations.cpp +++ b/xbmc/interfaces/json-rpc/PlaylistOperations.cpp @@ -30,7 +30,6 @@ using namespace JSONRPC; using namespace PLAYLIST; -using namespace std; using namespace KODI::MESSAGING; JSONRPC_STATUS CPlaylistOperations::GetPlaylists(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) @@ -300,14 +299,14 @@ JSONRPC_STATUS CPlaylistOperations::GetPropertyValue(int playlist, const std::st bool CPlaylistOperations::HandleItemsParameter(int playlistid, const CVariant &itemParam, CFileItemList &items) { - vector vecItems; + std::vector vecItems; if (itemParam.isArray()) vecItems.assign(itemParam.begin_array(), itemParam.end_array()); else vecItems.push_back(itemParam); bool success = false; - for (vector::iterator itemIt = vecItems.begin(); itemIt != vecItems.end(); ++itemIt) + for (std::vector::iterator itemIt = vecItems.begin(); itemIt != vecItems.end(); ++itemIt) { if (!CheckMediaParameter(playlistid, *itemIt)) continue; diff --git a/xbmc/interfaces/json-rpc/SettingsOperations.cpp b/xbmc/interfaces/json-rpc/SettingsOperations.cpp index 2e8723a471244..2a179f6155b3f 100644 --- a/xbmc/interfaces/json-rpc/SettingsOperations.cpp +++ b/xbmc/interfaces/json-rpc/SettingsOperations.cpp @@ -31,7 +31,6 @@ #include "utils/StringUtils.h" #include "utils/Variant.h" -using namespace std; using namespace JSONRPC; JSONRPC_STATUS CSettingsOperations::GetSections(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) @@ -42,8 +41,8 @@ JSONRPC_STATUS CSettingsOperations::GetSections(const std::string &method, ITran result["sections"] = CVariant(CVariant::VariantTypeArray); // apply the level filter - vector allSections = CSettings::GetInstance().GetSections(); - for (vector::const_iterator itSection = allSections.begin(); itSection != allSections.end(); ++itSection) + std::vector allSections = CSettings::GetInstance().GetSections(); + for (std::vector::const_iterator itSection = allSections.begin(); itSection != allSections.end(); ++itSection) { SettingCategoryList categories = (*itSection)->GetCategories(level); if (categories.empty()) @@ -78,7 +77,7 @@ JSONRPC_STATUS CSettingsOperations::GetCategories(const std::string &method, ITr std::string strSection = parameterObject["section"].asString(); bool listSettings = !parameterObject["properties"].empty() && parameterObject["properties"][0].asString() == "settings"; - vector sections; + std::vector sections; if (!strSection.empty()) { CSettingSection *section = CSettings::GetInstance().GetSection(strSection); @@ -92,7 +91,7 @@ JSONRPC_STATUS CSettingsOperations::GetCategories(const std::string &method, ITr result["categories"] = CVariant(CVariant::VariantTypeArray); - for (vector::const_iterator itSection = sections.begin(); itSection != sections.end(); ++itSection) + for (std::vector::const_iterator itSection = sections.begin(); itSection != sections.end(); ++itSection) { SettingCategoryList categories = (*itSection)->GetCategories(level); for (SettingCategoryList::const_iterator itCategory = categories.begin(); itCategory != categories.end(); ++itCategory) @@ -142,14 +141,14 @@ JSONRPC_STATUS CSettingsOperations::GetSettings(const std::string &method, ITran SettingLevel level = (SettingLevel)ParseSettingLevel(parameterObject["level"].asString()); const CVariant &filter = parameterObject["filter"]; bool doFilter = filter.isObject() && filter.isMember("section") && filter.isMember("category"); - string strSection, strCategory; + std::string strSection, strCategory; if (doFilter) { strSection = filter["section"].asString(); strCategory = filter["category"].asString(); } - vector sections; + std::vector sections; if (doFilter) { @@ -164,7 +163,7 @@ JSONRPC_STATUS CSettingsOperations::GetSettings(const std::string &method, ITran result["settings"] = CVariant(CVariant::VariantTypeArray); - for (vector::const_iterator itSection = sections.begin(); itSection != sections.end(); ++itSection) + for (std::vector::const_iterator itSection = sections.begin(); itSection != sections.end(); ++itSection) { SettingCategoryList categories = (*itSection)->GetCategories(level); bool found = !doFilter; @@ -204,7 +203,7 @@ JSONRPC_STATUS CSettingsOperations::GetSettings(const std::string &method, ITran JSONRPC_STATUS CSettingsOperations::GetSettingValue(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { - string settingId = parameterObject["setting"].asString(); + std::string settingId = parameterObject["setting"].asString(); CSetting* setting = CSettings::GetInstance().GetSetting(settingId); if (setting == NULL || @@ -249,7 +248,7 @@ JSONRPC_STATUS CSettingsOperations::GetSettingValue(const std::string &method, I JSONRPC_STATUS CSettingsOperations::SetSettingValue(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { - string settingId = parameterObject["setting"].asString(); + std::string settingId = parameterObject["setting"].asString(); CVariant value = parameterObject["value"]; CSetting* setting = CSettings::GetInstance().GetSetting(settingId); @@ -311,7 +310,7 @@ JSONRPC_STATUS CSettingsOperations::SetSettingValue(const std::string &method, I JSONRPC_STATUS CSettingsOperations::ResetSettingValue(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { - string settingId = parameterObject["setting"].asString(); + std::string settingId = parameterObject["setting"].asString(); CSetting* setting = CSettings::GetInstance().GetSetting(settingId); if (setting == NULL || diff --git a/xbmc/interfaces/python/AddonPythonInvoker.cpp b/xbmc/interfaces/python/AddonPythonInvoker.cpp index ec9c245bf4141..0fdc52567689c 100644 --- a/xbmc/interfaces/python/AddonPythonInvoker.cpp +++ b/xbmc/interfaces/python/AddonPythonInvoker.cpp @@ -86,7 +86,6 @@ namespace PythonBindings { void initModule_xbmcvfs(void); } -using namespace std; using namespace PythonBindings; typedef struct @@ -119,7 +118,7 @@ std::map CAddonPythonIn if (modules.empty()) { for (size_t i = 0; i < PythonModulesSize; i++) - modules.insert(make_pair(PythonModules[i].name, PythonModules[i].initialization)); + modules.insert(std::make_pair(PythonModules[i].name, PythonModules[i].initialization)); } return modules; diff --git a/xbmc/interfaces/python/PythonInvoker.cpp b/xbmc/interfaces/python/PythonInvoker.cpp index fc6f1b5fc29c0..fc03aeb8738c5 100644 --- a/xbmc/interfaces/python/PythonInvoker.cpp +++ b/xbmc/interfaces/python/PythonInvoker.cpp @@ -65,7 +65,6 @@ extern "C" FILE *fopen_utf8(const char *_Filename, const char *_Mode); // Time before ill-behaved scripts are terminated #define PYTHON_SCRIPT_TIMEOUT 5000 // ms -using namespace std; using namespace XFILE; using namespace KODI::MESSAGING; From 0fea51624fa02c1b74a89078d1fbb8f52693899b Mon Sep 17 00:00:00 2001 From: Matthias Kortstiege Date: Fri, 28 Aug 2015 11:22:54 +0200 Subject: [PATCH 13/22] [input] use std:: instead of using namespace std --- xbmc/input/ButtonTranslator.cpp | 45 +++++++++++++++--------------- xbmc/input/KeyboardStat.cpp | 3 +- xbmc/input/SDLJoystick.cpp | 2 -- xbmc/input/windows/WINJoystick.cpp | 2 -- 4 files changed, 23 insertions(+), 29 deletions(-) diff --git a/xbmc/input/ButtonTranslator.cpp b/xbmc/input/ButtonTranslator.cpp index 83debf8655bb0..ef4b22eda5807 100644 --- a/xbmc/input/ButtonTranslator.cpp +++ b/xbmc/input/ButtonTranslator.cpp @@ -47,7 +47,6 @@ #define JOYSTICK_DEFAULT_MAP "_xbmc_" -using namespace std; using namespace XFILE; typedef struct @@ -482,13 +481,13 @@ CButtonTranslator::CButtonTranslator() #if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) void CButtonTranslator::ClearLircButtonMapEntries() { - vector maps; - for (map::iterator it = lircRemotesMap.begin(); + std::vector maps; + for (std::map::iterator it = lircRemotesMap.begin(); it != lircRemotesMap.end();++it) maps.push_back(it->second); sort(maps.begin(),maps.end()); - vector::iterator itend = unique(maps.begin(),maps.end()); - for (vector::iterator it = maps.begin(); it != itend;++it) + std::vector::iterator itend = unique(maps.begin(),maps.end()); + for (std::vector::iterator it = maps.begin(); it != itend;++it) delete *it; } #endif @@ -715,8 +714,8 @@ bool CButtonTranslator::LoadLircMap(const std::string &lircmapPath) void CButtonTranslator::MapRemote(TiXmlNode *pRemote, const char* szDevice) { CLog::Log(LOGINFO, "* Adding remote mapping for device '%s'", szDevice); - vector RemoteNames; - map::iterator it = lircRemotesMap.find(szDevice); + std::vector RemoteNames; + std::map::iterator it = lircRemotesMap.find(szDevice); if (it == lircRemotesMap.end()) lircRemotesMap[szDevice] = new lircButtonMap; lircButtonMap& buttons = *lircRemotesMap[szDevice]; @@ -733,7 +732,7 @@ void CButtonTranslator::MapRemote(TiXmlNode *pRemote, const char* szDevice) } pButton = pButton->NextSiblingElement(); } - for (vector::iterator it = RemoteNames.begin(); + for (std::vector::iterator it = RemoteNames.begin(); it != RemoteNames.end();++it) { CLog::Log(LOGINFO, "* Linking remote mapping for '%s' to '%s'", szDevice, it->c_str()); @@ -744,7 +743,7 @@ void CButtonTranslator::MapRemote(TiXmlNode *pRemote, const char* szDevice) int CButtonTranslator::TranslateLircRemoteString(const char* szDevice, const char *szButton) { // Find the device - map::iterator it = lircRemotesMap.find(szDevice); + std::map::iterator it = lircRemotesMap.find(szDevice); if (it == lircRemotesMap.end()) return 0; @@ -795,8 +794,8 @@ void CButtonTranslator::MapJoystickFamily(TiXmlNode *pNode) void CButtonTranslator::MapJoystickActions(int windowID, TiXmlNode *pJoystick) { std::string joyFamilyName; - map buttonMap; - map axisMap; + std::map buttonMap; + std::map axisMap; AxesConfig axesConfig; ActionMap hatMap; @@ -805,7 +804,7 @@ void CButtonTranslator::MapJoystickActions(int windowID, TiXmlNode *pJoystick) joyFamilyName = pJoy->Attribute("family"); else if (pJoy) { // transform loose name to new family, including altnames - string joyName = JOYSTICK_DEFAULT_MAP; // default global map name + std::string joyName = JOYSTICK_DEFAULT_MAP; // default global map name if (pJoy->Attribute("name")) joyName = pJoy->Attribute("name"); joyFamilyName = joyName; @@ -898,7 +897,7 @@ void CButtonTranslator::MapJoystickActions(int windowID, TiXmlNode *pJoystick) } else if (type == "hat") { - string position; + std::string position; if (pButton->QueryValueAttribute("position", &position) == TIXML_SUCCESS) { uint32_t hatID = id|0xFFF00000; @@ -1075,7 +1074,7 @@ bool CButtonTranslator::TranslateTouchAction(int window, int touchAction, int to int CButtonTranslator::GetActionCode(int window, int action) { - map::const_iterator it = m_translatorMap.find(window); + std::map::const_iterator it = m_translatorMap.find(window); if (it == m_translatorMap.end()) return 0; @@ -1097,8 +1096,8 @@ int CButtonTranslator::GetActionCode(int window, int id, const WindowMap &wmap, WindowMap::const_iterator it = wmap.find(window); if (it != wmap.end()) { - const map &windowbmap = it->second; - map::const_iterator it2 = windowbmap.find(id); + const std::map &windowbmap = it->second; + std::map::const_iterator it2 = windowbmap.find(id); if (it2 != windowbmap.end()) { strAction = (it2->second).c_str(); @@ -1187,7 +1186,7 @@ CAction CButtonTranslator::GetGlobalAction(const CKey &key) bool CButtonTranslator::HasLonpressMapping(int window, const CKey &key) { - map::const_iterator it = m_translatorMap.find(window); + std::map::const_iterator it = m_translatorMap.find(window); if (it == m_translatorMap.end()) { // first check if we have a fallback for the window @@ -1224,7 +1223,7 @@ int CButtonTranslator::GetActionCode(int window, const CKey &key, std::string &s { uint32_t code = key.GetButtonCode(); - map::const_iterator it = m_translatorMap.find(window); + std::map::const_iterator it = m_translatorMap.find(window); if (it == m_translatorMap.end()) return 0; buttonMap::const_iterator it2 = (*it).second.find(code); @@ -1274,7 +1273,7 @@ void CButtonTranslator::MapAction(uint32_t buttonCode, const char *szAction, but CButtonAction button; button.id = action; button.strID = szAction; - map.insert(pair(buttonCode, button)); + map.insert(std::pair(buttonCode, button)); } } @@ -1331,7 +1330,7 @@ void CButtonTranslator::MapWindowActions(TiXmlNode *pWindow, int windowID) // add our map to our table if (!map.empty()) - m_translatorMap.insert(pair( windowID, map)); + m_translatorMap.insert(std::pair( windowID, map)); } } @@ -1612,10 +1611,10 @@ uint32_t CButtonTranslator::TranslateKeyboardButton(TiXmlElement *pButton) { StringUtils::ToLower(strMod); - vector modArray = StringUtils::Split(strMod, ","); - for (vector::const_iterator i = modArray.begin(); i != modArray.end(); ++i) + std::vector modArray = StringUtils::Split(strMod, ","); + for (std::vector::const_iterator i = modArray.begin(); i != modArray.end(); ++i) { - string substr = *i; + std::string substr = *i; StringUtils::Trim(substr); if (substr == "ctrl" || substr == "control") diff --git a/xbmc/input/KeyboardStat.cpp b/xbmc/input/KeyboardStat.cpp index 80ee650020a6d..f90973a73d659 100644 --- a/xbmc/input/KeyboardStat.cpp +++ b/xbmc/input/KeyboardStat.cpp @@ -34,7 +34,6 @@ #define HOLD_THRESHOLD 250 -using namespace std; using namespace PERIPHERALS; bool operator==(const XBMC_keysym& lhs, const XBMC_keysym& rhs) @@ -61,7 +60,7 @@ void CKeyboardStat::Initialize() bool CKeyboardStat::LookupSymAndUnicodePeripherals(XBMC_keysym &keysym, uint8_t *key, char *unicode) { - vector hidDevices; + std::vector hidDevices; if (g_peripherals.GetPeripheralsWithFeature(hidDevices, FEATURE_HID)) { for (unsigned int iDevicePtr = 0; iDevicePtr < hidDevices.size(); iDevicePtr++) diff --git a/xbmc/input/SDLJoystick.cpp b/xbmc/input/SDLJoystick.cpp index 73f907270da79..b1e71e138a3ba 100644 --- a/xbmc/input/SDLJoystick.cpp +++ b/xbmc/input/SDLJoystick.cpp @@ -32,8 +32,6 @@ #ifdef HAS_SDL_JOYSTICK #include -using namespace std; - CJoystick::CJoystick() { m_joystickEnabled = false; diff --git a/xbmc/input/windows/WINJoystick.cpp b/xbmc/input/windows/WINJoystick.cpp index ab4c488f7b727..76e3c521b9146 100644 --- a/xbmc/input/windows/WINJoystick.cpp +++ b/xbmc/input/windows/WINJoystick.cpp @@ -26,8 +26,6 @@ #include #include -using namespace std; - extern HWND g_hWnd; #define MAX_AXISAMOUNT 32768 From 3dded36ad64b6882d0efdadaf95b5f8fe0f506f8 Mon Sep 17 00:00:00 2001 From: Matthias Kortstiege Date: Fri, 28 Aug 2015 11:28:53 +0200 Subject: [PATCH 14/22] [audioengine] use std:: instead of using namespace std --- .../AudioEngine/DSPAddons/ActiveAEDSP.cpp | 11 +++---- .../DSPAddons/ActiveAEDSPAddon.cpp | 7 ++--- .../DSPAddons/ActiveAEDSPDatabase.cpp | 31 +++++++++---------- .../DSPAddons/ActiveAEDSPProcess.cpp | 11 +++---- xbmc/cores/AudioEngine/Sinks/AESinkPULSE.cpp | 6 ++-- xbmc/cores/AudioEngine/Utils/AEUtil.cpp | 2 -- 6 files changed, 30 insertions(+), 38 deletions(-) diff --git a/xbmc/cores/AudioEngine/DSPAddons/ActiveAEDSP.cpp b/xbmc/cores/AudioEngine/DSPAddons/ActiveAEDSP.cpp index db0e96cb11b18..02335f7450dbd 100644 --- a/xbmc/cores/AudioEngine/DSPAddons/ActiveAEDSP.cpp +++ b/xbmc/cores/AudioEngine/DSPAddons/ActiveAEDSP.cpp @@ -49,7 +49,6 @@ extern "C" { #include "utils/StringUtils.h" #include "utils/JobManager.h" -using namespace std; using namespace ADDON; using namespace ActiveAE; using namespace KODI::MESSAGING; @@ -251,7 +250,7 @@ void CActiveAEDSP::Cleanup(void) m_modes[i].clear(); } -bool CActiveAEDSP::InstallAddonAllowed(const string &strAddonId) const +bool CActiveAEDSP::InstallAddonAllowed(const std::string &strAddonId) const { return !m_isActive || !IsInUse(strAddonId) || @@ -352,7 +351,7 @@ bool CActiveAEDSP::RequestRemoval(AddonPtr addon) return StopAudioDSPAddon(addon, false); } -bool CActiveAEDSP::IsInUse(const string &strAddonId) const +bool CActiveAEDSP::IsInUse(const std::string &strAddonId) const { CSingleLock lock(m_critSection); @@ -815,7 +814,7 @@ void CActiveAEDSP::ShowDialogNoAddonsEnabled(void) CGUIDialogOK::ShowAndGetInput(15048, 15049, 0, 0); - vector params; + std::vector params; params.push_back("addons://disabled/kodi.adsp"); params.push_back("return"); g_windowManager.ActivateWindow(WINDOW_ADDON_BROWSER, params); @@ -1010,7 +1009,7 @@ bool CActiveAEDSP::GetReadyAudioDSPAddon(int iAddonId, AE_DSP_ADDON &addon) cons return false; } -bool CActiveAEDSP::GetAudioDSPAddonName(int iAddonId, string &strName) const +bool CActiveAEDSP::GetAudioDSPAddonName(int iAddonId, std::string &strName) const { bool bReturn(false); AE_DSP_ADDON addon; @@ -1038,7 +1037,7 @@ bool CActiveAEDSP::GetAudioDSPAddon(int iAddonId, AE_DSP_ADDON &addon) const return bReturn; } -bool CActiveAEDSP::GetAudioDSPAddon(const string &strId, AddonPtr &addon) const +bool CActiveAEDSP::GetAudioDSPAddon(const std::string &strId, AddonPtr &addon) const { CSingleLock lock(m_critUpdateSection); for (AE_DSP_ADDONMAP_CITR itr = m_addonMap.begin(); itr != m_addonMap.end(); itr++) diff --git a/xbmc/cores/AudioEngine/DSPAddons/ActiveAEDSPAddon.cpp b/xbmc/cores/AudioEngine/DSPAddons/ActiveAEDSPAddon.cpp index 1b984206384dd..7656616f6eb6c 100644 --- a/xbmc/cores/AudioEngine/DSPAddons/ActiveAEDSPAddon.cpp +++ b/xbmc/cores/AudioEngine/DSPAddons/ActiveAEDSPAddon.cpp @@ -28,7 +28,6 @@ #include "utils/log.h" #include "utils/StringUtils.h" -using namespace std; using namespace ADDON; using namespace ActiveAE; @@ -293,7 +292,7 @@ bool CActiveAEDSPAddon::CheckAPIVersion(void) bool CActiveAEDSPAddon::GetAddonProperties(void) { - string strDSPName, strFriendlyName, strAudioDSPVersion; + std::string strDSPName, strFriendlyName, strAudioDSPVersion; AE_DSP_ADDON_CAPABILITIES addonCapabilities; /* get the capabilities */ @@ -693,9 +692,9 @@ unsigned int CActiveAEDSPAddon::MasterProcess(const ADDON_HANDLE handle, float * return 0; } -string CActiveAEDSPAddon::MasterProcessGetStreamInfoString(const ADDON_HANDLE handle) +std::string CActiveAEDSPAddon::MasterProcessGetStreamInfoString(const ADDON_HANDLE handle) { - string strReturn; + std::string strReturn; if (!m_bReadyToUse) return strReturn; diff --git a/xbmc/cores/AudioEngine/DSPAddons/ActiveAEDSPDatabase.cpp b/xbmc/cores/AudioEngine/DSPAddons/ActiveAEDSPDatabase.cpp index f6a6a4ce71af7..2925ef7d9c983 100644 --- a/xbmc/cores/AudioEngine/DSPAddons/ActiveAEDSPDatabase.cpp +++ b/xbmc/cores/AudioEngine/DSPAddons/ActiveAEDSPDatabase.cpp @@ -28,7 +28,6 @@ #include "utils/log.h" #include "utils/StringUtils.h" -using namespace std; using namespace dbiplus; using namespace ActiveAE; using namespace ADDON; @@ -172,7 +171,7 @@ bool CActiveAEDSPDatabase::DeleteMode(const CActiveAEDSPMode &mode) return DeleteValues("modes", filter); } -bool CActiveAEDSPDatabase::PersistModes(vector &modes, int modeType) +bool CActiveAEDSPDatabase::PersistModes(std::vector &modes, int modeType) { bool bReturn(true); @@ -211,7 +210,7 @@ bool CActiveAEDSPDatabase::AddUpdateMode(CActiveAEDSPMode &mode) if (NULL == m_pDB.get()) return false; if (NULL == m_pDS.get()) return false; - string strSQL = PrepareSQL("SELECT * FROM modes WHERE modes.iAddonId=%i AND modes.iAddonModeNumber=%i AND modes.iType=%i", mode.AddonID(), mode.AddonModeNumber(), mode.ModeType()); + std::string strSQL = PrepareSQL("SELECT * FROM modes WHERE modes.iAddonId=%i AND modes.iAddonModeNumber=%i AND modes.iType=%i", mode.AddonID(), mode.AddonModeNumber(), mode.ModeType()); m_pDS->query( strSQL.c_str() ); if (m_pDS->num_rows() > 0) @@ -296,7 +295,7 @@ bool CActiveAEDSPDatabase::AddUpdateMode(CActiveAEDSPMode &mode) int CActiveAEDSPDatabase::GetModeId(const CActiveAEDSPMode &mode) { - string id = GetSingleValue(PrepareSQL("SELECT * from modes WHERE modes.iAddonId=%i and modes.iAddonModeNumber=%i and modes.iType=%i", mode.AddonID(), mode.AddonModeNumber(), mode.ModeType())); + std::string id = GetSingleValue(PrepareSQL("SELECT * from modes WHERE modes.iAddonId=%i and modes.iAddonModeNumber=%i and modes.iType=%i", mode.AddonID(), mode.AddonModeNumber(), mode.ModeType())); if (id.empty()) return -1; return strtol(id.c_str(), NULL, 10); @@ -306,7 +305,7 @@ int CActiveAEDSPDatabase::GetModes(AE_DSP_MODELIST &results, int modeType) { int iReturn(0); - string strQuery=PrepareSQL("SELECT * FROM modes WHERE modes.iType=%i ORDER BY iPosition", modeType); + std::string strQuery=PrepareSQL("SELECT * FROM modes WHERE modes.iType=%i ORDER BY iPosition", modeType); m_pDS->query( strQuery.c_str() ); if (m_pDS->num_rows() > 0) @@ -370,7 +369,7 @@ bool CActiveAEDSPDatabase::DeleteActiveDSPSettings() bool CActiveAEDSPDatabase::DeleteActiveDSPSettings(const CFileItem &item) { - string strPath, strFileName; + std::string strPath, strFileName; URIUtils::Split(item.GetPath(), strPath, strFileName); return ExecuteQuery(PrepareSQL("DELETE FROM settings WHERE settings.strPath='%s' and settings.strFileName='%s'", strPath.c_str() , strFileName.c_str())); } @@ -381,9 +380,9 @@ bool CActiveAEDSPDatabase::GetActiveDSPSettings(const CFileItem &item, CAudioSet { if (NULL == m_pDB.get()) return false; if (NULL == m_pDS.get()) return false; - string strPath, strFileName; + std::string strPath, strFileName; URIUtils::Split(item.GetPath(), strPath, strFileName); - string strSQL=PrepareSQL("SELECT * FROM settings WHERE settings.strPath='%s' and settings.strFileName='%s'", strPath.c_str() , strFileName.c_str()); + std::string strSQL=PrepareSQL("SELECT * FROM settings WHERE settings.strPath='%s' and settings.strFileName='%s'", strPath.c_str() , strFileName.c_str()); m_pDS->query( strSQL.c_str() ); if (m_pDS->num_rows() > 0) @@ -416,9 +415,9 @@ void CActiveAEDSPDatabase::SetActiveDSPSettings(const CFileItem &item, const CAu { if (NULL == m_pDB.get()) return ; if (NULL == m_pDS.get()) return ; - string strPath, strFileName; + std::string strPath, strFileName; URIUtils::Split(item.GetPath(), strPath, strFileName); - string strSQL = StringUtils::Format("select * from settings WHERE settings.strPath='%s' and settings.strFileName='%s'", strPath.c_str() , strFileName.c_str()); + std::string strSQL = StringUtils::Format("select * from settings WHERE settings.strPath='%s' and settings.strFileName='%s'", strPath.c_str() , strFileName.c_str()); m_pDS->query( strSQL.c_str() ); if (m_pDS->num_rows() > 0) { @@ -474,7 +473,7 @@ void CActiveAEDSPDatabase::EraseActiveDSPSettings() ExecuteQuery(PrepareSQL("DELETE from settings")); } -void CActiveAEDSPDatabase::SplitPath(const string& strFileNameAndPath, string& strPath, string& strFileName) +void CActiveAEDSPDatabase::SplitPath(const std::string& strFileNameAndPath, std::string& strPath, std::string& strFileName) { if (URIUtils::IsStack(strFileNameAndPath) || StringUtils::StartsWithNoCase(strFileNameAndPath, "rar://") || StringUtils::StartsWithNoCase(strFileNameAndPath, "zip://")) { @@ -500,7 +499,7 @@ bool CActiveAEDSPDatabase::DeleteAddons() return DeleteValues("addons"); } -bool CActiveAEDSPDatabase::Delete(const string &strAddonUid) +bool CActiveAEDSPDatabase::Delete(const std::string &strAddonUid) { /* invalid addon uid */ if (strAddonUid.empty()) @@ -515,10 +514,10 @@ bool CActiveAEDSPDatabase::Delete(const string &strAddonUid) return DeleteValues("addons", filter); } -int CActiveAEDSPDatabase::GetAudioDSPAddonId(const string &strAddonUid) +int CActiveAEDSPDatabase::GetAudioDSPAddonId(const std::string &strAddonUid) { - string strWhereClause = PrepareSQL("sUid = '%s'", strAddonUid.c_str()); - string strValue = GetSingleValue("addons", "idAddon", strWhereClause); + std::string strWhereClause = PrepareSQL("sUid = '%s'", strAddonUid.c_str()); + std::string strValue = GetSingleValue("addons", "idAddon", strWhereClause); if (strValue.empty()) return -1; @@ -537,7 +536,7 @@ int CActiveAEDSPDatabase::Persist(const AddonPtr& addon) return iReturn; } - string strQuery = PrepareSQL("REPLACE INTO addons (sName, sUid) VALUES ('%s', '%s');", + std::string strQuery = PrepareSQL("REPLACE INTO addons (sName, sUid) VALUES ('%s', '%s');", addon->Name().c_str(), addon->ID().c_str()); if (ExecuteQuery(strQuery)) diff --git a/xbmc/cores/AudioEngine/DSPAddons/ActiveAEDSPProcess.cpp b/xbmc/cores/AudioEngine/DSPAddons/ActiveAEDSPProcess.cpp index a6808a6ab6f32..eaa4b50a1e882 100644 --- a/xbmc/cores/AudioEngine/DSPAddons/ActiveAEDSPProcess.cpp +++ b/xbmc/cores/AudioEngine/DSPAddons/ActiveAEDSPProcess.cpp @@ -35,7 +35,6 @@ extern "C" { #include "libavutil/opt.h" } -using namespace std; using namespace ADDON; using namespace ActiveAE; @@ -611,7 +610,7 @@ bool CActiveAEDSPProcess::Create(const AEAudioFormat &inputFormat, const AEAudio CLog::Log(LOGDEBUG, " | Sample Rate : %d", m_addonSettings.iInSamplerate); CLog::Log(LOGDEBUG, " | Sample Format : %s", CAEUtil::DataFormatToStr(m_inputFormat.m_dataFormat)); CLog::Log(LOGDEBUG, " | Channel Count : %d", m_inputFormat.m_channelLayout.Count()); - CLog::Log(LOGDEBUG, " | Channel Layout : %s", ((string)m_inputFormat.m_channelLayout).c_str()); + CLog::Log(LOGDEBUG, " | Channel Layout : %s", ((std::string)m_inputFormat.m_channelLayout).c_str()); CLog::Log(LOGDEBUG, " | Frames : %d", m_addonSettings.iInFrames); CLog::Log(LOGDEBUG, " ---- Process format ----"); CLog::Log(LOGDEBUG, " | Sample Rate : %d", m_addonSettings.iProcessSamplerate); @@ -622,7 +621,7 @@ bool CActiveAEDSPProcess::Create(const AEAudioFormat &inputFormat, const AEAudio CLog::Log(LOGDEBUG, " | Sample Rate : %d", m_outputSamplerate); CLog::Log(LOGDEBUG, " | Sample Format : %s", CAEUtil::DataFormatToStr(m_outputFormat.m_dataFormat)); CLog::Log(LOGDEBUG, " | Channel Count : %d", m_outputFormat.m_channelLayout.Count()); - CLog::Log(LOGDEBUG, " | Channel Layout : %s", ((string)m_outputFormat.m_channelLayout).c_str()); + CLog::Log(LOGDEBUG, " | Channel Layout : %s", ((std::string)m_outputFormat.m_channelLayout).c_str()); CLog::Log(LOGDEBUG, " | Frames : %d", m_outputFrames); } @@ -868,7 +867,7 @@ unsigned int CActiveAEDSPProcess::GetInputChannels() return m_inputFormat.m_channelLayout.Count(); } -string CActiveAEDSPProcess::GetInputChannelNames() +std::string CActiveAEDSPProcess::GetInputChannelNames() { return m_inputFormat.m_channelLayout; } @@ -888,7 +887,7 @@ unsigned int CActiveAEDSPProcess::GetOutputChannels() return m_outputFormat.m_channelLayout.Count(); } -string CActiveAEDSPProcess::GetOutputChannelNames() +std::string CActiveAEDSPProcess::GetOutputChannelNames() { return m_outputFormat.m_channelLayout; } @@ -964,7 +963,7 @@ AE_DSP_BASETYPE CActiveAEDSPProcess::GetUsedBaseType() return GetBaseType(&m_addonStreamProperties); } -bool CActiveAEDSPProcess::GetMasterModeStreamInfoString(string &strInfo) +bool CActiveAEDSPProcess::GetMasterModeStreamInfoString(std::string &strInfo) { if (m_activeMode <= AE_DSP_MASTER_MODE_ID_PASSOVER) { diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkPULSE.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkPULSE.cpp index 72481e2c3f4a0..f3e08eeab7af8 100644 --- a/xbmc/cores/AudioEngine/Sinks/AESinkPULSE.cpp +++ b/xbmc/cores/AudioEngine/Sinks/AESinkPULSE.cpp @@ -25,8 +25,6 @@ #include "guilib/LocalizeStrings.h" #include "Application.h" -using namespace std; - static const char *ContextStateToString(pa_context_state s) { switch (s) @@ -374,8 +372,8 @@ static void SinkInfoRequestCallback(pa_context *c, const pa_sink_info *i, int eo { CAEDeviceInfo device; bool valid = true; - device.m_deviceName = string(i->name); - device.m_displayName = string(i->description); + device.m_deviceName = std::string(i->name); + device.m_displayName = std::string(i->description); if (i->active_port && i->active_port->description) device.m_displayNameExtra = std::string((i->active_port->description)).append(" (PULSEAUDIO)"); else diff --git a/xbmc/cores/AudioEngine/Utils/AEUtil.cpp b/xbmc/cores/AudioEngine/Utils/AEUtil.cpp index 318d43ab7ca80..6d6b0e19ca882 100644 --- a/xbmc/cores/AudioEngine/Utils/AEUtil.cpp +++ b/xbmc/cores/AudioEngine/Utils/AEUtil.cpp @@ -31,8 +31,6 @@ extern "C" { #include "libavutil/channel_layout.h" } -using namespace std; - /* declare the rng seed and initialize it */ unsigned int CAEUtil::m_seed = (unsigned int)(CurrentHostCounter() / 1000.0f); #ifdef __SSE2__ From 819b82f4fae50da8fd77b23f820311f128ae0bf8 Mon Sep 17 00:00:00 2001 From: Matthias Kortstiege Date: Fri, 28 Aug 2015 11:35:01 +0200 Subject: [PATCH 15/22] [dialogs] use std:: instead of using namespace std --- xbmc/dialogs/GUIDialogBoxBase.cpp | 11 ++++------- xbmc/dialogs/GUIDialogContextMenu.cpp | 6 ++---- xbmc/dialogs/GUIDialogExtendedProgressBar.cpp | 16 +++++++--------- xbmc/dialogs/GUIDialogMediaFilter.cpp | 14 ++++++-------- xbmc/dialogs/GUIDialogMediaSource.cpp | 5 ++--- xbmc/dialogs/GUIDialogProgress.cpp | 4 +--- xbmc/dialogs/GUIDialogSmartPlaylistEditor.cpp | 9 +++------ xbmc/dialogs/GUIDialogSmartPlaylistRule.cpp | 8 +++----- 8 files changed, 28 insertions(+), 45 deletions(-) diff --git a/xbmc/dialogs/GUIDialogBoxBase.cpp b/xbmc/dialogs/GUIDialogBoxBase.cpp index 4ebb10fe0534c..dc009f5db839c 100644 --- a/xbmc/dialogs/GUIDialogBoxBase.cpp +++ b/xbmc/dialogs/GUIDialogBoxBase.cpp @@ -25,9 +25,6 @@ #include "utils/StringUtils.h" #include "utils/Variant.h" - -using namespace std; - #define CONTROL_HEADING 1 #define CONTROL_LINES_START 2 #define CONTROL_TEXTBOX 9 @@ -80,7 +77,7 @@ void CGUIDialogBoxBase::SetLine(unsigned int iLine, CVariant line) { std::string label = GetLocalized(line); CSingleLock lock(m_section); - vector lines = StringUtils::Split(m_text, '\n'); + std::vector lines = StringUtils::Split(m_text, '\n'); if (iLine >= lines.size()) lines.resize(iLine+1); lines[iLine] = label; @@ -118,8 +115,8 @@ void CGUIDialogBoxBase::Process(unsigned int currentTime, CDirtyRegionList &dirt { if (m_bInvalidated) { // take a copy of our labels to save holding the lock for too long - string heading, text; - vector choices; + std::string heading, text; + std::vector choices; choices.reserve(DIALOG_MAX_CHOICES); { CSingleLock lock(m_section); @@ -135,7 +132,7 @@ void CGUIDialogBoxBase::Process(unsigned int currentTime, CDirtyRegionList &dirt } else { - vector lines = StringUtils::Split(text, "\n", DIALOG_MAX_LINES); + std::vector lines = StringUtils::Split(text, "\n", DIALOG_MAX_LINES); lines.resize(DIALOG_MAX_LINES); for (size_t i = 0 ; i < lines.size(); ++i) SET_CONTROL_LABEL(CONTROL_LINES_START + i, lines[i]); diff --git a/xbmc/dialogs/GUIDialogContextMenu.cpp b/xbmc/dialogs/GUIDialogContextMenu.cpp index 972692f6d1079..7ab2dd5e0070b 100644 --- a/xbmc/dialogs/GUIDialogContextMenu.cpp +++ b/xbmc/dialogs/GUIDialogContextMenu.cpp @@ -47,8 +47,6 @@ #include "utils/StringUtils.h" #include "utils/Variant.h" -using namespace std; - #define BACKGROUND_IMAGE 999 #define GROUP_LIST 996 #define BUTTON_TEMPLATE 1000 @@ -60,7 +58,7 @@ void CContextButtons::Add(unsigned int button, const std::string &label) for (const_iterator i = begin(); i != end(); ++i) if (i->first == button) return; // already have this button - push_back(pair(button, label)); + push_back(std::pair(button, label)); } void CContextButtons::Add(unsigned int button, int label) @@ -68,7 +66,7 @@ void CContextButtons::Add(unsigned int button, int label) for (const_iterator i = begin(); i != end(); ++i) if (i->first == button) return; // already have added this button - push_back(pair(button, g_localizeStrings.Get(label))); + push_back(std::pair(button, g_localizeStrings.Get(label))); } CGUIDialogContextMenu::CGUIDialogContextMenu(void) diff --git a/xbmc/dialogs/GUIDialogExtendedProgressBar.cpp b/xbmc/dialogs/GUIDialogExtendedProgressBar.cpp index c1f2a3d213e04..42c22387508c3 100644 --- a/xbmc/dialogs/GUIDialogExtendedProgressBar.cpp +++ b/xbmc/dialogs/GUIDialogExtendedProgressBar.cpp @@ -30,22 +30,20 @@ #define ITEM_SWITCH_TIME_MS 2000 -using namespace std; - -string CGUIDialogProgressBarHandle::Text(void) const +std::string CGUIDialogProgressBarHandle::Text(void) const { CSingleLock lock(m_critSection); - string retVal(m_strText); + std::string retVal(m_strText); return retVal; } -void CGUIDialogProgressBarHandle::SetText(const string &strText) +void CGUIDialogProgressBarHandle::SetText(const std::string &strText) { CSingleLock lock(m_critSection); m_strText = strText; } -void CGUIDialogProgressBarHandle::SetTitle(const string &strTitle) +void CGUIDialogProgressBarHandle::SetTitle(const std::string &strTitle) { CSingleLock lock(m_critSection); m_strTitle = strTitle; @@ -66,7 +64,7 @@ CGUIDialogExtendedProgressBar::CGUIDialogExtendedProgressBar(void) m_iCurrentItem = 0; } -CGUIDialogProgressBarHandle *CGUIDialogExtendedProgressBar::GetHandle(const string &strTitle) +CGUIDialogProgressBarHandle *CGUIDialogExtendedProgressBar::GetHandle(const std::string &strTitle) { CGUIDialogProgressBarHandle *handle = new CGUIDialogProgressBarHandle(strTitle); { @@ -108,8 +106,8 @@ void CGUIDialogExtendedProgressBar::Process(unsigned int currentTime, CDirtyRegi void CGUIDialogExtendedProgressBar::UpdateState(unsigned int currentTime) { - string strHeader; - string strTitle; + std::string strHeader; + std::string strTitle; float fProgress(-1.0f); { diff --git a/xbmc/dialogs/GUIDialogMediaFilter.cpp b/xbmc/dialogs/GUIDialogMediaFilter.cpp index 6faa659da6ec2..6d5bc299844dc 100644 --- a/xbmc/dialogs/GUIDialogMediaFilter.cpp +++ b/xbmc/dialogs/GUIDialogMediaFilter.cpp @@ -114,8 +114,6 @@ static const CGUIDialogMediaFilter::Filter filterList[] = { #define NUM_FILTERS sizeof(filterList) / sizeof(CGUIDialogMediaFilter::Filter) -using namespace std; - CGUIDialogMediaFilter::CGUIDialogMediaFilter() : CGUIDialogSettingsManualBase(WINDOW_DIALOG_MEDIA_FILTER, "DialogMediaFilter.xml"), m_dbUrl(NULL), @@ -138,7 +136,7 @@ bool CGUIDialogMediaFilter::OnMessage(CGUIMessage& message) m_filter->Reset(); m_filter->SetType(m_mediaType); - for (map::iterator filter = m_filters.begin(); filter != m_filters.end(); filter++) + for (std::map::iterator filter = m_filters.begin(); filter != m_filters.end(); filter++) { filter->second.rule = NULL; filter->second.setting->Reset(); @@ -206,7 +204,7 @@ void CGUIDialogMediaFilter::OnSettingChanged(const CSetting *setting) { CGUIDialogSettingsManualBase::OnSettingChanged(setting); - map::iterator it = m_filters.find(setting->GetId()); + std::map::iterator it = m_filters.find(setting->GetId()); if (it == m_filters.end()) return; @@ -423,9 +421,9 @@ void CGUIDialogMediaFilter::InitializeSettings() value = filter.rule->m_operator == CDatabaseQueryRule::OPERATOR_TRUE ? CHECK_YES : CHECK_NO; StaticIntegerSettingOptions entries; - entries.push_back(pair(CHECK_LABEL_ALL, CHECK_ALL)); - entries.push_back(pair(CHECK_LABEL_NO, CHECK_NO)); - entries.push_back(pair(CHECK_LABEL_YES, CHECK_YES)); + entries.push_back(std::pair(CHECK_LABEL_ALL, CHECK_ALL)); + entries.push_back(std::pair(CHECK_LABEL_NO, CHECK_NO)); + entries.push_back(std::pair(CHECK_LABEL_YES, CHECK_YES)); filter.setting = AddSpinner(group, settingId, filter.label, 0, value, entries, true); } @@ -569,7 +567,7 @@ bool CGUIDialogMediaFilter::SetPath(const std::string &path) void CGUIDialogMediaFilter::UpdateControls() { - for (map::iterator itFilter = m_filters.begin(); itFilter != m_filters.end(); itFilter++) + for (std::map::iterator itFilter = m_filters.begin(); itFilter != m_filters.end(); itFilter++) { if (itFilter->second.controlType != "list") continue; diff --git a/xbmc/dialogs/GUIDialogMediaSource.cpp b/xbmc/dialogs/GUIDialogMediaSource.cpp index 88082497aad1b..70aff453c6726 100644 --- a/xbmc/dialogs/GUIDialogMediaSource.cpp +++ b/xbmc/dialogs/GUIDialogMediaSource.cpp @@ -44,7 +44,6 @@ #include "filesystem/File.h" #endif -using namespace std; using namespace XFILE; #define CONTROL_HEADING 2 @@ -517,9 +516,9 @@ void CGUIDialogMediaSource::OnPathAdd() HighlightItem(m_paths->Size() - 1); } -vector CGUIDialogMediaSource::GetPaths() const +std::vector CGUIDialogMediaSource::GetPaths() const { - vector paths; + std::vector paths; for (int i = 0; i < m_paths->Size(); i++) { if (!m_paths->Get(i)->GetPath().empty()) diff --git a/xbmc/dialogs/GUIDialogProgress.cpp b/xbmc/dialogs/GUIDialogProgress.cpp index e0307d5bc3ccc..529d940faf92b 100644 --- a/xbmc/dialogs/GUIDialogProgress.cpp +++ b/xbmc/dialogs/GUIDialogProgress.cpp @@ -28,8 +28,6 @@ #include "utils/log.h" #include "utils/Variant.h" -using namespace std; - #define CONTROL_CANCEL_BUTTON 10 #define CONTROL_PROGRESS_BAR 20 @@ -116,7 +114,7 @@ bool CGUIDialogProgress::OnMessage(CGUIMessage& message) int iControl = message.GetSenderId(); if (iControl == CONTROL_CANCEL_BUTTON && m_bCanCancel && !m_bCanceled) { - string strHeading = m_strHeading; + std::string strHeading = m_strHeading; strHeading.append(" : "); strHeading.append(g_localizeStrings.Get(16024)); CGUIDialogBoxBase::SetHeading(CVariant{strHeading}); diff --git a/xbmc/dialogs/GUIDialogSmartPlaylistEditor.cpp b/xbmc/dialogs/GUIDialogSmartPlaylistEditor.cpp index 5d66786a0541c..51785a9b9b4c1 100644 --- a/xbmc/dialogs/GUIDialogSmartPlaylistEditor.cpp +++ b/xbmc/dialogs/GUIDialogSmartPlaylistEditor.cpp @@ -34,9 +34,6 @@ #include "input/Key.h" #include "guilib/LocalizeStrings.h" - -using namespace std; - #define CONTROL_HEADING 2 #define CONTROL_RULE_LIST 10 #define CONTROL_NAME 12 @@ -353,14 +350,14 @@ void CGUIDialogSmartPlaylistEditor::UpdateButtons() // sort out the order fields std::vector< std::pair > labels; - vector orders = CSmartPlaylistRule::GetOrders(m_playlist.GetType()); + std::vector orders = CSmartPlaylistRule::GetOrders(m_playlist.GetType()); for (unsigned int i = 0; i < orders.size(); i++) labels.push_back(make_pair(g_localizeStrings.Get(SortUtils::GetSortLabel(orders[i])), orders[i])); SET_CONTROL_LABELS(CONTROL_ORDER_FIELD, m_playlist.m_orderField, &labels); // setup groups labels.clear(); - vector groups = CSmartPlaylistRule::GetGroups(m_playlist.GetType()); + std::vector groups = CSmartPlaylistRule::GetGroups(m_playlist.GetType()); Field currentGroup = CSmartPlaylistRule::TranslateGroup(m_playlist.GetGroup().c_str()); for (unsigned int i = 0; i < groups.size(); i++) labels.push_back(make_pair(CSmartPlaylistRule::GetLocalizedGroup(groups[i]), groups[i])); @@ -423,7 +420,7 @@ void CGUIDialogSmartPlaylistEditor::OnInitWindow() SendMessage(GUI_MSG_ITEM_SELECT, CONTROL_LIMIT, m_playlist.m_limit); - vector allowedTypes; + std::vector allowedTypes; if (m_mode == "partymusic") { allowedTypes.push_back(TYPE_SONGS); diff --git a/xbmc/dialogs/GUIDialogSmartPlaylistRule.cpp b/xbmc/dialogs/GUIDialogSmartPlaylistRule.cpp index 3729c9d278124..e976d3606cc36 100644 --- a/xbmc/dialogs/GUIDialogSmartPlaylistRule.cpp +++ b/xbmc/dialogs/GUIDialogSmartPlaylistRule.cpp @@ -44,8 +44,6 @@ #define CONTROL_CANCEL 19 #define CONTROL_BROWSE 20 -using namespace std; - CGUIDialogSmartPlaylistRule::CGUIDialogSmartPlaylistRule(void) : CGUIDialog(WINDOW_DIALOG_SMART_PLAYLIST_RULE, "SmartPlaylistRule.xml") { @@ -391,7 +389,7 @@ void CGUIDialogSmartPlaylistRule::OnOperator() std::pair OperatorLabel(CDatabaseQueryRule::SEARCH_OPERATOR op) { - return make_pair(CSmartPlaylistRule::GetLocalizedOperator(op), op); + return std::make_pair(CSmartPlaylistRule::GetLocalizedOperator(op), op); } void CGUIDialogSmartPlaylistRule::UpdateButtons() @@ -501,9 +499,9 @@ void CGUIDialogSmartPlaylistRule::OnInitWindow() // add the fields to the field spincontrol std::vector< std::pair > labels; - vector fields = CSmartPlaylistRule::GetFields(m_type); + std::vector fields = CSmartPlaylistRule::GetFields(m_type); for (unsigned int i = 0; i < fields.size(); i++) - labels.push_back(make_pair(CSmartPlaylistRule::GetLocalizedField(fields[i]), fields[i])); + labels.push_back(std::make_pair(CSmartPlaylistRule::GetLocalizedField(fields[i]), fields[i])); SET_CONTROL_LABELS(CONTROL_FIELD, 0, &labels); From ccf0550e11138dbf9b352bbbabc93e6dbc707433 Mon Sep 17 00:00:00 2001 From: Matthias Kortstiege Date: Fri, 28 Aug 2015 11:41:50 +0200 Subject: [PATCH 16/22] [peripherals] use std:: instead of using namespace std --- xbmc/peripherals/Peripherals.cpp | 41 +++++++++-------- xbmc/peripherals/bus/PeripheralBus.cpp | 7 ++- .../bus/virtual/PeripheralBusCEC.cpp | 1 - xbmc/peripherals/devices/Peripheral.cpp | 45 +++++++++---------- .../devices/PeripheralCecAdapter.cpp | 7 ++- xbmc/peripherals/devices/PeripheralHID.cpp | 1 - xbmc/peripherals/devices/PeripheralImon.cpp | 1 - xbmc/peripherals/devices/PeripheralNIC.cpp | 1 - .../devices/PeripheralNyxboard.cpp | 1 - .../dialogs/GUIDialogPeripheralManager.cpp | 1 - .../dialogs/GUIDialogPeripheralSettings.cpp | 5 +-- 11 files changed, 50 insertions(+), 61 deletions(-) diff --git a/xbmc/peripherals/Peripherals.cpp b/xbmc/peripherals/Peripherals.cpp index 4d67029bd2741..a993fb287ac3d 100644 --- a/xbmc/peripherals/Peripherals.cpp +++ b/xbmc/peripherals/Peripherals.cpp @@ -54,7 +54,6 @@ using namespace PERIPHERALS; using namespace XFILE; -using namespace std; CPeripherals::CPeripherals(void) { @@ -118,8 +117,8 @@ void CPeripherals::Clear(void) /* delete mappings */ for (unsigned int iMappingPtr = 0; iMappingPtr < m_mappings.size(); iMappingPtr++) { - map settings = m_mappings.at(iMappingPtr).m_settings; - for (map::iterator itr = settings.begin(); itr != settings.end(); ++itr) + std::map settings = m_mappings.at(iMappingPtr).m_settings; + for (std::map::iterator itr = settings.begin(); itr != settings.end(); ++itr) delete itr->second.m_setting; m_mappings.at(iMappingPtr).m_settings.clear(); } @@ -199,7 +198,7 @@ CPeripheralBus *CPeripherals::GetBusWithDevice(const std::string &strLocation) c return NULL; } -int CPeripherals::GetPeripheralsWithFeature(vector &results, const PeripheralFeature feature, PeripheralBusType busType /* = PERIPHERAL_BUS_UNKNOWN */) const +int CPeripherals::GetPeripheralsWithFeature(std::vector &results, const PeripheralFeature feature, PeripheralBusType busType /* = PERIPHERAL_BUS_UNKNOWN */) const { CSingleLock lock(m_critSection); int iReturn(0); @@ -229,7 +228,7 @@ size_t CPeripherals::GetNumberOfPeripherals() const bool CPeripherals::HasPeripheralWithFeature(const PeripheralFeature feature, PeripheralBusType busType /* = PERIPHERAL_BUS_UNKNOWN */) const { - vector dummy; + std::vector dummy; return (GetPeripheralsWithFeature(dummy, feature, busType) > 0); } @@ -404,7 +403,7 @@ void CPeripherals::GetSettingsFromMapping(CPeripheral &peripheral) const if (bBusMatch && bProductMatch && bClassMatch) { - for (map::const_iterator itr = mapping->m_settings.begin(); itr != mapping->m_settings.end(); ++itr) + for (std::map::const_iterator itr = mapping->m_settings.begin(); itr != mapping->m_settings.end(); ++itr) peripheral.AddSetting((*itr).first, (*itr).second.m_setting, (*itr).second.m_order); } } @@ -438,10 +437,10 @@ bool CPeripherals::LoadMappings(void) if (currentNode->Attribute("vendor_product")) { // The vendor_product attribute is a list of comma separated vendor:product pairs - vector vpArray = StringUtils::Split(currentNode->Attribute("vendor_product"), ","); - for (vector::const_iterator i = vpArray.begin(); i != vpArray.end(); ++i) + std::vector vpArray = StringUtils::Split(currentNode->Attribute("vendor_product"), ","); + for (std::vector::const_iterator i = vpArray.begin(); i != vpArray.end(); ++i) { - vector idArray = StringUtils::Split(*i, ":"); + std::vector idArray = StringUtils::Split(*i, ":"); if (idArray.size() != 2) { CLog::Log(LOGERROR, "%s - ignoring node \"%s\" with invalid vendor_product attribute", __FUNCTION__, mapping.m_strDeviceName.c_str()); @@ -466,7 +465,7 @@ bool CPeripherals::LoadMappings(void) return true; } -void CPeripherals::GetSettingsFromMappingsFile(TiXmlElement *xmlNode, map &settings) +void CPeripherals::GetSettingsFromMappingsFile(TiXmlElement *xmlNode, std::map &settings) { TiXmlElement *currentNode = xmlNode->FirstChildElement("setting"); int iMaxOrder = 0; @@ -509,11 +508,11 @@ void CPeripherals::GetSettingsFromMappingsFile(TiXmlElement *xmlNode, map > enums; - vector valuesVec; + std::vector< std::pair > enums; + std::vector valuesVec; StringUtils::Tokenize(strEnums, valuesVec, "|"); for (unsigned int i = 0; i < valuesVec.size(); i++) - enums.push_back(make_pair(atoi(valuesVec[i].c_str()), atoi(valuesVec[i].c_str()))); + enums.push_back(std::make_pair(atoi(valuesVec[i].c_str()), atoi(valuesVec[i].c_str()))); int iValue = currentNode->Attribute("value") ? atoi(currentNode->Attribute("value")) : 0; setting = new CSettingInt(strKey, iLabelId, iValue, enums); } @@ -549,7 +548,7 @@ void CPeripherals::GetSettingsFromMappingsFile(TiXmlElement *xmlNode, map::iterator it = settings.begin(); it != settings.end(); ++it) + for (std::map::iterator it = settings.begin(); it != settings.end(); ++it) { if (it->second.m_order == 0) it->second.m_order = ++iMaxOrder; @@ -600,7 +599,7 @@ bool CPeripherals::OnAction(const CAction &action) if (SupportsCEC() && action.GetAmount() && (action.GetID() == ACTION_VOLUME_UP || action.GetID() == ACTION_VOLUME_DOWN)) { - vector peripherals; + std::vector peripherals; if (GetPeripheralsWithFeature(peripherals, FEATURE_CEC)) { for (unsigned int iPeripheralPtr = 0; iPeripheralPtr < peripherals.size(); iPeripheralPtr++) @@ -623,7 +622,7 @@ bool CPeripherals::OnAction(const CAction &action) bool CPeripherals::IsMuted(void) { - vector peripherals; + std::vector peripherals; if (SupportsCEC() && GetPeripheralsWithFeature(peripherals, FEATURE_CEC)) { for (unsigned int iPeripheralPtr = 0; iPeripheralPtr < peripherals.size(); iPeripheralPtr++) @@ -639,7 +638,7 @@ bool CPeripherals::IsMuted(void) bool CPeripherals::ToggleMute(void) { - vector peripherals; + std::vector peripherals; if (SupportsCEC() && GetPeripheralsWithFeature(peripherals, FEATURE_CEC)) { for (unsigned int iPeripheralPtr = 0; iPeripheralPtr < peripherals.size(); iPeripheralPtr++) @@ -659,7 +658,7 @@ bool CPeripherals::ToggleMute(void) bool CPeripherals::ToggleDeviceState(CecStateChange mode /*= STATE_SWITCH_TOGGLE */, unsigned int iPeripheral /*= 0 */) { bool ret(false); - vector peripherals; + std::vector peripherals; if (SupportsCEC() && GetPeripheralsWithFeature(peripherals, FEATURE_CEC)) { @@ -678,7 +677,7 @@ bool CPeripherals::ToggleDeviceState(CecStateChange mode /*= STATE_SWITCH_TOGGLE bool CPeripherals::GetNextKeypress(float frameTime, CKey &key) { - vector peripherals; + std::vector peripherals; if (SupportsCEC() && GetPeripheralsWithFeature(peripherals, FEATURE_CEC)) { for (unsigned int iPeripheralPtr = 0; iPeripheralPtr < peripherals.size(); iPeripheralPtr++) @@ -706,10 +705,10 @@ void CPeripherals::OnSettingChanged(const CSetting *setting) if (settingId == CSettings::SETTING_LOCALE_LANGUAGE) { // user set language, no longer use the TV's language - vector cecDevices; + std::vector cecDevices; if (g_peripherals.GetPeripheralsWithFeature(cecDevices, FEATURE_CEC) > 0) { - for (vector::iterator it = cecDevices.begin(); it != cecDevices.end(); ++it) + for (std::vector::iterator it = cecDevices.begin(); it != cecDevices.end(); ++it) (*it)->SetSetting("use_tv_menu_language", false); } } diff --git a/xbmc/peripherals/bus/PeripheralBus.cpp b/xbmc/peripherals/bus/PeripheralBus.cpp index 1e3e00e5cb133..1a45b0edf25f7 100644 --- a/xbmc/peripherals/bus/PeripheralBus.cpp +++ b/xbmc/peripherals/bus/PeripheralBus.cpp @@ -24,7 +24,6 @@ #include "utils/log.h" #include "FileItem.h" -using namespace std; using namespace PERIPHERALS; #define PERIPHERAL_DEFAULT_RESCAN_INTERVAL 5000 @@ -74,7 +73,7 @@ void CPeripheralBus::Clear(void) void CPeripheralBus::UnregisterRemovedDevices(const PeripheralScanResults &results) { CSingleLock lock(m_critSection); - vector removedPeripherals; + std::vector removedPeripherals; for (int iDevicePtr = (int) m_peripherals.size() - 1; iDevicePtr >= 0; iDevicePtr--) { CPeripheral *peripheral = m_peripherals.at(iDevicePtr); @@ -92,7 +91,7 @@ void CPeripheralBus::UnregisterRemovedDevices(const PeripheralScanResults &resul for (unsigned int iDevicePtr = 0; iDevicePtr < removedPeripherals.size(); iDevicePtr++) { CPeripheral *peripheral = removedPeripherals.at(iDevicePtr); - vector features; + std::vector features; peripheral->GetFeatures(features); bool peripheralHasFeatures = features.size() > 1 || (features.size() == 1 && features.at(0) != FEATURE_UNKNOWN); if (peripheral->Type() != PERIPHERAL_UNKNOWN || peripheralHasFeatures) @@ -173,7 +172,7 @@ CPeripheral *CPeripheralBus::GetPeripheral(const std::string &strLocation) const return peripheral; } -int CPeripheralBus::GetPeripheralsWithFeature(vector &results, const PeripheralFeature feature) const +int CPeripheralBus::GetPeripheralsWithFeature(std::vector &results, const PeripheralFeature feature) const { int iReturn(0); CSingleLock lock(m_critSection); diff --git a/xbmc/peripherals/bus/virtual/PeripheralBusCEC.cpp b/xbmc/peripherals/bus/virtual/PeripheralBusCEC.cpp index 70ba8d03ad52b..b04fe00bf7ffe 100644 --- a/xbmc/peripherals/bus/virtual/PeripheralBusCEC.cpp +++ b/xbmc/peripherals/bus/virtual/PeripheralBusCEC.cpp @@ -28,7 +28,6 @@ using namespace PERIPHERALS; using namespace CEC; -using namespace std; class DllLibCECInterface { diff --git a/xbmc/peripherals/devices/Peripheral.cpp b/xbmc/peripherals/devices/Peripheral.cpp index d67817d2aa95b..b3a38324c4e2d 100644 --- a/xbmc/peripherals/devices/Peripheral.cpp +++ b/xbmc/peripherals/devices/Peripheral.cpp @@ -28,7 +28,6 @@ #include "guilib/LocalizeStrings.h" using namespace PERIPHERALS; -using namespace std; struct SortBySettingsOrder { @@ -166,7 +165,7 @@ bool CPeripheral::Initialise(void) return bReturn; } -void CPeripheral::GetSubdevices(vector &subDevices) const +void CPeripheral::GetSubdevices(std::vector &subDevices) const { for (unsigned int iSubdevicePtr = 0; iSubdevicePtr < m_subDevices.size(); iSubdevicePtr++) subDevices.push_back(m_subDevices.at(iSubdevicePtr)); @@ -177,15 +176,15 @@ bool CPeripheral::IsMultiFunctional(void) const return m_subDevices.size() > 0; } -vector CPeripheral::GetSettings(void) const +std::vector CPeripheral::GetSettings(void) const { - vector tmpSettings; - for (map::const_iterator it = m_settings.begin(); it != m_settings.end(); ++it) + std::vector tmpSettings; + for (std::map::const_iterator it = m_settings.begin(); it != m_settings.end(); ++it) tmpSettings.push_back(it->second); sort(tmpSettings.begin(), tmpSettings.end(), SortBySettingsOrder()); - vector settings; - for (vector::const_iterator it = tmpSettings.begin(); it != tmpSettings.end(); ++it) + std::vector settings; + for (std::vector::const_iterator it = tmpSettings.begin(); it != tmpSettings.end(); ++it) settings.push_back(it->m_setting); return settings; } @@ -259,7 +258,7 @@ void CPeripheral::AddSetting(const std::string &strKey, const CSetting *setting, bool CPeripheral::HasSetting(const std::string &strKey) const { - map:: const_iterator it = m_settings.find(strKey); + std::map:: const_iterator it = m_settings.find(strKey); return it != m_settings.end(); } @@ -271,7 +270,7 @@ bool CPeripheral::HasSettings(void) const bool CPeripheral::HasConfigurableSettings(void) const { bool bReturn(false); - map::const_iterator it = m_settings.begin(); + std::map::const_iterator it = m_settings.begin(); while (it != m_settings.end() && !bReturn) { if ((*it).second.m_setting->IsVisible()) @@ -288,7 +287,7 @@ bool CPeripheral::HasConfigurableSettings(void) const bool CPeripheral::GetSettingBool(const std::string &strKey) const { - map::const_iterator it = m_settings.find(strKey); + std::map::const_iterator it = m_settings.find(strKey); if (it != m_settings.end() && (*it).second.m_setting->GetType() == SettingTypeBool) { CSettingBool *boolSetting = (CSettingBool *) (*it).second.m_setting; @@ -301,7 +300,7 @@ bool CPeripheral::GetSettingBool(const std::string &strKey) const int CPeripheral::GetSettingInt(const std::string &strKey) const { - map::const_iterator it = m_settings.find(strKey); + std::map::const_iterator it = m_settings.find(strKey); if (it != m_settings.end() && (*it).second.m_setting->GetType() == SettingTypeInteger) { CSettingInt *intSetting = (CSettingInt *) (*it).second.m_setting; @@ -314,7 +313,7 @@ int CPeripheral::GetSettingInt(const std::string &strKey) const float CPeripheral::GetSettingFloat(const std::string &strKey) const { - map::const_iterator it = m_settings.find(strKey); + std::map::const_iterator it = m_settings.find(strKey); if (it != m_settings.end() && (*it).second.m_setting->GetType() == SettingTypeNumber) { CSettingNumber *floatSetting = (CSettingNumber *) (*it).second.m_setting; @@ -327,7 +326,7 @@ float CPeripheral::GetSettingFloat(const std::string &strKey) const const std::string CPeripheral::GetSettingString(const std::string &strKey) const { - map::const_iterator it = m_settings.find(strKey); + std::map::const_iterator it = m_settings.find(strKey); if (it != m_settings.end() && (*it).second.m_setting->GetType() == SettingTypeString) { CSettingString *stringSetting = (CSettingString *) (*it).second.m_setting; @@ -341,7 +340,7 @@ const std::string CPeripheral::GetSettingString(const std::string &strKey) const bool CPeripheral::SetSetting(const std::string &strKey, bool bValue) { bool bChanged(false); - map::iterator it = m_settings.find(strKey); + std::map::iterator it = m_settings.find(strKey); if (it != m_settings.end() && (*it).second.m_setting->GetType() == SettingTypeBool) { CSettingBool *boolSetting = (CSettingBool *) (*it).second.m_setting; @@ -359,7 +358,7 @@ bool CPeripheral::SetSetting(const std::string &strKey, bool bValue) bool CPeripheral::SetSetting(const std::string &strKey, int iValue) { bool bChanged(false); - map::iterator it = m_settings.find(strKey); + std::map::iterator it = m_settings.find(strKey); if (it != m_settings.end() && (*it).second.m_setting->GetType() == SettingTypeInteger) { CSettingInt *intSetting = (CSettingInt *) (*it).second.m_setting; @@ -377,7 +376,7 @@ bool CPeripheral::SetSetting(const std::string &strKey, int iValue) bool CPeripheral::SetSetting(const std::string &strKey, float fValue) { bool bChanged(false); - map::iterator it = m_settings.find(strKey); + std::map::iterator it = m_settings.find(strKey); if (it != m_settings.end() && (*it).second.m_setting->GetType() == SettingTypeNumber) { CSettingNumber *floatSetting = (CSettingNumber *) (*it).second.m_setting; @@ -394,14 +393,14 @@ bool CPeripheral::SetSetting(const std::string &strKey, float fValue) void CPeripheral::SetSettingVisible(const std::string &strKey, bool bSetTo) { - map::iterator it = m_settings.find(strKey); + std::map::iterator it = m_settings.find(strKey); if (it != m_settings.end()) (*it).second.m_setting->SetVisible(bSetTo); } bool CPeripheral::IsSettingVisible(const std::string &strKey) const { - map::const_iterator it = m_settings.find(strKey); + std::map::const_iterator it = m_settings.find(strKey); if (it != m_settings.end()) return (*it).second.m_setting->IsVisible(); return false; @@ -410,7 +409,7 @@ bool CPeripheral::IsSettingVisible(const std::string &strKey) const bool CPeripheral::SetSetting(const std::string &strKey, const std::string &strValue) { bool bChanged(false); - map::iterator it = m_settings.find(strKey); + std::map::iterator it = m_settings.find(strKey); if (it != m_settings.end()) { if ((*it).second.m_setting->GetType() == SettingTypeString) @@ -439,7 +438,7 @@ void CPeripheral::PersistSettings(bool bExiting /* = false */) CXBMCTinyXML doc; TiXmlElement node("settings"); doc.InsertEndChild(node); - for (map::const_iterator itr = m_settings.begin(); itr != m_settings.end(); ++itr) + for (std::map::const_iterator itr = m_settings.begin(); itr != m_settings.end(); ++itr) { TiXmlElement nodeSetting("setting"); nodeSetting.SetAttribute("id", itr->first.c_str()); @@ -485,7 +484,7 @@ void CPeripheral::PersistSettings(bool bExiting /* = false */) if (!bExiting) { - for (set::const_iterator it = m_changedSettings.begin(); it != m_changedSettings.end(); ++it) + for (std::set::const_iterator it = m_changedSettings.begin(); it != m_changedSettings.end(); ++it) OnSettingChanged(*it); } m_changedSettings.clear(); @@ -513,7 +512,7 @@ void CPeripheral::ResetDefaultSettings(void) ClearSettings(); g_peripherals.GetSettingsFromMapping(*this); - map::iterator it = m_settings.begin(); + std::map::iterator it = m_settings.begin(); while (it != m_settings.end()) { m_changedSettings.insert((*it).first); @@ -525,7 +524,7 @@ void CPeripheral::ResetDefaultSettings(void) void CPeripheral::ClearSettings(void) { - map::iterator it = m_settings.begin(); + std::map::iterator it = m_settings.begin(); while (it != m_settings.end()) { delete (*it).second.m_setting; diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp index 7aeadabcafb09..ac80683bca04c 100644 --- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp @@ -41,7 +41,6 @@ using namespace KODI::MESSAGING; using namespace PERIPHERALS; using namespace ANNOUNCEMENT; using namespace CEC; -using namespace std; #define CEC_LIB_SUPPORTED_VERSION LIBCEC_VERSION_TO_UINT(3, 0, 0) @@ -753,7 +752,7 @@ void CPeripheralCecAdapter::GetNextKey(void) m_bHasButton = false; if (m_bIsReady) { - vector::iterator it = m_buttonQueue.begin(); + std::vector::iterator it = m_buttonQueue.begin(); if (it != m_buttonQueue.end()) { m_currentButton = (*it); @@ -779,7 +778,7 @@ void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key) return; } // if we received a keypress with a duration set, try to find the same one without a duration set, and replace it - for (vector::reverse_iterator it = m_buttonQueue.rbegin(); it != m_buttonQueue.rend(); ++it) + for (std::vector::reverse_iterator it = m_buttonQueue.rbegin(); it != m_buttonQueue.rend(); ++it) { if ((*it).iButton == key.iButton) { @@ -1410,7 +1409,7 @@ void CPeripheralCecAdapter::ReadLogicalAddresses(int iLocalisedId, cec_logical_a } } -bool CPeripheralCecAdapter::WriteLogicalAddresses(const cec_logical_addresses& addresses, const string& strSettingName, const string& strAdvancedSettingName) +bool CPeripheralCecAdapter::WriteLogicalAddresses(const cec_logical_addresses& addresses, const std::string& strSettingName, const std::string& strAdvancedSettingName) { bool bChanged(false); diff --git a/xbmc/peripherals/devices/PeripheralHID.cpp b/xbmc/peripherals/devices/PeripheralHID.cpp index 6433a0d83121f..bc78806d6e9d0 100644 --- a/xbmc/peripherals/devices/PeripheralHID.cpp +++ b/xbmc/peripherals/devices/PeripheralHID.cpp @@ -24,7 +24,6 @@ #include "input/ButtonTranslator.h" using namespace PERIPHERALS; -using namespace std; CPeripheralHID::CPeripheralHID(const PeripheralScanResult& scanResult) : CPeripheral(scanResult) diff --git a/xbmc/peripherals/devices/PeripheralImon.cpp b/xbmc/peripherals/devices/PeripheralImon.cpp index 1e83ec91aed6d..52ecd5a1490b0 100644 --- a/xbmc/peripherals/devices/PeripheralImon.cpp +++ b/xbmc/peripherals/devices/PeripheralImon.cpp @@ -25,7 +25,6 @@ #include "input/InputManager.h" using namespace PERIPHERALS; -using namespace std; volatile long CPeripheralImon::m_lCountOfImonsConflictWithDInput = 0; diff --git a/xbmc/peripherals/devices/PeripheralNIC.cpp b/xbmc/peripherals/devices/PeripheralNIC.cpp index c5666859949a7..5caf79adc56f5 100644 --- a/xbmc/peripherals/devices/PeripheralNIC.cpp +++ b/xbmc/peripherals/devices/PeripheralNIC.cpp @@ -22,7 +22,6 @@ #include "guilib/LocalizeStrings.h" using namespace PERIPHERALS; -using namespace std; CPeripheralNIC::CPeripheralNIC(const PeripheralScanResult& scanResult) : CPeripheral(scanResult) diff --git a/xbmc/peripherals/devices/PeripheralNyxboard.cpp b/xbmc/peripherals/devices/PeripheralNyxboard.cpp index 7119018a79f9e..f7144abc109bd 100644 --- a/xbmc/peripherals/devices/PeripheralNyxboard.cpp +++ b/xbmc/peripherals/devices/PeripheralNyxboard.cpp @@ -24,7 +24,6 @@ #include "Application.h" using namespace PERIPHERALS; -using namespace std; CPeripheralNyxboard::CPeripheralNyxboard(const PeripheralScanResult& scanResult) : CPeripheralHID(scanResult) diff --git a/xbmc/peripherals/dialogs/GUIDialogPeripheralManager.cpp b/xbmc/peripherals/dialogs/GUIDialogPeripheralManager.cpp index b244cbdd60e00..a23cc3848ff6e 100644 --- a/xbmc/peripherals/dialogs/GUIDialogPeripheralManager.cpp +++ b/xbmc/peripherals/dialogs/GUIDialogPeripheralManager.cpp @@ -30,7 +30,6 @@ #define BUTTON_SETTINGS 11 #define CONTROL_LIST 20 -using namespace std; using namespace PERIPHERALS; CGUIDialogPeripheralManager::CGUIDialogPeripheralManager(void) : diff --git a/xbmc/peripherals/dialogs/GUIDialogPeripheralSettings.cpp b/xbmc/peripherals/dialogs/GUIDialogPeripheralSettings.cpp index fd96d2dd24141..0f25931d7312a 100644 --- a/xbmc/peripherals/dialogs/GUIDialogPeripheralSettings.cpp +++ b/xbmc/peripherals/dialogs/GUIDialogPeripheralSettings.cpp @@ -30,7 +30,6 @@ #define CONTROL_BUTTON_DEFAULTS 50 -using namespace std; using namespace PERIPHERALS; CGUIDialogPeripheralSettings::CGUIDialogPeripheralSettings() @@ -160,8 +159,8 @@ void CGUIDialogPeripheralSettings::InitializeSettings() return; } - vector settings = peripheral->GetSettings(); - for (vector::iterator itSetting = settings.begin(); itSetting != settings.end(); ++itSetting) + std::vector settings = peripheral->GetSettings(); + for (std::vector::iterator itSetting = settings.begin(); itSetting != settings.end(); ++itSetting) { CSetting *setting = *itSetting; if (setting == NULL) From b76d30e04884828d5ffa18b8bed8519e3565607a Mon Sep 17 00:00:00 2001 From: Matthias Kortstiege Date: Fri, 28 Aug 2015 11:56:31 +0200 Subject: [PATCH 17/22] [dvdplayer] use std:: instead of using namespace std --- xbmc/cores/dvdplayer/DVDAudio.cpp | 3 --- .../DVDCodecs/Overlay/DVDOverlayCodecSSA.cpp | 1 - .../DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp | 2 -- xbmc/cores/dvdplayer/DVDCodecs/Video/VDA.cpp | 1 - .../dvdplayer/DVDDemuxers/DVDDemuxBXA.cpp | 8 +++---- .../dvdplayer/DVDDemuxers/DVDDemuxCDDA.cpp | 4 +--- .../dvdplayer/DVDDemuxers/DVDDemuxVobsub.cpp | 12 +++++------ .../DVDDemuxers/DVDFactoryDemuxer.cpp | 13 ++++++------ .../DVDInputStreams/DVDInputStreamBluray.cpp | 5 ++--- .../DVDInputStreams/DVDInputStreamRTMP.cpp | 3 +-- .../DVDInputStreams/DVDInputStreamStack.cpp | 1 - xbmc/cores/dvdplayer/DVDMessageQueue.cpp | 8 +++---- xbmc/cores/dvdplayer/DVDPlayer.cpp | 21 +++++++++---------- xbmc/cores/dvdplayer/DVDPlayerAudio.cpp | 14 ++++++------- xbmc/cores/dvdplayer/DVDPlayerSubtitle.cpp | 4 +--- xbmc/cores/dvdplayer/DVDPlayerTeletext.cpp | 2 -- xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 11 +++++----- .../DVDSubtitles/DVDFactorySubtitle.cpp | 5 +---- .../DVDSubtitles/DVDSubtitleParserMPL2.cpp | 4 +--- .../DVDSubtitleParserMicroDVD.cpp | 4 +--- .../DVDSubtitles/DVDSubtitleParserSSA.cpp | 4 +--- .../DVDSubtitles/DVDSubtitleParserSami.cpp | 4 +--- .../DVDSubtitles/DVDSubtitleParserSubrip.cpp | 4 +--- .../DVDSubtitles/DVDSubtitleParserVplayer.cpp | 4 +--- .../DVDSubtitles/DVDSubtitleStream.cpp | 9 ++++---- .../DVDSubtitles/DVDSubtitlesLibass.cpp | 2 -- xbmc/cores/dvdplayer/DVDTSCorrection.cpp | 8 +++---- xbmc/cores/dvdplayer/Edl.cpp | 8 +++---- 28 files changed, 60 insertions(+), 109 deletions(-) diff --git a/xbmc/cores/dvdplayer/DVDAudio.cpp b/xbmc/cores/dvdplayer/DVDAudio.cpp index cccd368325461..f420300ff0e5c 100644 --- a/xbmc/cores/dvdplayer/DVDAudio.cpp +++ b/xbmc/cores/dvdplayer/DVDAudio.cpp @@ -27,9 +27,6 @@ #include "cores/AudioEngine/Interfaces/AEStream.h" #include "settings/MediaSettings.h" -using namespace std; - - CDVDAudio::CDVDAudio(volatile bool &bStop) : m_bStop(bStop) { diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecSSA.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecSSA.cpp index e8aa8a85505de..83603a8f12233 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecSSA.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecSSA.cpp @@ -28,7 +28,6 @@ #include "utils/StringUtils.h" using namespace AUTOPTR; -using namespace std; CDVDOverlayCodecSSA::CDVDOverlayCodecSSA() : CDVDOverlayCodec("SSA Subtitle Decoder") { diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp index d5765f65f0984..3498503af27fd 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp @@ -68,8 +68,6 @@ extern "C" { #include "libavfilter/buffersrc.h" } -using namespace std; - enum DecoderState { STATE_NONE, diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDA.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDA.cpp index 130569986a61a..8fccb9f79cdf5 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDA.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDA.cpp @@ -30,7 +30,6 @@ extern "C" { #include "libavcodec/vda.h" } -using namespace std; using namespace VDA; diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxBXA.cpp b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxBXA.cpp index 0fe63649c37fd..0131ce9c73088 100644 --- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxBXA.cpp +++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxBXA.cpp @@ -26,20 +26,18 @@ // AirTunes audio Demuxer. -using namespace std; - class CDemuxStreamAudioBXA : public CDemuxStreamAudio { CDVDDemuxBXA *m_parent; - string m_codec; + std::string m_codec; public: - CDemuxStreamAudioBXA(CDVDDemuxBXA *parent, const string& codec) + CDemuxStreamAudioBXA(CDVDDemuxBXA *parent, const std::string& codec) : m_parent(parent) , m_codec(codec) {} - void GetStreamInfo(string& strInfo) + void GetStreamInfo(std::string& strInfo) { strInfo = StringUtils::Format("%s", m_codec.c_str()); } diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxCDDA.cpp b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxCDDA.cpp index d6ad5fa4ee32a..05318cd214ffc 100644 --- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxCDDA.cpp +++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxCDDA.cpp @@ -25,13 +25,11 @@ // CDDA audio demuxer based on AirTunes audio Demuxer. -using namespace std; - class CDemuxStreamAudioCDDA : public CDemuxStreamAudio { public: - void GetStreamInfo(string& strInfo) + void GetStreamInfo(std::string& strInfo) { strInfo = "pcm"; } diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxVobsub.cpp b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxVobsub.cpp index 0885dd191d968..e974193ef03b5 100644 --- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxVobsub.cpp +++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxVobsub.cpp @@ -29,8 +29,6 @@ #include -using namespace std; - CDVDDemuxVobsub::CDVDDemuxVobsub() { } @@ -44,16 +42,16 @@ CDVDDemuxVobsub::~CDVDDemuxVobsub() m_Streams.clear(); } -bool CDVDDemuxVobsub::Open(const string& filename, int source, const string& subfilename) +bool CDVDDemuxVobsub::Open(const std::string& filename, int source, const std::string& subfilename) { m_Filename = filename; m_source = source; - unique_ptr pStream(new CDVDSubtitleStream()); + std::unique_ptr pStream(new CDVDSubtitleStream()); if(!pStream->Open(filename)) return false; - string vobsub = subfilename; + std::string vobsub = subfilename; if ( vobsub == "") { vobsub = filename; @@ -147,7 +145,7 @@ bool CDVDDemuxVobsub::SeekTime(int time, bool backwords, double* startpts) DemuxPacket* CDVDDemuxVobsub::Read() { - vector::iterator current; + std::vector::iterator current; do { if(m_Timestamp == m_Timestamps.end()) return NULL; @@ -195,7 +193,7 @@ bool CDVDDemuxVobsub::ParseDelay(SState& state, char* line) bool CDVDDemuxVobsub::ParseId(SState& state, char* line) { - unique_ptr stream(new CStream(this)); + std::unique_ptr stream(new CStream(this)); while(*line == ' ') line++; strncpy(stream->language, line, 2); diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.cpp b/xbmc/cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.cpp index e1e7326fe20e7..feed543617ea4 100644 --- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.cpp +++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.cpp @@ -33,7 +33,6 @@ #include "pvr/PVRManager.h" #include "pvr/addons/PVRClients.h" -using namespace std; using namespace PVR; CDVDDemux* CDVDFactoryDemuxer::CreateDemuxer(CDVDInputStream* pInputStream, bool fileinfo) @@ -46,7 +45,7 @@ CDVDDemux* CDVDFactoryDemuxer::CreateDemuxer(CDVDInputStream* pInputStream, bool { // audio/x-xbmc-pcm this is the used codec for AirTunes // (apples audio only streaming) - unique_ptr demuxer(new CDVDDemuxBXA()); + std::unique_ptr demuxer(new CDVDDemuxBXA()); if(demuxer->Open(pInputStream)) return demuxer.release(); else @@ -61,7 +60,7 @@ CDVDDemux* CDVDFactoryDemuxer::CreateDemuxer(CDVDInputStream* pInputStream, bool { CLog::Log(LOGDEBUG, "DVDFactoryDemuxer: Stream is probably CD audio. Creating CDDA demuxer."); - unique_ptr demuxer(new CDVDDemuxCDDA()); + std::unique_ptr demuxer(new CDVDDemuxCDDA()); if (demuxer->Open(pInputStream)) { return demuxer.release(); @@ -77,7 +76,7 @@ CDVDDemux* CDVDFactoryDemuxer::CreateDemuxer(CDVDInputStream* pInputStream, bool /* check so we got the meta information as requested in our http header */ if( header->GetValue("icy-metaint").length() > 0 ) { - unique_ptr demuxer(new CDVDDemuxShoutcast()); + std::unique_ptr demuxer(new CDVDDemuxShoutcast()); if(demuxer->Open(pInputStream)) return demuxer.release(); else @@ -100,7 +99,7 @@ CDVDDemux* CDVDFactoryDemuxer::CreateDemuxer(CDVDInputStream* pInputStream, bool /* Used for MediaPortal PVR addon (uses PVR otherstream for playback of rtsp streams) */ if (pOtherStream->IsStreamType(DVDSTREAM_TYPE_FFMPEG)) { - unique_ptr demuxer(new CDVDDemuxFFmpeg()); + std::unique_ptr demuxer(new CDVDDemuxFFmpeg()); if(demuxer->Open(pOtherStream, streaminfo)) return demuxer.release(); else @@ -115,7 +114,7 @@ CDVDDemux* CDVDFactoryDemuxer::CreateDemuxer(CDVDInputStream* pInputStream, bool if (g_PVRClients->GetPlayingClient(client) && client->HandlesDemuxing()) { - unique_ptr demuxer(new CDVDDemuxPVRClient()); + std::unique_ptr demuxer(new CDVDDemuxPVRClient()); if(demuxer->Open(pInputStream)) return demuxer.release(); else @@ -130,7 +129,7 @@ CDVDDemux* CDVDFactoryDemuxer::CreateDemuxer(CDVDInputStream* pInputStream, bool streaminfo = !useFastswitch; } - unique_ptr demuxer(new CDVDDemuxFFmpeg()); + std::unique_ptr demuxer(new CDVDDemuxFFmpeg()); if(demuxer->Open(pInputStream, streaminfo, fileinfo)) return demuxer.release(); else diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamBluray.cpp b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamBluray.cpp index 544261c84eebc..02e62619d5c0f 100644 --- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamBluray.cpp +++ b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamBluray.cpp @@ -41,7 +41,6 @@ #define LIBBLURAY_BYTESEEK 0 -using namespace std; using namespace XFILE; void DllLibbluray::file_close(BD_FILE_H *file) @@ -713,7 +712,7 @@ void CDVDInputStreamBluray::OverlayClear(SPlane& plane, int x, int y, int w, int , (*it)->x + (*it)->width , (*it)->y + (*it)->height); - vector rem = old.SubtractRect(ovr); + std::vector rem = old.SubtractRect(ovr); /* if no overlap we are done */ if(rem.size() == 1 && !(rem[0] != old)) @@ -723,7 +722,7 @@ void CDVDInputStreamBluray::OverlayClear(SPlane& plane, int x, int y, int w, int } SOverlays add; - for(vector::iterator itr = rem.begin(); itr != rem.end(); ++itr) + for(std::vector::iterator itr = rem.begin(); itr != rem.end(); ++itr) { SOverlay overlay(new CDVDOverlayImage(*(*it) , itr->x1 diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.cpp b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.cpp index 37c3870802791..d44f13cffbd24 100644 --- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.cpp +++ b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.cpp @@ -35,7 +35,6 @@ #include using namespace XFILE; -using namespace std; static int RTMP_level=0; extern "C" @@ -166,7 +165,7 @@ bool CDVDInputStreamRTMP::Open(const char* strFile, const std::string& content, */ std::string url = strFile; size_t iPosBlank = url.find(' '); - if (iPosBlank != string::npos && (url.find("live=true") != string::npos || url.find("live=1") != string::npos)) + if (iPosBlank != std::string::npos && (url.find("live=true") != std::string::npos || url.find("live=1") != std::string::npos)) { m_canSeek = false; m_canPause = false; diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamStack.cpp b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamStack.cpp index 094a82a21a5d4..3e3f0097b74a1 100644 --- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamStack.cpp +++ b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamStack.cpp @@ -27,7 +27,6 @@ #include using namespace XFILE; -using namespace std; CDVDInputStreamStack::CDVDInputStreamStack() : CDVDInputStream(DVDSTREAM_TYPE_FILE) { diff --git a/xbmc/cores/dvdplayer/DVDMessageQueue.cpp b/xbmc/cores/dvdplayer/DVDMessageQueue.cpp index fa0ef4e47892e..e4b3efe75ad96 100644 --- a/xbmc/cores/dvdplayer/DVDMessageQueue.cpp +++ b/xbmc/cores/dvdplayer/DVDMessageQueue.cpp @@ -24,9 +24,7 @@ #include "DVDClock.h" #include "utils/MathUtils.h" -using namespace std; - -CDVDMessageQueue::CDVDMessageQueue(const string &owner) : m_hEvent(true), m_owner(owner) +CDVDMessageQueue::CDVDMessageQueue(const std::string &owner) : m_hEvent(true), m_owner(owner) { m_iDataSize = 0; m_bAbortRequest = false; @@ -256,9 +254,9 @@ int CDVDMessageQueue::GetLevel() const return 0; if(IsDataBased()) - return min(100, 100 * m_iDataSize / m_iMaxDataSize); + return std::min(100, 100 * m_iDataSize / m_iMaxDataSize); - return min(100, MathUtils::round_int(100.0 * m_TimeSize * (m_TimeFront - m_TimeBack) / DVD_TIME_BASE )); + return std::min(100, MathUtils::round_int(100.0 * m_TimeSize * (m_TimeFront - m_TimeBack) / DVD_TIME_BASE )); } int CDVDMessageQueue::GetTimeSize() const diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp index 2166cc71686e6..72ffc85a4e2ca 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp @@ -81,7 +81,6 @@ #endif #include "DVDPlayerAudio.h" -using namespace std; using namespace PVR; using namespace KODI::MESSAGING; @@ -422,7 +421,7 @@ void CSelectionStreams::Update(CDVDInputStream* input, CDVDDemux* demuxer, std:: if(input && input->IsStreamType(DVDSTREAM_TYPE_DVD)) { CDVDInputStreamNavigator* nav = (CDVDInputStreamNavigator*)input; - string filename = nav->GetFileName(); + std::string filename = nav->GetFileName(); int source = Source(STREAM_SOURCE_NAV, filename); int count; @@ -464,7 +463,7 @@ void CSelectionStreams::Update(CDVDInputStream* input, CDVDDemux* demuxer, std:: } else if(demuxer) { - string filename = demuxer->GetFileName(); + std::string filename = demuxer->GetFileName(); int count = demuxer->GetNrOfStreams(); int source; if(input) /* hack to know this is sub decoder */ @@ -1878,7 +1877,7 @@ void CDVDPlayer::HandlePlaySpeed() { error = (int)DVD_TIME_TO_MSEC(m_clock.GetClock()) - m_SpeedState.lastseekpts; - if(abs(error) > 1000) + if(std::abs(error) > 1000) { CLog::Log(LOGDEBUG, "CDVDPlayer::Process - Seeking to catch up"); m_SpeedState.lastseekpts = (int)DVD_TIME_TO_MSEC(m_clock.GetClock()); @@ -2034,7 +2033,7 @@ void CDVDPlayer::UpdateTimestamps(CCurrentStream& current, DemuxPacket* pPacket) /* send a playback state structure periodically */ if(current.dts_state == DVD_NOPTS_VALUE - || abs(current.dts - current.dts_state) > DVD_MSEC_TO_TIME(200)) + || std::abs(current.dts - current.dts_state) > DVD_MSEC_TO_TIME(200)) { current.dts_state = current.dts; if (current.inited) @@ -2163,7 +2162,7 @@ void CDVDPlayer::CheckAutoSceneSkip() || m_CurrentVideo.dts == DVD_NOPTS_VALUE) return; - const int64_t clock = m_omxplayer_mode ? GetTime() : DVD_TIME_TO_MSEC(min(m_CurrentAudio.dts, m_CurrentVideo.dts) + m_offset_pts); + const int64_t clock = m_omxplayer_mode ? GetTime() : DVD_TIME_TO_MSEC(std::min(m_CurrentAudio.dts, m_CurrentVideo.dts) + m_offset_pts); CEdl::Cut cut; if(!m_Edl.InCut(clock, &cut)) @@ -3289,7 +3288,7 @@ bool CDVDPlayer::OpenStream(CCurrentStream& current, int iStream, int source, bo if(!m_pSubtitleDemuxer || m_pSubtitleDemuxer->GetFileName() != st.filename) { CLog::Log(LOGNOTICE, "Opening Subtitle file: %s", st.filename.c_str()); - unique_ptr demux(new CDVDDemuxVobsub()); + std::unique_ptr demux(new CDVDDemuxVobsub()); if(!demux->Open(st.filename, source, st.filename2)) return false; m_pSubtitleDemuxer = demux.release(); @@ -4291,7 +4290,7 @@ double CDVDPlayer::GetQueueTime() { int a = m_dvdPlayerAudio->GetLevel(); int v = m_dvdPlayerVideo->GetLevel(); - return max(a, v) * 8000.0 / 100; + return std::max(a, v) * 8000.0 / 100; } void CDVDPlayer::GetVideoStreamInfo(SPlayerVideoStreamInfo &info) @@ -4562,14 +4561,14 @@ void CDVDPlayer::UpdatePlayState(double timeout) double level, delay, offset; if(GetCachingTimes(level, delay, offset)) { - state.cache_delay = max(0.0, delay); - state.cache_level = max(0.0, min(1.0, level)); + state.cache_delay = std::max(0.0, delay); + state.cache_level = std::max(0.0, std::min(1.0, level)); state.cache_offset = offset; } else { state.cache_delay = 0.0; - state.cache_level = min(1.0, GetQueueTime() / 8000.0); + state.cache_level = std::min(1.0, GetQueueTime() / 8000.0); state.cache_offset = GetQueueTime() / state.time_total; } diff --git a/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp b/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp index 7dc53b11673bd..39074ffd1534d 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp @@ -42,13 +42,11 @@ #define PROPDIVMAX 40.0 #define INTEGRAL 200.0 -using namespace std; - void CPTSInputQueue::Add(int64_t bytes, double pts) { CSingleLock lock(m_sync); - m_list.insert(m_list.begin(), make_pair(bytes, pts)); + m_list.insert(m_list.begin(), std::make_pair(bytes, pts)); } void CPTSInputQueue::Flush() @@ -478,15 +476,15 @@ void CDVDPlayerAudio::OnStartup() void CDVDPlayerAudio::UpdatePlayerInfo() { std::ostringstream s; - s << "aq:" << setw(2) << min(99,m_messageQueue.GetLevel() + MathUtils::round_int(100.0/8.0*m_dvdAudio.GetCacheTime())) << "%"; - s << ", Kb/s:" << fixed << setprecision(2) << (double)GetAudioBitrate() / 1024.0; + s << "aq:" << std::setw(2) << std::min(99,m_messageQueue.GetLevel() + MathUtils::round_int(100.0/8.0*m_dvdAudio.GetCacheTime())) << "%"; + s << ", Kb/s:" << std::fixed << std::setprecision(2) << (double)GetAudioBitrate() / 1024.0; //print the inverse of the resample ratio, since that makes more sense //if the resample ratio is 0.5, then we're playing twice as fast if (m_synctype == SYNC_RESAMPLE) - s << ", rr:" << fixed << setprecision(5) << 1.0 / m_resampleratio; + s << ", rr:" << std::fixed << std::setprecision(5) << 1.0 / m_resampleratio; - s << ", att:" << fixed << setprecision(1) << log(GetCurrentAttenuation()) * 20.0f << " dB"; + s << ", att:" << std::fixed << std::setprecision(1) << log(GetCurrentAttenuation()) * 20.0f << " dB"; SInfo info; info.info = s.str(); @@ -892,7 +890,7 @@ bool CDVDPlayerAudio::SwitchCodecIfNeeded() return true; } -string CDVDPlayerAudio::GetPlayerInfo() +std::string CDVDPlayerAudio::GetPlayerInfo() { CSingleLock lock(m_info_section); return m_info.info; diff --git a/xbmc/cores/dvdplayer/DVDPlayerSubtitle.cpp b/xbmc/cores/dvdplayer/DVDPlayerSubtitle.cpp index f086162d6b4fb..3d5c26bd4c7d6 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerSubtitle.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerSubtitle.cpp @@ -31,8 +31,6 @@ #include "config.h" #endif -using namespace std; - CDVDPlayerSubtitle::CDVDPlayerSubtitle(CDVDOverlayContainer* pOverlayContainer) { m_pOverlayContainer = pOverlayContainer; @@ -133,7 +131,7 @@ void CDVDPlayerSubtitle::SendMessage(CDVDMsg* pMsg, int priority) pMsg->Release(); } -bool CDVDPlayerSubtitle::OpenStream(CDVDStreamInfo &hints, string &filename) +bool CDVDPlayerSubtitle::OpenStream(CDVDStreamInfo &hints, std::string &filename) { CSingleLock lock(m_section); diff --git a/xbmc/cores/dvdplayer/DVDPlayerTeletext.cpp b/xbmc/cores/dvdplayer/DVDPlayerTeletext.cpp index 2b5402e564878..cd71dbd4f2cf1 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerTeletext.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerTeletext.cpp @@ -24,8 +24,6 @@ #include "utils/log.h" #include "threads/SingleLock.h" -using namespace std; - const uint8_t rev_lut[32] = { 0x00,0x08,0x04,0x0c, /* upper nibble */ diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp index 352126f95f058..17dee9ce4c724 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp @@ -41,7 +41,6 @@ #include #include "utils/log.h" -using namespace std; using namespace RenderManager; class CPulldownCorrection @@ -1156,7 +1155,7 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) // timestamp when we think next picture should be displayed based on current duration m_FlipTimeStamp = iCurrentClock; - m_FlipTimeStamp += max(0.0, iSleepTime); + m_FlipTimeStamp += std::max(0.0, iSleepTime); m_FlipTimePts = pts; if ((pPicture->iFlags & DVP_FLAG_DROPPED)) @@ -1218,10 +1217,10 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) std::string CDVDPlayerVideo::GetPlayerInfo() { std::ostringstream s; - s << "fr:" << fixed << setprecision(3) << m_fFrameRate; - s << ", vq:" << setw(2) << min(99,GetLevel()) << "%"; + s << "fr:" << std::fixed << std::setprecision(3) << m_fFrameRate; + s << ", vq:" << std::setw(2) << std::min(99,GetLevel()) << "%"; s << ", dc:" << m_codecname; - s << ", Mb/s:" << fixed << setprecision(2) << (double)GetVideoBitrate() / (1024.0*1024.0); + s << ", Mb/s:" << std::fixed << std::setprecision(2) << (double)GetVideoBitrate() / (1024.0*1024.0); s << ", drop:" << m_iDroppedFrames; s << ", skip:" << g_renderManager.GetSkippedFrames(); @@ -1264,7 +1263,7 @@ double CDVDPlayerVideo::GetCurrentPts() return DVD_NOPTS_VALUE; else if (m_speed == DVD_PLAYSPEED_NORMAL) { - iRenderPts -= max(0.0, DVD_SEC_TO_TIME(iSleepTime)); + iRenderPts -= std::max(0.0, DVD_SEC_TO_TIME(iSleepTime)); if (iRenderPts < 0) iRenderPts = 0; diff --git a/xbmc/cores/dvdplayer/DVDSubtitles/DVDFactorySubtitle.cpp b/xbmc/cores/dvdplayer/DVDSubtitles/DVDFactorySubtitle.cpp index e457778645d56..61ca3695e7e8d 100644 --- a/xbmc/cores/dvdplayer/DVDSubtitles/DVDFactorySubtitle.cpp +++ b/xbmc/cores/dvdplayer/DVDSubtitles/DVDFactorySubtitle.cpp @@ -29,10 +29,7 @@ #include "DVDSubtitleParserSSA.h" #include "DVDSubtitleParserVplayer.h" -using namespace std; - - -CDVDSubtitleParser* CDVDFactorySubtitle::CreateParser(string& strFile) +CDVDSubtitleParser* CDVDFactorySubtitle::CreateParser(std::string& strFile) { char line[1024]; int i; diff --git a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserMPL2.cpp b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserMPL2.cpp index 4f50a803af025..909e0fa9af1fb 100644 --- a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserMPL2.cpp +++ b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserMPL2.cpp @@ -25,9 +25,7 @@ #include "DVDStreamInfo.h" #include "DVDSubtitleTagMicroDVD.h" -using namespace std; - -CDVDSubtitleParserMPL2::CDVDSubtitleParserMPL2(CDVDSubtitleStream* stream, const string& filename) +CDVDSubtitleParserMPL2::CDVDSubtitleParserMPL2(CDVDSubtitleStream* stream, const std::string& filename) : CDVDSubtitleParserText(stream, filename), m_framerate(DVD_TIME_BASE / 10.0) { diff --git a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserMicroDVD.cpp b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserMicroDVD.cpp index 43f625b3bc59c..9427cf76f8ea4 100644 --- a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserMicroDVD.cpp +++ b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserMicroDVD.cpp @@ -26,9 +26,7 @@ #include "utils/log.h" #include "DVDSubtitleTagMicroDVD.h" -using namespace std; - -CDVDSubtitleParserMicroDVD::CDVDSubtitleParserMicroDVD(CDVDSubtitleStream* stream, const string& filename) +CDVDSubtitleParserMicroDVD::CDVDSubtitleParserMicroDVD(CDVDSubtitleStream* stream, const std::string& filename) : CDVDSubtitleParserText(stream, filename), m_framerate( DVD_TIME_BASE / 25.0 ) { diff --git a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserSSA.cpp b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserSSA.cpp index 8e697f3ed1c71..849e6ef51db83 100644 --- a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserSSA.cpp +++ b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserSSA.cpp @@ -23,9 +23,7 @@ #include "DVDClock.h" #include "utils/log.h" -using namespace std; - -CDVDSubtitleParserSSA::CDVDSubtitleParserSSA(CDVDSubtitleStream* pStream, const string& strFile) +CDVDSubtitleParserSSA::CDVDSubtitleParserSSA(CDVDSubtitleStream* pStream, const std::string& strFile) : CDVDSubtitleParserText(pStream, strFile) { m_libass = new CDVDSubtitlesLibass(); diff --git a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserSami.cpp b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserSami.cpp index 49673fe939719..c77cd1e7a0759 100644 --- a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserSami.cpp +++ b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserSami.cpp @@ -27,9 +27,7 @@ #include "utils/URIUtils.h" #include "DVDSubtitleTagSami.h" -using namespace std; - -CDVDSubtitleParserSami::CDVDSubtitleParserSami(CDVDSubtitleStream* pStream, const string& filename) +CDVDSubtitleParserSami::CDVDSubtitleParserSami(CDVDSubtitleStream* pStream, const std::string& filename) : CDVDSubtitleParserText(pStream, filename) { diff --git a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserSubrip.cpp b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserSubrip.cpp index 7810175209eea..cc789c7b60ad6 100644 --- a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserSubrip.cpp +++ b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserSubrip.cpp @@ -24,9 +24,7 @@ #include "utils/StringUtils.h" #include "DVDSubtitleTagSami.h" -using namespace std; - -CDVDSubtitleParserSubrip::CDVDSubtitleParserSubrip(CDVDSubtitleStream* pStream, const string& strFile) +CDVDSubtitleParserSubrip::CDVDSubtitleParserSubrip(CDVDSubtitleStream* pStream, const std::string& strFile) : CDVDSubtitleParserText(pStream, strFile) { } diff --git a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserVplayer.cpp b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserVplayer.cpp index 20035aaa607c8..19c4c1404b8ca 100644 --- a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserVplayer.cpp +++ b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserVplayer.cpp @@ -23,9 +23,7 @@ #include "DVDClock.h" #include "utils/RegExp.h" -using namespace std; - -CDVDSubtitleParserVplayer::CDVDSubtitleParserVplayer(CDVDSubtitleStream* pStream, const string& strFile) +CDVDSubtitleParserVplayer::CDVDSubtitleParserVplayer(CDVDSubtitleStream* pStream, const std::string& strFile) : CDVDSubtitleParserText(pStream, strFile), m_framerate(DVD_TIME_BASE) { } diff --git a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleStream.cpp b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleStream.cpp index c0997bc9d8ed4..834ea1ef013ba 100644 --- a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleStream.cpp +++ b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleStream.cpp @@ -30,7 +30,6 @@ #include "utils/log.h" #include "utils/URIUtils.h" -using namespace std; using XFILE::auto_buffer; CDVDSubtitleStream::CDVDSubtitleStream() @@ -41,7 +40,7 @@ CDVDSubtitleStream::~CDVDSubtitleStream() { } -bool CDVDSubtitleStream::Open(const string& strFile) +bool CDVDSubtitleStream::Open(const std::string& strFile) { CDVDInputStream* pInputStream; pInputStream = CDVDFactoryInputStream::CreateInputStream(NULL, strFile, ""); @@ -135,17 +134,17 @@ long CDVDSubtitleStream::Seek(long offset, int whence) { case SEEK_CUR: { - m_stringstream.seekg(offset, ios::cur); + m_stringstream.seekg(offset, std::ios::cur); break; } case SEEK_END: { - m_stringstream.seekg(offset, ios::end); + m_stringstream.seekg(offset, std::ios::end); break; } case SEEK_SET: { - m_stringstream.seekg(offset, ios::beg); + m_stringstream.seekg(offset, std::ios::beg); break; } } diff --git a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitlesLibass.cpp b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitlesLibass.cpp index c381f36cf4970..0f5e1ace4c85f 100644 --- a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitlesLibass.cpp +++ b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitlesLibass.cpp @@ -29,8 +29,6 @@ #include "threads/SingleLock.h" #include "guilib/GraphicContext.h" -using namespace std; - static void libass_log(int level, const char *fmt, va_list args, void *data) { if(level >= 5) diff --git a/xbmc/cores/dvdplayer/DVDTSCorrection.cpp b/xbmc/cores/dvdplayer/DVDTSCorrection.cpp index 37a1b8e3ab130..a72c1e5fd8645 100644 --- a/xbmc/cores/dvdplayer/DVDTSCorrection.cpp +++ b/xbmc/cores/dvdplayer/DVDTSCorrection.cpp @@ -27,8 +27,6 @@ #define MAXERR DVD_MSEC_TO_TIME(2.5) -using namespace std; - CPullupCorrection::CPullupCorrection() { ResetVFRDetection(); @@ -81,7 +79,7 @@ void CPullupCorrection::Add(double pts) return; //get the current pattern in the ringbuffer - vector pattern; + std::vector pattern; GetPattern(pattern); //check if the pattern is the same as the saved pattern @@ -169,7 +167,7 @@ void CPullupCorrection::GetPattern(std::vector& pattern) //difftypesbuff[1] the one added before that etc //get the difftypes - vector difftypes; + std::vector difftypes; GetDifftypes(difftypes); //mark each diff with what difftype it is @@ -227,7 +225,7 @@ void CPullupCorrection::GetPattern(std::vector& pattern) } //calculate the different types of diffs we have -void CPullupCorrection::GetDifftypes(vector& difftypes) +void CPullupCorrection::GetDifftypes(std::vector& difftypes) { for (int i = 0; i < m_ringfill; i++) { diff --git a/xbmc/cores/dvdplayer/Edl.cpp b/xbmc/cores/dvdplayer/Edl.cpp index b4012922d85f9..6d07bd6ed637f 100644 --- a/xbmc/cores/dvdplayer/Edl.cpp +++ b/xbmc/cores/dvdplayer/Edl.cpp @@ -29,8 +29,6 @@ #include "pvr/recordings/PVRRecordings.h" #include "pvr/PVRManager.h" -using namespace std; - #define COMSKIP_HEADER "FILE PROCESSING COMPLETE" #define VIDEOREDO_HEADER "2" #define VIDEOREDO_TAG_CUT "" @@ -185,7 +183,7 @@ bool CEdl::ReadEdl(const std::string& strMovie, const float fFramesPerSecond) continue; } - vector strFields(2); + std::vector strFields(2); strFields[0] = buffer1; strFields[1] = buffer2; @@ -204,7 +202,7 @@ bool CEdl::ReadEdl(const std::string& strMovie, const float fFramesPerSecond) { if (strFields[i].find(":") != std::string::npos) // HH:MM:SS.sss format { - vector fieldParts = StringUtils::Split(strFields[i], '.'); + std::vector fieldParts = StringUtils::Split(strFields[i], '.'); if (fieldParts.size() == 1) // No ms { iCutStartEnd[i] = StringUtils::TimeStringToSeconds(fieldParts[0]) * (int64_t)1000; // seconds to ms @@ -707,7 +705,7 @@ bool CEdl::AddCut(Cut& cut) } else { - vector::iterator pCurrentCut; + std::vector::iterator pCurrentCut; for (pCurrentCut = m_vecCuts.begin(); pCurrentCut != m_vecCuts.end(); ++pCurrentCut) { if (cut.start < pCurrentCut->start) From a6f063a963480599d5fd5a230183ba331fa6e017 Mon Sep 17 00:00:00 2001 From: Matthias Kortstiege Date: Fri, 28 Aug 2015 11:57:48 +0200 Subject: [PATCH 18/22] [linux] use std:: instead of using namespace std --- xbmc/linux/DBusReserve.cpp | 4 +--- xbmc/linux/LinuxTimezone.cpp | 18 ++++++++---------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/xbmc/linux/DBusReserve.cpp b/xbmc/linux/DBusReserve.cpp index adc55bbb5a81b..6c91b3fa8cd93 100644 --- a/xbmc/linux/DBusReserve.cpp +++ b/xbmc/linux/DBusReserve.cpp @@ -27,8 +27,6 @@ #include "utils/log.h" -using namespace std; - /* This implements the code to exclusively acquire * * a device on the system describe at: * * http://git.0pointer.de/?p=reserve.git;a=blob_plain;f=reserve.txt */ @@ -161,7 +159,7 @@ bool CDBusReserve::ReleaseDevice(const std::string& device) DBusError error; dbus_error_init (&error); - vector::iterator it = find(m_devs.begin(), m_devs.end(), device); + std::vector::iterator it = find(m_devs.begin(), m_devs.end(), device); if(it == m_devs.end()) { CLog::Log(LOGDEBUG, "CDBusReserve::ReleaseDevice(%s): device wasn't aquired here", device.c_str()); diff --git a/xbmc/linux/LinuxTimezone.cpp b/xbmc/linux/LinuxTimezone.cpp index 25e9f38b87787..7de8f8cb00194 100644 --- a/xbmc/linux/LinuxTimezone.cpp +++ b/xbmc/linux/LinuxTimezone.cpp @@ -42,8 +42,6 @@ #include -using namespace std; - CLinuxTimezone::CLinuxTimezone() : m_IsDST(0) { char* line = NULL; @@ -80,13 +78,13 @@ CLinuxTimezone::CLinuxTimezone() : m_IsDST(0) if (m_timezonesByCountryCode.count(countryCode) == 0) { - vector timezones; + std::vector timezones; timezones.push_back(timezoneName); m_timezonesByCountryCode[countryCode] = timezones; } else { - vector& timezones = m_timezonesByCountryCode[countryCode]; + std::vector& timezones = m_timezonesByCountryCode[countryCode]; timezones.push_back(timezoneName); } @@ -179,12 +177,12 @@ void CLinuxTimezone::OnSettingsLoaded() CDateTime::ResetTimezoneBias(); } -vector CLinuxTimezone::GetCounties() +std::vector CLinuxTimezone::GetCounties() { return m_counties; } -vector CLinuxTimezone::GetTimezonesByCountry(const std::string& country) +std::vector CLinuxTimezone::GetTimezonesByCountry(const std::string& country) { return m_timezonesByCountryCode[m_countryByName[country]]; } @@ -256,22 +254,22 @@ std::string CLinuxTimezone::GetOSConfiguredTimezone() void CLinuxTimezone::SettingOptionsTimezoneCountriesFiller(const CSetting *setting, std::vector< std::pair > &list, std::string ¤t, void *data) { - vector countries = g_timezone.GetCounties(); + std::vector countries = g_timezone.GetCounties(); for (unsigned int i = 0; i < countries.size(); i++) - list.push_back(make_pair(countries[i], countries[i])); + list.push_back(std::make_pair(countries[i], countries[i])); } void CLinuxTimezone::SettingOptionsTimezonesFiller(const CSetting *setting, std::vector< std::pair > &list, std::string ¤t, void *data) { current = ((const CSettingString*)setting)->GetValue(); bool found = false; - vector timezones = g_timezone.GetTimezonesByCountry(CSettings::GetInstance().GetString(CSettings::SETTING_LOCALE_TIMEZONECOUNTRY)); + std::vector timezones = g_timezone.GetTimezonesByCountry(CSettings::GetInstance().GetString(CSettings::SETTING_LOCALE_TIMEZONECOUNTRY)); for (unsigned int i = 0; i < timezones.size(); i++) { if (!found && StringUtils::EqualsNoCase(timezones[i], current)) found = true; - list.push_back(make_pair(timezones[i], timezones[i])); + list.push_back(std::make_pair(timezones[i], timezones[i])); } if (!found && timezones.size() > 0) From 0439550f246e850e31f0a8dae76db0a7f7ca16ce Mon Sep 17 00:00:00 2001 From: Matthias Kortstiege Date: Fri, 28 Aug 2015 11:59:50 +0200 Subject: [PATCH 19/22] [epg] use std:: instead of using namespace std --- xbmc/epg/Epg.cpp | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/xbmc/epg/Epg.cpp b/xbmc/epg/Epg.cpp index 614f05b0d2691..9e0445a8d39d9 100644 --- a/xbmc/epg/Epg.cpp +++ b/xbmc/epg/Epg.cpp @@ -32,7 +32,6 @@ using namespace PVR; using namespace EPG; -using namespace std; CEpg::CEpg(int iEpgID, const std::string &strName /* = "" */, const std::string &strScraperName /* = "" */, bool bLoadedFromDb /* = false */) : m_bChanged(!bLoadedFromDb), @@ -87,7 +86,7 @@ CEpg &CEpg::operator =(const CEpg &right) m_lastScanTime = right.m_lastScanTime; m_pvrChannel = right.m_pvrChannel; - for (map::const_iterator it = right.m_tags.begin(); it != right.m_tags.end(); ++it) + for (std::map::const_iterator it = right.m_tags.begin(); it != right.m_tags.end(); ++it) m_tags.insert(make_pair(it->first, it->second)); return *this; @@ -159,7 +158,7 @@ void CEpg::Cleanup(void) void CEpg::Cleanup(const CDateTime &Time) { CSingleLock lock(m_critSection); - for (map::iterator it = m_tags.begin(); it != m_tags.end();) + for (std::map::iterator it = m_tags.begin(); it != m_tags.end();) { if (it->second->EndAsUTC() < Time) { @@ -181,7 +180,7 @@ CEpgInfoTagPtr CEpg::GetTagNow(bool bUpdateIfNeeded /* = true */) const CSingleLock lock(m_critSection); if (m_nowActiveStart.IsValid()) { - map::const_iterator it = m_tags.find(m_nowActiveStart); + std::map::const_iterator it = m_tags.find(m_nowActiveStart); if (it != m_tags.end() && it->second->IsActive()) return it->second; } @@ -191,7 +190,7 @@ CEpgInfoTagPtr CEpg::GetTagNow(bool bUpdateIfNeeded /* = true */) const CEpgInfoTagPtr lastActiveTag; /* one of the first items will always match if the list is sorted */ - for (map::const_iterator it = m_tags.begin(); it != m_tags.end(); ++it) + for (std::map::const_iterator it = m_tags.begin(); it != m_tags.end(); ++it) { if (it->second->IsActive()) { @@ -217,14 +216,14 @@ CEpgInfoTagPtr CEpg::GetTagNext() const if (nowTag) { CSingleLock lock(m_critSection); - map::const_iterator it = m_tags.find(nowTag->StartAsUTC()); + std::map::const_iterator it = m_tags.find(nowTag->StartAsUTC()); if (it != m_tags.end() && ++it != m_tags.end()) return it->second; } else if (Size() > 0) { /* return the first event that is in the future */ - for (map::const_iterator it = m_tags.begin(); it != m_tags.end(); ++it) + for (std::map::const_iterator it = m_tags.begin(); it != m_tags.end(); ++it) { if (it->second->IsUpcoming()) return it->second; @@ -252,7 +251,7 @@ bool CEpg::CheckPlayingEvent(void) CEpgInfoTagPtr CEpg::GetTag(const CDateTime &StartTime) const { CSingleLock lock(m_critSection); - map::const_iterator it = m_tags.find(StartTime); + std::map::const_iterator it = m_tags.find(StartTime); if (it != m_tags.end()) { return it->second; @@ -265,7 +264,7 @@ CEpgInfoTagPtr CEpg::GetTag(int uniqueID) const { CEpgInfoTagPtr retval; CSingleLock lock(m_critSection); - for (map::const_iterator it = m_tags.begin(); !retval && it != m_tags.end(); ++it) + for (std::map::const_iterator it = m_tags.begin(); !retval && it != m_tags.end(); ++it) if (it->second->UniqueBroadcastID() == uniqueID) retval = it->second; @@ -275,7 +274,7 @@ CEpgInfoTagPtr CEpg::GetTag(int uniqueID) const CEpgInfoTagPtr CEpg::GetTagBetween(const CDateTime &beginTime, const CDateTime &endTime) const { CSingleLock lock(m_critSection); - for (map::const_iterator it = m_tags.begin(); it != m_tags.end(); ++it) + for (std::map::const_iterator it = m_tags.begin(); it != m_tags.end(); ++it) { if (it->second->StartAsUTC() >= beginTime && it->second->EndAsUTC() <= endTime) return it->second; @@ -287,7 +286,7 @@ CEpgInfoTagPtr CEpg::GetTagBetween(const CDateTime &beginTime, const CDateTime & CEpgInfoTagPtr CEpg::GetTagAround(const CDateTime &time) const { CSingleLock lock(m_critSection); - for (map::const_iterator it = m_tags.begin(); it != m_tags.end(); ++it) + for (std::map::const_iterator it = m_tags.begin(); it != m_tags.end(); ++it) { if ((it->second->StartAsUTC() < time) && (it->second->EndAsUTC() > time)) return it->second; @@ -300,7 +299,7 @@ void CEpg::AddEntry(const CEpgInfoTag &tag) { CEpgInfoTagPtr newTag; CSingleLock lock(m_critSection); - map::iterator itr = m_tags.find(tag.StartAsUTC()); + std::map::iterator itr = m_tags.find(tag.StartAsUTC()); if (itr != m_tags.end()) newTag = itr->second; else @@ -321,7 +320,7 @@ bool CEpg::UpdateEntry(const CEpgInfoTag &tag, bool bUpdateDatabase /* = false * { CEpgInfoTagPtr infoTag; CSingleLock lock(m_critSection); - map::iterator it = m_tags.find(tag.StartAsUTC()); + std::map::iterator it = m_tags.find(tag.StartAsUTC()); bool bNewTag(false); if (it != m_tags.end()) { @@ -384,7 +383,7 @@ bool CEpg::UpdateEntries(const CEpg &epg, bool bStoreInDb /* = true */) CLog::Log(LOGDEBUG, "EPG - %s - %" PRIuS" entries in memory before merging", __FUNCTION__, m_tags.size()); #endif /* copy over tags */ - for (map::const_iterator it = epg.m_tags.begin(); it != epg.m_tags.end(); ++it) + for (std::map::const_iterator it = epg.m_tags.begin(); it != epg.m_tags.end(); ++it) UpdateEntry(*it->second, bStoreInDb, false); #if EPG_DEBUGGING @@ -491,7 +490,7 @@ int CEpg::Get(CFileItemList &results) const CSingleLock lock(m_critSection); - for (map::const_iterator it = m_tags.begin(); it != m_tags.end(); ++it) + for (std::map::const_iterator it = m_tags.begin(); it != m_tags.end(); ++it) results.Add(CFileItemPtr(new CFileItem(it->second))); return results.Size() - iInitialSize; @@ -506,7 +505,7 @@ int CEpg::Get(CFileItemList &results, const EpgSearchFilter &filter) const CSingleLock lock(m_critSection); - for (map::const_iterator it = m_tags.begin(); it != m_tags.end(); ++it) + for (std::map::const_iterator it = m_tags.begin(); it != m_tags.end(); ++it) { if (filter.FilterEntry(*it->second)) results.Add(CFileItemPtr(new CFileItem(it->second))); @@ -591,7 +590,7 @@ bool CEpg::FixOverlappingEvents(bool bUpdateDb /* = false */) bool bReturn(true); CEpgInfoTagPtr previousTag, currentTag; - for (map::iterator it = m_tags.begin(); it != m_tags.end(); it != m_tags.end() ? it++ : it) + for (std::map::iterator it = m_tags.begin(); it != m_tags.end(); it != m_tags.end() ? it++ : it) { if (!previousTag) { @@ -768,7 +767,7 @@ bool CEpg::LoadFromClients(time_t start, time_t end) CEpgInfoTagPtr CEpg::GetNextEvent(const CEpgInfoTag& tag) const { CSingleLock lock(m_critSection); - map::const_iterator it = m_tags.find(tag.StartAsUTC()); + std::map::const_iterator it = m_tags.find(tag.StartAsUTC()); if (it != m_tags.end() && ++it != m_tags.end()) return it->second; @@ -779,7 +778,7 @@ CEpgInfoTagPtr CEpg::GetNextEvent(const CEpgInfoTag& tag) const CEpgInfoTagPtr CEpg::GetPreviousEvent(const CEpgInfoTag& tag) const { CSingleLock lock(m_critSection); - map::const_iterator it = m_tags.find(tag.StartAsUTC()); + std::map::const_iterator it = m_tags.find(tag.StartAsUTC()); if (it != m_tags.end() && it != m_tags.begin()) { --it; @@ -825,7 +824,7 @@ void CEpg::SetChannel(const PVR::CPVRChannelPtr &channel) channel->SetEpgID(m_iEpgID); } m_pvrChannel = channel; - for (map::iterator it = m_tags.begin(); it != m_tags.end(); ++it) + for (std::map::iterator it = m_tags.begin(); it != m_tags.end(); ++it) it->second->SetPVRChannel(m_pvrChannel); } } From 7ab6e178fb4327e6df96b1d29c876ea5113478f3 Mon Sep 17 00:00:00 2001 From: Matthias Kortstiege Date: Fri, 28 Aug 2015 12:01:03 +0200 Subject: [PATCH 20/22] [cdrip] use std:: instead of using namespace std --- xbmc/cdrip/CDDARipper.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xbmc/cdrip/CDDARipper.cpp b/xbmc/cdrip/CDDARipper.cpp index 5595f53cd1f9d..04f30a9b6d2a8 100644 --- a/xbmc/cdrip/CDDARipper.cpp +++ b/xbmc/cdrip/CDDARipper.cpp @@ -47,7 +47,6 @@ #include "addons/AddonManager.h" #include "addons/AudioEncoder.h" -using namespace std; using namespace ADDON; using namespace XFILE; using namespace MUSIC_INFO; @@ -113,7 +112,7 @@ bool CCDDARipper::RipCD() { CFileItemPtr pItem = vecItems[i]; CMusicInfoTagLoaderFactory factory; - unique_ptr pLoader (factory.CreateLoader(*pItem)); + std::unique_ptr pLoader (factory.CreateLoader(*pItem)); if (NULL != pLoader.get()) { pLoader->Load(pItem->GetPath(), *pItem->GetMusicInfoTag()); // get tag from file From 53d77bfc3fccb9110b7146b8e9bee47de46e9e23 Mon Sep 17 00:00:00 2001 From: Matthias Kortstiege Date: Fri, 28 Aug 2015 12:04:26 +0200 Subject: [PATCH 21/22] [dllloader] use std:: instead of using namespace std --- xbmc/cores/DllLoader/exports/emu_kernel32.cpp | 7 +++--- xbmc/cores/DllLoader/exports/emu_msvcrt.cpp | 23 +++++++++---------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/xbmc/cores/DllLoader/exports/emu_kernel32.cpp b/xbmc/cores/DllLoader/exports/emu_kernel32.cpp index 6cd8969da6027..0ab0c309f32e3 100644 --- a/xbmc/cores/DllLoader/exports/emu_kernel32.cpp +++ b/xbmc/cores/DllLoader/exports/emu_kernel32.cpp @@ -41,9 +41,8 @@ #include #include #include -using namespace std; -vector m_vecAtoms; +std::vector m_vecAtoms; //#define API_DEBUG @@ -56,7 +55,7 @@ extern "C" UINT WINAPI dllGetAtomNameA( ATOM nAtom, LPTSTR lpBuffer, int nSize) { if (nAtom < 1 || nAtom > m_vecAtoms.size() ) return 0; nAtom--; - string& strAtom = m_vecAtoms[nAtom]; + std::string& strAtom = m_vecAtoms[nAtom]; strcpy(lpBuffer, strAtom.c_str()); return strAtom.size(); } @@ -65,7 +64,7 @@ extern "C" ATOM WINAPI dllFindAtomA( LPCTSTR lpString) { for (int i = 0; i < (int)m_vecAtoms.size(); ++i) { - string& strAtom = m_vecAtoms[i]; + std::string& strAtom = m_vecAtoms[i]; if (strAtom == lpString) return i + 1; } return 0; diff --git a/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp b/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp index 56a83565eae82..d0775e205d1d4 100644 --- a/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp +++ b/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp @@ -79,7 +79,6 @@ #include "utils/Environment.h" #include "utils/StringUtils.h" -using namespace std; using namespace XFILE; struct SDirData @@ -142,29 +141,29 @@ extern "C" void __stdcall init_emu_environ() { // using external python, it's build looking for xxx/lib/python2.6 // so point it to frameworks which is where python2.6 is located - dll_putenv(string("PYTHONPATH=" + + dll_putenv(std::string("PYTHONPATH=" + CSpecialProtocol::TranslatePath("special://frameworks")).c_str()); - dll_putenv(string("PYTHONHOME=" + + dll_putenv(std::string("PYTHONHOME=" + CSpecialProtocol::TranslatePath("special://frameworks")).c_str()); - dll_putenv(string("PATH=.;" + + dll_putenv(std::string("PATH=.;" + CSpecialProtocol::TranslatePath("special://xbmc") + ";" + CSpecialProtocol::TranslatePath("special://frameworks")).c_str()); } else { - dll_putenv(string("PYTHONPATH=" + + dll_putenv(std::string("PYTHONPATH=" + CSpecialProtocol::TranslatePath("special://xbmc/system/python/DLLs") + ";" + CSpecialProtocol::TranslatePath("special://xbmc/system/python/Lib")).c_str()); - dll_putenv(string("PYTHONHOME=" + + dll_putenv(std::string("PYTHONHOME=" + CSpecialProtocol::TranslatePath("special://xbmc/system/python")).c_str()); - dll_putenv(string("PATH=.;" + CSpecialProtocol::TranslatePath("special://xbmc") + ";" + + dll_putenv(std::string("PATH=.;" + CSpecialProtocol::TranslatePath("special://xbmc") + ";" + CSpecialProtocol::TranslatePath("special://xbmc/system/python")).c_str()); } #if defined(TARGET_ANDROID) - string apkPath = getenv("XBMC_ANDROID_APK"); + std::string apkPath = getenv("XBMC_ANDROID_APK"); apkPath += "/assets/python2.6"; - dll_putenv(string("PYTHONHOME=" + apkPath).c_str()); + dll_putenv(std::string("PYTHONHOME=" + apkPath).c_str()); dll_putenv("PYTHONOPTIMIZE="); dll_putenv("PYTHONNOUSERSITE=1"); dll_putenv("PYTHONPATH="); @@ -855,18 +854,18 @@ extern "C" // non-local files. handle through IDirectory-class - only supports '*.bah' or '*.*' std::string strURL(file); std::string strMask; - if (url.GetFileName().find("*.*") != string::npos) + if (url.GetFileName().find("*.*") != std::string::npos) { std::string strReplaced = url.GetFileName(); StringUtils::Replace(strReplaced, "*.*",""); url.SetFileName(strReplaced); } - else if (url.GetFileName().find("*.") != string::npos) + else if (url.GetFileName().find("*.") != std::string::npos) { strMask = URIUtils::GetExtension(url.GetFileName()); url.SetFileName(url.GetFileName().substr(0, url.GetFileName().find("*."))); } - else if (url.GetFileName().find("*") != string::npos) + else if (url.GetFileName().find("*") != std::string::npos) { std::string strReplaced = url.GetFileName(); StringUtils::Replace(strReplaced, "*",""); From 3601d70950feb93f92e8d6d95f97c952ce69bb0e Mon Sep 17 00:00:00 2001 From: Matthias Kortstiege Date: Fri, 28 Aug 2015 12:07:17 +0200 Subject: [PATCH 22/22] [goom] use std:: instead of using namespace std --- xbmc/visualizations/Goom/Main.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/xbmc/visualizations/Goom/Main.cpp b/xbmc/visualizations/Goom/Main.cpp index 890e01a68766b..b6325e04d7900 100644 --- a/xbmc/visualizations/Goom/Main.cpp +++ b/xbmc/visualizations/Goom/Main.cpp @@ -55,8 +55,6 @@ unsigned char* g_goom_buffer = NULL; short g_audio_data[2][512]; std::string g_configFile; -using namespace std; - //-- Create ------------------------------------------------------------------- // Called once when the visualisation is created by XBMC. Do any setup here. //----------------------------------------------------------------------------- @@ -68,8 +66,8 @@ extern "C" ADDON_STATUS ADDON_Create(void* hdl, void* props) VIS_PROPS* visprops = (VIS_PROPS*)props; strcpy(g_visName, visprops->name); - g_configFile = string(visprops->profile) + string("/goom.conf"); - std::string presetsDir = string(visprops->presets) + string("/resources"); + g_configFile = std::string(visprops->profile) + std::string("/goom.conf"); + std::string presetsDir = std::string(visprops->presets) + std::string("/resources"); /** Initialise Goom */ if (g_goom)