From 14dbd3c899368c90c2d0e9f0e56cbe66d0f2d95f Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Tue, 28 Mar 2023 21:48:20 -0600 Subject: [PATCH] Remove old workaround for MinGW's lack of unicode support Dates back to 2009 when 78247bd38 was written. I'm going to assume the situation has improved in the last 14 years. There are SFML users who weren't even alive in 2009... --- include/SFML/System/Utf.inl | 38 ------------------------------------- 1 file changed, 38 deletions(-) diff --git a/include/SFML/System/Utf.inl b/include/SFML/System/Utf.inl index f01ba7a2..02211135 100644 --- a/include/SFML/System/Utf.inl +++ b/include/SFML/System/Utf.inl @@ -657,28 +657,11 @@ Out Utf<32>::toUtf32(In begin, In end, Out output) template std::uint32_t Utf<32>::decodeAnsi(In input, [[maybe_unused]] const std::locale& locale) { - // On Windows, GCC's standard library (glibc++) has almost - // no support for Unicode stuff. As a consequence, in this - // context we can only use the default locale and ignore - // the one passed as parameter. - -#if defined(SFML_SYSTEM_WINDOWS) && /* if Windows ... */ \ - (defined(__GLIBCPP__) || defined(__GLIBCXX__)) && /* ... and standard library is glibc++ ... */ \ - !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) /* ... and STLPort is not used on top of it */ - - wchar_t character = 0; - mbtowc(&character, &input, 1); - return static_cast(character); - -#else - // Get the facet of the locale which deals with character conversion const auto& facet = std::use_facet>(locale); // Use the facet to convert each character of the input string return static_cast(facet.widen(input)); - -#endif } @@ -700,25 +683,6 @@ std::uint32_t Utf<32>::decodeWide(In input) template Out Utf<32>::encodeAnsi(std::uint32_t codepoint, Out output, char replacement, [[maybe_unused]] const std::locale& locale) { - // On Windows, gcc's standard library (glibc++) has almost - // no support for Unicode stuff. As a consequence, in this - // context we can only use the default locale and ignore - // the one passed as parameter. - -#if defined(SFML_SYSTEM_WINDOWS) && /* if Windows ... */ \ - (defined(__GLIBCPP__) || defined(__GLIBCXX__)) && /* ... and standard library is glibc++ ... */ \ - !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) /* ... and STLPort is not used on top of it */ - - char character = 0; - if (wctomb(&character, static_cast(codepoint)) >= 0) - *output++ = character; - else if (replacement) - *output++ = replacement; - - return output; - -#else - // Get the facet of the locale which deals with character conversion const auto& facet = std::use_facet>(locale); @@ -726,8 +690,6 @@ Out Utf<32>::encodeAnsi(std::uint32_t codepoint, Out output, char replacement, [ *output++ = facet.narrow(static_cast(codepoint), replacement); return output; - -#endif }