Fixed some more GCC warnings

This commit is contained in:
Lukas Matena 2021-01-29 14:47:41 +01:00
parent df634a715d
commit dc4bdad84a
6 changed files with 18 additions and 10 deletions

View File

@ -2178,11 +2178,11 @@ static std::vector<MonotonicRegionLink> chain_monotonic_regions(
float best_path_length = std::numeric_limits<float>::max();
struct NextCandidate {
MonotonicRegion *region;
MonotonicRegion *region = nullptr;
AntPath *link;
AntPath *link_flipped;
float probability;
bool dir;
bool dir = false;
};
std::vector<NextCandidate> next_candidates;
@ -2317,6 +2317,7 @@ static std::vector<MonotonicRegionLink> chain_monotonic_regions(
queue.pop_back();
}
// Extend the path.
assert(next_candidate.region);
MonotonicRegion *next_region = next_candidate.region;
bool next_dir = next_candidate.dir;
total_length += next_region->length(next_dir) + path_matrix(*path_end.region, path_end.flipped, *next_region, next_dir).length;

View File

@ -800,10 +800,9 @@ void PresetBundle::load_config_file_config(const std::string &name_or_path, bool
compatible_printers_condition = compatible_printers_condition_values[1];
compatible_prints_condition = compatible_prints_condition_values.front();
Preset *loaded = nullptr;
if (is_external) {
auto [aloaded, modified] = this->filaments.load_external_preset(name_or_path, name, old_filament_profile_names->values.front(), config);
loaded = aloaded;
} else {
if (is_external)
loaded = this->filaments.load_external_preset(name_or_path, name, old_filament_profile_names->values.front(), config).first;
else {
// called from Config Wizard.
loaded= &this->filaments.load_preset(this->filaments.path_from_name(name), name, config);
loaded->save();

View File

@ -1553,7 +1553,8 @@ static inline void reorder_by_two_exchanges_with_segment_flipping(std::vector<Fl
size_t crossover1_pos_final = std::numeric_limits<size_t>::max();
size_t crossover2_pos_final = std::numeric_limits<size_t>::max();
size_t crossover_flip_final = 0;
for (const auto& [longest_connection_length, longest_connection_idx] : connection_lengths) {
for (const std::pair<double, size_t>& first_crossover_candidate : connection_lengths) {
size_t longest_connection_idx = first_crossover_candidate.second;
connection_tried[longest_connection_idx] = true;
// Find the second crossover connection with the lowest total chain cost.
size_t crossover_pos_min = std::numeric_limits<size_t>::max();
@ -1628,7 +1629,8 @@ static inline void reorder_by_three_exchanges_with_segment_flipping(std::vector<
size_t crossover2_pos_final = std::numeric_limits<size_t>::max();
size_t crossover3_pos_final = std::numeric_limits<size_t>::max();
size_t crossover_flip_final = 0;
for (const auto& [longest_connection_length, longest_connection_idx] : connection_lengths) {
for (const std::pair<double, size_t> &first_crossover_candidate : connection_lengths) {
size_t longest_connection_idx = first_crossover_candidate.second;
connection_tried[longest_connection_idx] = true;
// Find the second crossover connection with the lowest total chain cost.
double crossover_cost_min = connections.back().cost;
@ -1784,7 +1786,8 @@ static inline void reorder_by_three_exchanges_with_segment_flipping2(std::vector
#else /* NDEBUG */
Matrixd segment_end_point_distance_matrix = Matrixd::Constant(4 * 4, 4 * 4, std::numeric_limits<double>::max());
#endif /* NDEBUG */
for (const auto& [longest_connection_length, longest_connection_idx] : connection_lengths) {
for (const std::pair<double, size_t> &first_crossover_candidate : connection_lengths) {
size_t longest_connection_idx = first_crossover_candidate.second;
connection_tried[longest_connection_idx] = true;
// Find the second crossover connection with the lowest total chain cost.
double crossover_cost_min = connections.back().cost;

View File

@ -201,7 +201,7 @@ void PresetComboBox::update_selection()
if (!cell) return;
g_object_set(G_OBJECT(cell), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
g_object_set(G_OBJECT(cell), "ellipsize", PANGO_ELLIPSIZE_END, (char*)NULL);
// Only the list of cells must be freed, the renderer isn't ours to free
g_list_free(cells);

View File

@ -16,6 +16,7 @@ using namespace Slic3r;
namespace Slic3r {
ClipperLib::Path mittered_offset_path_scaled(const Points& contour, const std::vector<float>& deltas, double miter_limit);
#if 0
static Points mittered_offset_path_scaled_points(const Points& contour, const std::vector<float>& deltas, double miter_limit)
{
Points out;
@ -29,6 +30,7 @@ namespace Slic3r {
}
return out;
}
#endif
}
static ExPolygon spirograph_gear_1mm()
@ -494,6 +496,7 @@ SCENARIO("Elephant foot compensation", "[ElephantFoot]") {
ExPolygon input = spirograph_gear_1mm().simplify(SCALED_EPSILON).front();
ExPolygon output;
std::vector<float> deltas(input.contour.points.size(), scale_(1.));
// mittered_offset_path_scaled_points is commented out somewhere above
output.contour.points = Slic3r::mittered_offset_path_scaled_points(input.contour.points, deltas, 2.);
#ifdef TESTS_EXPORT_SVGS
{

View File

@ -326,7 +326,9 @@ static void recreate_object_from_rasters(const std::string &objname, float lh) {
double disp_w = 120.96;
double disp_h = 68.04;
#ifndef NDEBUG
size_t cntr = 0;
#endif
for (ExPolygons &layer : layers) {
auto rst = create_raster(res, disp_w, disp_h);