#include "settings/AdvancedSettings.h"
#include "utils/log.h"
#include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
#include "URL.h"
#include "utils/StringUtils.h"
if (url != "-" && !CURL::IsFullPath(url))
return true;
if (URIUtils::IsInPath(url, "special://skin/") ||
+ URIUtils::IsInPath(url, "special://temp/") ||
URIUtils::IsInPath(url, "androidapp://") ||
URIUtils::IsInPath(url, CProfilesManager::Get().GetThumbnailsFolder()))
return true;
{
CTextureDetails details;
CStdString cachedImage(GetCachedImage(url, details));
- return (!cachedImage.IsEmpty() && cachedImage != url);
+ return (!cachedImage.empty() && cachedImage != url);
}
CStdString CTextureCache::GetCachedImage(const CStdString &image, CTextureDetails &details, bool trackUsage)
CTextureDetails details;
CStdString path(GetCachedImage(url, details, true));
needsRecaching = !details.hash.empty();
- if (!path.IsEmpty())
+ if (!path.empty())
{
if (!needsRecaching && returnDDS && !URIUtils::IsInPath(url, "special://skin/")) // TODO: should skin images be .dds'd (currently they're not necessarily writeable)
{ // check for dds version
{
CTextureDetails details;
CStdString path(GetCachedImage(url, details));
- if (!path.IsEmpty() && details.hash.empty())
+ if (!path.empty() && details.hash.empty())
return; // image is already cached and doesn't need to be checked further
// needs (re)caching
{
CStdString url = CTextureUtils::UnwrapImageURL(image);
CSingleLock lock(m_processingSection);
- if (m_processing.find(url) == m_processing.end())
+ if (m_processinglist.find(url) == m_processinglist.end())
{
- m_processing.insert(url);
+ m_processinglist.insert(url);
lock.Leave();
// cache the texture directly
CTextureCacheJob job(url);
m_completeEvent.WaitMSec(1000);
{
CSingleLock lock(m_processingSection);
- if (m_processing.find(url) == m_processing.end())
+ if (m_processinglist.find(url) == m_processinglist.end())
break;
}
}
{
Crc32 crc;
crc.ComputeFromLowerCase(url);
- CStdString hex;
- hex.Format("%08x", (unsigned int)crc);
- CStdString hash;
- hash.Format("%c/%s", hex[0], hex.c_str());
+ CStdString hex = StringUtils::Format("%08x", (unsigned int)crc);
+ CStdString hash = StringUtils::Format("%c/%s", hex[0], hex.c_str());
return hash;
}
{ // remove from our processing list
CSingleLock lock(m_processingSection);
- std::set<CStdString>::iterator i = m_processing.find(job->m_url);
- if (i != m_processing.end())
- m_processing.erase(i);
+ std::set<CStdString>::iterator i = m_processinglist.find(job->m_url);
+ if (i != m_processinglist.end())
+ m_processinglist.erase(i);
}
m_completeEvent.Set();
{
CSingleLock lock(m_processingSection);
const CTextureCacheJob *cacheJob = (CTextureCacheJob *)job;
- std::set<CStdString>::iterator i = m_processing.find(cacheJob->m_url);
- if (i == m_processing.end())
+ std::set<CStdString>::iterator i = m_processinglist.find(cacheJob->m_url);
+ if (i == m_processinglist.end())
{
- m_processing.insert(cacheJob->m_url);
+ m_processinglist.insert(cacheJob->m_url);
return;
}
}
{
CTextureDetails details;
CStdString cachedImage(GetCachedImage(image, details));
- if (!cachedImage.IsEmpty())
+ if (!cachedImage.empty())
{
CStdString dest = destination + URIUtils::GetExtension(cachedImage);
if (overwrite || !CFile::Exists(dest))
{
CTextureDetails details;
CStdString cachedImage(GetCachedImage(image, details));
- if (!cachedImage.IsEmpty())
+ if (!cachedImage.empty())
{
if (CFile::Cache(cachedImage, destination))
return true;