From 6de9ea8a0fbe8cb26681267e5fd589dcc3ce7359 Mon Sep 17 00:00:00 2001 From: LaurentGom Date: Wed, 8 Sep 2010 18:52:39 +0000 Subject: [PATCH] Workarounds used sf::Utf classes for broken MinGW locales, are not used when STLPort is detected git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1566 4e206d99-4929-0410-ac5d-dfc041789085 --- include/SFML/System/Utf.inl | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/include/SFML/System/Utf.inl b/include/SFML/System/Utf.inl index 552c6177f..47c705454 100644 --- a/include/SFML/System/Utf.inl +++ b/include/SFML/System/Utf.inl @@ -561,11 +561,14 @@ Out Utf<32>::ToUtf32(In begin, In end, Out output) template Uint32 Utf<32>::DecodeAnsi(In input, const std::locale& locale) { - #ifdef __MINGW32__ + // 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. - // MinGW has almost no support for unicode stuff - // As a consequence, the MinGW version of this function can only use the default locale - // and ignores 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); @@ -601,11 +604,14 @@ Uint32 Utf<32>::DecodeWide(In input) template Out Utf<32>::EncodeAnsi(Uint32 codepoint, Out output, char replacement, const std::locale& locale) { - #ifdef __MINGW32__ + // 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. - // MinGW has almost no support for unicode stuff - // As a consequence, the MinGW version of this function can only use the default locale - // and ignores 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)