Browse Source

NaCl's newlib doesn't have std::to_string().

pull/278/head
Vladimír Vondruš 13 years ago
parent
commit
0c31f5dbe4
  1. 17
      src/Shader.cpp

17
src/Shader.cpp

@ -27,6 +27,10 @@
#include <fstream>
#include <Utility/Assert.h>
#ifdef CORRADE_TARGET_NACL_NEWLIB
#include <sstream>
#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));
}

Loading…
Cancel
Save