Suppress some compiler warnings, fix few possible bugs. (#6224)

* Supress warnings on unused functions an variables

Compilation of OrcaSlicer produces 3056 warnings.
Nearly half of them related to unused functions and variables.

It is unlikely we going to clean them up since we may want to
keep code base as close to the BBS as possible

* initialize class member with correct value

* Fix memset arguments order

* Merge multiple statemensts into single

* fix -Wpessimizing-move
This commit is contained in:
Dima Buzdyk
2024-08-02 20:56:23 +06:00
committed by GitHub
parent de76e36e31
commit 2dba699a42
6 changed files with 16 additions and 14 deletions

View File

@ -873,7 +873,7 @@ void TreeSupport::detect_overhangs(bool detect_first_sharp_tail_only)
// normal overhang
ExPolygons lower_layer_offseted = offset_ex(lower_polys, support_offset_scaled, SUPPORT_SURFACES_OFFSET_PARAMETERS);
ExPolygons overhang_areas = std::move(diff_ex(curr_polys, lower_layer_offseted));
ExPolygons overhang_areas = diff_ex(curr_polys, lower_layer_offseted);
overhang_areas.erase(std::remove_if(overhang_areas.begin(), overhang_areas.end(),
[extrusion_width_scaled](ExPolygon& area) { return offset_ex(area, -0.1 * extrusion_width_scaled).empty(); }),
@ -2303,7 +2303,7 @@ void TreeSupport::draw_circles(const std::vector<std::vector<Node*>>& contact_no
for (size_t i = 0; i <= bottom_gap_layers; i++)
{
const Layer* below_layer = m_object->get_layer(layer_nr - bottom_interface_layers - i);
ExPolygons bottom_interface = std::move(intersection_ex(base_areas, below_layer->lslices));
ExPolygons bottom_interface = intersection_ex(base_areas, below_layer->lslices);
floor_areas.insert(floor_areas.end(), bottom_interface.begin(), bottom_interface.end());
}
}
@ -2315,7 +2315,7 @@ void TreeSupport::draw_circles(const std::vector<std::vector<Node*>>& contact_no
}
if (bottom_gap_layers > 0 && layer_nr > bottom_gap_layers) {
const Layer* below_layer = m_object->get_layer(layer_nr - bottom_gap_layers);
ExPolygons bottom_gap_area = std::move(intersection_ex(floor_areas, below_layer->lslices));
ExPolygons bottom_gap_area = intersection_ex(floor_areas, below_layer->lslices);
if (!bottom_gap_area.empty()) {
floor_areas = std::move(diff_ex(floor_areas, bottom_gap_area));
}
@ -2659,7 +2659,7 @@ void TreeSupport::drop_nodes(std::vector<std::vector<Node*>>& contact_nodes)
m_object->print()->set_status(60, (boost::format(_L("Support: propagate branches at layer %d")) % layer_nr).str());
Polygons layer_contours = std::move(m_ts_data->get_contours_with_holes(layer_nr));
Polygons layer_contours = m_ts_data->get_contours_with_holes(layer_nr);
//std::unordered_map<Line, bool, LineHash>& mst_line_x_layer_contour_cache = m_mst_line_x_layer_contour_caches[layer_nr];
std::unordered_map<Line, bool, LineHash> mst_line_x_layer_contour_cache;
auto is_line_cut_by_contour = [&mst_line_x_layer_contour_cache,&layer_contours](Point a, Point b)
@ -3645,7 +3645,7 @@ const ExPolygons& TreeSupportData::calculate_collision(const RadiusLayerPair& ke
{
assert(key.layer_nr < m_layer_outlines.size());
ExPolygons collision_areas = std::move(offset_ex(m_layer_outlines[key.layer_nr], scale_(key.radius)));
ExPolygons collision_areas = offset_ex(m_layer_outlines[key.layer_nr], scale_(key.radius));
const auto ret = m_collision_cache.insert({ key, std::move(collision_areas) });
return ret.first->second;
}
@ -3677,7 +3677,7 @@ const ExPolygons& TreeSupportData::calculate_avoidance(const RadiusLayerPair& ke
}
layer_nr_next = layer_heights[layer_nr].next_layer_nr;
ExPolygons avoidance_areas = std::move(offset_ex(get_avoidance(radius, layer_nr_next, key.recursions+1), scale_(-m_max_move)));
ExPolygons avoidance_areas = offset_ex(get_avoidance(radius, layer_nr_next, key.recursions+1), scale_(-m_max_move));
const ExPolygons &collision = get_collision(radius, layer_nr);
avoidance_areas.insert(avoidance_areas.end(), collision.begin(), collision.end());
avoidance_areas = std::move(union_ex(avoidance_areas));
@ -3685,7 +3685,7 @@ const ExPolygons& TreeSupportData::calculate_avoidance(const RadiusLayerPair& ke
//assert(ret.second);
return ret.first->second;
} else {
ExPolygons avoidance_areas = std::move(offset_ex(m_layer_outlines_below[layer_nr], scale_(m_xy_distance + radius)));
ExPolygons avoidance_areas = offset_ex(m_layer_outlines_below[layer_nr], scale_(m_xy_distance + radius));
auto ret = m_avoidance_cache.insert({ key, std::move(avoidance_areas) });
assert(ret.second);
return ret.first->second;