Merge pull request #4630 from Red-F/gotham-resume-pvr-lastplayedposition
[vuplus_xbmc] / xbmc / TextureCacheJob.cpp
index 7058fca..beeaa38 100644 (file)
@@ -102,7 +102,7 @@ bool CTextureCacheJob::CacheTexture(CBaseTexture **out_texture)
     return true;
   }
 #endif
-  CBaseTexture *texture = LoadImage(image, width, height, additional_info);
+  CBaseTexture *texture = LoadImage(image, width, height, additional_info, true);
   if (texture)
   {
     if (texture->HasAlpha())
@@ -145,7 +145,7 @@ CStdString CTextureCacheJob::DecodeImageURL(const CStdString &url, unsigned int
 
     image = thumbURL.GetHostName();
 
-    CStdString optionString = thumbURL.GetOptions().substr(1);
+    CStdString optionString = thumbURL.GetOptions().empty() ? "" : thumbURL.GetOptions().substr(1);
     StringUtils::TrimRight(optionString, "/"); // In case XBMC adds a slash.
 
     std::vector<CStdString> options;
@@ -153,8 +153,8 @@ CStdString CTextureCacheJob::DecodeImageURL(const CStdString &url, unsigned int
     for (std::vector<CStdString>::iterator i = options.begin(); i != options.end(); i++)
     {
       CStdString option, value;
-      int pos = i->Find('=');
-      if (pos != -1)
+      size_t pos = i->find('=');
+      if (pos != std::string::npos)
       {
         option = i->substr(0, pos);
         value  = i->substr(pos + 1);
@@ -177,7 +177,7 @@ CStdString CTextureCacheJob::DecodeImageURL(const CStdString &url, unsigned int
   return image;
 }
 
-CBaseTexture *CTextureCacheJob::LoadImage(const CStdString &image, unsigned int width, unsigned int height, const std::string &additional_info)
+CBaseTexture *CTextureCacheJob::LoadImage(const CStdString &image, unsigned int width, unsigned int height, const std::string &additional_info, bool requirePixels)
 {
   if (additional_info == "music")
   { // special case for embedded music images
@@ -193,7 +193,7 @@ CBaseTexture *CTextureCacheJob::LoadImage(const CStdString &image, unsigned int
       && !StringUtils::StartsWithNoCase(file.GetMimeType(), "image/") && !file.GetMimeType().Equals("application/octet-stream")) // ignore non-pictures
     return NULL;
 
-  CBaseTexture *texture = CBaseTexture::LoadFromFile(image, width, height, CSettings::Get().GetBool("pictures.useexifrotation"));
+  CBaseTexture *texture = CBaseTexture::LoadFromFile(image, width, height, CSettings::Get().GetBool("pictures.useexifrotation"), requirePixels, file.GetMimeType());
   if (!texture)
     return NULL;