From 0862cb49e24bc03b043226329462abfa8874efef Mon Sep 17 00:00:00 2001 From: Alwin Esch Date: Wed, 6 Sep 2023 20:40:18 +0200 Subject: [PATCH] [utils] change old "URIUtils::HasExtension(...)" to give his vector to new function As on commit before the new function was added where handle the strings by vector, is on old the code no more needed and can call the new. --- xbmc/utils/URIUtils.cpp | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/xbmc/utils/URIUtils.cpp b/xbmc/utils/URIUtils.cpp index a38a455000f1f..3b700b762ca1e 100644 --- a/xbmc/utils/URIUtils.cpp +++ b/xbmc/utils/URIUtils.cpp @@ -90,28 +90,8 @@ bool URIUtils::HasExtension(const CURL& url, const std::string& strExtensions) bool URIUtils::HasExtension(const std::string& strFileName, const std::string& strExtensions) { - if (IsURL(strFileName)) - { - const CURL url(strFileName); - return HasExtension(url.GetFileName(), strExtensions); - } - - const size_t pos = strFileName.find_last_of("./\\"); - if (pos == std::string::npos || strFileName[pos] != '.') - return false; - - const std::string extensionLower = StringUtils::ToLower(strFileName.substr(pos)); - - const std::vector extensionsLower = - StringUtils::Split(StringUtils::ToLower(strExtensions), '|'); - - for (const auto& ext : extensionsLower) - { - if (StringUtils::EndsWith(ext, extensionLower)) - return true; - } - - return false; + const std::vector extList = StringUtils::Split(strExtensions, '|'); + return HasExtension(strFileName, extList); } bool URIUtils::HasExtension(const CURL& url, const std::vector& extList)