From 3b0f8d551630cdc23f3ba003014e22376dbe8ff0 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 22 Apr 2020 19:30:16 +0200 Subject: [PATCH] lib/icu/CaseFold: remove Windows implementation Reverts commit fb3564fbe76a10a0825bd06c0ff19f481d94b835 LCMapStringEx() doesn't do what I imagined it would do 5 years ago. D'oh! Closes https://github.com/MusicPlayerDaemon/MPD/issues/820 --- NEWS | 2 ++ src/lib/icu/CaseFold.cxx | 24 ------------------------ src/lib/icu/CaseFold.hxx | 2 +- 3 files changed, 3 insertions(+), 25 deletions(-) diff --git a/NEWS b/NEWS index ac5656a6b..198302b20 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,8 @@ ver 0.21.23 (not yet released) - alsa: implement channel mapping for 5.0 and 7.0 * player - drain outputs at end of song in "single" mode +* Windows + - fix case insensitive search ver 0.21.22 (2020/04/02) * database diff --git a/src/lib/icu/CaseFold.cxx b/src/lib/icu/CaseFold.cxx index 8ad8dadfa..e7cf5ba26 100644 --- a/src/lib/icu/CaseFold.cxx +++ b/src/lib/icu/CaseFold.cxx @@ -36,11 +36,6 @@ #include #endif -#ifdef _WIN32 -#include "Win32.hxx" -#include -#endif - #include #include @@ -72,25 +67,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 buffer(new wchar_t[size]); - if (LCMapStringEx(LOCALE_NAME_INVARIANT, - LCMAP_SORTKEY|LINGUISTIC_IGNORECASE, - u.c_str(), -1, buffer.get(), size, - nullptr, nullptr, 0) <= 0) - return AllocatedString<>::Duplicate(src); - - return WideCharToMultiByte(CP_UTF8, buffer.get()); - #else #error not implemented #endif diff --git a/src/lib/icu/CaseFold.hxx b/src/lib/icu/CaseFold.hxx index 828415b9b..13a517e0a 100644 --- a/src/lib/icu/CaseFold.hxx +++ b/src/lib/icu/CaseFold.hxx @@ -22,7 +22,7 @@ #include "config.h" -#if defined(HAVE_ICU) || defined(_WIN32) +#ifdef HAVE_ICU #define HAVE_ICU_CASE_FOLD #include "util/Compiler.h"