From a6471234a22e15176424d24cb31be56fd8e73061 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Tue, 27 Jun 2017 12:45:02 +0200 Subject: [PATCH] FileSearch: Use strcasecmp in non-std code Because why should only Windows get in on the FileSearch speedup fun? (Not that this fixes the slowness of File::ScanDirectoryTree...) --- Source/Core/Common/FileSearch.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/Core/Common/FileSearch.cpp b/Source/Core/Common/FileSearch.cpp index 4b3b0820d2..cca5c095f7 100644 --- a/Source/Core/Common/FileSearch.cpp +++ b/Source/Core/Common/FileSearch.cpp @@ -14,6 +14,8 @@ namespace fs = std::experimental::filesystem; #define HAS_STD_FILESYSTEM #else +#include +#include "Common/CommonFuncs.h" #include "Common/FileUtil.h" #endif @@ -55,11 +57,10 @@ std::vector DoFileSearch(const std::vector& directorie return true; if (entry.isDirectory) return false; - std::string name = entry.virtualName; - std::transform(name.begin(), name.end(), name.begin(), ::tolower); return std::any_of(exts.begin(), exts.end(), [&](const std::string& ext) { + const std::string& name = entry.virtualName; return name.length() >= ext.length() && - name.compare(name.length() - ext.length(), ext.length(), ext) == 0; + strcasecmp(name.c_str() + name.length() - ext.length(), ext.c_str()) == 0; }); }); }