}
// URLDecode since the original path may be an URL
- CURL::Decode(strFilename);
+ strFilename = CURL::Decode(strFilename);
return strFilename;
}
const CStdStringArray ®exps = g_advancedSettings.m_videoCleanStringRegExps;
- CRegExp reTags(true, true);
- CRegExp reYear(false, true);
+ CRegExp reTags(true, CRegExp::autoUtf8);
+ CRegExp reYear(false, CRegExp::autoUtf8);
if (!reYear.RegComp(g_advancedSettings.m_videoCleanDateTimeRegExp))
{
if (strFileOrFolder.empty())
return false;
- CRegExp regExExcludes(true, true); // case insensitive regex
+ CRegExp regExExcludes(true, CRegExp::autoUtf8); // case insensitive regex
for (unsigned int i = 0; i < regexps.size(); i++)
{
// Check for special protocols
CURL checkURL(strPath);
+ if (StringUtils::StartsWith(strPath, "special://skin/"))
+ return 1;
+
// stack://
if (checkURL.GetProtocol() == "stack")
strPath.erase(0, 8); // remove the stack protocol
// since we add the drive status and disc name to the source
// "Name (Drive Status/Disc Name)"
size_t iPos = strName.rfind('(');
- if (iPos > 1)
+ if (iPos != std::string::npos && iPos > 1)
strName = strName.substr(0, iPos - 1);
}
if (strPath.Equals(strName))
if (!URIUtils::HasSlashAtEnd(strDest))
strDest += "/";
- size_t iLength = std::string::npos;
+ size_t iLength = 0;
size_t iLenPath = strDest.size();
for (int i = 0; i < (int)VECSOURCES.size(); ++i)
{
void CUtil::ForceForwardSlashes(CStdString& strPath)
{
size_t iPos = strPath.rfind('\\');
- while (iPos > 0)
+ while (iPos != string::npos)
{
strPath.at(iPos) = '/';
iPos = strPath.rfind('\\');
continue;
}
}
- if (info.flag == 0x1111)
+
+ // try to recognize a flag
+ std::string flag_tmp(*it);
+ StringUtils::ToLower(flag_tmp);
+ if (!flag_tmp.compare("none"))
{
- std::string flag_tmp(*it);
- StringUtils::ToLower(flag_tmp);
- if (!flag_tmp.compare("none"))
- {
- info.flag = CDemuxStream::FLAG_NONE;
- continue;
- }
- else if (!flag_tmp.compare("default"))
- {
- info.flag = CDemuxStream::FLAG_DEFAULT;
- continue;
- }
- else if (!flag_tmp.compare("forced"))
- {
- info.flag = CDemuxStream::FLAG_FORCED;
- continue;
- }
+ info.flag |= CDemuxStream::FLAG_NONE;
+ continue;
+ }
+ else if (!flag_tmp.compare("default"))
+ {
+ info.flag |= CDemuxStream::FLAG_DEFAULT;
+ continue;
}
+ else if (!flag_tmp.compare("forced"))
+ {
+ info.flag |= CDemuxStream::FLAG_FORCED;
+ continue;
+ }
+
name += " " + (*it);
}
}
name += g_localizeStrings.Get(21602); // External
StringUtils::Trim(name);
info.name = StringUtils::RemoveDuplicatedSpacesAndTabs(name);
- if (info.flag == 0x1111)
+ if (info.flag == 0)
info.flag = CDemuxStream::FLAG_NONE;
CLog::Log(LOGDEBUG, "%s - Language = '%s' / Name = '%s' / Flag = '%u' from %s", __FUNCTION__, info.language.c_str(), info.name.c_str(), info.flag, strStream.c_str());
CStdString strSubDirectory;
URIUtils::Split(vecSubtitles[j], strSubDirectory, strSubFile);
if (URIUtils::IsInArchive(vecSubtitles[j]))
- CURL::Decode(strSubDirectory);
+ strSubDirectory = CURL::Decode(strSubDirectory);
if (URIUtils::HasExtension(strSubFile, ".sub") &&
(URIUtils::ReplaceExtension(strIdxFile,"").Equals(URIUtils::ReplaceExtension(strSubFile,"")) ||
- StringUtils::EqualsNoCase(strSubDirectory.substr(6, strSubDirectory.length()-11), URIUtils::ReplaceExtension(strIdxPath,""))))
+ (strSubDirectory.size() >= 11 &&
+ StringUtils::EqualsNoCase(strSubDirectory.substr(6, strSubDirectory.length()-11), URIUtils::ReplaceExtension(strIdxPath,"")))))
{
strSubPath = vecSubtitles[j];
return true;
CStdString strSubDirectory;
URIUtils::Split(strSubPath, strSubDirectory, strSubFile);
if (URIUtils::IsInArchive(strSubPath))
- CURL::Decode(strSubDirectory);
+ strSubDirectory = CURL::Decode(strSubDirectory);
for (unsigned int j=0; j < vecSubtitles.size(); j++)
{
CStdString strIdxFile;
URIUtils::Split(vecSubtitles[j], strIdxDirectory, strIdxFile);
if (URIUtils::HasExtension(strIdxFile, ".idx") &&
(URIUtils::ReplaceExtension(strIdxFile,"").Equals(URIUtils::ReplaceExtension(strSubFile,"")) ||
- StringUtils::EqualsNoCase(strSubDirectory.substr(6, strSubDirectory.length()-11), URIUtils::ReplaceExtension(vecSubtitles[j],""))))
+ (strSubDirectory.size() >= 11 &&
+ StringUtils::EqualsNoCase(strSubDirectory.substr(6, strSubDirectory.length()-11), URIUtils::ReplaceExtension(vecSubtitles[j],"")))))
return true;
}
}