Fixed few warnings

This commit is contained in:
Lukas Matena 2020-04-22 12:49:52 +02:00
parent 3e855d36dc
commit 32a353058f
11 changed files with 44 additions and 58 deletions

View file

@ -901,7 +901,7 @@ static void connect_segment_intersections_by_contours(
const SegmentedIntersectionLine *il_prev = i_vline > 0 ? &segs[i_vline - 1] : nullptr;
const SegmentedIntersectionLine *il_next = i_vline + 1 < segs.size() ? &segs[i_vline + 1] : nullptr;
for (int i_intersection = 0; i_intersection < il.intersections.size(); ++ i_intersection) {
for (int i_intersection = 0; i_intersection < int(il.intersections.size()); ++ i_intersection) {
SegmentIntersection &itsct = il.intersections[i_intersection];
const Polygon &poly = poly_with_offset.contour(itsct.iContour);
const bool forward = itsct.is_low(); // == poly_with_offset.is_contour_ccw(intrsctn->iContour);
@ -914,7 +914,7 @@ static void connect_segment_intersections_by_contours(
int iprev = -1;
int d_prev = std::numeric_limits<int>::max();
if (il_prev) {
for (int i = 0; i < il_prev->intersections.size(); ++ i) {
for (int i = 0; i < int(il_prev->intersections.size()); ++ i) {
const SegmentIntersection &itsct2 = il_prev->intersections[i];
if (itsct.iContour == itsct2.iContour && itsct.type == itsct2.type) {
// The intersection points lie on the same contour and have the same orientation.
@ -932,7 +932,7 @@ static void connect_segment_intersections_by_contours(
int inext = -1;
int d_next = std::numeric_limits<int>::max();
if (il_next) {
for (int i = 0; i < il_next->intersections.size(); ++ i) {
for (int i = 0; i < int(il_next->intersections.size()); ++ i) {
const SegmentIntersection &itsct2 = il_next->intersections[i];
if (itsct.iContour == itsct2.iContour && itsct.type == itsct2.type) {
// The intersection points lie on the same contour and have the same orientation.
@ -950,7 +950,7 @@ static void connect_segment_intersections_by_contours(
bool same_prev = false;
bool same_next = false;
// Does the perimeter intersect the current vertical line above intrsctn?
for (int i = 0; i < il.intersections.size(); ++ i)
for (int i = 0; i < int(il.intersections.size()); ++ i)
if (const SegmentIntersection &it2 = il.intersections[i];
i != i_intersection && it2.iContour == itsct.iContour && it2.type != itsct.type) {
int d = distance_of_segmens(poly, it2.iSegment, itsct.iSegment, forward);
@ -1040,7 +1040,7 @@ static void connect_segment_intersections_by_contours(
}
// Make the LinkQuality::Invalid symmetric on vertical connections.
for (int i_intersection = 0; i_intersection < il.intersections.size(); ++ i_intersection) {
for (int i_intersection = 0; i_intersection < int(il.intersections.size()); ++ i_intersection) {
SegmentIntersection &it = il.intersections[i_intersection];
if (it.has_left_vertical() && it.prev_on_contour_quality == SegmentIntersection::LinkQuality::Invalid) {
SegmentIntersection &it2 = il.intersections[it.left_vertical()];
@ -1157,9 +1157,9 @@ static void traverse_graph_generate_polylines(
{
// For each outer only chords, measure their maximum distance to the bow of the outer contour.
// Mark an outer only chord as consumed, if the distance is low.
for (int i_vline = 0; i_vline < segs.size(); ++ i_vline) {
for (int i_vline = 0; i_vline < int(segs.size()); ++ i_vline) {
SegmentedIntersectionLine &vline = segs[i_vline];
for (int i_intersection = 0; i_intersection + 1 < vline.intersections.size(); ++ i_intersection) {
for (int i_intersection = 0; i_intersection + 1 < int(vline.intersections.size()); ++ i_intersection) {
if (vline.intersections[i_intersection].type == SegmentIntersection::OUTER_LOW &&
vline.intersections[i_intersection + 1].type == SegmentIntersection::OUTER_HIGH) {
bool consumed = false;
@ -1189,14 +1189,14 @@ static void traverse_graph_generate_polylines(
if (i_intersection == -1) {
// The path has been interrupted. Find a next starting point, closest to the previous extruder position.
coordf_t dist2min = std::numeric_limits<coordf_t>().max();
for (int i_vline2 = 0; i_vline2 < segs.size(); ++ i_vline2) {
for (int i_vline2 = 0; i_vline2 < int(segs.size()); ++ i_vline2) {
const SegmentedIntersectionLine &vline = segs[i_vline2];
if (! vline.intersections.empty()) {
assert(vline.intersections.size() > 1);
// Even number of intersections with the loops.
assert((vline.intersections.size() & 1) == 0);
assert(vline.intersections.front().type == SegmentIntersection::OUTER_LOW);
for (int i = 0; i < vline.intersections.size(); ++ i) {
for (int i = 0; i < int(vline.intersections.size()); ++ i) {
const SegmentIntersection& intrsctn = vline.intersections[i];
if (intrsctn.is_outer()) {
assert(intrsctn.is_low() || i > 0);
@ -1674,13 +1674,13 @@ static std::vector<MonotonousRegion> generate_montonous_regions(std::vector<Segm
auto test_overlap = [](int, int, int) { return false; };
#endif
for (int i_vline_seed = 0; i_vline_seed < segs.size(); ++ i_vline_seed) {
for (int i_vline_seed = 0; i_vline_seed < int(segs.size()); ++ i_vline_seed) {
SegmentedIntersectionLine &vline_seed = segs[i_vline_seed];
for (int i_intersection_seed = 1; i_intersection_seed + 1 < vline_seed.intersections.size(); ) {
while (i_intersection_seed < vline_seed.intersections.size() &&
for (int i_intersection_seed = 1; i_intersection_seed + 1 < int(vline_seed.intersections.size()); ) {
while (i_intersection_seed < int(vline_seed.intersections.size()) &&
vline_seed.intersections[i_intersection_seed].type != SegmentIntersection::INNER_LOW)
++ i_intersection_seed;
if (i_intersection_seed == vline_seed.intersections.size())
if (i_intersection_seed == int(vline_seed.intersections.size()))
break;
SegmentIntersection *start = &vline_seed.intersections[i_intersection_seed];
SegmentIntersection *end = &end_of_vertical_run(vline_seed, *start);
@ -1697,7 +1697,7 @@ static std::vector<MonotonousRegion> generate_montonous_regions(std::vector<Segm
assert(! test_overlap(region.left.vline, region.left.low, region.left.high));
start->consumed_vertical_up = true;
int num_lines = 1;
while (++ i_vline < segs.size()) {
while (++ i_vline < int(segs.size())) {
SegmentedIntersectionLine &vline_left = segs[i_vline - 1];
SegmentedIntersectionLine &vline_right = segs[i_vline];
std::pair<SegmentIntersection*, SegmentIntersection*> right = right_overlap(left, vline_left, vline_right);
@ -1860,7 +1860,7 @@ static void connect_monotonous_regions(std::vector<MonotonousRegion> &regions, c
}
}
}
if (region.right.vline + 1 < segs.size()) {
if (region.right.vline + 1 < int(segs.size())) {
auto &vline = segs[region.right.vline];
auto &vline_right = segs[region.right.vline + 1];
auto [rbegin, rend] = right_overlap(vline.intersections[region.right.low], vline.intersections[region.right.high], vline, vline_right);
@ -2100,7 +2100,7 @@ static std::vector<MonotonousRegionLink> chain_monotonous_regions(
AntPath &path2 = path_matrix(region, dir, *next, true);
if (path1.visibility > next_candidate.probability)
next_candidate = { next, &path1, &path1, path1.visibility, false };
if (path2.visibility > next_candidate.probability)
if (path2.visibility > next_candidate.probability)
next_candidate = { next, &path2, &path2, path2.visibility, true };
}
}
@ -2111,7 +2111,7 @@ static std::vector<MonotonousRegionLink> chain_monotonous_regions(
AntPath &path2 = path_matrix(region, dir, *next, true);
if (path1.visibility > next_candidate.probability)
next_candidate = { next, &path1, &path1, path1.visibility, false };
if (path2.visibility > next_candidate.probability)
if (path2.visibility > next_candidate.probability)
next_candidate = { next, &path2, &path2, path2.visibility, true };
}
}

View file

@ -282,7 +282,7 @@ namespace Slic3r {
};
GCodeReader parser;
unsigned int g1_lines_count = 0;
int g1_lines_count = 0;
int normal_g1_line_id = 0;
float normal_last_recorded_time = 0.0f;
int silent_g1_line_id = 0;

View file

@ -300,13 +300,13 @@ void AppConfig::set_mouse_device(const std::string& name, double translation_spe
std::vector<std::string> AppConfig::get_mouse_device_names() const
{
static constexpr char *prefix = "mouse_device:";
static constexpr size_t prefix_len = 13; // strlen(prefix); reports error C2131: expression did not evaluate to a constant on VS2019
std::vector<std::string> out;
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)
if (boost::starts_with(key_value_pair.first, "mouse_device:") && key_value_pair.first.size() > prefix_len)
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;
return out;
}
void AppConfig::update_config_dir(const std::string &dir)

View file

@ -425,9 +425,6 @@ double Camera::calc_zoom_to_bounding_box_factor(const BoundingBoxf3& box, double
if ((dx <= 0.0) || (dy <= 0.0))
return -1.0f;
double med_x = 0.5 * (max_x + min_x);
double med_y = 0.5 * (max_y + min_y);
dx *= margin_factor;
dy *= margin_factor;

View file

@ -22,7 +22,7 @@ namespace DoubleSlider {
/* For exporting GCode in GCodeWriter is used XYZF_NUM(val) = PRECISION(val, 3) for XYZ values.
* So, let use same value as a permissible error for layer height.
*/
static double epsilon() { return 0.0011;}
constexpr double epsilon() { return 0.0011; }
// custom message the slider sends to its parent to notify a tick-change:
wxDECLARE_EVENT(wxCUSTOMEVT_TICKSCHANGED, wxEvent);

View file

@ -26,7 +26,6 @@ std::string GLGizmoScale3D::get_tooltip() const
bool single_instance = selection.is_single_full_instance();
bool single_volume = selection.is_single_modifier() || selection.is_single_volume();
bool single_selection = single_instance || single_volume;
Vec3f scale = 100.0f * Vec3f::Ones();
if (single_instance)

View file

@ -25,15 +25,6 @@
#include <wx/choicebk.h>
#endif // BOOK_TYPE
#if ENABLE_SCROLLABLE
static wxSize get_screen_size(wxWindow* window)
{
const auto idx = wxDisplay::GetFromWindow(window);
wxDisplay display(idx != wxNOT_FOUND ? idx : 0u);
return display.GetClientArea().GetSize();
}
#endif // ENABLE_SCROLLABLE
namespace Slic3r {
namespace GUI {

View file

@ -962,7 +962,7 @@ void PresetCollection::load_bitmap_add(const std::string &file_name)
const Preset* PresetCollection::get_selected_preset_parent() const
{
if (this->get_selected_idx() == -1)
if (this->get_selected_idx() == size_t(-1))
// This preset collection has no preset activated yet. Only the get_edited_preset() is valid.
return nullptr;

View file

@ -296,9 +296,8 @@ std::string PresetHints::top_bottom_shell_thickness_explanation(const PresetBund
double bottom_solid_min_thickness = print_config.opt_float("bottom_solid_min_thickness");
double layer_height = print_config.opt_float("layer_height");
bool variable_layer_height = printer_config.opt_bool("variable_layer_height");
//FIXME the following lines take into account the 1st extruder only.
//FIXME the following line takes into account the 1st extruder only.
double min_layer_height = variable_layer_height ? Slicing::min_layer_height_from_nozzle(printer_config, 1) : layer_height;
double max_layer_height = variable_layer_height ? Slicing::max_layer_height_from_nozzle(printer_config, 1) : layer_height;
if (layer_height <= 0.f) {
out += _utf8(L("Top / bottom shell thickness hint: Not available due to invalid layer height."));

View file

@ -3297,28 +3297,28 @@ void Tab::save_preset(std::string name /*= ""*/, bool detach)
wxGetApp().plater()->force_filament_colors_update();
{
// Profile compatiblity is updated first when the profile is saved.
// Update profile selection combo boxes at the depending tabs to reflect modifications in profile compatibility.
std::vector<Preset::Type> dependent;
switch (m_type) {
case Preset::TYPE_PRINT:
dependent = { Preset::TYPE_FILAMENT };
break;
case Preset::TYPE_SLA_PRINT:
dependent = { Preset::TYPE_SLA_MATERIAL };
break;
case Preset::TYPE_PRINTER:
// Profile compatiblity is updated first when the profile is saved.
// Update profile selection combo boxes at the depending tabs to reflect modifications in profile compatibility.
std::vector<Preset::Type> dependent;
switch (m_type) {
case Preset::TYPE_PRINT:
dependent = { Preset::TYPE_FILAMENT };
break;
case Preset::TYPE_SLA_PRINT:
dependent = { Preset::TYPE_SLA_MATERIAL };
break;
case Preset::TYPE_PRINTER:
if (static_cast<const TabPrinter*>(this)->m_printer_technology == ptFFF)
dependent = { Preset::TYPE_PRINT, Preset::TYPE_FILAMENT };
else
dependent = { Preset::TYPE_SLA_PRINT, Preset::TYPE_SLA_MATERIAL };
break;
break;
default:
break;
}
for (Preset::Type preset_type : dependent)
wxGetApp().get_tab(preset_type)->update_tab_ui();
}
break;
}
for (Preset::Type preset_type : dependent)
wxGetApp().get_tab(preset_type)->update_tab_ui();
}
}
// Called for a currently selected preset.

View file

@ -120,7 +120,7 @@ namespace fts {
char *end = Slic3r::fold_to_ascii(*str, tmp);
char *c = tmp;
for (const wchar_t* d = pattern; c != end && *d != 0 && wchar_t(std::tolower(*c)) == std::tolower(*d); ++c, ++d);
if (c == end) {
if (c == end) {
folded_match = true;
num_matched = end - tmp;
}