Fixed some more compilation warnings

This commit is contained in:
Vojtech Bubnik 2023-05-25 12:59:32 +02:00
parent 2424f9826f
commit 714bfb2347
2 changed files with 10 additions and 8 deletions

View File

@ -1229,7 +1229,7 @@ void Print::alert_when_supports_needed()
} }
std::string translated_list = expansion_rule; 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%"); auto first_elem = translated_list.find("%1%");
assert(first_elem != translated_list.npos); assert(first_elem != translated_list.npos);
translated_list.replace(first_elem, 3, translated_elements[i]); 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 // expand the translated list by another application of the same rule
auto second_elem = translated_list.find("%2%"); auto second_elem = translated_list.find("%2%");
assert(second_elem != translated_list.npos); 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); translated_list.replace(second_elem, 3, expansion_rule);
} else { } else {
translated_list.replace(second_elem, 3, translated_elements[i + 1]); translated_list.replace(second_elem, 3, translated_elements[i + 1]);

View File

@ -387,6 +387,7 @@ static std::vector<std::pair<TreeSupportSettings, std::vector<size_t>>> group_me
return result; return result;
} }
#if 0
/*! /*!
* \brief Converts lines in internal format into a Polygons object representing these lines. * \brief Converts lines in internal format into a Polygons object representing these lines.
* *
@ -405,6 +406,7 @@ static std::vector<std::pair<TreeSupportSettings, std::vector<size_t>>> group_me
validate_range(result); validate_range(result);
return result; return result;
} }
#endif
/*! /*!
* \brief Evaluates if a point has to be added now. Required for a split_lines call in generate_initial_areas(). * \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<std::pair<Point, size_t>> polyline_sample_next_point_at_dis
else else
do_final_difference = true; 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 // 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 // reduce the stepsize to ensure it is offset the required amount of times
step_size = distance / min_amount_offset; step_size = distance / min_amount_offset;
@ -2611,13 +2613,13 @@ static void remove_deleted_elements(std::vector<SupportElements> &move_bounds)
std::iota(map_current.begin(), map_current.end(), 0); std::iota(map_current.begin(), map_current.end(), 0);
} }
// Delete all "deleted" elements from the end of the layer vector. // 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(); layer.pop_back();
// Mark as deleted in the map. // Mark as deleted in the map.
map_current[layer.size()] = -1; map_current[layer.size()] = -1;
} }
assert(i == layer.size() || i + 1 < layer.size()); 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()); element = std::move(layer.back());
layer.pop_back(); layer.pop_back();
// Mark the current element as deleted. // 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) { for (LayerIndex layer_idx = 1; layer_idx < LayerIndex(move_bounds.size()); ++ layer_idx) {
auto &layer = move_bounds[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) if (layer_above)
for (SupportElement &elem : *layer_above) for (SupportElement &elem : *layer_above)
elem.state.marked = false; 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; const Point movement = draw_area.child_element->state.result_on_layer - draw_area.element->state.result_on_layer;
movement_directions.emplace_back(movement, radius); 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) { for (int32_t parent_idx : draw_area.element->parents) {
const SupportElement &parent = (*layer_above)[parent_idx]; const SupportElement &parent = (*layer_above)[parent_idx];
const Point movement = parent.state.result_on_layer - draw_area.element->state.result_on_layer; 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<std::pair<SupportElement*, SupportElement*>> map_downwards_old; std::vector<std::pair<SupportElement*, SupportElement*>> map_downwards_old;
std::vector<std::pair<SupportElement*, SupportElement*>> map_downwards_new; std::vector<std::pair<SupportElement*, SupportElement*>> map_downwards_new;
for (LayerIndex layer_idx = 0; layer_idx < LayerIndex(move_bounds.size()); ++ layer_idx) { 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(); map_downwards_new.clear();
linear_data_layers.emplace_back(linear_data.size()); 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; }); std::sort(map_downwards_old.begin(), map_downwards_old.end(), [](auto &l, auto &r) { return l.first < r.first; });