diff --git a/src/libslic3r/EdgeGrid.cpp b/src/libslic3r/EdgeGrid.cpp index 065a69ba3..240951053 100644 --- a/src/libslic3r/EdgeGrid.cpp +++ b/src/libslic3r/EdgeGrid.cpp @@ -1147,7 +1147,7 @@ EdgeGrid::Grid::ClosestPointResult EdgeGrid::Grid::closest_point(const Point &pt } } } - if (result.contour_idx != -1 && d_min <= double(search_radius)) { + if (result.contour_idx != size_t(-1) && d_min <= double(search_radius)) { result.distance = d_min * sign_min; result.t /= l2_seg_min; assert(result.t >= 0. && result.t < 1.); diff --git a/src/libslic3r/Fill/FillBase.cpp b/src/libslic3r/Fill/FillBase.cpp index 39679e3d6..b8a83c57e 100644 --- a/src/libslic3r/Fill/FillBase.cpp +++ b/src/libslic3r/Fill/FillBase.cpp @@ -611,7 +611,7 @@ static inline SegmentPoint clip_start_segment_and_point(const Points &polyline, SegmentPoint out; if (polyline.size() >= 2) { Vec2d pt_prev = polyline.front().cast(); - for (int i = 1; i < polyline.size(); ++ i) { + for (size_t i = 1; i < polyline.size(); ++ i) { Vec2d pt = polyline[i].cast(); Vec2d v = pt - pt_prev; double l2 = v.squaredNorm(); diff --git a/src/libslic3r/Fill/FillGyroid.cpp b/src/libslic3r/Fill/FillGyroid.cpp index 913b0b0c0..964b87cef 100644 --- a/src/libslic3r/Fill/FillGyroid.cpp +++ b/src/libslic3r/Fill/FillGyroid.cpp @@ -156,7 +156,7 @@ void FillGyroid::_fill_surface_single( Polylines &polylines_out) { float infill_angle = this->angle + (CorrectionAngle * 2*M_PI) / 360.; - if(abs(infill_angle) >= EPSILON) + if(std::abs(infill_angle) >= EPSILON) expolygon.rotate(-infill_angle); BoundingBox bb = expolygon.contour.bounding_box(); @@ -197,8 +197,9 @@ void FillGyroid::_fill_surface_single( append(polylines_out, std::move(polylines)); else this->connect_infill(std::move(polylines), expolygon, polylines_out, this->spacing, params); + // new paths must be rotated back - if (abs(infill_angle) >= EPSILON) { + if (std::abs(infill_angle) >= EPSILON) { for (auto it = polylines_out.begin() + polylines_out_first_idx; it != polylines_out.end(); ++ it) it->rotate(infill_angle); } diff --git a/src/libslic3r/GCode/ToolOrdering.hpp b/src/libslic3r/GCode/ToolOrdering.hpp index de0460f1b..1281d1493 100644 --- a/src/libslic3r/GCode/ToolOrdering.hpp +++ b/src/libslic3r/GCode/ToolOrdering.hpp @@ -72,7 +72,7 @@ private: std::map entity_map; // to keep track of who prints what bool something_overridable = false; bool something_overridden = false; - const LayerTools* m_layer_tools; // so we know which LayerTools object this belongs to + const LayerTools* m_layer_tools = nullptr; // so we know which LayerTools object this belongs to }; diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index 3fc43b726..b6f8be499 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -511,7 +511,7 @@ void TextCtrl::disable() { dynamic_cast(window)->Disable(); dynamic #ifdef __WXGTK__ void TextCtrl::change_field_value(wxEvent& event) { - if (bChangedValueEvent = (event.GetEventType()==wxEVT_KEY_UP)) + if ((bChangedValueEvent = (event.GetEventType()==wxEVT_KEY_UP))) on_change_field(); event.Skip(); }; diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 961fc2077..f31519251 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -479,7 +479,6 @@ void ObjectList::update_extruder_values_for_items(const size_t max_extruder) void ObjectList::update_objects_list_extruder_column(size_t extruders_count) { - if (!this) return; // #ys_FIXME if (printer_technology() == ptSLA) extruders_count = 1; diff --git a/src/slic3r/GUI/Preset.cpp b/src/slic3r/GUI/Preset.cpp index c0af7bcea..833951afe 100644 --- a/src/slic3r/GUI/Preset.cpp +++ b/src/slic3r/GUI/Preset.cpp @@ -1065,6 +1065,7 @@ size_t PresetCollection::update_compatible_internal(const PresetWithVendorProfil bool selected = idx_preset == m_idx_selected; Preset &preset_selected = m_presets[idx_preset]; Preset &preset_edited = selected ? m_edited_preset : preset_selected; + const PresetWithVendorProfile this_preset_with_vendor_profile = this->get_preset_with_vendor_profile(preset_edited); bool was_compatible = preset_edited.is_compatible; preset_edited.is_compatible = is_compatible_with_printer(this_preset_with_vendor_profile, active_printer, &config); @@ -1072,7 +1073,7 @@ size_t PresetCollection::update_compatible_internal(const PresetWithVendorProfil preset_edited.is_compatible &= is_compatible_with_print(this_preset_with_vendor_profile, *active_print, active_printer); if (! preset_edited.is_compatible && selected && (unselect_if_incompatible == PresetSelectCompatibleType::Always || (unselect_if_incompatible == PresetSelectCompatibleType::OnlyIfWasCompatible && was_compatible))) - m_idx_selected = -1; + m_idx_selected = size_t(-1); if (selected) preset_selected.is_compatible = preset_edited.is_compatible; } @@ -1369,7 +1370,7 @@ void add_correct_opts_to_diff(const std::string &opt_key, t_config_option_keys& const T* opt_init = static_cast(other.option(opt_key)); const T* opt_cur = static_cast(this_c.option(opt_key)); int opt_init_max_id = opt_init->values.size() - 1; - for (int i = 0; i < opt_cur->values.size(); i++) + for (int i = 0; i < int(opt_cur->values.size()); i++) { int init_id = i <= opt_init_max_id ? i : 0; if (opt_cur->values[i] != opt_init->values[init_id]) diff --git a/src/slic3r/GUI/Preset.hpp b/src/slic3r/GUI/Preset.hpp index 46008eadb..224adaeaa 100644 --- a/src/slic3r/GUI/Preset.hpp +++ b/src/slic3r/GUI/Preset.hpp @@ -342,9 +342,9 @@ public: // Return the selected preset, without the user modifications applied. Preset& get_selected_preset() { return m_presets[m_idx_selected]; } const Preset& get_selected_preset() const { return m_presets[m_idx_selected]; } - int get_selected_idx() const { return m_idx_selected; } + size_t get_selected_idx() const { return m_idx_selected; } // Returns the name of the selected preset, or an empty string if no preset is selected. - std::string get_selected_preset_name() const { return (m_idx_selected == -1) ? std::string() : this->get_selected_preset().name; } + std::string get_selected_preset_name() const { return (m_idx_selected == size_t(-1)) ? std::string() : this->get_selected_preset().name; } // For the current edited preset, return the parent preset if there is one. // If there is no parent preset, nullptr is returned. // The parent preset may be a system preset or a user preset, which will be @@ -365,7 +365,7 @@ public: // used to update preset_choice from Tab const std::deque& get_presets() const { return m_presets; } - int get_idx_selected() { return m_idx_selected; } + size_t get_idx_selected() { return m_idx_selected; } static const std::string& get_suffix_modified(); // Return a preset possibly with modifications. @@ -373,7 +373,7 @@ public: const Preset& default_preset(size_t idx = 0) const { assert(idx < m_num_default_presets); return m_presets[idx]; } virtual const Preset& default_preset_for(const DynamicPrintConfig & /* config */) const { return this->default_preset(); } // Return a preset by an index. If the preset is active, a temporary copy is returned. - Preset& preset(size_t idx) { return (int(idx) == m_idx_selected) ? m_edited_preset : m_presets[idx]; } + Preset& preset(size_t idx) { return (idx == m_idx_selected) ? m_edited_preset : m_presets[idx]; } const Preset& preset(size_t idx) const { return const_cast(this)->preset(idx); } void discard_current_changes() { m_presets[m_idx_selected].reset_dirty(); m_edited_preset = m_presets[m_idx_selected]; } @@ -541,7 +541,7 @@ private: // Initially this preset contains a copy of the selected preset. Later on, this copy may be modified by the user. Preset m_edited_preset; // Selected preset. - int m_idx_selected; + size_t m_idx_selected; // Is the "- default -" preset suppressed? bool m_default_suppressed = true; size_t m_num_default_presets = 0; diff --git a/src/slic3r/GUI/PresetBundle.cpp b/src/slic3r/GUI/PresetBundle.cpp index 5c9dc2ec9..9fa891da0 100644 --- a/src/slic3r/GUI/PresetBundle.cpp +++ b/src/slic3r/GUI/PresetBundle.cpp @@ -964,8 +964,6 @@ static void flatten_configbundle_hierarchy(boost::property_tree::ptree &tree, co { namespace pt = boost::property_tree; - typedef std::pair ptree_child_type; - // 1) For the group given by group_name, initialize the presets. struct Prst { Prst(const std::string &name, pt::ptree *node) : name(name), node(node) {} diff --git a/tests/fff_print/test_data.cpp b/tests/fff_print/test_data.cpp index b3c16f4b0..7d7cd5480 100644 --- a/tests/fff_print/test_data.cpp +++ b/tests/fff_print/test_data.cpp @@ -161,7 +161,7 @@ void init_print(std::vector &&meshes, Slic3r::Print &print, Slic3r if (verbose_gcode()) config.set_key_value("gcode_comments", new ConfigOptionBool(true)); - for (const TriangleMesh &t : meshes) { + for (const TriangleMesh &t : meshes) { ModelObject *object = model.add_object(); object->name += "object.stl"; object->add_volume(std::move(t)); diff --git a/tests/fff_print/test_trianglemesh.cpp b/tests/fff_print/test_trianglemesh.cpp index 9598a3c5a..6b467a511 100644 --- a/tests/fff_print/test_trianglemesh.cpp +++ b/tests/fff_print/test_trianglemesh.cpp @@ -277,7 +277,6 @@ SCENARIO( "make_xxx functions produce meshes.") { GIVEN("make_sphere() function") { WHEN("make_sphere() is called with arguments 10, PI / 3") { TriangleMesh sph = make_sphere(10, PI / 243.0); - double angle = (2.0*PI / floor(2.0*PI / (PI / 243.0))); THEN("Resulting mesh has one point at 0,0,-10 and one at 0,0,10") { const std::vector &verts = sph.its.vertices; REQUIRE(std::count_if(verts.begin(), verts.end(), [](const Vec3f& t) { return is_approx(t, Vec3f(0.f, 0.f, 10.f)); } ) == 1);