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

Commit ddb2610

Browse files
committed
Fix crash on certain locales (Chinese for example) #95
1 parent c85bc89 commit ddb2610

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

libs/external-file-loader/include/mod.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <functional>
55
#include <unordered_map>
66
#include <vector>
7+
#include <cstring>
78

89
namespace fs = std::filesystem;
910

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

20-
return fs::hash_value(c);
21+
return fs::hash_value(s);
2122
}
2223
};
2324

2425
template <> struct equal_to<fs::path> {
2526
bool operator()(const fs::path &l, const fs::path &r) const {
26-
auto left = l.lexically_normal().u8string();
27-
utf8upr(left.data());
27+
auto left = l.lexically_normal().wstring();
28+
auto ls = _wcsupr(left.data());
2829

29-
auto right = r.lexically_normal().u8string();
30-
utf8upr(right.data());
30+
auto right = r.lexically_normal().wstring();
31+
auto rs =_wcsupr(right.data());
3132

32-
return left == right;
33+
return wcscmp(ls, rs) == 0;
3334
}
3435
};
3536

libs/python35/src/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// clang-format off
44
#define VERSION_MAJOR 0
55
#define VERSION_MINOR 8
6-
#define VERSION_REVISION 1
6+
#define VERSION_REVISION 2
77

88
#define STRINGIFY_(s) #s
99
#define STRINGIFY(s) STRINGIFY_(s)

0 commit comments

Comments
 (0)