From a34c006ca54fe9d1b56f7c9ff14bd1f3fc253494 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 5 Jul 2012 21:30:31 +0200 Subject: [PATCH] GCC 4.5 compatibility: removed range-based for cycles. --- src/Mesh.cpp | 16 ++++++++-------- src/MeshTools/FlipNormals.cpp | 4 ++-- src/MeshTools/Tipsify.cpp | 4 +++- src/Trade/MeshData.cpp | 6 +++--- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/Mesh.cpp b/src/Mesh.cpp index 6cd8633a5..a16cf8286 100644 --- a/src/Mesh.cpp +++ b/src/Mesh.cpp @@ -21,8 +21,8 @@ using namespace std; namespace Magnum { Mesh::~Mesh() { - for(auto& it: _buffers) - delete it.first; + for(auto it = _buffers.begin(); it != _buffers.end(); ++it) + delete it->first; #ifndef MAGNUM_TARGET_GLES glDeleteVertexArrays(1, &vao); @@ -81,10 +81,10 @@ void Mesh::finalize() { CORRADE_ASSERT(_vertexCount, "Mesh: the mesh has zero vertex count!", ) /* Finalize attribute positions for every buffer */ - for(auto& it: _buffers) { + for(auto it = _buffers.begin(); it != _buffers.end(); ++it) { /* Avoid confustion */ - bool interleaved = it.second.first == BufferType::Interleaved; - vector& attributes = it.second.second; + bool interleaved = it->second.first == BufferType::Interleaved; + vector& attributes = it->second.second; /* Interleaved buffer, set stride and position of first attribute */ if(interleaved) { @@ -129,12 +129,12 @@ void Mesh::bindBuffers() { for(set::const_iterator it = _attributes.begin(); it != _attributes.end(); ++it) glEnableVertexAttribArray(*it); - for(auto& it: _buffers) { + for(auto it = _buffers.begin(); it != _buffers.end(); ++it) { /* Avoid confusion */ - vector& attributes = it.second.second; + vector& attributes = it->second.second; /* Bind buffer */ - it.first->bind(); + it->first->bind(); /* Bind all attributes to this buffer */ for(vector::const_iterator ait = attributes.begin(); ait != attributes.end(); ++ait) diff --git a/src/MeshTools/FlipNormals.cpp b/src/MeshTools/FlipNormals.cpp index 8abc87cc2..108d258f9 100644 --- a/src/MeshTools/FlipNormals.cpp +++ b/src/MeshTools/FlipNormals.cpp @@ -27,8 +27,8 @@ void flipFaceWinding(vector& indices) { } void flipNormals(vector& normals) { - for(Vector3& normal: normals) - normal = -normal; + for(auto it = normals.begin(); it != normals.end(); ++it) + *it = -*it; } }} diff --git a/src/MeshTools/Tipsify.cpp b/src/MeshTools/Tipsify.cpp index 5f19c1f92..f26e9fdc2 100644 --- a/src/MeshTools/Tipsify.cpp +++ b/src/MeshTools/Tipsify.cpp @@ -74,7 +74,9 @@ void Tipsify::operator()(size_t cacheSize) { /* Go through candidates in 1-ring around fanning vertex */ int candidatePriority = -1; - for(unsigned int v: candidates) { + for(auto it = candidates.begin(); it != candidates.end(); ++it) { + unsigned int v = *it; + /* Skip if it doesn't have any live triangles */ if(!liveTriangleCount[v]) continue; diff --git a/src/Trade/MeshData.cpp b/src/Trade/MeshData.cpp index 8c51fd064..94308d843 100644 --- a/src/Trade/MeshData.cpp +++ b/src/Trade/MeshData.cpp @@ -19,9 +19,9 @@ namespace Magnum { namespace Trade { MeshData::~MeshData() { delete _indices; - for(auto i: _vertices) delete i; - for(auto i: _normals) delete i; - for(auto i: _textureCoords2D) delete i; + for(auto it = _vertices.begin(); it != _vertices.end(); ++it) delete *it; + for(auto it = _normals.begin(); it != _normals.end(); ++it) delete *it; + for(auto it = _textureCoords2D.begin(); it != _textureCoords2D.end(); ++it) delete *it; } }}