Fixed some clang warnings

This commit is contained in:
Vojtech Bubnik 2021-02-09 19:23:58 +01:00
parent 770d8b5d08
commit 5e9a8ea700
17 changed files with 45 additions and 30 deletions

View file

@ -301,7 +301,7 @@ static Polylines connect_brim_lines(Polylines &&polylines, const Polygons &brim_
polylines.erase(polylines.begin() + end, polylines.end());
}
return polylines;
return std::move(polylines);
}
static void make_inner_brim(const Print &print, const ConstPrintObjectPtrs &top_level_objects_with_brim, ExtrusionEntityCollection &brim)

View file

@ -1695,6 +1695,7 @@ public:
// Static configuration definition. Any value stored into this ConfigBase shall have its definition here.
virtual const ConfigDef* def() const = 0;
// Find ando/or create a ConfigOption instance for a given name.
using ConfigOptionResolver::optptr;
virtual ConfigOption* optptr(const t_config_option_key &opt_key, bool create = false) = 0;
// Collect names of all configuration values maintained by this configuration store.
virtual t_config_option_keys keys() const = 0;

View file

@ -445,6 +445,7 @@ Points resample_polygon(const Points &contour, double dist, std::vector<Resample
return out;
}
#if 0
static inline void smooth_compensation(std::vector<float> &compensation, float strength, size_t num_iterations)
{
std::vector<float> out(compensation);
@ -459,6 +460,7 @@ static inline void smooth_compensation(std::vector<float> &compensation, float s
out.swap(compensation);
}
}
#endif
static inline void smooth_compensation_banded(const Points &contour, float band, std::vector<float> &compensation, float strength, size_t num_iterations)
{

View file

@ -690,6 +690,7 @@ static inline bool interval_inside_interval(double outer_low, double outer_high,
return inside_interval(outer_low, outer_high, inner_low) && inside_interval(outer_low, outer_high, inner_high);
}
#if 0
static inline bool cyclic_interval_inside_interval(double outer_low, double outer_high, double inner_low, double inner_high, double length)
{
if (outer_low > outer_high)
@ -702,6 +703,7 @@ static inline bool cyclic_interval_inside_interval(double outer_low, double oute
}
return interval_inside_interval(outer_low, outer_high, inner_low, inner_high, double(SCALED_EPSILON));
}
#endif
// #define INFILL_DEBUG_OUTPUT

View file

@ -2245,22 +2245,22 @@ static std::vector<MonotonicRegionLink> chain_monotonic_regions(
#endif /* NDEBUG */
// How many times to repeat the ant simulation (number of ant generations).
constexpr int num_rounds = 25;
constexpr int const const num_rounds = 25;
// After how many rounds without an improvement to exit?
constexpr int num_rounds_no_change_exit = 8;
constexpr int const num_rounds_no_change_exit = 8;
// With how many ants each of the run will be performed?
const int num_ants = std::min(int(regions.size()), 10);
const int const num_ants = std::min(int(regions.size()), 10);
// Base (initial) pheromone level. This value will be adjusted based on the length of the first greedy path found.
float pheromone_initial_deposit = 0.5f;
// Evaporation rate of pheromones.
constexpr float pheromone_evaporation = 0.1f;
constexpr float const pheromone_evaporation = 0.1f;
// Evaporation rate to diversify paths taken by individual ants.
constexpr float pheromone_diversification = 0.1f;
constexpr float const pheromone_diversification = 0.1f;
// Probability at which to take the next best path. Otherwise take the the path based on the cost distribution.
constexpr float probability_take_best = 0.9f;
constexpr float const probability_take_best = 0.9f;
// Exponents of the cost function.
constexpr float pheromone_alpha = 1.f; // pheromone exponent
constexpr float pheromone_beta = 2.f; // attractiveness weighted towards edge length
constexpr float const pheromone_alpha = 1.f; // pheromone exponent
constexpr float const pheromone_beta = 2.f; // attractiveness weighted towards edge length
AntPathMatrix path_matrix(regions, poly_with_offset, segs, pheromone_initial_deposit);

View file

@ -2432,7 +2432,7 @@ namespace Slic3r {
if (!volume->mesh().has_shared_vertices())
throw Slic3r::FileIOError("store_3mf() requires shared vertices");
volumes_offsets.insert({ volume, Offsets(vertices_count) }).first;
volumes_offsets.insert({ volume, Offsets(vertices_count) });
const indexed_triangle_set &its = volume->mesh().its;
if (its.vertices.empty()) {

View file

@ -891,6 +891,7 @@ namespace DoExport {
}
}
#if 0
// Sort the PrintObjects by their increasing Z, likely useful for avoiding colisions on Deltas during sequential prints.
static inline std::vector<const PrintInstance*> sort_object_instances_by_max_z(const Print &print)
{
@ -903,6 +904,7 @@ static inline std::vector<const PrintInstance*> sort_object_instances_by_max_z(c
instances.emplace_back(&object->instances()[i]);
return instances;
}
#endif
// Produce a vector of PrintObjects in the order of their respective ModelObjects in print.model().
std::vector<const PrintInstance*> sort_object_instances_by_model_order(const Print& print)

View file

@ -1083,6 +1083,7 @@ void svg_draw_polyline_chain(const char *name, size_t idx, const Polylines &poly
}
#endif /* DEBUG_SVG_OUTPUT */
#if 0
// Flip the sequences of polylines to lower the total length of connecting lines.
static inline void improve_ordering_by_segment_flipping(Polylines &polylines, bool fixed_start)
{
@ -1253,6 +1254,7 @@ static inline void improve_ordering_by_segment_flipping(Polylines &polylines, bo
assert(cost_final <= cost_initial);
#endif /* NDEBUG */
}
#endif
struct FlipEdge {
FlipEdge(const Vec2d &p1, const Vec2d &p2, size_t source_index) : p1(p1), p2(p2), source_index(source_index) {}
@ -1337,6 +1339,7 @@ static inline std::pair<double, size_t> minimum_crossover_cost(
return std::make_pair(cost_min, flip_min);
}
#if 0
static inline std::pair<double, size_t> minimum_crossover_cost(
const std::vector<FlipEdge> &edges,
const std::pair<size_t, size_t> &span1, const ConnectionCost &cost1,
@ -1412,6 +1415,7 @@ static inline std::pair<double, size_t> minimum_crossover_cost(
}
return std::make_pair(cost_min, flip_min);
}
#endif
static inline void do_crossover(const std::vector<FlipEdge> &edges_in, std::vector<FlipEdge> &edges_out,
const std::pair<size_t, size_t> &span1, const std::pair<size_t, size_t> &span2, const std::pair<size_t, size_t> &span3,
@ -1454,7 +1458,7 @@ static inline void do_crossover(const std::vector<FlipEdge> &edges_in, std::vect
assert(edges_in.size() == edges_out.size());
}
#if 0
static inline void do_crossover(const std::vector<FlipEdge> &edges_in, std::vector<FlipEdge> &edges_out,
const std::pair<size_t, size_t> &span1, const std::pair<size_t, size_t> &span2, const std::pair<size_t, size_t> &span3, const std::pair<size_t, size_t> &span4,
size_t i)
@ -1526,6 +1530,7 @@ static inline void do_crossover(const std::vector<FlipEdge> &edges_in, std::vect
}
assert(edges_in.size() == edges_out.size());
}
#endif
// Worst time complexity: O(min(n, 100) * (n * log n + n^2)
// Expected time complexity: O(min(n, 100) * (n * log n + k * n)
@ -1702,6 +1707,7 @@ private:
const ConnectionCost* costs[4];
};
#if 0
static inline std::pair<double, size_t> minimum_crossover_cost(
const FourOptCosts &segment_costs,
const Matrixd &segment_end_point_distance_matrix,
@ -1760,7 +1766,6 @@ static inline std::pair<double, size_t> minimum_crossover_cost(
return std::make_pair(cost_min, flip_min);
}
#if 0
// Currently not used, too slow.
static inline void reorder_by_three_exchanges_with_segment_flipping2(std::vector<FlipEdge> &edges)
{

View file

@ -52,7 +52,7 @@ static inline std::pair<float, float> face_z_span(const stl_facet &f)
// https://tams.informatik.uni-hamburg.de/publications/2017/Adaptive%20Slicing%20for%20the%20FDM%20Process%20Revisited.pdf
// (page 51, formula (8))
// Currenty @platch's error metric formula is not used.
static constexpr double SURFACE_CONST = 0.18403;
static constexpr const double SURFACE_CONST = 0.18403;
// for a given facet, compute maximum height within the allowed surface roughness / stairstepping deviation
static inline float layer_height_from_slope(const SlicingAdaptive::FaceZ &face, float max_surface_deviation)

View file

@ -3304,7 +3304,7 @@ void PrintObjectSupportMaterial::generate_toolpaths(
// Now modulate the support layer height in parallel.
tbb::parallel_for(tbb::blocked_range<size_t>(n_raft_layers, support_layers.size()),
[this, &support_layers, &layer_caches]
[&support_layers, &layer_caches]
(const tbb::blocked_range<size_t>& range) {
for (size_t support_layer_id = range.begin(); support_layer_id < range.end(); ++ support_layer_id) {
SupportLayer &support_layer = *support_layers[support_layer_id];

View file

@ -1146,6 +1146,7 @@ TriangleMeshSlicer::FacetSliceType TriangleMeshSlicer::slice_facet(
return NoSlice;
}
#if 0
//FIXME Should this go away? For valid meshes the function slice_facet() returns Slicing
// and sets edges of vertical triangles to produce only a single edge per pair of neighbor faces.
// So the following code makes only sense now to handle degenerate meshes with more than two faces
@ -1209,7 +1210,7 @@ static inline void remove_tangent_edges(std::vector<IntersectionLine> &lines)
}
}
}
#endif
struct OpenPolyline {
OpenPolyline() {};

View file

@ -3553,7 +3553,7 @@ void GCodeViewer::render_toolpaths() const
}
#if ENABLE_REDUCED_TOOLPATHS_SEGMENT_CAPS
auto render_sequential_range_cap = [this, set_uniform_color](const SequentialRangeCap& cap) {
auto render_sequential_range_cap = [set_uniform_color](const SequentialRangeCap& cap) {
GLShaderProgram* shader = wxGetApp().get_shader(cap.buffer->shader.c_str());
if (shader != nullptr) {
shader->start_using();

View file

@ -67,20 +67,20 @@
#include <imgui/imgui_internal.h>
static const float TRACKBALLSIZE = 0.8f;
static constexpr const float TRACKBALLSIZE = 0.8f;
static const float DEFAULT_BG_DARK_COLOR[3] = { 0.478f, 0.478f, 0.478f };
static const float DEFAULT_BG_LIGHT_COLOR[3] = { 0.753f, 0.753f, 0.753f };
static const float ERROR_BG_DARK_COLOR[3] = { 0.478f, 0.192f, 0.039f };
static const float ERROR_BG_LIGHT_COLOR[3] = { 0.753f, 0.192f, 0.039f };
//static const float AXES_COLOR[3][3] = { { 1.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, { 0.0f, 0.0f, 1.0f } };
static constexpr const float DEFAULT_BG_DARK_COLOR[3] = { 0.478f, 0.478f, 0.478f };
static constexpr const float DEFAULT_BG_LIGHT_COLOR[3] = { 0.753f, 0.753f, 0.753f };
static constexpr const float ERROR_BG_DARK_COLOR[3] = { 0.478f, 0.192f, 0.039f };
static constexpr const float ERROR_BG_LIGHT_COLOR[3] = { 0.753f, 0.192f, 0.039f };
//static constexpr const float AXES_COLOR[3][3] = { { 1.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, { 0.0f, 0.0f, 1.0f } };
// Number of floats
static const size_t MAX_VERTEX_BUFFER_SIZE = 131072 * 6; // 3.15MB
static constexpr const size_t MAX_VERTEX_BUFFER_SIZE = 131072 * 6; // 3.15MB
// Reserve size in number of floats.
static const size_t VERTEX_BUFFER_RESERVE_SIZE = 131072 * 2; // 1.05MB
static constexpr const size_t VERTEX_BUFFER_RESERVE_SIZE = 131072 * 2; // 1.05MB
// Reserve size in number of floats, maximum sum of all preallocated buffers.
static const size_t VERTEX_BUFFER_RESERVE_SIZE_SUM_MAX = 1024 * 1024 * 128 / 4; // 128MB
static constexpr const size_t VERTEX_BUFFER_RESERVE_SIZE_SUM_MAX = 1024 * 1024 * 128 / 4; // 128MB
namespace Slic3r {
namespace GUI {
@ -1180,7 +1180,7 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas)
#endif // ENABLE_RENDER_PICKING_PASS
, m_render_sla_auxiliaries(true)
, m_labels(*this)
, m_slope(*this, m_volumes)
, m_slope(m_volumes)
{
if (m_canvas != nullptr) {
m_timer.SetOwner(m_canvas);

View file

@ -394,11 +394,10 @@ class GLCanvas3D
class Slope
{
bool m_enabled{ false };
GLCanvas3D& m_canvas;
GLVolumeCollection& m_volumes;
static float s_window_width;
public:
Slope(GLCanvas3D& canvas, GLVolumeCollection& volumes) : m_canvas(canvas), m_volumes(volumes) {}
Slope(GLVolumeCollection& volumes) : m_volumes(volumes) {}
void enable(bool enable) { m_enabled = enable; }
bool is_enabled() const { return m_enabled; }

View file

@ -203,6 +203,7 @@ namespace search_for_drives_internal
}
}
#if 0
static void search_path(const std::string &path, const std::string &parent_path, std::vector<DriveData> &out)
{
glob_t globbuf;
@ -217,6 +218,7 @@ namespace search_for_drives_internal
}
globfree(&globbuf);
}
#endif
}
std::vector<DriveData> RemovableDriveManager::search_for_removable_drives() const

View file

@ -18,7 +18,9 @@ public:
float get_scale_factor();
private:
#ifdef __WXGTK3__
wxWindow* m_window;
#endif // __WXGTK3__
void* m_self;
};

View file

@ -11,8 +11,7 @@
namespace Slic3r {
namespace GUI {
RetinaHelper::RetinaHelper(wxWindow* window) :
m_window(window)
RetinaHelper::RetinaHelper(wxWindow*)
{
m_self = nullptr;
m_self = [[RetinaHelperImpl alloc] initWithView:window->GetHandle() handler:window->GetEventHandler()];