Skip to content
This repository has been archived by the owner on Aug 4, 2023. It is now read-only.

Commit

Permalink
Fix crash on certain locales (Chinese for example) #95
Browse files Browse the repository at this point in the history
  • Loading branch information
xforce committed Sep 1, 2021
1 parent c85bc89 commit ddb2610
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
17 changes: 9 additions & 8 deletions libs/external-file-loader/include/mod.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <functional>
#include <unordered_map>
#include <vector>
#include <cstring>

namespace fs = std::filesystem;

Expand All @@ -14,22 +15,22 @@ namespace std
template <> struct hash<fs::path> {
size_t operator()(const fs::path &x) const
{
auto c = x.lexically_normal().u8string();
utf8upr(c.data());
auto c = x.lexically_normal().wstring();
auto s = _wcsupr(c.data());

return fs::hash_value(c);
return fs::hash_value(s);
}
};

template <> struct equal_to<fs::path> {
bool operator()(const fs::path &l, const fs::path &r) const {
auto left = l.lexically_normal().u8string();
utf8upr(left.data());
auto left = l.lexically_normal().wstring();
auto ls = _wcsupr(left.data());

auto right = r.lexically_normal().u8string();
utf8upr(right.data());
auto right = r.lexically_normal().wstring();
auto rs =_wcsupr(right.data());

return left == right;
return wcscmp(ls, rs) == 0;
}
};

Expand Down
2 changes: 1 addition & 1 deletion libs/python35/src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// clang-format off
#define VERSION_MAJOR 0
#define VERSION_MINOR 8
#define VERSION_REVISION 1
#define VERSION_REVISION 2

#define STRINGIFY_(s) #s
#define STRINGIFY(s) STRINGIFY_(s)
Expand Down

0 comments on commit ddb2610

Please sign in to comment.