From 2424f9826fd13a4f5174067d6c417468bdf45284 Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik Date: Thu, 25 May 2023 12:52:47 +0200 Subject: [PATCH] Fixed some compilation warnings. --- src/libslic3r/GCode/GCodeProcessor.cpp | 3 ++- src/libslic3r/Layer.cpp | 15 ++++++++------- src/libslic3r/PerimeterGenerator.cpp | 2 +- src/libslic3r/Polyline.cpp | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index 8b5f64662..6cfeda4cb 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -3909,7 +3909,7 @@ void GCodeProcessor::post_process() std::stringstream ss(cmd.substr(1)); int tool_number = -1; ss >> tool_number; - if (tool_number != -1) + if (tool_number != -1) { if (tool_number < 0 || (int)m_extruder_temps_config.size() <= tool_number) { // found an invalid value, clamp it to a valid one tool_number = std::clamp(0, m_extruder_temps_config.size() - 1, tool_number); @@ -3944,6 +3944,7 @@ void GCodeProcessor::post_process() } return line; }); + } } }; diff --git a/src/libslic3r/Layer.cpp b/src/libslic3r/Layer.cpp index 199caf0d0..842544c24 100644 --- a/src/libslic3r/Layer.cpp +++ b/src/libslic3r/Layer.cpp @@ -84,16 +84,16 @@ void Layer::make_slices() co.MiterLimit = scaled(3.); // Use the default zero edge merging distance. For this kind of safety offset the accuracy of normal direction is not important. // co.ShortestEdgeLength = delta * ClipperOffsetShortestEdgeFactor; - static constexpr const double accept_area_threshold_ccw = sqr(scaled(0.1 * delta)); +// static constexpr const double accept_area_threshold_ccw = sqr(scaled(0.1 * delta)); // Such a small hole should not survive the shrinkage, it should grow over - static constexpr const double accept_area_threshold_cw = sqr(scaled(0.2 * delta)); +// static constexpr const double accept_area_threshold_cw = sqr(scaled(0.2 * delta)); for (const ExPolygon &expoly : expolygons) { contours.clear(); co.Clear(); co.AddPath(expoly.contour.points, ClipperLib::jtMiter, ClipperLib::etClosedPolygon); co.Execute(contours, - delta); - size_t num_prev = out.size(); +// size_t num_prev = out.size(); if (! contours.empty()) { holes.clear(); for (const Polygon &hole : expoly.holes) { @@ -447,7 +447,7 @@ static void connect_layer_slices( for (int i = int(other_layer.lslices_ex.size()) - 1; i >= 0; -- i) if (contour_aabb.overlap(other_layer.lslices_ex[i].bbox)) // it is potentially slow, but should be executed rarely - if (Polygons overlap = intersection(contour_poly, other_layer.lslices[i]); ! overlap.empty()) + if (Polygons overlap = intersection(contour_poly, other_layer.lslices[i]); ! overlap.empty()) { if (other_has_duplicates) { // Find the contour with the largest overlap. It is expected that the other overlap will be very small. double a = area(overlap); @@ -460,6 +460,7 @@ static void connect_layer_slices( i_largest = i; break; } + } assert(i_largest >= 0); return i_largest; } @@ -500,10 +501,10 @@ static void connect_layer_slices( #endif // NDEBUG // Scatter the links, but don't sort them yet. - for (int32_t islice = 0; islice < below.lslices_ex.size(); ++ islice) + for (int32_t islice = 0; islice < int32_t(below.lslices_ex.size()); ++ islice) for (LayerSlice::Link &link : below.lslices_ex[islice].overlaps_above) above.lslices_ex[link.slice_idx].overlaps_below.push_back({ islice, link.area }); - for (int32_t islice = 0; islice < above.lslices_ex.size(); ++ islice) + for (int32_t islice = 0; islice < int32_t(above.lslices_ex.size()); ++ islice) for (LayerSlice::Link &link : above.lslices_ex[islice].overlaps_below) below.lslices_ex[link.slice_idx].overlaps_above.push_back({ islice, link.area }); // Sort the links. @@ -935,7 +936,7 @@ void Layer::sort_perimeters_into_islands( island.fill_region_id = LayerIsland::fill_region_composite_id; for (uint32_t fill_idx : fill_range) { if (const int fill_regon_id = map_expolygon_to_region_and_fill[fill_idx].region_id; - fill_regon_id == -1 || (island.fill_region_id != LayerIsland::fill_region_composite_id && island.fill_region_id != fill_regon_id)) { + fill_regon_id == -1 || (island.fill_region_id != LayerIsland::fill_region_composite_id && int(island.fill_region_id) != fill_regon_id)) { island.fill_region_id = LayerIsland::fill_region_composite_id; break; } else diff --git a/src/libslic3r/PerimeterGenerator.cpp b/src/libslic3r/PerimeterGenerator.cpp index b6c543bd9..5b2ffaa6a 100644 --- a/src/libslic3r/PerimeterGenerator.cpp +++ b/src/libslic3r/PerimeterGenerator.cpp @@ -743,7 +743,7 @@ ExtrusionPaths sort_extra_perimeters(const ExtrusionPaths& extra_perims, int ind } std::vector processed(extra_perims.size(), false); - for (size_t path_idx = 0; path_idx < index_of_first_unanchored; path_idx++) { + for (int path_idx = 0; path_idx < index_of_first_unanchored; path_idx++) { processed[path_idx] = true; } diff --git a/src/libslic3r/Polyline.cpp b/src/libslic3r/Polyline.cpp index 524736575..5261a8cfc 100644 --- a/src/libslic3r/Polyline.cpp +++ b/src/libslic3r/Polyline.cpp @@ -301,7 +301,7 @@ void ThickPolyline::start_at_index(int index) { assert(index >= 0 && index < this->points.size()); assert(this->points.front() == this->points.back() && this->width.front() == this->width.back()); - if (index != 0 && index != (this->points.size() - 1) && this->points.front() == this->points.back() && this->width.front() == this->width.back()) { + if (index != 0 && index + 1 != int(this->points.size()) && this->points.front() == this->points.back() && this->width.front() == this->width.back()) { this->points.pop_back(); assert(this->points.size() * 2 == this->width.size()); std::rotate(this->points.begin(), this->points.begin() + index, this->points.end());