Some refactoring and fixes based on static source code analysis

This commit is contained in:
Lukas Matena 2021-04-16 14:44:36 +02:00
parent 807f380d3f
commit 96a6c8538f
10 changed files with 15 additions and 13 deletions

View file

@ -1498,7 +1498,7 @@ void PhysicalPrinter::update_preset_names_in_config()
if (!preset_names.empty()) {
std::vector<std::string>& values = config.option<ConfigOptionStrings>("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<std::string> PhysicalPrinterCollection::get_printers_with_only_prese
{
std::vector<std::string> 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);