From 573e18eabd0df33521c13b0df0fde74c8769bf3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 13 Nov 2013 11:57:30 +0100 Subject: [PATCH] Broken std::u32string is also only MinGW32's fault. MSVC doesn't have it at all, for security reasons ;-) --- .../MagnumFontConverter/MagnumFontConverter.cpp | 2 +- .../MagnumFontConverter/MagnumFontConverter.h | 2 +- src/Text/AbstractFont.cpp | 2 +- src/Text/AbstractFont.h | 2 +- src/Text/AbstractFontConverter.cpp | 10 +++++----- src/Text/AbstractFontConverter.h | 8 ++++---- src/Text/Test/AbstractFontConverterTest.cpp | 14 +++++++------- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/Plugins/MagnumFontConverter/MagnumFontConverter.cpp b/src/Plugins/MagnumFontConverter/MagnumFontConverter.cpp index 4b5fce79c..1e6f381b2 100644 --- a/src/Plugins/MagnumFontConverter/MagnumFontConverter.cpp +++ b/src/Plugins/MagnumFontConverter/MagnumFontConverter.cpp @@ -44,7 +44,7 @@ auto MagnumFontConverter::doFeatures() const -> Features { return Feature::ExportFont|Feature::ConvertData|Feature::MultiFile; } -#ifndef _WIN32 +#ifndef __MINGW32__ std::vector>> MagnumFontConverter::doExportFontToData(AbstractFont& font, GlyphCache& cache, const std::string& filename, const std::u32string& characters) const #else std::vector>> MagnumFontConverter::doExportFontToData(AbstractFont& font, GlyphCache& cache, const std::string& filename, const std::vector& characters) const diff --git a/src/Plugins/MagnumFontConverter/MagnumFontConverter.h b/src/Plugins/MagnumFontConverter/MagnumFontConverter.h index ff23c414b..808c3be4e 100644 --- a/src/Plugins/MagnumFontConverter/MagnumFontConverter.h +++ b/src/Plugins/MagnumFontConverter/MagnumFontConverter.h @@ -58,7 +58,7 @@ class MagnumFontConverter: public Text::AbstractFontConverter { private: Features doFeatures() const override; - #ifndef _WIN32 + #ifndef __MINGW32__ std::vector>> doExportFontToData(AbstractFont& font, GlyphCache& cache, const std::string& filename, const std::u32string& characters) const override; #else std::vector>> doExportFontToData(AbstractFont& font, GlyphCache& cache, const std::string& filename, const std::vector& characters) const override; diff --git a/src/Text/AbstractFont.cpp b/src/Text/AbstractFont.cpp index 0ebd9e2b3..75fd06609 100644 --- a/src/Text/AbstractFont.cpp +++ b/src/Text/AbstractFont.cpp @@ -134,7 +134,7 @@ void AbstractFont::fillGlyphCache(GlyphCache& cache, const std::string& characte doFillGlyphCache(cache, Utility::Unicode::utf32(characters)); } -#ifndef _WIN32 +#ifndef __MINGW32__ void AbstractFont::doFillGlyphCache(GlyphCache&, const std::u32string&) #else void AbstractFont::doFillGlyphCache(GlyphCache&, const std::vector&) diff --git a/src/Text/AbstractFont.h b/src/Text/AbstractFont.h index 4aa3d415b..96f034f1f 100644 --- a/src/Text/AbstractFont.h +++ b/src/Text/AbstractFont.h @@ -261,7 +261,7 @@ class MAGNUM_TEXT_EXPORT AbstractFont: public PluginManager::AbstractPlugin { * `std::u32string`. See @ref Corrade::Utility::Unicode::utf32() * for more information. */ - #ifndef _WIN32 + #ifndef __MINGW32__ virtual void doFillGlyphCache(GlyphCache& cache, const std::u32string& characters); #else virtual void doFillGlyphCache(GlyphCache& cache, const std::vector& characters); diff --git a/src/Text/AbstractFontConverter.cpp b/src/Text/AbstractFontConverter.cpp index c6061a96c..055a15eb2 100644 --- a/src/Text/AbstractFontConverter.cpp +++ b/src/Text/AbstractFontConverter.cpp @@ -45,7 +45,7 @@ std::vector>> AbstractFo return doExportFontToData(font, cache, filename, uniqueUnicode(characters)); } -#ifndef _WIN32 +#ifndef __MINGW32__ std::vector>> AbstractFontConverter::doExportFontToData(AbstractFont& font, GlyphCache& cache, const std::string& filename, const std::u32string& characters) const #else std::vector>> AbstractFontConverter::doExportFontToData(AbstractFont& font, GlyphCache& cache, const std::string& filename, const std::vector& characters) const @@ -68,7 +68,7 @@ Containers::Array AbstractFontConverter::exportFontToSingleData(A return doExportFontToSingleData(font, cache, uniqueUnicode(characters)); } -#ifndef _WIN32 +#ifndef __MINGW32__ Containers::Array AbstractFontConverter::doExportFontToSingleData(AbstractFont&, GlyphCache&, const std::u32string&) const #else Containers::Array AbstractFontConverter::doExportFontToSingleData(AbstractFont&, GlyphCache&, const std::vector&) const @@ -85,7 +85,7 @@ bool AbstractFontConverter::exportFontToFile(AbstractFont& font, GlyphCache& cac return doExportFontToFile(font, cache, filename, uniqueUnicode(characters)); } -#ifndef _WIN32 +#ifndef __MINGW32__ bool AbstractFontConverter::doExportFontToFile(AbstractFont& font, GlyphCache& cache, const std::string& filename, const std::u32string& characters) const #else bool AbstractFontConverter::doExportFontToFile(AbstractFont& font, GlyphCache& cache, const std::string& filename, const std::vector& characters) const @@ -231,14 +231,14 @@ std::unique_ptr AbstractFontConverter::doImportGlyphCacheFromFile(co return doImportGlyphCacheFromSingleData(data); } -#ifndef _WIN32 +#ifndef __MINGW32__ std::u32string AbstractFontConverter::uniqueUnicode(const std::string& characters) #else std::vector AbstractFontConverter::uniqueUnicode(const std::string& characters) #endif { /* Convert UTF-8 to UTF-32 */ - #ifndef _WIN32 + #ifndef __MINGW32__ std::u32string result = Utility::Unicode::utf32(characters); #else std::vector result = Utility::Unicode::utf32(characters); diff --git a/src/Text/AbstractFontConverter.h b/src/Text/AbstractFontConverter.h index bbe5c6a64..efde20b8f 100644 --- a/src/Text/AbstractFontConverter.h +++ b/src/Text/AbstractFontConverter.h @@ -268,7 +268,7 @@ class MAGNUM_TEXT_EXPORT AbstractFontConverter: public PluginManager::AbstractPl * `std::u32string`. See @ref Corrade::Utility::Unicode::utf32() * for more information. */ - #ifndef _WIN32 + #ifndef __MINGW32__ virtual std::vector>> doExportFontToData(AbstractFont& font, GlyphCache& cache, const std::string& filename, const std::u32string& characters) const; #else virtual std::vector>> doExportFontToData(AbstractFont& font, GlyphCache& cache, const std::string& filename, const std::vector& characters) const; @@ -281,7 +281,7 @@ class MAGNUM_TEXT_EXPORT AbstractFontConverter: public PluginManager::AbstractPl * `std::u32string`. See @ref Corrade::Utility::Unicode::utf32() * for more information. */ - #ifndef _WIN32 + #ifndef __MINGW32__ virtual Containers::Array doExportFontToSingleData(AbstractFont& font, GlyphCache& cache, const std::u32string& characters) const; #else virtual Containers::Array doExportFontToSingleData(AbstractFont& font, GlyphCache& cache, const std::vector& characters) const; @@ -297,7 +297,7 @@ class MAGNUM_TEXT_EXPORT AbstractFontConverter: public PluginManager::AbstractPl * `std::u32string`. See @ref Corrade::Utility::Unicode::utf32() * for more information. */ - #ifndef _WIN32 + #ifndef __MINGW32__ virtual bool doExportFontToFile(AbstractFont& font, GlyphCache& cache, const std::string& filename, const std::u32string& characters) const; #else virtual bool doExportFontToFile(AbstractFont& font, GlyphCache& cache, const std::string& filename, const std::vector& characters) const; @@ -344,7 +344,7 @@ class MAGNUM_TEXT_EXPORT AbstractFontConverter: public PluginManager::AbstractPl virtual std::unique_ptr doImportGlyphCacheFromFile(const std::string& filename) const; private: - #ifndef _WIN32 + #ifndef __MINGW32__ MAGNUM_TEXT_LOCAL static std::u32string uniqueUnicode(const std::string& characters); #else MAGNUM_TEXT_LOCAL static std::vector uniqueUnicode(const std::string& characters); diff --git a/src/Text/Test/AbstractFontConverterTest.cpp b/src/Text/Test/AbstractFontConverterTest.cpp index afeef448c..fc38f8b8b 100644 --- a/src/Text/Test/AbstractFontConverterTest.cpp +++ b/src/Text/Test/AbstractFontConverterTest.cpp @@ -66,7 +66,7 @@ AbstractFontConverterTest::AbstractFontConverterTest() { void AbstractFontConverterTest::convertGlyphs() { class GlyphExporter: public AbstractFontConverter { public: - #ifndef _WIN32 + #ifndef __MINGW32__ GlyphExporter(std::u32string& characters): characters(characters) {} #else GlyphExporter(std::vector& characters): characters(characters) {} @@ -75,7 +75,7 @@ void AbstractFontConverterTest::convertGlyphs() { private: Features doFeatures() const override { return Feature::ConvertData|Feature::ExportFont; } - #ifndef _WIN32 + #ifndef __MINGW32__ Containers::Array doExportFontToSingleData(AbstractFont&, GlyphCache&, const std::u32string& characters) const override #else Containers::Array doExportFontToSingleData(AbstractFont&, GlyphCache&, const std::vector& characters) const override @@ -85,21 +85,21 @@ void AbstractFontConverterTest::convertGlyphs() { return nullptr; } - #ifndef _WIN32 + #ifndef __MINGW32__ std::u32string& characters; #else std::vector& characters; #endif }; - #ifndef _WIN32 + #ifndef __MINGW32__ std::u32string characters; #else std::vector characters; #endif GlyphExporter exporter(characters); exporter.exportFontToSingleData(*static_cast(nullptr), *static_cast(nullptr), "abC01a0 "); - #ifndef _WIN32 + #ifndef __MINGW32__ CORRADE_COMPARE(characters, U" 01Cab"); #else CORRADE_COMPARE(characters, (std::vector{ @@ -112,7 +112,7 @@ void AbstractFontConverterTest::exportFontToSingleData() { private: Features doFeatures() const override { return Feature::ConvertData|Feature::ExportFont; } - #ifndef _WIN32 + #ifndef __MINGW32__ Containers::Array doExportFontToSingleData(AbstractFont&, GlyphCache&, const std::u32string&) const override #else Containers::Array doExportFontToSingleData(AbstractFont&, GlyphCache&, const std::vector&) const override @@ -138,7 +138,7 @@ void AbstractFontConverterTest::exportFontToFile() { private: Features doFeatures() const override { return Feature::ConvertData|Feature::ExportFont|Feature::MultiFile; } - #ifndef _WIN32 + #ifndef __MINGW32__ std::vector>> doExportFontToData(AbstractFont&, GlyphCache&, const std::string& filename, const std::u32string&) const override #else std::vector>> doExportFontToData(AbstractFont&, GlyphCache&, const std::string& filename, const std::vector&) const override