diff --git a/src/libslic3r/AppConfig.cpp b/src/libslic3r/AppConfig.cpp index 4b3d33a549..79b9a025a6 100644 --- a/src/libslic3r/AppConfig.cpp +++ b/src/libslic3r/AppConfig.cpp @@ -395,7 +395,7 @@ std::vector AppConfig::get_mouse_device_names() const static constexpr const char *prefix = "mouse_device:"; static const size_t prefix_len = strlen(prefix); std::vector out; - for (const std::pair>& key_value_pair : m_storage) + for (const auto& key_value_pair : m_storage) if (boost::starts_with(key_value_pair.first, prefix) && key_value_pair.first.size() > prefix_len) out.emplace_back(key_value_pair.first.substr(prefix_len)); return out; diff --git a/src/libslic3r/Config.hpp b/src/libslic3r/Config.hpp index 4b726bea9e..5e4b2ed6a0 100644 --- a/src/libslic3r/Config.hpp +++ b/src/libslic3r/Config.hpp @@ -1358,11 +1358,11 @@ public: // Initialize the map. const t_config_enum_values &enum_keys_map = ConfigOptionEnum::get_enum_values(); int cnt = 0; - for (const std::pair &kvp : enum_keys_map) + for (const auto& kvp : enum_keys_map) cnt = std::max(cnt, kvp.second); cnt += 1; names.assign(cnt, ""); - for (const std::pair &kvp : enum_keys_map) + for (const auto& kvp : enum_keys_map) names[kvp.second] = kvp.first; } return names; diff --git a/src/libslic3r/Format/3mf.cpp b/src/libslic3r/Format/3mf.cpp index ba477be8e5..c9f1108644 100644 --- a/src/libslic3r/Format/3mf.cpp +++ b/src/libslic3r/Format/3mf.cpp @@ -124,7 +124,6 @@ const char* VALID_OBJECT_TYPES[] = "model" }; -const unsigned int INVALID_OBJECT_TYPES_COUNT = 4; const char* INVALID_OBJECT_TYPES[] = { "solidsupport", diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 261487cc16..f076a74ca0 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -851,7 +851,7 @@ namespace DoExport { double extruded_volume = extruder.extruded_volume() + (has_wipe_tower ? wipe_tower_data.used_filament[extruder.id()] * 2.4052f : 0.f); // assumes 1.75mm filament diameter double filament_weight = extruded_volume * extruder.filament_density() * 0.001; double filament_cost = filament_weight * extruder.filament_cost() * 0.001; - auto append = [&extruder, &extruders](std::pair &dst, const char *tmpl, double value) { + auto append = [&extruder](std::pair &dst, const char *tmpl, double value) { while (dst.second < extruder.id()) { // Fill in the non-printing extruders with zeros. dst.first += (dst.second > 0) ? ", 0" : "0"; diff --git a/src/libslic3r/GCode/SeamPlacer.cpp b/src/libslic3r/GCode/SeamPlacer.cpp index 1acc160f0f..1778e06892 100644 --- a/src/libslic3r/GCode/SeamPlacer.cpp +++ b/src/libslic3r/GCode/SeamPlacer.cpp @@ -664,7 +664,7 @@ static std::vector find_enforcer_centers(const Polygon& polygon, if (polygon.size() < 2 || enforcers_idxs.empty()) return out; - auto get_center_idx = [&polygon, &lengths](size_t start_idx, size_t end_idx) -> size_t { + auto get_center_idx = [&lengths](size_t start_idx, size_t end_idx) -> size_t { assert(end_idx >= start_idx); if (start_idx == end_idx) return start_idx; diff --git a/src/libslic3r/PresetBundle.cpp b/src/libslic3r/PresetBundle.cpp index 8fc8e92899..7d08c93592 100644 --- a/src/libslic3r/PresetBundle.cpp +++ b/src/libslic3r/PresetBundle.cpp @@ -915,7 +915,7 @@ void PresetBundle::load_config_file_config_bundle(const std::string &path, const std::string bundle_name = std::string(" - ") + boost::filesystem::path(path).filename().string(); // 2) Extract active configs from the config bundle, copy them and activate them in this bundle. - auto load_one = [this, &path, &bundle_name](PresetCollection &collection_dst, PresetCollection &collection_src, const std::string &preset_name_src, bool activate) -> std::string { + auto load_one = [&path, &bundle_name](PresetCollection &collection_dst, PresetCollection &collection_src, const std::string &preset_name_src, bool activate) -> std::string { Preset *preset_src = collection_src.find_preset(preset_name_src, false); Preset *preset_dst = collection_dst.find_preset(preset_name_src, false); assert(preset_src != nullptr); diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 61a5ae99c3..b96768904d 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -1405,7 +1405,7 @@ std::string Print::validate() const return L("One or more object were assigned an extruder that the printer does not have."); #endif - auto validate_extrusion_width = [min_nozzle_diameter, max_nozzle_diameter](const ConfigBase &config, const char *opt_key, double layer_height, std::string &err_msg) -> bool { + auto validate_extrusion_width = [/*min_nozzle_diameter,*/ max_nozzle_diameter](const ConfigBase &config, const char *opt_key, double layer_height, std::string &err_msg) -> bool { // This may change in the future, if we switch to "extrusion width wrt. nozzle diameter" // instead of currently used logic "extrusion width wrt. layer height", see GH issues #1923 #2829. // double extrusion_width_min = config.get_abs_value(opt_key, min_nozzle_diameter); diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index 3595f68388..ee2e645695 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -908,7 +908,7 @@ void PrintObject::detect_surfaces_type() // Fill in layerm->fill_surfaces by trimming the layerm->slices by the cummulative layerm->fill_surfaces. tbb::parallel_for( tbb::blocked_range(0, m_layers.size()), - [this, idx_region, interface_shells](const tbb::blocked_range& range) { + [this, idx_region](const tbb::blocked_range& range) { for (size_t idx_layer = range.begin(); idx_layer < range.end(); ++ idx_layer) { m_print->throw_if_canceled(); LayerRegion *layerm = m_layers[idx_layer]->m_regions[idx_region]; diff --git a/src/libslic3r/SLA/IndexedMesh.cpp b/src/libslic3r/SLA/IndexedMesh.cpp index efcf09873e..485fa98ed8 100644 --- a/src/libslic3r/SLA/IndexedMesh.cpp +++ b/src/libslic3r/SLA/IndexedMesh.cpp @@ -55,8 +55,6 @@ public: } }; -static const constexpr double MESH_EPS = 1e-6; - IndexedMesh::IndexedMesh(const TriangleMesh& tmesh) : m_aabb(new AABBImpl()), m_tm(&tmesh) { diff --git a/src/libslic3r/ShortestPath.cpp b/src/libslic3r/ShortestPath.cpp index 9565b1874e..60f8feaa63 100644 --- a/src/libslic3r/ShortestPath.cpp +++ b/src/libslic3r/ShortestPath.cpp @@ -1423,7 +1423,7 @@ static inline void do_crossover(const std::vector &edges_in, std::vect const std::pair &span2, bool reversed2, bool flipped2, const std::pair &span3, bool reversed3, bool flipped3) { auto it_edges_out = edges_out.begin(); - auto copy_span = [&edges_in, &edges_out, &it_edges_out](std::pair span, bool reversed, bool flipped) { + auto copy_span = [&edges_in, &it_edges_out](std::pair span, bool reversed, bool flipped) { assert(span.first < span.second); auto it = it_edges_out; if (reversed) @@ -1466,7 +1466,7 @@ static inline void do_crossover(const std::vector &edges_in, std::vect const std::pair &span3, bool reversed3, bool flipped3, const std::pair &span4, bool reversed4, bool flipped4) { auto it_edges_out = edges_out.begin(); - auto copy_span = [&edges_in, &edges_out, &it_edges_out](std::pair span, bool reversed, bool flipped) { + auto copy_span = [&edges_in, &it_edges_out](std::pair span, bool reversed, bool flipped) { assert(span.first < span.second); auto it = it_edges_out; if (reversed) diff --git a/src/slic3r/GUI/DoubleSlider.cpp b/src/slic3r/GUI/DoubleSlider.cpp index 1e4eed1e8c..fddb63e3e4 100644 --- a/src/slic3r/GUI/DoubleSlider.cpp +++ b/src/slic3r/GUI/DoubleSlider.cpp @@ -1889,7 +1889,7 @@ void Control::show_cog_icon_context_menu() []() { return true; }, [this]() { return m_extra_style & wxSL_VALUE_LABEL; }, GUI::wxGetApp().plater()); append_submenu(&menu, ruler_mode_menu, wxID_ANY, _L("Ruler mode"), _L("Set ruler mode"), "", - [this]() { return true; }, this); + []() { return true; }, this); } if (m_mode == MultiAsSingle && m_draw_mode == dmRegular) diff --git a/src/slic3r/GUI/FirmwareDialog.cpp b/src/slic3r/GUI/FirmwareDialog.cpp index 046d9d1386..6927a03302 100644 --- a/src/slic3r/GUI/FirmwareDialog.cpp +++ b/src/slic3r/GUI/FirmwareDialog.cpp @@ -648,7 +648,7 @@ void FirmwareDialog::priv::perform_upload() } } }) - .on_message([q, extra_verbose](const char *msg, unsigned /* size */) { + .on_message([q](const char *msg, unsigned /* size */) { if (extra_verbose) { BOOST_LOG_TRIVIAL(debug) << "avrdude: " << msg; } diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 917e11d0fd..b97c51d1b0 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -4582,9 +4582,9 @@ bool GLCanvas3D::_init_main_toolbar() "\n" + "[" + GUI::shortkey_ctrl_prefix() + "4] - " + _u8L("Printer Settings Tab") ; item.sprite_id = 10; item.enabling_callback = GLToolbarItem::Default_Enabling_Callback; - item.visibility_callback = [this]() { return (wxGetApp().app_config->get("new_settings_layout_mode") == "1" || - wxGetApp().app_config->get("dlg_settings_layout_mode") == "1"); }; - item.left.action_callback = [this]() { wxGetApp().mainframe->select_tab(); }; + item.visibility_callback = []() { return (wxGetApp().app_config->get("new_settings_layout_mode") == "1" || + wxGetApp().app_config->get("dlg_settings_layout_mode") == "1"); }; + item.left.action_callback = []() { wxGetApp().mainframe->select_tab(); }; if (!m_main_toolbar.add_item(item)) return false; @@ -5910,8 +5910,7 @@ void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, c tbb::blocked_range(0, ctxt.layers.size(), grain_size), [&ctxt, &new_volume, is_selected_separate_extruder, this](const tbb::blocked_range& range) { GLVolumePtrs vols; - std::vector color_print_layer_to_glvolume; - auto volume = [&ctxt, &vols, &color_print_layer_to_glvolume, &range](size_t layer_idx, int extruder, int feature) -> GLVolume& { + auto volume = [&ctxt, &vols](size_t layer_idx, int extruder, int feature) -> GLVolume& { return *vols[ctxt.color_by_color_print()? ctxt.color_print_color_idx_by_layer_idx_and_extruder(layer_idx, extruder) : ctxt.color_by_tool() ? diff --git a/src/slic3r/GUI/GUI_ObjectLayers.cpp b/src/slic3r/GUI/GUI_ObjectLayers.cpp index 7d8643c7f8..8768f39ff7 100644 --- a/src/slic3r/GUI/GUI_ObjectLayers.cpp +++ b/src/slic3r/GUI/GUI_ObjectLayers.cpp @@ -132,7 +132,7 @@ wxSizer* ObjectLayers::create_layer(const t_layer_height_range& range, PlusMinus // Add control for the "Layer height" editor = new LayerRangeEditor(this, double_to_string(m_object->layer_config_ranges[range].option("layer_height")->getFloat()), etLayerHeight, set_focus_data, - [range, this](coordf_t layer_height, bool, bool) + [range](coordf_t layer_height, bool, bool) { return wxGetApp().obj_list()->edit_layer_range(range, layer_height); }); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp index e626aa7f86..2f7fa4638b 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp @@ -893,7 +893,7 @@ void GLGizmoSlaSupports::on_set_state() // Only take the snapshot when the USER opens the gizmo. Common gizmos // data are not yet available, the CallAfter will postpone taking the // snapshot until they are. No, it does not feel right. - wxGetApp().CallAfter([this]() { + wxGetApp().CallAfter([]() { Plater::TakeSnapshot snapshot(wxGetApp().plater(), _(L("SLA gizmo turned on"))); }); } diff --git a/src/slic3r/GUI/ImGuiWrapper.cpp b/src/slic3r/GUI/ImGuiWrapper.cpp index ff8ba8f48a..1ed4b492fd 100644 --- a/src/slic3r/GUI/ImGuiWrapper.cpp +++ b/src/slic3r/GUI/ImGuiWrapper.cpp @@ -940,7 +940,7 @@ void ImGuiWrapper::init_font(bool compress) config.MergeMode = true; if (! m_font_cjk) { // Apple keyboard shortcuts are only contained in the CJK fonts. - ImFont *font_cjk = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/NotoSansCJK-Regular.ttc").c_str(), m_font_size, &config, ranges_keyboard_shortcuts); + [[maybe_unused]]ImFont *font_cjk = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/NotoSansCJK-Regular.ttc").c_str(), m_font_size, &config, ranges_keyboard_shortcuts); assert(font_cjk != nullptr); } #endif diff --git a/src/slic3r/GUI/ObjectDataViewModel.cpp b/src/slic3r/GUI/ObjectDataViewModel.cpp index d69f2d0773..7de37fb48c 100644 --- a/src/slic3r/GUI/ObjectDataViewModel.cpp +++ b/src/slic3r/GUI/ObjectDataViewModel.cpp @@ -1208,7 +1208,7 @@ void ObjectDataViewModel::AddAllChildren(const wxDataViewItem& parent) ItemAdded(parent, wxDataViewItem((void*)child)); } - for (const auto item : array) + for (const auto& item : array) AddAllChildren(item); m_ctrl->Expand(parent); diff --git a/src/slic3r/GUI/OptionsGroup.cpp b/src/slic3r/GUI/OptionsGroup.cpp index 953275be7e..d077c81f60 100644 --- a/src/slic3r/GUI/OptionsGroup.cpp +++ b/src/slic3r/GUI/OptionsGroup.cpp @@ -64,7 +64,7 @@ const t_field& OptionsGroup::build_field(const t_config_option_key& id, const Co m_fields.emplace(id, Choice::Create(this->ctrl_parent(), opt, id)); break; case coPoints: - m_fields.emplace(id, std::move(PointCtrl::Create(this->ctrl_parent(), opt, id))); + m_fields.emplace(id, PointCtrl::Create(this->ctrl_parent(), opt, id)); break; case coNone: break; default: diff --git a/src/slic3r/Utils/FlashAir.cpp b/src/slic3r/Utils/FlashAir.cpp index 22eaddecef..2337ac2904 100644 --- a/src/slic3r/Utils/FlashAir.cpp +++ b/src/slic3r/Utils/FlashAir.cpp @@ -50,7 +50,7 @@ bool FlashAir::test(wxString &msg) const res = false; msg = format_error(body, error, status); }) - .on_complete([&, this](std::string body, unsigned) { + .on_complete([&](std::string body, unsigned) { BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: Got upload enabled: %2%") % name % body; res = boost::starts_with(body, "1"); diff --git a/src/slic3r/Utils/Repetier.cpp b/src/slic3r/Utils/Repetier.cpp index 115ea010ef..7b66922d70 100644 --- a/src/slic3r/Utils/Repetier.cpp +++ b/src/slic3r/Utils/Repetier.cpp @@ -190,7 +190,7 @@ bool Repetier::get_groups(wxArrayString& groups) const http.on_error([&](std::string body, std::string error, unsigned status) { BOOST_LOG_TRIVIAL(error) << boost::format("%1%: Error getting version: %2%, HTTP %3%, body: `%4%`") % name % error % status % body; }) - .on_complete([&, this](std::string body, unsigned) { + .on_complete([&](std::string body, unsigned) { BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: Got groups: %2%") % name % body; try { @@ -233,7 +233,7 @@ bool Repetier::get_printers(wxArrayString& printers) const BOOST_LOG_TRIVIAL(error) << boost::format("%1%: Error listing printers: %2%, HTTP %3%, body: `%4%`") % name % error % status % body; res = false; }) - .on_complete([&, this](std::string body, unsigned http_status) { + .on_complete([&](std::string body, unsigned http_status) { BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: Got printers: %2%, HTTP status: %3%") % name % body % http_status; if (http_status != 200) diff --git a/src/slic3r/Utils/UndoRedo.cpp b/src/slic3r/Utils/UndoRedo.cpp index d82d9e31db..697c1209de 100644 --- a/src/slic3r/Utils/UndoRedo.cpp +++ b/src/slic3r/Utils/UndoRedo.cpp @@ -209,7 +209,7 @@ public: bool is_immutable() const override { return true; } bool is_optional() const override { return m_optional; } // If it is an immutable object, return its pointer. There is a map assigning a temporary ObjectID to the immutable object pointer. - const void* immutable_object_ptr() const { return (const void*)m_shared_object.get(); } + const void* immutable_object_ptr() const override { return (const void*)m_shared_object.get(); } // Estimated size in memory, to be used to drop least recently used snapshots. size_t memsize() const override {