lib/icu/CaseFold: disable broken strxfrm() callback
This commit is contained in:
parent
1295a1272a
commit
828f5f8384
|
@ -19,6 +19,9 @@
|
|||
|
||||
#include "config.h"
|
||||
#include "CaseFold.hxx"
|
||||
|
||||
#ifdef HAVE_ICU_CASE_FOLD
|
||||
|
||||
#include "util/AllocatedString.hxx"
|
||||
|
||||
#ifdef HAVE_ICU
|
||||
|
@ -90,22 +93,10 @@ try {
|
|||
return WideCharToMultiByte(CP_UTF8, buffer.get());
|
||||
|
||||
#else
|
||||
size_t size = strlen(src) + 1;
|
||||
std::unique_ptr<char[]> buffer(new char[size]);
|
||||
size_t nbytes = strxfrm(buffer.get(), src, size);
|
||||
if (nbytes >= size) {
|
||||
/* buffer too small - reallocate and try again */
|
||||
buffer.reset();
|
||||
size = nbytes + 1;
|
||||
buffer.reset(new char[size]);
|
||||
nbytes = strxfrm(buffer.get(), src, size);
|
||||
}
|
||||
|
||||
assert(nbytes < size);
|
||||
assert(buffer[nbytes] == 0);
|
||||
|
||||
return AllocatedString<>::Donate(buffer.release());
|
||||
#error not implemented
|
||||
#endif
|
||||
} catch (const std::runtime_error &) {
|
||||
return AllocatedString<>::Duplicate(src);
|
||||
}
|
||||
|
||||
#endif /* HAVE_ICU_CASE_FOLD */
|
||||
|
|
|
@ -21,11 +21,11 @@
|
|||
#define MPD_ICU_CASE_FOLD_HXX
|
||||
|
||||
#include "check.h"
|
||||
#include "Compiler.h"
|
||||
|
||||
#if defined(HAVE_ICU) || defined(_WIN32)
|
||||
#define HAVE_ICU_CASE_FOLD
|
||||
#endif
|
||||
|
||||
#include "Compiler.h"
|
||||
|
||||
template<typename T> class AllocatedString;
|
||||
|
||||
|
@ -34,3 +34,5 @@ AllocatedString<char>
|
|||
IcuCaseFold(const char *src) noexcept;
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue