From ff08203694cfd519be6c57bfddba218c73b4acde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 13 Nov 2013 21:46:26 +0100 Subject: [PATCH] GCC 4.5 compatibility: no range-based for. --- .../MagnumFontConverter.cpp | 18 +++++++++++------- src/Text/Renderer.cpp | 6 ++++-- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/Plugins/MagnumFontConverter/MagnumFontConverter.cpp b/src/Plugins/MagnumFontConverter/MagnumFontConverter.cpp index 8bea885a8..c411785e3 100644 --- a/src/Plugins/MagnumFontConverter/MagnumFontConverter.cpp +++ b/src/Plugins/MagnumFontConverter/MagnumFontConverter.cpp @@ -68,22 +68,24 @@ std::vector>> MagnumFont #else glyphIdMap.insert({0, 0}); #endif - for(const std::pair>& glyph: cache) + for(auto it = cache.begin(); it != cache.end(); ++it) #ifndef CORRADE_GCC46_COMPATIBILITY - glyphIdMap.emplace(glyph.first, glyphIdMap.size()); + glyphIdMap.emplace(it->first, glyphIdMap.size()); #else - glyphIdMap.insert({glyph.first, glyphIdMap.size()}); + glyphIdMap.insert({it->first, glyphIdMap.size()}); #endif /** @todo Save only glyphs contained in @p characters */ /* Inverse map from new glyph IDs to old ones */ std::vector inverseGlyphIdMap(glyphIdMap.size()); - for(const std::pair& map: glyphIdMap) - inverseGlyphIdMap[map.second] = map.first; + for(auto it = glyphIdMap.begin(); it != glyphIdMap.end(); ++it) + inverseGlyphIdMap[it->second] = it->first; /* Character->glyph map, map glyph IDs to new ones */ - for(const char32_t c: characters) { + for(auto it = characters.begin(); it != characters.end(); ++it) { + const char32_t c = *it; + Utility::ConfigurationGroup* group = configuration.addGroup("char"); const UnsignedInt glyphId = font.glyphId(c); group->setValue("unicode", c); @@ -96,7 +98,9 @@ std::vector>> MagnumFont /* Save glyph properties in order which preserves their IDs, remove padding from the values so they aren't added twice when using the font later */ /** @todo Some better way to handle this padding stuff */ - for(UnsignedInt oldGlyphId: inverseGlyphIdMap) { + for(auto it = inverseGlyphIdMap.begin(); it != inverseGlyphIdMap.end(); ++it) { + const UnsignedInt oldGlyphId = *it; + std::pair glyph = cache[oldGlyphId]; Utility::ConfigurationGroup* group = configuration.addGroup("glyph"); group->setValue("advance", font.glyphAdvance(oldGlyphId)); diff --git a/src/Text/Renderer.cpp b/src/Text/Renderer.cpp index fb25201d2..e40b4afec 100644 --- a/src/Text/Renderer.cpp +++ b/src/Text/Renderer.cpp @@ -163,7 +163,8 @@ std::tuple, Rectangle> renderVerticesInternal(AbstractFont& /* Align positions and bounds */ rectangle = rectangle.translated(Vector2::yAxis(alignmentOffsetY)); - for(auto& v: vertices) v.position.y() += alignmentOffsetY; + for(auto it = vertices.begin(); it != vertices.end(); ++it) + it->position.y() += alignmentOffsetY; return std::make_tuple(std::move(vertices), rectangle); } @@ -230,7 +231,8 @@ std::tuple, std::vector, std::vector, std::vector positions, textureCoordinates; positions.reserve(vertices.size()); positions.reserve(textureCoordinates.size()); - for(const auto& v: vertices) { + for(auto it = vertices.begin(); it != vertices.end(); ++it) { + const Vertex& v = *it; positions.push_back(v.position); textureCoordinates.push_back(v.textureCoordinates); }