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

Francois Cartegnie git at videolan.org
Tue Apr 10 09:53:51 CEST 2018


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

demux: adaptive: add icasecmp helper

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

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

diff --git a/modules/demux/adaptive/tools/Helper.cpp b/modules/demux/adaptive/tools/Helper.cpp
index d45dacaf16..a2a402075c 100644
--- a/modules/demux/adaptive/tools/Helper.cpp
+++ b/modules/demux/adaptive/tools/Helper.cpp
@@ -68,6 +68,13 @@ std::string Helper::getFileExtension (const std::string &uri)
     return extension.substr(pos + 1);
 }
 
+bool Helper::icaseEquals(std::string str1, std::string str2)
+{
+    transform(str1.begin(), str1.end(), str1.begin(), toupper);
+    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