Fixing some compiler warnings on Linux

This commit is contained in:
Vojtech Bubnik 2021-02-08 11:58:03 +01:00
parent cbee82dc95
commit 5449e6c549
4 changed files with 10 additions and 8 deletions

View File

@ -676,7 +676,7 @@ namespace Slic3r {
// select the geometry associated with the original model object // select the geometry associated with the original model object
const Geometry* geometry = nullptr; const Geometry* geometry = nullptr;
for (const IdToModelObjectMap::value_type& object : m_objects) { for (const IdToModelObjectMap::value_type& object : m_objects) {
if (static_cast<int>(object.second) == i) { if (object.second == int(i)) {
IdToGeometryMap::const_iterator obj_geometry = m_geometries.find(object.first); IdToGeometryMap::const_iterator obj_geometry = m_geometries.find(object.first);
if (obj_geometry == m_geometries.end()) { if (obj_geometry == m_geometries.end()) {
add_error("Unable to find object geometry"); add_error("Unable to find object geometry");
@ -1875,7 +1875,6 @@ namespace Slic3r {
} }
else { else {
std::cout << "non-single instance !!!\n"; std::cout << "non-single instance !!!\n";
int a = 0;
} }
} }
#endif // ENABLE_RELOAD_FROM_DISK_FOR_3MF #endif // ENABLE_RELOAD_FROM_DISK_FOR_3MF

View File

@ -1683,7 +1683,7 @@ size_t idx_higher_or_equal(IT begin, IT end, size_t idx, FN_HIGHER_EQUAL fn_high
(fn_higher_equal(begin[idx_high]) ? idx_high : size); (fn_higher_equal(begin[idx_high]) ? idx_high : size);
} else { } else {
// For the other layers of this batch of layers, search incrementally, which is cheaper than the binary search. // For the other layers of this batch of layers, search incrementally, which is cheaper than the binary search.
while (idx < size && ! fn_higher_equal(begin[idx])) while (int(idx) < size && ! fn_higher_equal(begin[idx]))
++ idx; ++ idx;
} }
return idx; return idx;

View File

@ -666,19 +666,21 @@ void annotate_inside_outside(VD &vd, const Lines &lines)
// Set a VertexCategory, verify validity of the operation. // Set a VertexCategory, verify validity of the operation.
auto annotate_vertex = [](const VD::vertex_type *vertex, VertexCategory new_vertex_category) { auto annotate_vertex = [](const VD::vertex_type *vertex, VertexCategory new_vertex_category) {
#ifndef NDEBUG
VertexCategory vc = vertex_category(vertex); VertexCategory vc = vertex_category(vertex);
assert(vc == VertexCategory::Unknown || vc == new_vertex_category); assert(vc == VertexCategory::Unknown || vc == new_vertex_category);
assert(new_vertex_category == VertexCategory::Inside || assert(new_vertex_category == VertexCategory::Inside ||
new_vertex_category == VertexCategory::Outside || new_vertex_category == VertexCategory::Outside ||
new_vertex_category == VertexCategory::OnContour); new_vertex_category == VertexCategory::OnContour);
#endif // NDEBUG
set_vertex_category(const_cast<VD::vertex_type*>(vertex), new_vertex_category); set_vertex_category(const_cast<VD::vertex_type*>(vertex), new_vertex_category);
}; };
// Set an EdgeCategory, verify validity of the operation. // Set an EdgeCategory, verify validity of the operation.
auto annotate_edge = [](const VD::edge_type *edge, EdgeCategory new_edge_category) { auto annotate_edge = [](const VD::edge_type *edge, EdgeCategory new_edge_category) {
#ifndef NDEBUG
EdgeCategory ec = edge_category(edge); EdgeCategory ec = edge_category(edge);
assert(ec == EdgeCategory::Unknown || ec == new_edge_category); assert(ec == EdgeCategory::Unknown || ec == new_edge_category);
#ifndef NDEBUG
switch (new_edge_category) { switch (new_edge_category) {
case EdgeCategory::PointsInside: case EdgeCategory::PointsInside:
assert(edge->vertex0() != nullptr); assert(edge->vertex0() != nullptr);
@ -693,7 +695,6 @@ void annotate_inside_outside(VD &vd, const Lines &lines)
default: default:
assert(false); assert(false);
} }
#endif // NDEBUG #endif // NDEBUG
set_edge_category(const_cast<VD::edge_type*>(edge), new_edge_category); set_edge_category(const_cast<VD::edge_type*>(edge), new_edge_category);
}; };
@ -760,10 +761,12 @@ void annotate_inside_outside(VD &vd, const Lines &lines)
// Only one of the two vertices may lie on input contour. // Only one of the two vertices may lie on input contour.
const VD::vertex_type *v0 = edge.vertex0(); const VD::vertex_type *v0 = edge.vertex0();
const VD::vertex_type *v1 = edge.vertex1(); const VD::vertex_type *v1 = edge.vertex1();
#ifndef NDEBUG
VertexCategory v0_category = vertex_category(v0); VertexCategory v0_category = vertex_category(v0);
VertexCategory v1_category = vertex_category(v1); VertexCategory v1_category = vertex_category(v1);
assert(v0_category != VertexCategory::OnContour || v1_category != VertexCategory::OnContour); assert(v0_category != VertexCategory::OnContour || v1_category != VertexCategory::OnContour);
assert(! (on_contour(v0) && on_contour(v1))); assert(! (on_contour(v0) && on_contour(v1)));
#endif // NDEBUG
if (on_contour(v0)) if (on_contour(v0))
annotate_vertex(v0, VertexCategory::OnContour); annotate_vertex(v0, VertexCategory::OnContour);
else { else {

View File

@ -176,13 +176,13 @@ TEST_CASE("Voronoi missing edges - Alessandro gapfill 12707", "[Voronoi]")
std::mt19937 gen; std::mt19937 gen;
std::uniform_int_distribution<coord_t> dist(-100, 100); std::uniform_int_distribution<coord_t> dist(-100, 100);
for (Point &p : poly.points) {
#if 0 #if 0
for (Point &p : poly.points) {
// Wiggle the points a bit to find out whether this fixes the voronoi diagram for this particular polygon. // Wiggle the points a bit to find out whether this fixes the voronoi diagram for this particular polygon.
p.x() = (p.x() += dist(gen)); p.x() = (p.x() += dist(gen));
p.y() = (p.y() += dist(gen)); p.y() = (p.y() += dist(gen));
#endif
} }
#endif
REQUIRE(intersecting_edges({ poly }).empty()); REQUIRE(intersecting_edges({ poly }).empty());
@ -267,7 +267,7 @@ TEST_CASE("Voronoi weirdness", "[Voronoi]")
}; };
// coord_t shift = 35058881; // coord_t shift = 35058881;
coord_t shift_ok = 17000000; // coord_t shift_ok = 17000000;
coord_t shift = 35058881; coord_t shift = 35058881;
Polygon poly { Polygon poly {
// <-4, 0>: bug // <-4, 0>: bug