Fixed some more warnings

This commit is contained in:
Lukas Matena 2020-03-03 14:52:16 +01:00
parent 6918f11100
commit 7589e4ebfc
16 changed files with 21 additions and 22 deletions

View file

@ -62,7 +62,8 @@ std::vector<std::pair<double, unsigned int>> custom_tool_changes(const Info& cus
for (const Item& custom_gcode : custom_gcode_per_print_z.gcodes) for (const Item& custom_gcode : custom_gcode_per_print_z.gcodes)
if (custom_gcode.gcode == ToolChangeCode) { if (custom_gcode.gcode == ToolChangeCode) {
// If extruder count in PrinterSettings was changed, use default (0) extruder for extruders, more than num_extruders // If extruder count in PrinterSettings was changed, use default (0) extruder for extruders, more than num_extruders
custom_tool_changes.emplace_back(custom_gcode.print_z, static_cast<unsigned int>(custom_gcode.extruder > num_extruders ? 1 : custom_gcode.extruder)); assert(custom_gcode.extruder >= 0);
custom_tool_changes.emplace_back(custom_gcode.print_z, static_cast<unsigned int>(size_t(custom_gcode.extruder) > num_extruders ? 1 : custom_gcode.extruder));
} }
return custom_tool_changes; return custom_tool_changes;
} }

View file

@ -674,7 +674,7 @@ static inline double segment_point_distance_squared(const Vec2d &p1a, const Vec2
if (l2 < EPSILON) if (l2 < EPSILON)
// p1a == p1b // p1a == p1b
return (p2 - p1a).squaredNorm(); return (p2 - p1a).squaredNorm();
return segment_point_distance_squared(p1a, p1b, v, v.squaredNorm(), p2); return segment_point_distance_squared(p1a, p1b, v, v.squaredNorm(), p2);
} }
// Distance to the closest point of line. // Distance to the closest point of line.
@ -692,7 +692,7 @@ static inline double min_distance_of_segments(const Vec2d &p1a, const Vec2d &p1b
// p2a == p2b: Return distance of p2a from the (p1a, p1b) segment. // p2a == p2b: Return distance of p2a from the (p1a, p1b) segment.
return segment_point_distance_squared(p1a, p1b, v1, l1_2, p2a); return segment_point_distance_squared(p1a, p1b, v1, l1_2, p2a);
return std::min( return std::min(
std::min(segment_point_distance_squared(p1a, p1b, v1, l1_2, p2a), segment_point_distance_squared(p1a, p1b, v1, l1_2, p2b)), std::min(segment_point_distance_squared(p1a, p1b, v1, l1_2, p2a), segment_point_distance_squared(p1a, p1b, v1, l1_2, p2b)),
std::min(segment_point_distance_squared(p2a, p2b, v2, l2_2, p1a), segment_point_distance_squared(p2a, p2b, v2, l2_2, p1b))); std::min(segment_point_distance_squared(p2a, p2b, v2, l2_2, p1a), segment_point_distance_squared(p2a, p2b, v2, l2_2, p1b)));
} }

View file

@ -1722,7 +1722,7 @@ namespace Slic3r {
} }
// Added because of github #3435, currently not used by PrusaSlicer // Added because of github #3435, currently not used by PrusaSlicer
int instances_count_id = get_attribute_value_int(attributes, num_attributes, INSTANCESCOUNT_ATTR); // int instances_count_id = get_attribute_value_int(attributes, num_attributes, INSTANCESCOUNT_ATTR);
m_objects_metadata.insert(IdToMetadataMap::value_type(object_id, ObjectMetadata())); m_objects_metadata.insert(IdToMetadataMap::value_type(object_id, ObjectMetadata()));
m_curr_config.object_id = object_id; m_curr_config.object_id = object_id;

View file

@ -1749,7 +1749,6 @@ std::vector<GCode::InstanceToPrint> GCode::sort_print_object_instances(
std::sort(sorted.begin(), sorted.end()); std::sort(sorted.begin(), sorted.end());
if (! sorted.empty()) { if (! sorted.empty()) {
const Print &print = *sorted.front().first->print();
out.reserve(sorted.size()); out.reserve(sorted.size());
for (const PrintInstance *instance : *ordering) { for (const PrintInstance *instance : *ordering) {
const PrintObject &print_object = *instance->print_object; const PrintObject &print_object = *instance->print_object;
@ -1795,13 +1794,14 @@ namespace ProcessLayer
// we should add or not colorprint_change in respect to nozzle_diameter count instead of really used extruders count // we should add or not colorprint_change in respect to nozzle_diameter count instead of really used extruders count
if (color_change || tool_change) if (color_change || tool_change)
{ {
assert(m600_extruder_before_layer >= 0);
// Color Change or Tool Change as Color Change. // Color Change or Tool Change as Color Change.
// add tag for analyzer // add tag for analyzer
gcode += "; " + GCodeAnalyzer::Color_Change_Tag + ",T" + std::to_string(m600_extruder_before_layer) + "\n"; gcode += "; " + GCodeAnalyzer::Color_Change_Tag + ",T" + std::to_string(m600_extruder_before_layer) + "\n";
// add tag for time estimator // add tag for time estimator
gcode += "; " + GCodeTimeEstimator::Color_Change_Tag + "\n"; gcode += "; " + GCodeTimeEstimator::Color_Change_Tag + "\n";
if (!single_extruder_printer && m600_extruder_before_layer >= 0 && first_extruder_id != m600_extruder_before_layer if (!single_extruder_printer && m600_extruder_before_layer >= 0 && first_extruder_id != (unsigned)m600_extruder_before_layer
// && !MMU1 // && !MMU1
) { ) {
//! FIXME_in_fw show message during print pause //! FIXME_in_fw show message during print pause

View file

@ -644,7 +644,7 @@ bool GCodeAnalyzer::_process_tags(const GCodeReader::GCodeLine& line)
if (pos != comment.npos) if (pos != comment.npos)
{ {
pos = comment.find_last_of(",T"); pos = comment.find_last_of(",T");
int extruder = pos == comment.npos ? 0 : std::atoi(comment.substr(pos + 1, comment.npos).c_str()); unsigned extruder = pos == comment.npos ? 0 : std::stoi(comment.substr(pos + 1, comment.npos));
_process_color_change_tag(extruder); _process_color_change_tag(extruder);
return true; return true;
} }
@ -702,7 +702,7 @@ void GCodeAnalyzer::_process_height_tag(const std::string& comment, size_t pos)
_set_height((float)::strtod(comment.substr(pos + Height_Tag.length()).c_str(), nullptr)); _set_height((float)::strtod(comment.substr(pos + Height_Tag.length()).c_str(), nullptr));
} }
void GCodeAnalyzer::_process_color_change_tag(int extruder) void GCodeAnalyzer::_process_color_change_tag(unsigned extruder)
{ {
m_extruder_color[extruder] = m_extruders_count + m_state.cp_color_counter; // color_change position in list of color for preview m_extruder_color[extruder] = m_extruders_count + m_state.cp_color_counter; // color_change position in list of color for preview
m_state.cp_color_counter++; m_state.cp_color_counter++;

View file

@ -220,7 +220,7 @@ private:
void _process_height_tag(const std::string& comment, size_t pos); void _process_height_tag(const std::string& comment, size_t pos);
// Processes color change tag // Processes color change tag
void _process_color_change_tag(int extruder); void _process_color_change_tag(unsigned extruder);
// Processes pause print and custom gcode tag // Processes pause print and custom gcode tag
void _process_pause_print_or_custom_code_tag(); void _process_pause_print_or_custom_code_tag();

View file

@ -1936,7 +1936,7 @@ void Print::_make_brim()
// Find all pieces that the initial loop was split into. // Find all pieces that the initial loop was split into.
size_t j = i + 1; size_t j = i + 1;
for (; j < loops_trimmed_order.size() && loops_trimmed_order[i].second == loops_trimmed_order[j].second; ++ j) ; for (; j < loops_trimmed_order.size() && loops_trimmed_order[i].second == loops_trimmed_order[j].second; ++ j) ;
const ClipperLib_Z::Path &first_path = *loops_trimmed_order[i].first; const ClipperLib_Z::Path &first_path = *loops_trimmed_order[i].first;
if (i + 1 == j && first_path.size() > 3 && first_path.front().X == first_path.back().X && first_path.front().Y == first_path.back().Y) { if (i + 1 == j && first_path.size() > 3 && first_path.front().X == first_path.back().X && first_path.front().Y == first_path.back().Y) {
auto *loop = new ExtrusionLoop(); auto *loop = new ExtrusionLoop();
m_brim.entities.emplace_back(loop); m_brim.entities.emplace_back(loop);

View file

@ -72,7 +72,7 @@ void AppConfig::set_defaults()
if (get("remember_output_path").empty()) if (get("remember_output_path").empty())
set("remember_output_path", "1"); set("remember_output_path", "1");
if (get("remember_output_path_removable").empty()) if (get("remember_output_path_removable").empty())
set("remember_output_path_removable", "1"); set("remember_output_path_removable", "1");
if (get("use_custom_toolbar_size").empty()) if (get("use_custom_toolbar_size").empty())

View file

@ -1726,7 +1726,7 @@ bool ConfigWizard::priv::on_bnt_finish()
page_sla_materials->reload_presets(); page_sla_materials->reload_presets();
// theres no need to check that filament is selected if we have only custom printer // theres no need to check that filament is selected if we have only custom printer
if (custom_printer_selected && !any_fff_selected && !any_sla_selected) return true; if (custom_printer_selected && !any_fff_selected && !any_sla_selected) return true;
// check, that there is selected at least one filament/material // check, that there is selected at least one filament/material
return check_materials_in_config(T_ANY); return check_materials_in_config(T_ANY);
} }

View file

@ -1298,7 +1298,7 @@ void GLCanvas3D::Labels::render(const std::vector<const ModelInstance*>& sorted_
// updates print order strings // updates print order strings
if (sorted_instances.size() > 1) { if (sorted_instances.size() > 1) {
for (int i = 0; i < sorted_instances.size(); ++i) { for (size_t i = 0; i < sorted_instances.size(); ++i) {
size_t id = sorted_instances[i]->id().id; size_t id = sorted_instances[i]->id().id;
std::vector<Owner>::iterator it = std::find_if(owners.begin(), owners.end(), [id](const Owner& owner) { std::vector<Owner>::iterator it = std::find_if(owners.begin(), owners.end(), [id](const Owner& owner) {
return owner.model_instance_id == id; return owner.model_instance_id == id;

View file

@ -1543,7 +1543,7 @@ wxMenuItem* ObjectList::append_menu_item_settings(wxMenu* menu_)
// If there are selected more then one instance but not all of them // If there are selected more then one instance but not all of them
// don't add settings menu items // don't add settings menu items
const Selection& selection = scene_selection(); const Selection& selection = scene_selection();
if (selection.is_multiple_full_instance() && !selection.is_single_full_object() || if ((selection.is_multiple_full_instance() && !selection.is_single_full_object()) ||
selection.is_multiple_volume() || selection.is_mixed() ) // more than one volume(part) is selected on the scene selection.is_multiple_volume() || selection.is_mixed() ) // more than one volume(part) is selected on the scene
return nullptr; return nullptr;

View file

@ -3611,7 +3611,7 @@ void Plater::priv::on_process_completed(wxCommandEvent &evt)
else if (wxGetApp().get_mode() == comSimple) else if (wxGetApp().get_mode() == comSimple)
show_action_buttons(false); show_action_buttons(false);
if(!canceled && RemovableDriveManager::get_instance().get_is_writing()) if(!canceled && RemovableDriveManager::get_instance().get_is_writing())
{ {
RemovableDriveManager::get_instance().set_is_writing(false); RemovableDriveManager::get_instance().set_is_writing(false);
show_action_buttons(false); show_action_buttons(false);

View file

@ -1012,7 +1012,7 @@ const std::string& PresetCollection::get_preset_name_by_alias(const std::string&
it != m_map_alias_to_profile_name.end() && it->first == alias; ++ it) it != m_map_alias_to_profile_name.end() && it->first == alias; ++ it)
if (auto it_preset = this->find_preset_internal(it->second); if (auto it_preset = this->find_preset_internal(it->second);
it_preset != m_presets.end() && it_preset->name == it->second && it_preset != m_presets.end() && it_preset->name == it->second &&
it_preset->is_visible && (it_preset->is_compatible || (it_preset - m_presets.begin()) == m_idx_selected)) it_preset->is_visible && (it_preset->is_compatible || size_t(it_preset - m_presets.begin()) == m_idx_selected))
return it_preset->name; return it_preset->name;
return alias; return alias;
} }

View file

@ -1316,7 +1316,7 @@ size_t PresetBundle::load_configbundle(const std::string &path, unsigned int fla
// Derive the profile logical name aka alias from the preset name if the alias was not stated explicitely. // Derive the profile logical name aka alias from the preset name if the alias was not stated explicitely.
if (alias_name.empty()) { if (alias_name.empty()) {
int end_pos = preset_name.find_first_of("@"); size_t end_pos = preset_name.find_first_of("@");
if (end_pos != std::string::npos) { if (end_pos != std::string::npos) {
alias_name = preset_name.substr(0, end_pos); alias_name = preset_name.substr(0, end_pos);
if (renamed_from.empty()) if (renamed_from.empty())
@ -1717,7 +1717,7 @@ void PresetBundle::update_plater_filament_ui(unsigned int idx_extruder, GUI::Pre
if (selected_preset_item == INT_MAX) if (selected_preset_item == INT_MAX)
selected_preset_item = ui->GetCount() - 1; selected_preset_item = ui->GetCount() - 1;
ui->SetSelection(selected_preset_item); ui->SetSelection(selected_preset_item);
ui->SetToolTip(tooltip.IsEmpty() ? ui->GetString(selected_preset_item) : tooltip); ui->SetToolTip(tooltip.IsEmpty() ? ui->GetString(selected_preset_item) : tooltip);
ui->check_selection(); ui->check_selection();
ui->Thaw(); ui->Thaw();

View file

@ -182,8 +182,6 @@ std::string FlashAir::timestamp_str() const
auto t = std::time(nullptr); auto t = std::time(nullptr);
auto tm = *std::localtime(&t); auto tm = *std::localtime(&t);
const char *name = get_name();
unsigned long fattime = ((tm.tm_year - 80) << 25) | unsigned long fattime = ((tm.tm_year - 80) << 25) |
((tm.tm_mon + 1) << 21) | ((tm.tm_mon + 1) << 21) |
(tm.tm_mday << 16) | (tm.tm_mday << 16) |

View file

@ -526,8 +526,8 @@ Updates PresetUpdater::priv::get_config_updates(const Semver &old_slic3r_version
existing_idx.load(bundle_path_idx); existing_idx.load(bundle_path_idx);
// Find a recommended config bundle version for the slic3r version last executed. This makes sure that a config bundle update will not be missed // Find a recommended config bundle version for the slic3r version last executed. This makes sure that a config bundle update will not be missed
// when upgrading an application. On the other side, the user will be bugged every time he will switch between slic3r versions. // when upgrading an application. On the other side, the user will be bugged every time he will switch between slic3r versions.
const auto existing_recommended = existing_idx.recommended(old_slic3r_version); /*const auto existing_recommended = existing_idx.recommended(old_slic3r_version);
/*if (existing_recommended != existing_idx.end() && recommended->config_version == existing_recommended->config_version) { if (existing_recommended != existing_idx.end() && recommended->config_version == existing_recommended->config_version) {
// The user has already seen (and presumably rejected) this update // The user has already seen (and presumably rejected) this update
BOOST_LOG_TRIVIAL(info) << boost::format("Downloaded index for `%1%` is the same as installed one, not offering an update.") % idx.vendor(); BOOST_LOG_TRIVIAL(info) << boost::format("Downloaded index for `%1%` is the same as installed one, not offering an update.") % idx.vendor();
continue; continue;