Merge tag 'v0.21.23'
release v0.21.23
This commit is contained in:
@@ -34,12 +34,6 @@
|
||||
#include <algorithm>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "Win32.hxx"
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <cassert>
|
||||
#include <memory>
|
||||
|
||||
#include <string.h>
|
||||
@@ -65,27 +59,6 @@ try {
|
||||
folded.SetSize(folded_length);
|
||||
return UCharToUTF8({folded.begin(), folded.size()});
|
||||
|
||||
#elif defined(_WIN32)
|
||||
const auto u = MultiByteToWideChar(CP_UTF8, src);
|
||||
|
||||
const int size = LCMapStringEx(LOCALE_NAME_INVARIANT,
|
||||
LCMAP_SORTKEY|LINGUISTIC_IGNORECASE,
|
||||
u.c_str(), -1, nullptr, 0,
|
||||
nullptr, nullptr, 0);
|
||||
if (size <= 0)
|
||||
return AllocatedString<>::Duplicate(src);
|
||||
|
||||
std::unique_ptr<wchar_t[]> buffer(new wchar_t[size]);
|
||||
int result = LCMapStringEx(LOCALE_NAME_INVARIANT,
|
||||
LCMAP_SORTKEY|LINGUISTIC_IGNORECASE,
|
||||
u.c_str(), -1, buffer.get(), size,
|
||||
nullptr, nullptr, 0);
|
||||
if (result <= 0)
|
||||
return AllocatedString<>::Duplicate(src);
|
||||
|
||||
return WideCharToMultiByte(CP_UTF8,
|
||||
{buffer.get(), size_t(result - 1)});
|
||||
|
||||
#else
|
||||
#error not implemented
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user