Fixing compiler warnings

This commit is contained in:
Vojtech Bubnik 2021-05-03 15:00:23 +02:00
parent 0e6e60705d
commit 7563c885a1
2 changed files with 8 additions and 15 deletions

View file

@ -57,6 +57,7 @@ err:
#endif /* CLIPPER_UTILS_DEBUG */ #endif /* CLIPPER_UTILS_DEBUG */
namespace ClipperUtils { namespace ClipperUtils {
Points EmptyPathsProvider::s_empty_points;
Points SinglePathProvider::s_end; Points SinglePathProvider::s_end;
} }
@ -143,16 +144,6 @@ static ClipperLib::Paths safety_offset(PathsProvider &&paths)
return out; return out;
} }
static ClipperLib::Paths safety_offset(const ClipperLib::Paths &paths)
{
return safety_offset<const ClipperLib::Paths&>(paths);
}
static void safety_offset(ClipperLib::Paths *paths)
{
*paths = safety_offset(*paths);
}
template<typename PathsProvider> template<typename PathsProvider>
ClipperLib::Paths _offset(PathsProvider &&input, ClipperLib::EndType endType, const float delta, ClipperLib::JoinType joinType, double miterLimit) ClipperLib::Paths _offset(PathsProvider &&input, ClipperLib::EndType endType, const float delta, ClipperLib::JoinType joinType, double miterLimit)
{ {

View file

@ -32,11 +32,11 @@ namespace ClipperUtils {
public: public:
struct iterator : public PathsProviderIteratorBase { struct iterator : public PathsProviderIteratorBase {
public: public:
constexpr const Points& operator*() { assert(false); return *static_cast<Points*>(nullptr); } constexpr const Points& operator*() { assert(false); return s_empty_points; }
// all iterators point to end. // all iterators point to end.
constexpr bool operator==(const iterator &rhs) const { return true; } constexpr bool operator==(const iterator &rhs) const { return true; }
constexpr bool operator!=(const iterator &rhs) const { return false; } constexpr bool operator!=(const iterator &rhs) const { return false; }
constexpr const Points& operator++(int) { assert(false); return *static_cast<Points*>(nullptr); } constexpr const Points& operator++(int) { assert(false); return s_empty_points; }
constexpr iterator& operator++() { assert(false); return *this; } constexpr iterator& operator++() { assert(false); return *this; }
}; };
@ -46,6 +46,8 @@ namespace ClipperUtils {
static constexpr iterator cbegin() throw() { return cend(); } static constexpr iterator cbegin() throw() { return cend(); }
static constexpr iterator begin() throw() { return cend(); } static constexpr iterator begin() throw() { return cend(); }
static constexpr size_t size() throw() { return 0; } static constexpr size_t size() throw() { return 0; }
static Points &s_empty_points;
}; };
class SinglePathProvider { class SinglePathProvider {
@ -158,7 +160,7 @@ namespace ClipperUtils {
} }
private: private:
ExPolygons::const_iterator m_it_expolygon; ExPolygons::const_iterator m_it_expolygon;
int m_idx_contour; size_t m_idx_contour;
}; };
iterator cbegin() const { return iterator(m_expolygons.cbegin()); } iterator cbegin() const { return iterator(m_expolygons.cbegin()); }
@ -199,7 +201,7 @@ namespace ClipperUtils {
} }
private: private:
Surfaces::const_iterator m_it_surface; Surfaces::const_iterator m_it_surface;
int m_idx_contour; size_t m_idx_contour;
}; };
iterator cbegin() const { return iterator(m_surfaces.cbegin()); } iterator cbegin() const { return iterator(m_surfaces.cbegin()); }
@ -240,7 +242,7 @@ namespace ClipperUtils {
} }
private: private:
SurfacesPtr::const_iterator m_it_surface; SurfacesPtr::const_iterator m_it_surface;
int m_idx_contour; size_t m_idx_contour;
}; };
iterator cbegin() const { return iterator(m_surfaces.cbegin()); } iterator cbegin() const { return iterator(m_surfaces.cbegin()); }