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
This commit is contained in:
LaurentGom 2010-09-08 18:52:39 +00:00
parent 02688a4a3f
commit 6de9ea8a0f

View File

@ -561,11 +561,14 @@ Out Utf<32>::ToUtf32(In begin, In end, Out output)
template <typename In>
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 <typename Out>
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<wchar_t>(codepoint)) >= 0)