diff --git a/src/libslic3r/Arrange.cpp b/src/libslic3r/Arrange.cpp index bf2a219d0..8124b23e3 100644 --- a/src/libslic3r/Arrange.cpp +++ b/src/libslic3r/Arrange.cpp @@ -552,7 +552,7 @@ static CircleBed to_circle(const Point ¢er, const Points& points) { std::vector vertex_distances; double avg_dist = 0; - for (auto pt : points) + for (const Point& pt : points) { double distance = distance_to(center, pt); vertex_distances.push_back(distance); diff --git a/src/libslic3r/Config.cpp b/src/libslic3r/Config.cpp index 18b97665d..0297a8d42 100644 --- a/src/libslic3r/Config.cpp +++ b/src/libslic3r/Config.cpp @@ -306,7 +306,7 @@ ConfigOptionDef* ConfigDef::add_nullable(const t_config_option_key &opt_key, Con std::ostream& ConfigDef::print_cli_help(std::ostream& out, bool show_defaults, std::function filter) const { // prepare a function for wrapping text - auto wrap = [](std::string text, size_t line_length) -> std::string { + auto wrap = [](const std::string& text, size_t line_length) -> std::string { std::istringstream words(text); std::ostringstream wrapped; std::string word; @@ -335,7 +335,7 @@ std::ostream& ConfigDef::print_cli_help(std::ostream& out, bool show_defaults, s categories.insert(def.category); } - for (auto category : categories) { + for (const std::string& category : categories) { if (category != "") { out << category << ":" << std::endl; } else if (categories.size() > 1) { diff --git a/src/libslic3r/CustomGCode.cpp b/src/libslic3r/CustomGCode.cpp index 193235bf8..213437782 100644 --- a/src/libslic3r/CustomGCode.cpp +++ b/src/libslic3r/CustomGCode.cpp @@ -41,7 +41,7 @@ extern void check_mode_for_custom_gcode_per_print_z(Info& info) return; bool is_single_extruder = true; - for (auto item : info.gcodes) + for (const Item& item : info.gcodes) { if (item.type == ToolChange) { info.mode = MultiAsSingle; diff --git a/src/libslic3r/Fill/FillBase.hpp b/src/libslic3r/Fill/FillBase.hpp index 6c57a64bf..9ba060b85 100644 --- a/src/libslic3r/Fill/FillBase.hpp +++ b/src/libslic3r/Fill/FillBase.hpp @@ -125,7 +125,7 @@ protected: unsigned int /* thickness_layers */, const std::pair & /* direction */, ExPolygon /* expolygon */, - Polylines & /* polylines_out */) {}; + Polylines & /* polylines_out */) {} virtual float _layer_angle(size_t idx) const { return (idx & 1) ? float(M_PI/2.) : 0; } diff --git a/src/libslic3r/Layer.hpp b/src/libslic3r/Layer.hpp index a308ac0b6..0fe4952f4 100644 --- a/src/libslic3r/Layer.hpp +++ b/src/libslic3r/Layer.hpp @@ -18,7 +18,7 @@ class PrintObject; namespace FillAdaptive { struct Octree; -}; +} namespace FillLightning { class Generator; diff --git a/src/libslic3r/Model.cpp b/src/libslic3r/Model.cpp index 67450fb11..3376cc888 100644 --- a/src/libslic3r/Model.cpp +++ b/src/libslic3r/Model.cpp @@ -903,7 +903,7 @@ indexed_triangle_set ModelObject::raw_indexed_triangle_set() const size_t j = out.indices.size(); append(out.vertices, v->mesh().its.vertices); append(out.indices, v->mesh().its.indices); - auto m = v->get_matrix(); + const Transform3d& m = v->get_matrix(); for (; i < out.vertices.size(); ++ i) out.vertices[i] = (m * out.vertices[i].cast()).cast().eval(); if (v->is_left_handed()) { diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 2e630b9c8..f3a1c15b3 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -1498,7 +1498,7 @@ void PhysicalPrinter::update_preset_names_in_config() if (!preset_names.empty()) { std::vector& values = config.option("preset_names")->values; values.clear(); - for (auto preset : preset_names) + for (const std::string& preset : preset_names) values.push_back(preset); // temporary workaround for compatibility with older Slicer @@ -1571,7 +1571,7 @@ void PhysicalPrinter::set_name(const std::string& name) this->name = name; } -std::string PhysicalPrinter::get_full_name(std::string preset_name) const +std::string PhysicalPrinter::get_full_name(const std::string& preset_name) const { return name + separator() + preset_name; } @@ -1888,7 +1888,7 @@ std::vector PhysicalPrinterCollection::get_printers_with_only_prese { std::vector printers; - for (auto printer : m_printers) + for (const PhysicalPrinter& printer : m_printers) if (printer.preset_names.size() == 1 && *printer.preset_names.begin() == preset_name) printers.emplace_back(printer.name); diff --git a/src/libslic3r/Preset.hpp b/src/libslic3r/Preset.hpp index 25ae37484..58ab57cfd 100644 --- a/src/libslic3r/Preset.hpp +++ b/src/libslic3r/Preset.hpp @@ -675,7 +675,7 @@ public: bool operator<(const PhysicalPrinter& other) const { return this->name < other.name; } // get full printer name included a name of the preset - std::string get_full_name(std::string preset_name) const; + std::string get_full_name(const std::string &preset_name) const; // get printer name from the full name uncluded preset name static std::string get_short_name(std::string full_name); diff --git a/src/libslic3r/PresetBundle.cpp b/src/libslic3r/PresetBundle.cpp index 874b775cd..85bcd69ba 100644 --- a/src/libslic3r/PresetBundle.cpp +++ b/src/libslic3r/PresetBundle.cpp @@ -267,7 +267,7 @@ PresetsConfigSubstitutions PresetBundle::load_presets(AppConfig &config, Forward std::string errors_cummulative; std::tie(substitutions, errors_cummulative) = this->load_system_presets(substitution_rule); - const std::string dir_user_presets = data_dir() + const std::string& dir_user_presets = data_dir() #ifdef SLIC3R_PROFILE_USE_PRESETS_SUBDIR // Store the print/filament/printer presets into a "presets" directory. + "/presets" diff --git a/src/libslic3r/utils.cpp b/src/libslic3r/utils.cpp index e00b6e71c..ddc9a4081 100644 --- a/src/libslic3r/utils.cpp +++ b/src/libslic3r/utils.cpp @@ -961,9 +961,11 @@ std::string string_printf(const char *format, ...) buffer.resize(size_t(bufflen) + 1); ::vsnprintf(buffer.data(), buffer.size(), format, args2); } + + va_end(args1); + va_end(args2); buffer.resize(bufflen); - return buffer; }