From 1ab87a4de528c1b0d8d9e83c41780a5d2d8cff4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 9 Apr 2014 20:13:58 +0200 Subject: [PATCH] Workarounds for platforms without std::to_string(). I hate this. --- src/Magnum/AbstractShaderProgram.cpp | 26 ++++++++++++++++++++++++-- src/Magnum/Shader.cpp | 22 ++++++++++++++++++++-- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/src/Magnum/AbstractShaderProgram.cpp b/src/Magnum/AbstractShaderProgram.cpp index 43ebf0ce2..b72dcf562 100644 --- a/src/Magnum/AbstractShaderProgram.cpp +++ b/src/Magnum/AbstractShaderProgram.cpp @@ -34,6 +34,10 @@ #include "Implementation/ShaderProgramState.h" #include "Implementation/State.h" +#if defined(CORRADE_TARGET_NACL_NEWLIB) || defined(CORRADE_TARGET_ANDROID) || defined(__MINGW32__) +#include +#endif + namespace Magnum { Int AbstractShaderProgram::maxVertexAttributes() { @@ -289,13 +293,25 @@ bool AbstractShaderProgram::link(std::initializer_list> shade glGetShaderInfoLog(shader._id, message.size(), nullptr, &message[0]); message.resize(std::max(logLength, 1)-1); + /** @todo Remove when this is fixed everywhere (also the include above) */ + #if defined(CORRADE_TARGET_NACL_NEWLIB) || defined(CORRADE_TARGET_ANDROID) || defined(__MINGW32__) + std::ostringstream converter; + converter << i; + #endif + /* Show error log */ if(!success) { Error out; @@ -669,7 +675,13 @@ bool Shader::compile(std::initializer_list> shade out.setFlag(Debug::SpaceAfterEachValue, false); out << "Shader::compile(): compilation of " << shaderName(shader._type) << " shader"; - if(shaders.size() != 1) out << ' ' << std::to_string(i); + if(shaders.size() != 1) { + #if !defined(CORRADE_TARGET_NACL_NEWLIB) && !defined(CORRADE_TARGET_ANDROID) && !defined(__MINGW32__) + out << ' ' << std::to_string(i); + #else + out << ' ' << converter.str(); + #endif + } out << " failed with the following message:\n" << message; @@ -680,7 +692,13 @@ bool Shader::compile(std::initializer_list> shade out.setFlag(Debug::SpaceAfterEachValue, false); out << "Shader::compile(): compilation of " << shaderName(shader._type) << " shader"; - if(shaders.size() != 1) out << ' ' << std::to_string(i); + if(shaders.size() != 1) { + #if !defined(CORRADE_TARGET_NACL_NEWLIB) && !defined(CORRADE_TARGET_ANDROID) && !defined(__MINGW32__) + out << ' ' << std::to_string(i); + #else + out << ' ' << converter.str(); + #endif + } out << " succeeded with the following message:\n" << message; }