Browse Source

Trade: fix unused variable warning when building with CORRADE_NO_ASSERT.

pull/491/head
Vladimír Vondruš 5 years ago
parent
commit
7498d5742f
  1. 4
      src/Magnum/Trade/MaterialData.cpp
  2. 2
      src/Magnum/Trade/MaterialData.h

4
src/Magnum/Trade/MaterialData.cpp

@ -366,7 +366,9 @@ UnsignedInt MaterialData::layerFactorTexture(const UnsignedInt layer) const {
}
UnsignedInt MaterialData::layerFactorTexture(const Containers::StringView layer) const {
#ifndef CORRADE_NO_ASSERT
const UnsignedInt layerId = layerFor(layer);
#endif
CORRADE_ASSERT(layerId != ~UnsignedInt{},
"Trade::MaterialData::layerFactorTexture(): layer" << layer << "not found", {});
/* Not delegating into layerFactorTexture() in order to have layer name
@ -389,7 +391,9 @@ MaterialTextureSwizzle MaterialData::layerFactorTextureSwizzle(const UnsignedInt
}
MaterialTextureSwizzle MaterialData::layerFactorTextureSwizzle(const Containers::StringView layer) const {
#ifndef CORRADE_NO_ASSERT
const UnsignedInt layerId = layerFor(layer);
#endif
CORRADE_ASSERT(layerId != ~UnsignedInt{},
"Trade::MaterialData::layerFactorTextureSwizzle(): layer" << layer << "not found", {});
CORRADE_ASSERT(hasAttribute(layerId, MaterialAttribute::LayerFactorTexture),

2
src/Magnum/Trade/MaterialData.h

@ -2721,7 +2721,9 @@ template<class T> T MaterialData::attribute(const UnsignedInt layer, const Unsig
#ifdef CORRADE_GRACEFUL_ASSERT
if(!value) return {};
#endif
#ifndef CORRADE_NO_ASSERT
const Trade::MaterialAttributeData& data = _data[layerOffset(layer) + id];
#endif
CORRADE_ASSERT(Implementation::MaterialAttributeTypeFor<T>::type() == data._data.type,
"Trade::MaterialData::attribute(): improper type requested for" << (data._data.data + 1) << "of" << data._data.type, {});
return *reinterpret_cast<const T*>(value);

Loading…
Cancel
Save