Browse Source

Fixed compiler warnings when building with CORRADE_NO_ASSERT.

pull/132/head
Vladimír Vondruš 10 years ago
parent
commit
d36f45ac98
  1. 9
      src/Magnum/MeshTools/Interleave.h
  2. 2
      src/Magnum/SceneGraph/Object.hpp
  3. 3
      src/Magnum/Text/Renderer.cpp

9
src/Magnum/MeshTools/Interleave.h

@ -44,11 +44,12 @@ namespace Implementation {
resolution (the functions would otherwise need to be de-inlined to break
cyclic dependencies) */
struct AttributeCount {
template<class T, class ...U> typename std::enable_if<!std::is_convertible<T, std::size_t>::value, std::size_t>::type operator()(const T& first, const U&... next) const {
CORRADE_ASSERT(sizeof...(next) == 0 || AttributeCount{}(next...) == first.size() || AttributeCount{}(next...) == ~std::size_t(0), "MeshTools::interleave(): attribute arrays don't have the same length, expected" << first.size() << "but got" << AttributeCount{}(next...), 0);
#if defined(CORRADE_NO_ASSERT) && !defined(CORRADE_GRACEFUL_ASSERT)
static_cast<void>(sizeof...(next));
template<class T, class ...U> typename std::enable_if<!std::is_convertible<T, std::size_t>::value, std::size_t>::type operator()(const T& first, const U&...
#if !defined(CORRADE_NO_ASSERT) || defined(CORRADE_GRACEFUL_ASSERT)
next
#endif
) const {
CORRADE_ASSERT(sizeof...(next) == 0 || AttributeCount{}(next...) == first.size() || AttributeCount{}(next...) == ~std::size_t(0), "MeshTools::interleave(): attribute arrays don't have the same length, expected" << first.size() << "but got" << AttributeCount{}(next...), 0);
return first.size();
}

2
src/Magnum/SceneGraph/Object.hpp

@ -212,8 +212,10 @@ template<class Transformation> std::vector<typename Transformation::DataType> Ob
}
std::vector<std::reference_wrapper<Object<Transformation>>> jointObjects(objects);
#if !defined(CORRADE_NO_ASSERT) || defined(CORRADE_GRACEFUL_ASSERT)
/* Scene object */
const Scene<Transformation>* scene = this->scene();
#endif
/* Nearest common ancestor not yet implemented - assert this is done on scene */
CORRADE_ASSERT(scene == this, "SceneGraph::Object::transformationMatrices(): currently implemented only for Scene", {});

3
src/Magnum/Text/Renderer.cpp

@ -93,13 +93,12 @@ std::tuple<std::vector<Vertex>, Range2D> renderVerticesInternal(AbstractFont& fo
/* Layout the line */
const auto layouter = font.layout(cache, size, line);
const UnsignedInt vertexCount = layouter->glyphCount()*4;
/* Verify that we don't reallocate anything. The only problem might
arise when the layouter decides to compose one character from more
than one glyph (i.e. accents). Will remove the assert when this
issue arises. */
CORRADE_INTERNAL_ASSERT(vertices.size()+vertexCount <= vertices.capacity());
CORRADE_INTERNAL_ASSERT(vertices.size() + layouter->glyphCount()*4 <= vertices.capacity());
/* Bounds of rendered line */
Range2D lineRectangle;

Loading…
Cancel
Save