From 0c31f5dbe4bede88ab7674831ff34eb0b1efc750 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 5 Jun 2013 00:11:07 +0200 Subject: [PATCH] NaCl's newlib doesn't have std::to_string(). --- src/Shader.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Shader.cpp b/src/Shader.cpp index bdcb748fd..f13b1d383 100644 --- a/src/Shader.cpp +++ b/src/Shader.cpp @@ -27,6 +27,10 @@ #include #include +#ifdef CORRADE_TARGET_NACL_NEWLIB +#include +#endif + /* libgles-omap3-dev_4.03.00.02-r15.6 on BeagleBoard/Ångström linux 2011.3 doesn't have GLchar */ #ifdef MAGNUM_TARGET_GLES typedef char GLchar; @@ -101,9 +105,20 @@ Shader& Shader::operator=(Shader&& other) { Shader& Shader::addSource(std::string source) { if(!source.empty()) { + #ifdef CORRADE_TARGET_NACL_NEWLIB + std::ostringstream converter; + converter << (sources.size()+1)/2; + #endif + /* Fix line numbers, so line 41 of third added file is marked as 3(41). Source 0 is the #version string added in constructor. */ - sources.push_back("#line 1 " + std::to_string((sources.size()+1)/2) + '\n'); + sources.push_back("#line 1 " + + #ifndef CORRADE_TARGET_NACL_NEWLIB + std::to_string((sources.size()+1)/2) + + #else + converter.str() + + #endif + '\n'); sources.push_back(std::move(source)); }