Fixed several warnings

This commit is contained in:
Lukas Matena 2023-03-07 12:30:23 +01:00
parent 8bd240c93f
commit 1fbbaaae9b
15 changed files with 36 additions and 81 deletions

View File

@ -1736,7 +1736,7 @@ private:
void set_values(const std::initializer_list<std::string_view> il) {
m_values.clear();
m_values.reserve(il.size());
for (const std::string_view p : il)
for (const std::string_view& p : il)
m_values.emplace_back(p);
assert(m_labels.empty() || m_labels.size() == m_values.size());
}
@ -1745,7 +1745,7 @@ private:
m_values.reserve(il.size());
m_labels.clear();
m_labels.reserve(il.size());
for (const std::pair<std::string_view, std::string_view> p : il) {
for (const std::pair<std::string_view, std::string_view>& p : il) {
m_values.emplace_back(p.first);
m_labels.emplace_back(p.second);
}
@ -1753,7 +1753,7 @@ private:
void set_labels(const std::initializer_list<std::string_view> il) {
m_labels.clear();
m_labels.reserve(il.size());
for (const std::string_view p : il)
for (const std::string_view& p : il)
m_labels.emplace_back(p);
assert(m_values.empty() || m_labels.size() == m_values.size());
}
@ -1762,9 +1762,9 @@ private:
// Check whether def.enum_values contains all the values of def.enum_keys_map and
// that they are sorted by their ordinary values.
m_values_ordinary = true;
for (const std::pair<std::string, int>& key : *m_enum_keys_map) {
assert(key.second >= 0);
if (key.second >= this->values().size() || this->value(key.second) != key.first) {
for (const auto& [enum_name, enum_int] : *m_enum_keys_map) {
assert(enum_int >= 0);
if (enum_int >= int(this->values().size()) || this->value(enum_int) != enum_name) {
m_values_ordinary = false;
break;
}

View File

@ -929,7 +929,7 @@ void WipeTower::toolchange_Unload(
writer.retract(-m_cooling_tube_length/2.f+m_parking_pos_retraction-m_cooling_tube_retraction, 2000);
}
// this is to align ramming and future wiping extrusions, so the future y-steps can be uniform from the start:
// this is to align ramming and future wiping extrusions, so the future y-steps can be uniform from the start:
// the perimeter_width will later be subtracted, it is there to not load while moving over just extruded material
Vec2f pos = Vec2f(end_of_ramming.x(), end_of_ramming.y() + (y_step/m_extra_spacing-m_perimeter_width) / 2.f + m_perimeter_width);
if (m_semm)
@ -937,8 +937,8 @@ void WipeTower::toolchange_Unload(
else
writer.set_position(pos);
writer.resume_preview()
.flush_planner_queue();
writer.resume_preview()
.flush_planner_queue();
}
// Change the tool, set a speed override for soluble and flex materials.

View File

@ -444,7 +444,9 @@ private:
MedialAxis::MedialAxis(double min_width, double max_width, const ExPolygon &expolygon) :
m_expolygon(expolygon), m_lines(expolygon.lines()), m_min_width(min_width), m_max_width(max_width)
{}
{
(void)m_expolygon; // supress unused variable warning
}
void MedialAxis::build(ThickPolylines* polylines)
{

View File

@ -356,7 +356,7 @@ void LayerRegion::process_external_surfaces(const Layer *lower_layer, const Poly
shell_width += perimeter_flow.scaled_spacing() * (num_perimeters - 1);
} else {
// TODO: Maybe there is better solution when printing with zero perimeters, but this works reasonably well, given the situation
shell_width = SCALED_EPSILON;
shell_width = float(SCALED_EPSILON);
}
// Scaled expansions of the respective external surfaces.

View File

@ -889,7 +889,6 @@ const BoundingBoxf3& ModelObject::bounding_box_exact() const
if (! m_bounding_box_exact_valid) {
m_bounding_box_exact_valid = true;
m_min_max_z_valid = true;
BoundingBoxf3 raw_bbox = this->raw_mesh_bounding_box();
m_bounding_box_exact.reset();
for (size_t i = 0; i < this->instances.size(); ++ i)
m_bounding_box_exact.merge(this->instance_bounding_box(i));

View File

@ -1774,7 +1774,7 @@ void PrintObject::bridge_over_infill()
Polygons infill_region = to_polygons(r->fill_expolygons());
Polygons deep_infill_area = closing(infill_region, scale_(0.01), scale_(0.01) + 4.0 * flow.scaled_spacing());
Polygons solid_supported_area = expand(not_sparse_infill, 4.0 * flow.scaled_spacing());
infill_and_deep_infill_polygons_per_region[r] = {closing(infill_region, scale_(0.1)),
infill_and_deep_infill_polygons_per_region[r] = {closing(infill_region, float(scale_(0.1))),
intersection(lower_layers_sparse_infill,
diff(deep_infill_area, solid_supported_area))};
}

View File

@ -1077,7 +1077,7 @@ SLAPrintObject::get_parts_to_slice(SLAPrintObjectStep untilstep) const
std::vector<csg::CSGPart> ret;
for (int step = 0; step < s; ++step) {
for (unsigned int step = 0; step < s; ++step) {
auto r = m_mesh_to_slice.equal_range(SLAPrintObjectStep(step));
csg::copy_csgrange_shallow(Range{r.first, r.second}, std::back_inserter(ret));
}

View File

@ -180,7 +180,7 @@ indexed_triangle_set SLAPrint::Steps::generate_preview_vdb(
auto r = range(po.m_mesh_to_slice);
auto grid = csg::voxelize_csgmesh(r, voxparams);
auto m = grid ? grid_to_mesh(*grid, 0., 0.01) : indexed_triangle_set{};
float loss_less_max_error = 1e-6;
float loss_less_max_error = float(1e-6);
its_quadric_edge_collapse(m, 0U, &loss_less_max_error);
return m;

View File

@ -1114,7 +1114,7 @@ indexed_triangle_set its_make_sphere(double radius, double fa)
std::vector<std::array<DividedEdge, 3>> divided_triangles(indices.size());
std::vector<Vec3i> new_neighbors(4*indices.size());
size_t orig_indices_size = indices.size();
int orig_indices_size = int(indices.size());
for (int i=0; i<orig_indices_size; ++i) { // iterate over all old triangles
// We are going to split this triangle. Let's foresee what will be the indices

View File

@ -62,7 +62,11 @@ public:
// Inherits coord_t x, y
};
#define DEBUG_INTERSECTIONLINE (! defined(NDEBUG) || defined(SLIC3R_DEBUG_SLICE_PROCESSING))
#if (! defined(NDEBUG) || defined(SLIC3R_DEBUG_SLICE_PROCESSING))
#define DEBUG_INTERSECTION_LINE 1
#else
#define DEBUG_INTERSECTION_LINE 0
#endif
class IntersectionLine : public Line
{

View File

@ -598,11 +598,11 @@ void TextCtrl::propagate_value()
if (m_opt.nullable && val != na_value())
m_last_meaningful_value = val;
if (!is_defined_input_value<wxTextCtrl>(window, m_opt.type) )
// on_kill_focus() cause a call of OptionsGroup::reload_config(),
// Thus, do it only when it's really needed (when undefined value was input)
if (!is_defined_input_value<wxTextCtrl>(window, m_opt.type) )
// on_kill_focus() cause a call of OptionsGroup::reload_config(),
// Thus, do it only when it's really needed (when undefined value was input)
on_kill_focus();
else if (value_was_changed())
else if (value_was_changed())
on_change_field();
}
@ -931,8 +931,8 @@ boost::any& SpinCtrl::get_value()
if (spin->GetTextValue() == na_value(true))
return m_value;
int value = spin->GetValue();
return m_value = value;
int value = spin->GetValue();
return m_value = value;
}
void SpinCtrl::propagate_value()
@ -946,7 +946,7 @@ void SpinCtrl::propagate_value()
if (tmp_value == UNDEF_VALUE) {
on_kill_focus();
} else {
} else {
#ifdef __WXOSX__
// check input value for minimum
if (m_opt.min > 0 && tmp_value < m_opt.min) {
@ -1152,7 +1152,7 @@ void Choice::set_value(const std::string& value, bool change_event) //! Redunda
field->SetSelection(*opt);
else
field->SetValue(value);
m_disable_change_event = false;
m_disable_change_event = false;
}
void Choice::set_value(const boost::any& value, bool change_event)

View File

@ -64,26 +64,6 @@ static GLModel::Geometry its_make_line(Vec3f beg_pos, Vec3f end_pos)
return init_data;
}
// Generates mesh for a square plane
static GLModel::Geometry its_make_square_plane(float radius)
{
GLModel::Geometry init_data;
init_data.format = { GLModel::Geometry::EPrimitiveType::Triangles, GLModel::Geometry::EVertexLayout::P3 };
init_data.reserve_vertices(4);
init_data.reserve_indices(6);
// vertices
init_data.add_vertex(Vec3f(-radius, -radius, 0.0));
init_data.add_vertex(Vec3f(radius , -radius, 0.0));
init_data.add_vertex(Vec3f(radius , radius , 0.0));
init_data.add_vertex(Vec3f(-radius, radius , 0.0));
// indices
init_data.add_triangle(0, 1, 2);
init_data.add_triangle(2, 3, 0);
return init_data;
}
//! -- #ysFIXME those functions bodies are ported from GizmoRotation
// Generates mesh for a circle
static void init_from_circle(GLModel& model, double radius)
@ -627,36 +607,6 @@ bool GLGizmoCut3D::render_reset_button(const std::string& label_id, const std::s
return revert;
}
static Vec2d ndc_to_ss(const Vec3d& ndc, const std::array<int, 4>& viewport) {
const double half_w = 0.5 * double(viewport[2]);
const double half_h = 0.5 * double(viewport[3]);
return { half_w * ndc.x() + double(viewport[0]) + half_w, half_h * ndc.y() + double(viewport[1]) + half_h };
};
static Vec3d clip_to_ndc(const Vec4d& clip) {
return Vec3d(clip.x(), clip.y(), clip.z()) / clip.w();
}
static Vec4d world_to_clip(const Vec3d& world, const Matrix4d& projection_view_matrix) {
return projection_view_matrix * Vec4d(world.x(), world.y(), world.z(), 1.0);
}
static Vec2d world_to_ss(const Vec3d& world, const Matrix4d& projection_view_matrix, const std::array<int, 4>& viewport) {
return ndc_to_ss(clip_to_ndc(world_to_clip(world, projection_view_matrix)), viewport);
}
static wxString get_label(Vec3d vec)
{
wxString str = "x=" + double_to_string(vec.x(), 2) +
", y=" + double_to_string(vec.y(), 2) +
", z=" + double_to_string(vec.z(), 2);
return str;
}
static wxString get_label(Vec2d vec)
{
wxString str = "x=" + double_to_string(vec.x(), 2) +
", y=" + double_to_string(vec.y(), 2);
return str;
}
void GLGizmoCut3D::render_cut_plane()
{
if (cut_line_processing())

View File

@ -197,7 +197,7 @@ std::string PrintHostSendDialog::storage() const
{
if (!combo_storage)
return GUI::format("%1%", m_preselected_storage);
if (combo_storage->GetSelection() < 0 || combo_storage->GetSelection() >= m_paths.size())
if (combo_storage->GetSelection() < 0 || combo_storage->GetSelection() >= int(m_paths.size()))
return {};
return boost::nowide::narrow(m_paths[combo_storage->GetSelection()]);
}

View File

@ -11,7 +11,7 @@
#include <boost/date_time/posix_time/posix_time_duration.hpp>
#include <boost/format.hpp>
#include <boost/log/trivial.hpp>
#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>
using boost::optional;
using boost::system::error_code;

View File

@ -4,7 +4,7 @@
#include <boost/asio/read_until.hpp>
#include <boost/asio/steady_timer.hpp>
#include <boost/asio/write.hpp>
#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>
#include <boost/format.hpp>
#include <boost/log/trivial.hpp>
#include <boost/algorithm/string.hpp>
@ -41,7 +41,7 @@ void TCPConsole::transmit_next_command()
boost::asio::async_write(
m_socket,
boost::asio::buffer(m_send_buffer),
boost::bind(&TCPConsole::handle_write, this, _1, _2)
boost::bind(&TCPConsole::handle_write, this, boost::placeholders::_1, boost::placeholders::_2)
);
}
@ -52,7 +52,7 @@ void TCPConsole::wait_next_line()
m_socket,
m_recv_buffer,
m_newline,
boost::bind(&TCPConsole::handle_read, this, _1, _2)
boost::bind(&TCPConsole::handle_read, this, boost::placeholders::_1, boost::placeholders::_2)
);
}
@ -157,7 +157,7 @@ bool TCPConsole::run_queue()
auto endpoints = m_resolver.resolve(m_host_name, m_port_name);
m_socket.async_connect(endpoints->endpoint(),
boost::bind(&TCPConsole::handle_connect, this, _1)
boost::bind(&TCPConsole::handle_connect, this, boost::placeholders::_1)
);
// Loop until we get any reasonable result. Negative result is also result.