From d1088ae2e52f319e5c4b044d999699aa2f36f61c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Fri, 26 Jan 2018 13:38:21 +0100 Subject: [PATCH] Fix implicit fallthrough warning on gcc --- Doc/changelog.docu | 1 + src/OpenMesh/Core/IO/OMFormat.hh | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Doc/changelog.docu b/Doc/changelog.docu index 9aff8b23..9d148bb0 100644 --- a/Doc/changelog.docu +++ b/Doc/changelog.docu @@ -61,6 +61,7 @@
  • OM Writer: Added Mark to the format header to identify end of stream correctly (Thanks to Jamie Kydd for the patch)
  • PLY Reader: Skip reading extra elements after face
  • PLY Reader: Return error when reaching EOF
  • +
  • OMFormat: Fix implicit fallthrough warning on gcc(Thanks to Manuel Massing for the patch)
  • Unittests diff --git a/src/OpenMesh/Core/IO/OMFormat.hh b/src/OpenMesh/Core/IO/OMFormat.hh index 13228e84..9bbcd860 100644 --- a/src/OpenMesh/Core/IO/OMFormat.hh +++ b/src/OpenMesh/Core/IO/OMFormat.hh @@ -315,16 +315,16 @@ namespace OMFormat { /// Return the size of chunk data in bytes inline size_t chunk_data_size( Header& _hdr, Chunk::Header& _chunk_hdr ) { - size_t C = 0; - + size_t C; switch( _chunk_hdr.entity_ ) { case Chunk::Entity_Vertex: C = _hdr.n_vertices_; break; case Chunk::Entity_Face: C = _hdr.n_faces_; break; - case Chunk::Entity_Halfedge: C = _hdr.n_edges_; // no break! - case Chunk::Entity_Edge: C += _hdr.n_edges_; break; + case Chunk::Entity_Halfedge: C = _hdr.n_edges_*2; break; + case Chunk::Entity_Edge: C = _hdr.n_edges_; break; case Chunk::Entity_Mesh: C = 1; break; default: + C = 0; std::cerr << "Invalid value in _chunk_hdr.entity_\n"; assert( false ); break;