if (URIUtils::IsUPnP(item.GetPath()))
{
CFileItem item_new(item);
- if (XFILE::CUPnPDirectory::GetResource(item.GetPath(), item_new))
+ if (XFILE::CUPnPDirectory::GetResource(item.GetURL(), item_new))
return PlayFile(item_new, false);
return PLAYBACK_FAIL;
}
#ifdef HAS_UPNP
if (URIUtils::IsUPnP(file.GetPath()))
{
- if (!XFILE::CUPnPDirectory::GetResource(file.GetPath(), file))
+ if (!XFILE::CUPnPDirectory::GetResource(file.GetURL(), file))
return true;
}
#endif
class CURL
{
public:
- CURL(const CStdString& strURL);
+ explicit CURL(const CStdString& strURL);
CURL();
virtual ~CURL(void);
+ // explicit equals operator for std::string comparison
+ bool operator==(const std::string &url) const { return Get() == url; }
+
void Reset();
void Parse(const CStdString& strURL);
void SetFileName(const CStdString& strFileName);
bool CCurlFile::Service(const CStdString& strURL, CStdString& strHTML)
{
- if (Open(strURL))
+ const CURL pathToUrl(strURL);
+ if (Open(pathToUrl))
{
if (ReadData(strHTML))
{
// Detect whether we are "online" or not! Very simple and dirty!
bool CCurlFile::IsInternet()
{
- CStdString strURL = "http://www.google.com";
- bool found = Exists(strURL);
+ CURL url("http://www.google.com");
+ bool found = Exists(url);
Close();
return found;
bool CFile::Exists(const CStdString& strFileName, bool bUseCache /* = true */)
{
- CURL url = URIUtils::SubstitutePath(strFileName);
+ CURL url(URIUtils::SubstitutePath(strFileName));
try
{
if (!buffer)
return -1;
- CURL url;
-
+ CURL url(URIUtils::SubstitutePath(strFileName));
+
try
{
- url = URIUtils::SubstitutePath(strFileName);
-
auto_ptr<IFile> pFile(CFileFactory::CreateLoader(url));
if (!pFile.get())
return -1;
bool CMythDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items)
{
- m_session = CMythSession::AquireSession(strPath);
+ m_session = CMythSession::AquireSession(CURL(strPath));
if (!m_session)
return false;
url2.SetProtocolOptions(url2.GetProtocolOptions()+"&noshout=true&Icy-MetaData=1");
url2.SetProtocol("http");
- bool result = m_file.Open(url2.Get());
+ bool result = m_file.Open(url2);
if (result)
{
m_tag.SetTitle(m_file.GetHttpHeader().GetValue("icy-name"));
bool CUPnPFile::Open(const CURL& url)
{
CFileItem item_new;
- if (CUPnPDirectory::GetResource(url.Get(), item_new))
+ if (CUPnPDirectory::GetResource(url, item_new))
{
//CLog::Log(LOGDEBUG,"FileUPnP - file redirect to %s.", item_new.GetPath().c_str());
IFile *pNewImp = CFileFactory::CreateLoader(item_new.GetPath());
int CUPnPFile::Stat(const CURL& url, struct __stat64* buffer)
{
CFileItem item_new;
- if (CUPnPDirectory::GetResource(url.Get(), item_new))
+ if (CUPnPDirectory::GetResource(url, item_new))
{
//CLog::Log(LOGDEBUG,"FileUPnP - file redirect to %s.", item_new.GetPath().c_str());
IFile *pNewImp = CFileFactory::CreateLoader(item_new.GetPath());
bool CUPnPFile::Exists(const CURL& url)
{
CFileItem item_new;
- if (CUPnPDirectory::GetResource(url.Get(), item_new))
+ if (CUPnPDirectory::GetResource(url, item_new))
{
//CLog::Log(LOGDEBUG,"FileUPnP - file redirect to %s.", item_new.GetPath().c_str());
IFile *pNewImp = CFileFactory::CreateLoader(item_new.GetPath());
void* CAirTunesServer::AudioOutputFunctions::audio_init(void *cls, int bits, int channels, int samplerate)
{
XFILE::CPipeFile *pipe=(XFILE::CPipeFile *)cls;
- pipe->OpenForWrite(XFILE::PipesManager::GetInstance().GetUniquePipeName());
+ const CURL pathToUrl(XFILE::PipesManager::GetInstance().GetUniquePipeName());
+ pipe->OpenForWrite(pathToUrl);
pipe->SetOpenThreashold(300);
Demux_BXA_FmtHeader header;
{
for (CStdStringArray::const_iterator it = source.vecPaths.begin() ; it != source.vecPaths.end(); it++)
{
- CURL url = *it;
+ CURL url(*it);
AddHost (url.GetHostName(), hosts);
}
// add from path substitutions ..
for (CAdvancedSettings::StringMapping::iterator i = g_advancedSettings.m_pathSubstitutions.begin(); i != g_advancedSettings.m_pathSubstitutions.end(); ++i)
{
- CURL url = i->second;
+ CURL url(i->second);
AddHost (url.GetHostName(), hosts);
}
m_path = request.url.substr(7);
XFILE::CImageFile imageFile;
- if (imageFile.Exists(m_path))
+ const CURL pathToUrl(m_path);
+ if (imageFile.Exists(pathToUrl))
{
m_responseCode = MHD_HTTP_OK;
m_responseType = HTTPFileDownload;