Browse Source

GCC 4.5 compatibility: no range-based for.

Vladimír Vondruš 14 years ago
parent
commit
5d8444ace1
  1. 5
      src/AbstractTexture.cpp
  2. 16
      src/Context.cpp
  3. 24
      src/Mesh.cpp
  4. 4
      src/Physics/ShapedObjectGroup.cpp
  5. 3
      src/Physics/ShapedObjectGroup.h
  6. 4
      src/Trade/MeshData2D.cpp

5
src/AbstractTexture.cpp

@ -85,8 +85,9 @@ GLfloat AbstractTexture::maxSupportedAnisotropy() {
AbstractTexture::~AbstractTexture() { AbstractTexture::~AbstractTexture() {
/* Remove all bindings */ /* Remove all bindings */
for(GLuint& binding: Context::current()->state()->texture->bindings) std::vector<GLuint>& bindings = Context::current()->state()->texture->bindings;
if(binding == _id) binding = 0; for(auto it = Context::current()->state()->texture->bindings.begin(); it != bindings.end(); ++it)
if(*it == _id) *it = 0;
glDeleteTextures(1, &_id); glDeleteTextures(1, &_id);
} }

16
src/Context.cpp

@ -189,9 +189,11 @@ Context::Context() {
previous versions should be supported automatically, so we don't need previous versions should be supported automatically, so we don't need
to check for them) */ to check for them) */
unordered_map<string, Extension> futureExtensions; unordered_map<string, Extension> futureExtensions;
for(size_t i = future; i != versions.size(); ++i) for(size_t i = future; i != versions.size(); ++i) {
for(const Extension& extension: Extension::extensions(versions[i])) const std::vector<Extension>& extensions = Extension::extensions(versions[i]);
futureExtensions.insert(make_pair(extension._string, extension)); for(auto it = extensions.begin(); it != extensions.end(); ++it)
futureExtensions.insert(make_pair(it->_string, *it));
}
/* Check for presence of extensions in future versions */ /* Check for presence of extensions in future versions */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
@ -217,8 +219,8 @@ Context::Context() {
const char* e = reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS)); const char* e = reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS));
if(e) { if(e) {
vector<string> extensions = Corrade::Utility::split(e, ' '); vector<string> extensions = Corrade::Utility::split(e, ' ');
for(const string& extension: extensions) { for(auto it = extensions.begin(); it != extensions.end(); ++it) {
auto found = futureExtensions.find(extension); auto found = futureExtensions.find(*it);
if(found != futureExtensions.end()) { if(found != futureExtensions.end()) {
_supportedExtensions.push_back(found->second); _supportedExtensions.push_back(found->second);
extensionStatus.set(found->second._index); extensionStatus.set(found->second._index);
@ -252,8 +254,8 @@ Context::~Context() {
} }
Version Context::supportedVersion(initializer_list<Version> versions) const { Version Context::supportedVersion(initializer_list<Version> versions) const {
for(auto version: versions) for(auto it = versions.begin(); it != versions.end(); ++it)
if(isVersionSupported(version)) return version; if(isVersionSupported(*it)) return *it;
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
return Version::GL210; return Version::GL210;

24
src/Mesh.cpp

@ -228,16 +228,16 @@ void Mesh::attributePointerImplementationDSA(const LongAttribute& attribute) {
#endif #endif
void Mesh::bindImplementationDefault() { void Mesh::bindImplementationDefault() {
for(const Attribute& attribute: attributes) for(auto it = attributes.begin(); it != attributes.end(); ++it)
vertexAttribPointer(attribute); vertexAttribPointer(*it);
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
for(const IntegerAttribute& attribute: integerAttributes) for(auto it = integerAttributes.begin(); it != integerAttributes.end(); ++it)
vertexAttribPointer(attribute); vertexAttribPointer(*it);
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
for(const LongAttribute& attribute: longAttributes) for(auto it = longAttributes.begin(); it != longAttributes.end(); ++it)
vertexAttribPointer(attribute); vertexAttribPointer(*it);
#endif #endif
#endif #endif
} }
@ -247,16 +247,16 @@ void Mesh::bindImplementationVAO() {
} }
void Mesh::unbindImplementationDefault() { void Mesh::unbindImplementationDefault() {
for(const Attribute& attribute: attributes) for(auto it = attributes.begin(); it != attributes.end(); ++it)
glDisableVertexAttribArray(attribute.location); glDisableVertexAttribArray(it->location);
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
for(const IntegerAttribute& attribute: integerAttributes) for(auto it = integerAttributes.begin(); it != integerAttributes.end(); ++it)
glDisableVertexAttribArray(attribute.location); glDisableVertexAttribArray(it->location);
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
for(const LongAttribute& attribute: longAttributes) for(auto it = longAttributes.begin(); it != longAttributes.end(); ++it)
glDisableVertexAttribArray(attribute.location); glDisableVertexAttribArray(it->location);
#endif #endif
#endif #endif
} }

4
src/Physics/ShapedObjectGroup.cpp

@ -20,8 +20,8 @@
namespace Magnum { namespace Physics { namespace Magnum { namespace Physics {
template<std::uint8_t dimensions> void ShapedObjectGroup<dimensions>::setClean() { template<std::uint8_t dimensions> void ShapedObjectGroup<dimensions>::setClean() {
for(ShapedObject<dimensions>* object: objects) for(auto it = objects.begin(); it != objects.end(); ++it)
if(object->isDirty()) object->setClean(); if((*it)->isDirty()) (*it)->setClean();
dirty = false; dirty = false;
} }

3
src/Physics/ShapedObjectGroup.h

@ -53,7 +53,8 @@ template<std::uint8_t dimensions> class PHYSICS_EXPORT ShapedObjectGroup {
* Deletes all objects belogning to the group. * Deletes all objects belogning to the group.
*/ */
inline virtual ~ShapedObjectGroup() { inline virtual ~ShapedObjectGroup() {
for(auto i: objects) delete i; for(auto it = objects.begin(); it != objects.end(); ++it)
delete *it;
} }
/** /**

4
src/Trade/MeshData2D.cpp

@ -19,8 +19,8 @@ namespace Magnum { namespace Trade {
MeshData2D::~MeshData2D() { MeshData2D::~MeshData2D() {
delete _indices; delete _indices;
for(auto i: _positions) delete i; for(auto it = _positions.begin(); it != _positions.end(); ++it) delete *it;
for(auto i: _textureCoords2D) delete i; for(auto it = _textureCoords2D.begin(); it != _textureCoords2D.end(); ++it) delete *it;
} }
}} }}

Loading…
Cancel
Save