[vlc-commits] demux: adaptive: add icasecmp helper

Francois Cartegnie git at videolan.org
Fri Apr 13 11:04:07 CEST 2018


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Apr 10 09:51:06 2018 +0200| [dd2454b5db06decec5eb0acf414a247b20d7170e] | committer: Francois Cartegnie

demux: adaptive: add icasecmp helper

(cherry picked from commit 5e75d07bd073dccdff146aed4d7309e7fe46de70)
(cherry picked from commit 870b6dbc47bf94f43f93f8c3e0715bbf879c5b8c)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=dd2454b5db06decec5eb0acf414a247b20d7170e
---

 modules/demux/adaptive/tools/Helper.cpp | 10 ++++++++++
 modules/demux/adaptive/tools/Helper.h   |  1 +
 2 files changed, 11 insertions(+)

diff --git a/modules/demux/adaptive/tools/Helper.cpp b/modules/demux/adaptive/tools/Helper.cpp
index d45dacaf16..e0e80dfcaa 100644
--- a/modules/demux/adaptive/tools/Helper.cpp
+++ b/modules/demux/adaptive/tools/Helper.cpp
@@ -68,6 +68,16 @@ std::string Helper::getFileExtension (const std::string &uri)
     return extension.substr(pos + 1);
 }
 
+bool Helper::icaseEquals(std::string str1, std::string str2)
+{
+    if(str1.size() != str2.size())
+        return false;
+
+    std::transform(str1.begin(), str1.end(), str1.begin(), toupper);
+    std::transform(str2.begin(), str2.end(), str2.begin(), toupper);
+    return str1 == str2;
+}
+
 bool Helper::ifind(std::string haystack, std::string needle)
 {
     transform(haystack.begin(), haystack.end(), haystack.begin(), toupper);
diff --git a/modules/demux/adaptive/tools/Helper.h b/modules/demux/adaptive/tools/Helper.h
index 4e58d6375c..41cc4fcf42 100644
--- a/modules/demux/adaptive/tools/Helper.h
+++ b/modules/demux/adaptive/tools/Helper.h
@@ -36,6 +36,7 @@ namespace adaptive
             static std::string combinePaths     (const std::string &path1, const std::string &path2);
             static std::string getDirectoryPath (const std::string &path);
             static std::string getFileExtension (const std::string &uri);
+            static bool        icaseEquals     (std::string str1, std::string str2);
             static bool        ifind            (std::string haystack, std::string needle);
             static std::list<std::string> tokenize(const std::string &, char);
     };



More information about the vlc-commits mailing list