diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/cpu_caps.cpp | 1 | ||||
-rw-r--r-- | core/helpers.cpp | 18 | ||||
-rw-r--r-- | core/helpers.h | 14 |
3 files changed, 21 insertions, 12 deletions
diff --git a/core/cpu_caps.cpp b/core/cpu_caps.cpp index d4b4d86c..165edb24 100644 --- a/core/cpu_caps.cpp +++ b/core/cpu_caps.cpp @@ -17,6 +17,7 @@ #include <intrin.h> #endif +#include <algorithm> #include <array> #include <cctype> #include <string> diff --git a/core/helpers.cpp b/core/helpers.cpp index 99cf009c..71ddbc23 100644 --- a/core/helpers.cpp +++ b/core/helpers.cpp @@ -41,7 +41,7 @@ const PathNamePair &GetProcBinary() static al::optional<PathNamePair> procbin; if(procbin) return *procbin; - auto fullpath = al::vector<WCHAR>(256); + auto fullpath = std::vector<WCHAR>(256); DWORD len{GetModuleFileNameW(nullptr, fullpath.data(), static_cast<DWORD>(fullpath.size()))}; while(len == fullpath.size()) { @@ -75,7 +75,7 @@ const PathNamePair &GetProcBinary() namespace { -void DirectorySearch(const char *path, const char *ext, al::vector<std::string> *const results) +void DirectorySearch(const char *path, const char *ext, std::vector<std::string> *const results) { std::string pathstr{path}; pathstr += "\\*"; @@ -106,7 +106,7 @@ void DirectorySearch(const char *path, const char *ext, al::vector<std::string> } // namespace -al::vector<std::string> SearchDataFiles(const char *ext, const char *subdir) +std::vector<std::string> SearchDataFiles(const char *ext, const char *subdir) { auto is_slash = [](int c) noexcept -> int { return (c == '\\' || c == '/'); }; @@ -114,7 +114,7 @@ al::vector<std::string> SearchDataFiles(const char *ext, const char *subdir) std::lock_guard<std::mutex> _{search_lock}; /* If the path is absolute, use it directly. */ - al::vector<std::string> results; + std::vector<std::string> results; if(isalpha(subdir[0]) && subdir[1] == ':' && is_slash(subdir[2])) { std::string path{subdir}; @@ -212,7 +212,7 @@ const PathNamePair &GetProcBinary() static al::optional<PathNamePair> procbin; if(procbin) return *procbin; - al::vector<char> pathname; + std::vector<char> pathname; #ifdef __FreeBSD__ size_t pathlen; int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 }; @@ -295,7 +295,7 @@ const PathNamePair &GetProcBinary() namespace { -void DirectorySearch(const char *path, const char *ext, al::vector<std::string> *const results) +void DirectorySearch(const char *path, const char *ext, std::vector<std::string> *const results) { TRACE("Searching %s for *%s\n", path, ext); DIR *dir{opendir(path)}; @@ -331,12 +331,12 @@ void DirectorySearch(const char *path, const char *ext, al::vector<std::string> } // namespace -al::vector<std::string> SearchDataFiles(const char *ext, const char *subdir) +std::vector<std::string> SearchDataFiles(const char *ext, const char *subdir) { static std::mutex search_lock; std::lock_guard<std::mutex> _{search_lock}; - al::vector<std::string> results; + std::vector<std::string> results; if(subdir[0] == '/') { DirectorySearch(subdir, ext, &results); @@ -348,7 +348,7 @@ al::vector<std::string> SearchDataFiles(const char *ext, const char *subdir) DirectorySearch(localpath->c_str(), ext, &results); else { - al::vector<char> cwdbuf(256); + std::vector<char> cwdbuf(256); while(!getcwd(cwdbuf.data(), cwdbuf.size())) { if(errno != ERANGE) diff --git a/core/helpers.h b/core/helpers.h index f0bfcf1b..df51c116 100644 --- a/core/helpers.h +++ b/core/helpers.h @@ -1,18 +1,26 @@ #ifndef CORE_HELPERS_H #define CORE_HELPERS_H +#include <utility> #include <string> +#include <vector> -#include "vector.h" +struct PathNamePair { + std::string path, fname; -struct PathNamePair { std::string path, fname; }; + PathNamePair() = default; + template<typename T, typename U> + PathNamePair(T&& path_, U&& fname_) + : path{std::forward<T>(path_)}, fname{std::forward<U>(fname_)} + { } +}; const PathNamePair &GetProcBinary(void); extern int RTPrioLevel; extern bool AllowRTTimeLimit; void SetRTPriority(void); -al::vector<std::string> SearchDataFiles(const char *match, const char *subdir); +std::vector<std::string> SearchDataFiles(const char *match, const char *subdir); #endif /* CORE_HELPERS_H */ |