From fe6a387515e1bb6a3b685c9c7844349e2812f1ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 7 Sep 2022 09:06:03 +0200 Subject: [PATCH] TextureTools,Trade: fix unused var warning on a non-deprecated build. ... by actually using that variable outside of asserts. --- src/Magnum/TextureTools/Atlas.cpp | 2 +- src/Magnum/Trade/SceneData.cpp | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Magnum/TextureTools/Atlas.cpp b/src/Magnum/TextureTools/Atlas.cpp index a5b573894..d58768c5b 100644 --- a/src/Magnum/TextureTools/Atlas.cpp +++ b/src/Magnum/TextureTools/Atlas.cpp @@ -83,7 +83,7 @@ Containers::Pair> atlasArrayPowerOfTwo(const Ve CORRADE_ASSERT(size.product() && size.x() == size.y() && (size & (size - Vector2i{1})).isZero(), "TextureTools::atlasArrayPowerOfTwo(): expected size" << i << "to be a non-zero power-of-two square, got" << Debug::packed << size, {}); - sortedSizes[i].xy() = sizes[i]; + sortedSizes[i].xy() = size; sortedSizes[i].z() = i; } diff --git a/src/Magnum/Trade/SceneData.cpp b/src/Magnum/Trade/SceneData.cpp index 61d9b8387..3ebbac9ca 100644 --- a/src/Magnum/Trade/SceneData.cpp +++ b/src/Magnum/Trade/SceneData.cpp @@ -584,14 +584,14 @@ SceneData::SceneData(const SceneMappingType mappingType, const UnsignedLong mapp checked against a map and only custom fields are checked in an O(n^2) way with the assumption there isn't many of them (and that they'll gradually become builtin). */ - if(!isSceneFieldCustom(_fields[i]._name)) { - CORRADE_INTERNAL_ASSERT(UnsignedInt(_fields[i]._name) < fieldsPresent.Size); - CORRADE_ASSERT(!fieldsPresent[UnsignedInt(_fields[i]._name)], - "Trade::SceneData: duplicate field" << _fields[i]._name, ); - fieldsPresent.set(UnsignedInt(_fields[i]._name), true); + if(!isSceneFieldCustom(field._name)) { + CORRADE_INTERNAL_ASSERT(UnsignedInt(field._name) < fieldsPresent.Size); + CORRADE_ASSERT(!fieldsPresent[UnsignedInt(field._name)], + "Trade::SceneData: duplicate field" << field._name, ); + fieldsPresent.set(UnsignedInt(field._name), true); } else for(std::size_t j = 0; j != i; ++j) { - CORRADE_ASSERT(_fields[j]._name != _fields[i]._name, - "Trade::SceneData: duplicate field" << _fields[i]._name, ); + CORRADE_ASSERT(_fields[j]._name != field._name, + "Trade::SceneData: duplicate field" << field._name, ); } /* Check that both the mapping and field view fits into the provided @@ -634,21 +634,21 @@ SceneData::SceneData(const SceneMappingType mappingType, const UnsignedLong mapp /* Remember TRS and mesh/material fields to figure out whether the scene is 2D or 3D and check their object mapping consistency outside of the loop below */ - if(_fields[i]._name == SceneField::Transformation) { + if(field._name == SceneField::Transformation) { transformationField = i; - } else if(_fields[i]._name == SceneField::Translation) { + } else if(field._name == SceneField::Translation) { translationField = i; - } else if(_fields[i]._name == SceneField::Rotation) { + } else if(field._name == SceneField::Rotation) { rotationField = i; - } else if(_fields[i]._name == SceneField::Scaling) { + } else if(field._name == SceneField::Scaling) { scalingField = i; } #ifndef CORRADE_NO_ASSERT - else if(_fields[i]._name == SceneField::Mesh) { + else if(field._name == SceneField::Mesh) { meshField = i; - } else if(_fields[i]._name == SceneField::MeshMaterial) { + } else if(field._name == SceneField::MeshMaterial) { meshMaterialField = i; - } else if(_fields[i]._name == SceneField::Skin) { + } else if(field._name == SceneField::Skin) { skinField = i; } #endif