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() {
/* Remove all bindings */
for(GLuint& binding: Context::current()->state()->texture->bindings)
if(binding == _id) binding = 0;
std::vector<GLuint>& bindings = Context::current()->state()->texture->bindings;
for(auto it = Context::current()->state()->texture->bindings.begin(); it != bindings.end(); ++it)
if(*it == _id) *it = 0;
glDeleteTextures(1, &_id);
}

16
src/Context.cpp

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

24
src/Mesh.cpp

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

4
src/Physics/ShapedObjectGroup.cpp

@ -20,8 +20,8 @@
namespace Magnum { namespace Physics {
template<std::uint8_t dimensions> void ShapedObjectGroup<dimensions>::setClean() {
for(ShapedObject<dimensions>* object: objects)
if(object->isDirty()) object->setClean();
for(auto it = objects.begin(); it != objects.end(); ++it)
if((*it)->isDirty()) (*it)->setClean();
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.
*/
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() {
delete _indices;
for(auto i: _positions) delete i;
for(auto i: _textureCoords2D) delete i;
for(auto it = _positions.begin(); it != _positions.end(); ++it) delete *it;
for(auto it = _textureCoords2D.begin(); it != _textureCoords2D.end(); ++it) delete *it;
}
}}

Loading…
Cancel
Save