From 714bfb2347fe84403c2954308d62904360eba227 Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik Date: Thu, 25 May 2023 12:59:32 +0200 Subject: [PATCH] Fixed some more compilation warnings --- src/libslic3r/Print.cpp | 4 ++-- src/libslic3r/Support/TreeSupport.cpp | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 7e196c85f..0ec88c44f 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -1229,7 +1229,7 @@ void Print::alert_when_supports_needed() } std::string translated_list = expansion_rule; - for (int i = 0; i < translated_elements.size() - 1; i++) { + for (int i = 0; i < int(translated_elements.size()) - 1; ++ i) { auto first_elem = translated_list.find("%1%"); assert(first_elem != translated_list.npos); translated_list.replace(first_elem, 3, translated_elements[i]); @@ -1237,7 +1237,7 @@ void Print::alert_when_supports_needed() // expand the translated list by another application of the same rule auto second_elem = translated_list.find("%2%"); assert(second_elem != translated_list.npos); - if (i < translated_elements.size() - 2) { + if (i < int(translated_elements.size()) - 2) { translated_list.replace(second_elem, 3, expansion_rule); } else { translated_list.replace(second_elem, 3, translated_elements[i + 1]); diff --git a/src/libslic3r/Support/TreeSupport.cpp b/src/libslic3r/Support/TreeSupport.cpp index 06fff4fe7..051f6cbb1 100644 --- a/src/libslic3r/Support/TreeSupport.cpp +++ b/src/libslic3r/Support/TreeSupport.cpp @@ -387,6 +387,7 @@ static std::vector>> group_me return result; } +#if 0 /*! * \brief Converts lines in internal format into a Polygons object representing these lines. * @@ -405,6 +406,7 @@ static std::vector>> group_me validate_range(result); return result; } +#endif /*! * \brief Evaluates if a point has to be added now. Required for a split_lines call in generate_initial_areas(). @@ -788,7 +790,7 @@ static std::optional> polyline_sample_next_point_at_dis else do_final_difference = true; } - if (steps + (distance < last_step_offset_without_check || distance % step_size != 0) < min_amount_offset && min_amount_offset > 1) { + if (steps + (distance < last_step_offset_without_check || (distance % step_size) != 0) < int(min_amount_offset) && min_amount_offset > 1) { // yes one can add a bool as the standard specifies that a result from compare operators has to be 0 or 1 // reduce the stepsize to ensure it is offset the required amount of times step_size = distance / min_amount_offset; @@ -2611,13 +2613,13 @@ static void remove_deleted_elements(std::vector &move_bounds) std::iota(map_current.begin(), map_current.end(), 0); } // Delete all "deleted" elements from the end of the layer vector. - while (i < layer.size() && layer.back().state.deleted) { + while (i < int32_t(layer.size()) && layer.back().state.deleted) { layer.pop_back(); // Mark as deleted in the map. map_current[layer.size()] = -1; } assert(i == layer.size() || i + 1 < layer.size()); - if (i + 1 < layer.size()) { + if (i + 1 < int32_t(layer.size())) { element = std::move(layer.back()); layer.pop_back(); // Mark the current element as deleted. @@ -2667,7 +2669,7 @@ static void create_nodes_from_area( for (LayerIndex layer_idx = 1; layer_idx < LayerIndex(move_bounds.size()); ++ layer_idx) { auto &layer = move_bounds[layer_idx]; - auto *layer_above = layer_idx + 1 < move_bounds.size() ? &move_bounds[layer_idx + 1] : nullptr; + auto *layer_above = layer_idx + 1 < LayerIndex(move_bounds.size()) ? &move_bounds[layer_idx + 1] : nullptr; if (layer_above) for (SupportElement &elem : *layer_above) elem.state.marked = false; @@ -2809,7 +2811,7 @@ static void generate_branch_areas( const Point movement = draw_area.child_element->state.result_on_layer - draw_area.element->state.result_on_layer; movement_directions.emplace_back(movement, radius); } - const SupportElements *layer_above = layer_idx + 1 < move_bounds.size() ? &move_bounds[layer_idx + 1] : nullptr; + const SupportElements *layer_above = layer_idx + 1 < LayerIndex(move_bounds.size()) ? &move_bounds[layer_idx + 1] : nullptr; for (int32_t parent_idx : draw_area.element->parents) { const SupportElement &parent = (*layer_above)[parent_idx]; const Point movement = parent.state.result_on_layer - draw_area.element->state.result_on_layer; @@ -3255,7 +3257,7 @@ static void draw_areas( std::vector> map_downwards_old; std::vector> map_downwards_new; for (LayerIndex layer_idx = 0; layer_idx < LayerIndex(move_bounds.size()); ++ layer_idx) { - SupportElements *layer_above = layer_idx + 1 < move_bounds.size() ? &move_bounds[layer_idx + 1] : nullptr; + SupportElements *layer_above = layer_idx + 1 < LayerIndex(move_bounds.size()) ? &move_bounds[layer_idx + 1] : nullptr; map_downwards_new.clear(); linear_data_layers.emplace_back(linear_data.size()); std::sort(map_downwards_old.begin(), map_downwards_old.end(), [](auto &l, auto &r) { return l.first < r.first; });