mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 20:51:12 -06:00 
			
		
		
		
	Fixing Clang warnings 3
This commit is contained in:
		
							parent
							
								
									b85de89751
								
							
						
					
					
						commit
						1834ebe981
					
				
					 21 changed files with 25 additions and 29 deletions
				
			
		|  | @ -395,7 +395,7 @@ std::vector<std::string> AppConfig::get_mouse_device_names() const | |||
|     static constexpr const char   *prefix     = "mouse_device:"; | ||||
|     static const size_t  prefix_len = strlen(prefix); | ||||
|     std::vector<std::string> out; | ||||
|     for (const std::pair<std::string, std::map<std::string, std::string>>& 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; | ||||
|  |  | |||
|  | @ -1358,11 +1358,11 @@ public: | |||
|             // Initialize the map.
 | ||||
|             const t_config_enum_values &enum_keys_map = ConfigOptionEnum<T>::get_enum_values(); | ||||
|             int cnt = 0; | ||||
|             for (const std::pair<std::string, int> &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<std::string, int> &kvp : enum_keys_map) | ||||
|             for (const auto& kvp : enum_keys_map) | ||||
|                 names[kvp.second] = kvp.first; | ||||
|         } | ||||
|         return names; | ||||
|  |  | |||
|  | @ -124,7 +124,6 @@ const char* VALID_OBJECT_TYPES[] = | |||
|     "model" | ||||
| }; | ||||
| 
 | ||||
| const unsigned int INVALID_OBJECT_TYPES_COUNT = 4; | ||||
| const char* INVALID_OBJECT_TYPES[] = | ||||
| { | ||||
|     "solidsupport", | ||||
|  |  | |||
|  | @ -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<std::string, unsigned int> &dst, const char *tmpl, double value) { | ||||
|                 auto append = [&extruder](std::pair<std::string, unsigned int> &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"; | ||||
|  |  | |||
|  | @ -664,7 +664,7 @@ static std::vector<size_t> 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; | ||||
|  |  | |||
|  | @ -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); | ||||
|  |  | |||
|  | @ -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);
 | ||||
|  |  | |||
|  | @ -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<size_t>(0, m_layers.size()), | ||||
|             [this, idx_region, interface_shells](const tbb::blocked_range<size_t>& range) { | ||||
|             [this, idx_region](const tbb::blocked_range<size_t>& 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]; | ||||
|  |  | |||
|  | @ -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) | ||||
| { | ||||
|  |  | |||
|  | @ -1423,7 +1423,7 @@ static inline void do_crossover(const std::vector<FlipEdge> &edges_in, std::vect | |||
| 		const std::pair<size_t, size_t> &span2, bool reversed2, bool flipped2, | ||||
| 		const std::pair<size_t, size_t> &span3, bool reversed3, bool flipped3) { | ||||
| 		auto it_edges_out = edges_out.begin(); | ||||
| 		auto copy_span = [&edges_in, &edges_out, &it_edges_out](std::pair<size_t, size_t> span, bool reversed, bool flipped) { | ||||
|         auto copy_span = [&edges_in, &it_edges_out](std::pair<size_t, size_t> 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<FlipEdge> &edges_in, std::vect | |||
| 		const std::pair<size_t, size_t> &span3, bool reversed3, bool flipped3, | ||||
| 		const std::pair<size_t, size_t> &span4, bool reversed4, bool flipped4) { | ||||
| 		auto it_edges_out = edges_out.begin(); | ||||
| 		auto copy_span = [&edges_in, &edges_out, &it_edges_out](std::pair<size_t, size_t> span, bool reversed, bool flipped) { | ||||
|         auto copy_span = [&edges_in, &it_edges_out](std::pair<size_t, size_t> span, bool reversed, bool flipped) { | ||||
| 			assert(span.first < span.second); | ||||
| 			auto it = it_edges_out; | ||||
| 			if (reversed) | ||||
|  |  | |||
|  | @ -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) | ||||
|  |  | |||
|  | @ -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; | ||||
| 			} | ||||
|  |  | |||
|  | @ -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<size_t>(0, ctxt.layers.size(), grain_size), | ||||
|         [&ctxt, &new_volume, is_selected_separate_extruder, this](const tbb::blocked_range<size_t>& range) { | ||||
|         GLVolumePtrs 		vols; | ||||
|         std::vector<size_t>	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() ?  | ||||
|  |  | |||
|  | @ -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); | ||||
|     }); | ||||
|  |  | |||
|  | @ -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"))); | ||||
|             }); | ||||
|         } | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
|  | @ -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); | ||||
|  |  | |||
|  | @ -64,7 +64,7 @@ const t_field& OptionsGroup::build_field(const t_config_option_key& id, const Co | |||
|                 m_fields.emplace(id, Choice::Create<Choice>(this->ctrl_parent(), opt, id)); | ||||
| 				break; | ||||
|             case coPoints: | ||||
| 				m_fields.emplace(id, std::move(PointCtrl::Create<PointCtrl>(this->ctrl_parent(), opt, id))); | ||||
|                 m_fields.emplace(id, PointCtrl::Create<PointCtrl>(this->ctrl_parent(), opt, id)); | ||||
| 				break; | ||||
|             case coNone:   break; | ||||
|             default: | ||||
|  |  | |||
|  | @ -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"); | ||||
|  |  | |||
|  | @ -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) | ||||
|  |  | |||
|  | @ -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 { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lukas Matena
						Lukas Matena