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
const Geometry* geometry = nullptr;
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);
if (obj_geometry == m_geometries.end()) {
add_error("Unable to find object geometry");
@ -1875,7 +1875,6 @@ namespace Slic3r {
}
else {
std::cout << "non-single instance !!!\n";
int a = 0;
}
}
#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);
} else {
// 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;
}
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.
auto annotate_vertex = [](const VD::vertex_type *vertex, VertexCategory new_vertex_category) {
#ifndef NDEBUG
VertexCategory vc = vertex_category(vertex);
assert(vc == VertexCategory::Unknown || vc == new_vertex_category);
assert(new_vertex_category == VertexCategory::Inside ||
new_vertex_category == VertexCategory::Outside ||
new_vertex_category == VertexCategory::OnContour);
#endif // NDEBUG
set_vertex_category(const_cast<VD::vertex_type*>(vertex), new_vertex_category);
};
// Set an EdgeCategory, verify validity of the operation.
auto annotate_edge = [](const VD::edge_type *edge, EdgeCategory new_edge_category) {
#ifndef NDEBUG
EdgeCategory ec = edge_category(edge);
assert(ec == EdgeCategory::Unknown || ec == new_edge_category);
#ifndef NDEBUG
switch (new_edge_category) {
case EdgeCategory::PointsInside:
assert(edge->vertex0() != nullptr);
@ -693,7 +695,6 @@ void annotate_inside_outside(VD &vd, const Lines &lines)
default:
assert(false);
}
#endif // NDEBUG
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.
const VD::vertex_type *v0 = edge.vertex0();
const VD::vertex_type *v1 = edge.vertex1();
#ifndef NDEBUG
VertexCategory v0_category = vertex_category(v0);
VertexCategory v1_category = vertex_category(v1);
assert(v0_category != VertexCategory::OnContour || v1_category != VertexCategory::OnContour);
assert(! (on_contour(v0) && on_contour(v1)));
#endif // NDEBUG
if (on_contour(v0))
annotate_vertex(v0, VertexCategory::OnContour);
else {

View File

@ -176,13 +176,13 @@ TEST_CASE("Voronoi missing edges - Alessandro gapfill 12707", "[Voronoi]")
std::mt19937 gen;
std::uniform_int_distribution<coord_t> dist(-100, 100);
for (Point &p : poly.points) {
#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.
p.x() = (p.x() += dist(gen));
p.y() = (p.y() += dist(gen));
#endif
}
#endif
REQUIRE(intersecting_edges({ poly }).empty());
@ -267,7 +267,7 @@ TEST_CASE("Voronoi weirdness", "[Voronoi]")
};
// coord_t shift = 35058881;
coord_t shift_ok = 17000000;
// coord_t shift_ok = 17000000;
coord_t shift = 35058881;
Polygon poly {
// <-4, 0>: bug