From 048fafb9f9490374c32478e597a802b7e21e845e Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Thu, 24 Nov 2016 17:54:41 +0100 Subject: [PATCH] Fix compilation --- xs/src/admesh/stl.h | 8 ++++++++ xs/src/libslic3r/TriangleMesh.cpp | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/xs/src/admesh/stl.h b/xs/src/admesh/stl.h index d5ee6d130..f9fb2535a 100644 --- a/xs/src/admesh/stl.h +++ b/xs/src/admesh/stl.h @@ -57,7 +57,9 @@ typedef struct { float z; } stl_vertex; +#ifdef static_assert static_assert(sizeof(stl_vertex) == 12, "size of stl_vertex incorrect"); +#endif typedef struct { float x; @@ -65,7 +67,9 @@ typedef struct { float z; } stl_normal; +#ifdef static_assert static_assert(sizeof(stl_normal) == 12, "size of stl_normal incorrect"); +#endif typedef char stl_extra[2]; @@ -76,10 +80,12 @@ typedef struct { } stl_facet; #define SIZEOF_STL_FACET 50 +#ifdef static_assert static_assert(offsetof(stl_facet, normal) == 0, "stl_facet.normal has correct offset"); static_assert(offsetof(stl_facet, vertex) == 12, "stl_facet.vertex has correct offset"); static_assert(offsetof(stl_facet, extra ) == 48, "stl_facet.extra has correct offset"); static_assert(sizeof(stl_facet) >= SIZEOF_STL_FACET, "size of stl_facet incorrect"); +#endif typedef enum {binary, ascii, inmemory} stl_type; @@ -100,7 +106,9 @@ typedef struct stl_hash_edge { struct stl_hash_edge *next; } stl_hash_edge; +#ifdef static_assert static_assert(offsetof(stl_hash_edge, facet_number) == SIZEOF_EDGE_SORT, "size of stl_hash_edge.key incorrect"); +#endif typedef struct { // Index of a neighbor facet. diff --git a/xs/src/libslic3r/TriangleMesh.cpp b/xs/src/libslic3r/TriangleMesh.cpp index 4a569ed40..4fb2ca9a0 100644 --- a/xs/src/libslic3r/TriangleMesh.cpp +++ b/xs/src/libslic3r/TriangleMesh.cpp @@ -50,7 +50,7 @@ TriangleMesh::TriangleMesh(const TriangleMesh &other) TriangleMesh& TriangleMesh::operator= (TriangleMesh other) { - swap(*this, other); + this->swap(other); return *this; }