Fixed some compilation warnings.

This commit is contained in:
Vojtech Bubnik 2023-05-25 12:52:47 +02:00
parent 1adf916ced
commit 2424f9826f
4 changed files with 12 additions and 10 deletions

View File

@ -3909,7 +3909,7 @@ void GCodeProcessor::post_process()
std::stringstream ss(cmd.substr(1)); std::stringstream ss(cmd.substr(1));
int tool_number = -1; int tool_number = -1;
ss >> tool_number; ss >> tool_number;
if (tool_number != -1) if (tool_number != -1) {
if (tool_number < 0 || (int)m_extruder_temps_config.size() <= tool_number) { if (tool_number < 0 || (int)m_extruder_temps_config.size() <= tool_number) {
// found an invalid value, clamp it to a valid one // found an invalid value, clamp it to a valid one
tool_number = std::clamp<int>(0, m_extruder_temps_config.size() - 1, tool_number); tool_number = std::clamp<int>(0, m_extruder_temps_config.size() - 1, tool_number);
@ -3944,6 +3944,7 @@ void GCodeProcessor::post_process()
} }
return line; return line;
}); });
}
} }
}; };

View File

@ -84,16 +84,16 @@ void Layer::make_slices()
co.MiterLimit = scaled<double>(3.); co.MiterLimit = scaled<double>(3.);
// Use the default zero edge merging distance. For this kind of safety offset the accuracy of normal direction is not important. // 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; // co.ShortestEdgeLength = delta * ClipperOffsetShortestEdgeFactor;
static constexpr const double accept_area_threshold_ccw = sqr(scaled<double>(0.1 * delta)); // static constexpr const double accept_area_threshold_ccw = sqr(scaled<double>(0.1 * delta));
// Such a small hole should not survive the shrinkage, it should grow over // Such a small hole should not survive the shrinkage, it should grow over
static constexpr const double accept_area_threshold_cw = sqr(scaled<double>(0.2 * delta)); // static constexpr const double accept_area_threshold_cw = sqr(scaled<double>(0.2 * delta));
for (const ExPolygon &expoly : expolygons) { for (const ExPolygon &expoly : expolygons) {
contours.clear(); contours.clear();
co.Clear(); co.Clear();
co.AddPath(expoly.contour.points, ClipperLib::jtMiter, ClipperLib::etClosedPolygon); co.AddPath(expoly.contour.points, ClipperLib::jtMiter, ClipperLib::etClosedPolygon);
co.Execute(contours, - delta); co.Execute(contours, - delta);
size_t num_prev = out.size(); // size_t num_prev = out.size();
if (! contours.empty()) { if (! contours.empty()) {
holes.clear(); holes.clear();
for (const Polygon &hole : expoly.holes) { 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) for (int i = int(other_layer.lslices_ex.size()) - 1; i >= 0; -- i)
if (contour_aabb.overlap(other_layer.lslices_ex[i].bbox)) if (contour_aabb.overlap(other_layer.lslices_ex[i].bbox))
// it is potentially slow, but should be executed rarely // 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) { if (other_has_duplicates) {
// Find the contour with the largest overlap. It is expected that the other overlap will be very small. // Find the contour with the largest overlap. It is expected that the other overlap will be very small.
double a = area(overlap); double a = area(overlap);
@ -460,6 +460,7 @@ static void connect_layer_slices(
i_largest = i; i_largest = i;
break; break;
} }
}
assert(i_largest >= 0); assert(i_largest >= 0);
return i_largest; return i_largest;
} }
@ -500,10 +501,10 @@ static void connect_layer_slices(
#endif // NDEBUG #endif // NDEBUG
// Scatter the links, but don't sort them yet. // 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) for (LayerSlice::Link &link : below.lslices_ex[islice].overlaps_above)
above.lslices_ex[link.slice_idx].overlaps_below.push_back({ islice, link.area }); 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) for (LayerSlice::Link &link : above.lslices_ex[islice].overlaps_below)
below.lslices_ex[link.slice_idx].overlaps_above.push_back({ islice, link.area }); below.lslices_ex[link.slice_idx].overlaps_above.push_back({ islice, link.area });
// Sort the links. // Sort the links.
@ -935,7 +936,7 @@ void Layer::sort_perimeters_into_islands(
island.fill_region_id = LayerIsland::fill_region_composite_id; island.fill_region_id = LayerIsland::fill_region_composite_id;
for (uint32_t fill_idx : fill_range) { for (uint32_t fill_idx : fill_range) {
if (const int fill_regon_id = map_expolygon_to_region_and_fill[fill_idx].region_id; 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; island.fill_region_id = LayerIsland::fill_region_composite_id;
break; break;
} else } else

View File

@ -743,7 +743,7 @@ ExtrusionPaths sort_extra_perimeters(const ExtrusionPaths& extra_perims, int ind
} }
std::vector<bool> processed(extra_perims.size(), false); std::vector<bool> 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; processed[path_idx] = true;
} }

View File

@ -301,7 +301,7 @@ void ThickPolyline::start_at_index(int index)
{ {
assert(index >= 0 && index < this->points.size()); assert(index >= 0 && index < this->points.size());
assert(this->points.front() == this->points.back() && this->width.front() == this->width.back()); 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(); this->points.pop_back();
assert(this->points.size() * 2 == this->width.size()); assert(this->points.size() * 2 == this->width.size());
std::rotate(this->points.begin(), this->points.begin() + index, this->points.end()); std::rotate(this->points.begin(), this->points.begin() + index, this->points.end());