From 7563c885a19dac14d599bff4e08bcbf4de017064 Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik Date: Mon, 3 May 2021 15:00:23 +0200 Subject: [PATCH] Fixing compiler warnings --- src/libslic3r/ClipperUtils.cpp | 11 +---------- src/libslic3r/ClipperUtils.hpp | 12 +++++++----- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/libslic3r/ClipperUtils.cpp b/src/libslic3r/ClipperUtils.cpp index f8a94ed69..8bca3b25a 100644 --- a/src/libslic3r/ClipperUtils.cpp +++ b/src/libslic3r/ClipperUtils.cpp @@ -57,6 +57,7 @@ err: #endif /* CLIPPER_UTILS_DEBUG */ namespace ClipperUtils { + Points EmptyPathsProvider::s_empty_points; Points SinglePathProvider::s_end; } @@ -143,16 +144,6 @@ static ClipperLib::Paths safety_offset(PathsProvider &&paths) return out; } -static ClipperLib::Paths safety_offset(const ClipperLib::Paths &paths) -{ - return safety_offset(paths); -} - -static void safety_offset(ClipperLib::Paths *paths) -{ - *paths = safety_offset(*paths); -} - template ClipperLib::Paths _offset(PathsProvider &&input, ClipperLib::EndType endType, const float delta, ClipperLib::JoinType joinType, double miterLimit) { diff --git a/src/libslic3r/ClipperUtils.hpp b/src/libslic3r/ClipperUtils.hpp index 0d3b986c0..f3adba94e 100644 --- a/src/libslic3r/ClipperUtils.hpp +++ b/src/libslic3r/ClipperUtils.hpp @@ -32,11 +32,11 @@ namespace ClipperUtils { public: struct iterator : public PathsProviderIteratorBase { public: - constexpr const Points& operator*() { assert(false); return *static_cast(nullptr); } + constexpr const Points& operator*() { assert(false); return s_empty_points; } // all iterators point to end. constexpr bool operator==(const iterator &rhs) const { return true; } constexpr bool operator!=(const iterator &rhs) const { return false; } - constexpr const Points& operator++(int) { assert(false); return *static_cast(nullptr); } + constexpr const Points& operator++(int) { assert(false); return s_empty_points; } constexpr iterator& operator++() { assert(false); return *this; } }; @@ -46,6 +46,8 @@ namespace ClipperUtils { static constexpr iterator cbegin() throw() { return cend(); } static constexpr iterator begin() throw() { return cend(); } static constexpr size_t size() throw() { return 0; } + + static Points &s_empty_points; }; class SinglePathProvider { @@ -158,7 +160,7 @@ namespace ClipperUtils { } private: ExPolygons::const_iterator m_it_expolygon; - int m_idx_contour; + size_t m_idx_contour; }; iterator cbegin() const { return iterator(m_expolygons.cbegin()); } @@ -199,7 +201,7 @@ namespace ClipperUtils { } private: Surfaces::const_iterator m_it_surface; - int m_idx_contour; + size_t m_idx_contour; }; iterator cbegin() const { return iterator(m_surfaces.cbegin()); } @@ -240,7 +242,7 @@ namespace ClipperUtils { } private: SurfacesPtr::const_iterator m_it_surface; - int m_idx_contour; + size_t m_idx_contour; }; iterator cbegin() const { return iterator(m_surfaces.cbegin()); }