Fixed warnings in libslic3r

This commit is contained in:
Lukas Matena 2019-06-25 13:06:04 +02:00
parent 471331e8c1
commit cb916c4dda
30 changed files with 129 additions and 147 deletions

View File

@ -146,10 +146,10 @@ void EdgeGrid::Grid::create_from_m_contours(coord_t resolution)
coord_t iy = p1(1) / m_resolution;
coord_t ixb = p2(0) / m_resolution;
coord_t iyb = p2(1) / m_resolution;
assert(ix >= 0 && ix < m_cols);
assert(iy >= 0 && iy < m_rows);
assert(ixb >= 0 && ixb < m_cols);
assert(iyb >= 0 && iyb < m_rows);
assert(ix >= 0 && size_t(ix) < m_cols);
assert(iy >= 0 && size_t(iy) < m_rows);
assert(ixb >= 0 && size_t(ixb) < m_cols);
assert(iyb >= 0 && size_t(iyb) < m_rows);
// Account for the end points.
++ m_cells[iy*m_cols+ix].end;
if (ix == ixb && iy == iyb)
@ -290,10 +290,10 @@ void EdgeGrid::Grid::create_from_m_contours(coord_t resolution)
coord_t iy = p1(1) / m_resolution;
coord_t ixb = p2(0) / m_resolution;
coord_t iyb = p2(1) / m_resolution;
assert(ix >= 0 && ix < m_cols);
assert(iy >= 0 && iy < m_rows);
assert(ixb >= 0 && ixb < m_cols);
assert(iyb >= 0 && iyb < m_rows);
assert(ix >= 0 && size_t(ix) < m_cols);
assert(iy >= 0 && size_t(iy) < m_rows);
assert(ixb >= 0 && size_t(ixb) < m_cols);
assert(iyb >= 0 && size_t(iyb) < m_rows);
// Account for the end points.
m_cell_data[m_cells[iy*m_cols + ix].end++] = std::pair<size_t, size_t>(i, j);
if (ix == ixb && iy == iyb)
@ -775,11 +775,11 @@ void EdgeGrid::Grid::calculate_sdf()
// For each corner of this cell and its 1 ring neighbours:
for (int corner_y = -1; corner_y < 3; ++ corner_y) {
coord_t corner_r = r + corner_y;
if (corner_r < 0 || corner_r >= nrows)
if (corner_r < 0 || (size_t)corner_r >= nrows)
continue;
for (int corner_x = -1; corner_x < 3; ++ corner_x) {
coord_t corner_c = c + corner_x;
if (corner_c < 0 || corner_c >= ncols)
if (corner_c < 0 || (size_t)corner_c >= ncols)
continue;
float &d_min = m_signed_distance_field[corner_r * ncols + corner_c];
Slic3r::Point pt(m_bbox.min(0) + corner_c * m_resolution, m_bbox.min(1) + corner_r * m_resolution);
@ -1137,9 +1137,9 @@ bool EdgeGrid::Grid::signed_distance_edges(const Point &pt, coord_t search_radiu
return false;
bbox.max(0) /= m_resolution;
bbox.max(1) /= m_resolution;
if (bbox.max(0) >= m_cols)
if ((size_t)bbox.max(0) >= m_cols)
bbox.max(0) = m_cols - 1;
if (bbox.max(1) >= m_rows)
if ((size_t)bbox.max(1) >= m_rows)
bbox.max(1) = m_rows - 1;
// Lower boundary, round to grid and test validity.
bbox.min(0) -= search_radius;

View File

@ -78,8 +78,8 @@ protected:
#endif
bool cell_inside_or_crossing(int r, int c) const
{
if (r < 0 || r >= m_rows ||
c < 0 || c >= m_cols)
if (r < 0 || (size_t)r >= m_rows ||
c < 0 || (size_t)c >= m_cols)
// The cell is outside the domain. Hoping that the contours were correctly oriented, so
// there is a CCW outmost contour so the out of domain cells are outside.
return false;

View File

@ -660,7 +660,7 @@ void gcode_spread_points(
for (ExtrusionPoints::const_iterator it = points.begin(); it != points.end(); ++ it) {
const V2f &center = it->center;
const float radius = it->radius;
const float radius2 = radius * radius;
//const float radius2 = radius * radius;
const float height_target = it->height;
B2f bbox(center - V2f(radius, radius), center + V2f(radius, radius));
B2i bboxi(
@ -774,8 +774,8 @@ void gcode_spread_points(
}
}
#endif
float area_circle_total2 = float(M_PI) * sqr(radius);
float area_err = fabs(area_circle_total2 - area_circle_total) / area_circle_total2;
// float area_circle_total2 = float(M_PI) * sqr(radius);
// float area_err = fabs(area_circle_total2 - area_circle_total) / area_circle_total2;
// printf("area_circle_total: %f, %f, %f\n", area_circle_total, area_circle_total2, area_err);
float volume_full = float(M_PI) * sqr(radius) * height_target;
// if (true) {
@ -905,8 +905,8 @@ void ExtrusionSimulator::set_image_size(const Point &image_size)
// printf("Allocating image data, allocated\n");
//FIXME fill the image with red vertical lines.
for (size_t r = 0; r < image_size.y(); ++ r) {
for (size_t c = 0; c < image_size.x(); c += 2) {
for (size_t r = 0; r < size_t(image_size.y()); ++ r) {
for (size_t c = 0; c < size_t(image_size.x()); c += 2) {
// Color red
pimpl->image_data[r * image_size.x() * 4 + c * 4] = 255;
// Opacity full
@ -958,7 +958,7 @@ void ExtrusionSimulator::extrude_to_accumulator(const ExtrusionPath &path, const
float scalex = float(viewport.size().x()) / float(bbox.size().x());
float scaley = float(viewport.size().y()) / float(bbox.size().y());
float w = scale_(path.width) * scalex;
float h = scale_(path.height) * scalex;
//float h = scale_(path.height) * scalex;
w = scale_(path.mm3_per_mm / path.height) * scalex;
// printf("scalex: %f, scaley: %f\n", scalex, scaley);
// printf("bbox: %d,%d %d,%d\n", bbox.min.x(), bbox.min.y, bbox.max.x(), bbox.max.y);
@ -993,8 +993,8 @@ void ExtrusionSimulator::evaluate_accumulator(ExtrusionSimulationType simulation
for (int r = 0; r < sz.y(); ++r) {
for (int c = 0; c < sz.x(); ++c) {
float p = 0;
for (int j = 0; j < pimpl->bitmap_oversampled; ++ j) {
for (int i = 0; i < pimpl->bitmap_oversampled; ++ i) {
for (unsigned int j = 0; j < pimpl->bitmap_oversampled; ++ j) {
for (unsigned int i = 0; i < pimpl->bitmap_oversampled; ++ i) {
if (pimpl->bitmap[r * pimpl->bitmap_oversampled + j][c * pimpl->bitmap_oversampled + i])
p += 1.f;
}

View File

@ -130,14 +130,14 @@ static inline Point hilbert_n_to_xy(const size_t n)
}
}
int state = (ndigits & 1) ? 4 : 0;
int dirstate = (ndigits & 1) ? 0 : 4;
// int dirstate = (ndigits & 1) ? 0 : 4;
coord_t x = 0;
coord_t y = 0;
for (int i = (int)ndigits - 1; i >= 0; -- i) {
int digit = (n >> (i * 2)) & 3;
state += digit;
if (digit != 3)
dirstate = state; // lowest non-3 digit
// if (digit != 3)
// dirstate = state; // lowest non-3 digit
x |= digit_to_x[state] << i;
y |= digit_to_y[state] << i;
state = next_state[state];

View File

@ -287,7 +287,8 @@ public:
assert(aoffset1 < 0);
assert(aoffset2 < 0);
assert(aoffset2 < aoffset1);
bool sticks_removed = remove_sticks(polygons_src);
// bool sticks_removed =
remove_sticks(polygons_src);
// if (sticks_removed) printf("Sticks removed!\n");
polygons_outer = offset(polygons_src, aoffset1,
ClipperLib::jtMiter,
@ -481,7 +482,7 @@ static inline IntersectionTypeOtherVLine intersection_type_on_prev_next_vertical
{
// This routine will propose a connecting line even if the connecting perimeter segment intersects
// iVertical line multiple times before reaching iIntersectionOther.
if (iIntersectionOther == -1)
if (iIntersectionOther == size_t(-1))
return INTERSECTION_TYPE_OTHER_VLINE_UNDEFINED;
assert(dir_is_next ? (iVerticalLine + 1 < segs.size()) : (iVerticalLine > 0));
const SegmentedIntersectionLine &il_this = segs[iVerticalLine];
@ -858,8 +859,8 @@ bool FillRectilinear2::fill_surface_by_lines(const Surface *surface, const FillP
if (il > ir)
// No vertical line intersects this segment.
continue;
assert(il >= 0 && il < segs.size());
assert(ir >= 0 && ir < segs.size());
assert(il >= 0 && size_t(il) < segs.size());
assert(ir >= 0 && size_t(ir) < segs.size());
for (int i = il; i <= ir; ++ i) {
coord_t this_x = segs[i].pos;
assert(this_x == i * line_spacing + x0);
@ -1159,8 +1160,8 @@ bool FillRectilinear2::fill_surface_by_lines(const Surface *surface, const FillP
int iSegAbove = -1;
int iSegBelow = -1;
{
SegmentIntersection::SegmentIntersectionType type_crossing = (intrsctn->type == SegmentIntersection::INNER_LOW) ?
SegmentIntersection::INNER_HIGH : SegmentIntersection::INNER_LOW;
// SegmentIntersection::SegmentIntersectionType type_crossing = (intrsctn->type == SegmentIntersection::INNER_LOW) ?
// SegmentIntersection::INNER_HIGH : SegmentIntersection::INNER_LOW;
// Does the perimeter intersect the current vertical line above intrsctn?
for (size_t i = i_intersection + 1; i + 1 < seg.intersections.size(); ++ i)
// if (seg.intersections[i].iContour == intrsctn->iContour && seg.intersections[i].type == type_crossing) {

View File

@ -849,7 +849,7 @@ static inline IntersectionTypeOtherVLine intersection_type_on_prev_next_vertical
{
// This routine will propose a connecting line even if the connecting perimeter segment intersects
// iVertical line multiple times before reaching iIntersectionOther.
if (iIntersectionOther == -1)
if (iIntersectionOther == size_t(-1))
return INTERSECTION_TYPE_OTHER_VLINE_UNDEFINED;
assert(dir_is_next ? (iVerticalLine + 1 < segs.size()) : (iVerticalLine > 0));
const SegmentedIntersectionLine &il_this = segs[iVerticalLine];
@ -1284,8 +1284,8 @@ static bool fill_hatching_segments_legacy(
int iSegAbove = -1;
int iSegBelow = -1;
{
SegmentIntersection::SegmentIntersectionType type_crossing = (intrsctn->type == SegmentIntersection::INNER_LOW) ?
SegmentIntersection::INNER_HIGH : SegmentIntersection::INNER_LOW;
// SegmentIntersection::SegmentIntersectionType type_crossing = (intrsctn->type == SegmentIntersection::INNER_LOW) ?
// SegmentIntersection::INNER_HIGH : SegmentIntersection::INNER_LOW;
// Does the perimeter intersect the current vertical line above intrsctn?
for (size_t i = i_intersection + 1; i + 1 < seg.intersections.size(); ++ i)
// if (seg.intersections[i].iContour == intrsctn->iContour && seg.intersections[i].type == type_crossing) {

View File

@ -675,7 +675,7 @@ namespace Slic3r {
if (!XML_ParseBuffer(m_xml_parser, (int)stat.m_uncomp_size, 1))
{
char error_buf[1024];
::sprintf(error_buf, "Error (%s) while parsing xml file at line %d", XML_ErrorString(XML_GetErrorCode(m_xml_parser)), XML_GetCurrentLineNumber(m_xml_parser));
::sprintf(error_buf, "Error (%s) while parsing xml file at line %d", XML_ErrorString(XML_GetErrorCode(m_xml_parser)), (int)XML_GetCurrentLineNumber(m_xml_parser));
add_error(error_buf);
return false;
}
@ -895,7 +895,7 @@ namespace Slic3r {
if (!XML_ParseBuffer(m_xml_parser, (int)stat.m_uncomp_size, 1))
{
char error_buf[1024];
::sprintf(error_buf, "Error (%s) while parsing xml file at line %d", XML_ErrorString(XML_GetErrorCode(m_xml_parser)), XML_GetCurrentLineNumber(m_xml_parser));
::sprintf(error_buf, "Error (%s) while parsing xml file at line %d", XML_ErrorString(XML_GetErrorCode(m_xml_parser)), (int)XML_GetCurrentLineNumber(m_xml_parser));
add_error(error_buf);
return false;
}
@ -1452,7 +1452,7 @@ namespace Slic3r {
object->second.metadata.emplace_back(key, value);
else if (type == VOLUME_TYPE)
{
if (m_curr_config.volume_id < object->second.volumes.size())
if (size_t(m_curr_config.volume_id) < object->second.volumes.size())
object->second.volumes[m_curr_config.volume_id].metadata.emplace_back(key, value);
}
else

View File

@ -694,8 +694,8 @@ bool load_amf_file(const char *path, DynamicPrintConfig *config, Model *model)
}
int done = feof(pFile);
if (XML_Parse(parser, buff, len, done) == XML_STATUS_ERROR) {
printf("AMF parser: Parse error at line %ul:\n%s\n",
XML_GetCurrentLineNumber(parser),
printf("AMF parser: Parse error at line %d:\n%s\n",
(int)XML_GetCurrentLineNumber(parser),
XML_ErrorString(XML_GetErrorCode(parser)));
break;
}
@ -753,7 +753,7 @@ bool extract_model_from_archive(mz_zip_archive& archive, const mz_zip_archive_fi
if (!XML_ParseBuffer(parser, (int)stat.m_uncomp_size, 1))
{
printf("Error (%s) while parsing xml file at line %d\n", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser));
printf("Error (%s) while parsing xml file at line %d\n", XML_ErrorString(XML_GetErrorCode(parser)), (int)XML_GetCurrentLineNumber(parser));
close_zip_reader(&archive);
return false;
}
@ -959,7 +959,7 @@ bool store_amf(const char *path, Model *model, const DynamicPrintConfig *config)
stream << " <metadata type=\"slic3r.modifier\">1</metadata>\n";
stream << " <metadata type=\"slic3r.volume_type\">" << ModelVolume::type_to_string(volume->type()) << "</metadata>\n";
const indexed_triangle_set &its = volume->mesh().its;
for (size_t i = 0; i < (int)its.indices.size(); ++i) {
for (size_t i = 0; i < its.indices.size(); ++i) {
stream << " <triangle>\n";
for (int j = 0; j < 3; ++j)
stream << " <v" << j + 1 << ">" << its.indices[i][j] + vertices_offset << "</v" << j + 1 << ">\n";

View File

@ -176,8 +176,7 @@ static bool obj_parseline(const char *line, ObjData &data)
EATWS();
if (*line == 0)
return false;
// number of vertices of this face
int n = 0;
// current vertex to be parsed
ObjVertex vertex;
char *endptr = 0;
@ -266,7 +265,6 @@ static bool obj_parseline(const char *line, ObjData &data)
{
// o [object name]
EATWS();
const char *name = line;
while (*line != ' ' && *line != '\t' && *line != 0)
++ line;
// copy name to line.

View File

@ -316,10 +316,10 @@ std::string WipeTowerIntegration::prime(GCode &gcodegen)
std::string WipeTowerIntegration::tool_change(GCode &gcodegen, int extruder_id, bool finish_layer)
{
std::string gcode;
assert(m_layer_idx >= 0 && m_layer_idx <= m_tool_changes.size());
assert(m_layer_idx >= 0 && size_t(m_layer_idx) <= m_tool_changes.size());
if (! m_brim_done || gcodegen.writer().need_toolchange(extruder_id) || finish_layer) {
if (m_layer_idx < m_tool_changes.size()) {
assert(m_tool_change_idx < m_tool_changes[m_layer_idx].size());
if (m_layer_idx < (int)m_tool_changes.size()) {
assert(size_t(m_tool_change_idx) < m_tool_changes[m_layer_idx].size());
gcode += append_tcr(gcodegen, m_tool_changes[m_layer_idx][m_tool_change_idx++], extruder_id);
}
m_brim_done = true;
@ -1253,7 +1253,7 @@ void GCode::_print_first_layer_extruder_temperatures(FILE *file, Print &print, c
int temp = print.config().first_layer_temperature.get_at(first_printing_extruder_id);
if (temp_by_gcode >= 0 && temp_by_gcode < 1000)
temp = temp_by_gcode;
m_writer.set_temperature(temp_by_gcode, wait, first_printing_extruder_id);
m_writer.set_temperature(temp, wait, first_printing_extruder_id);
} else {
// Custom G-code does not set the extruder temperature. Do it now.
if (print.config().single_extruder_multi_material.value) {
@ -1344,11 +1344,11 @@ void GCode::process_layer(
// Check whether it is possible to apply the spiral vase logic for this layer.
// Just a reminder: A spiral vase mode is allowed for a single object, single material print only.
if (m_spiral_vase && layers.size() == 1 && support_layer == nullptr) {
bool enable = (layer.id() > 0 || print.config().brim_width.value == 0.) && (layer.id() >= print.config().skirt_height.value && ! print.has_infinite_skirt());
bool enable = (layer.id() > 0 || print.config().brim_width.value == 0.) && (layer.id() >= (size_t)print.config().skirt_height.value && ! print.has_infinite_skirt());
if (enable) {
for (const LayerRegion *layer_region : layer.regions())
if (layer_region->region()->config().bottom_solid_layers.value > layer.id() ||
layer_region->perimeters.items_count() > 1 ||
if (size_t(layer_region->region()->config().bottom_solid_layers.value) > layer.id() ||
layer_region->perimeters.items_count() > 1u ||
layer_region->fills.items_count() > 0) {
enable = false;
break;
@ -1414,11 +1414,11 @@ void GCode::process_layer(
bool extrude_skirt =
! print.skirt().entities.empty() &&
// Not enough skirt layers printed yet.
(m_skirt_done.size() < print.config().skirt_height.value || print.has_infinite_skirt()) &&
(m_skirt_done.size() < (size_t)print.config().skirt_height.value || print.has_infinite_skirt()) &&
// This print_z has not been extruded yet
(m_skirt_done.empty() ? 0. : m_skirt_done.back()) < print_z - EPSILON &&
// and this layer is the 1st layer, or it is an object layer, or it is a raft layer.
(first_layer || object_layer != nullptr || support_layer->id() < m_config.raft_layers.value);
(first_layer || object_layer != nullptr || support_layer->id() < (size_t)m_config.raft_layers.value);
std::map<unsigned int, std::pair<size_t, size_t>> skirt_loops_per_extruder;
coordf_t skirt_height = 0.;
if (extrude_skirt) {
@ -2067,19 +2067,18 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou
// Retrieve the last start position for this object.
float last_pos_weight = 1.f;
switch (seam_position) {
case spAligned:
if (seam_position == spAligned) {
// Seam is aligned to the seam at the preceding layer.
if (m_layer != NULL && m_seam_position.count(m_layer->object()) > 0) {
last_pos = m_seam_position[m_layer->object()];
last_pos_weight = 1.f;
}
break;
case spRear:
}
else if (seam_position == spRear) {
last_pos = m_layer->object()->bounding_box().center();
last_pos(1) += coord_t(3. * m_layer->object()->bounding_box().radius());
last_pos_weight = 5.f;
break;
}
// Insert a projection of last_pos into the polygon.
@ -2088,7 +2087,7 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou
Points::iterator it = project_point_to_polygon_and_insert(polygon, last_pos, 0.1 * nozzle_r);
last_pos_proj_idx = it - polygon.points.begin();
}
Point last_pos_proj = polygon.points[last_pos_proj_idx];
// Parametrize the polygon by its length.
std::vector<float> lengths = polygon_parameter_by_length(polygon);
@ -2098,7 +2097,6 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou
// No penalty for reflex points, slight penalty for convex points, high penalty for flat surfaces.
const float penaltyConvexVertex = 1.f;
const float penaltyFlatSurface = 5.f;
const float penaltySeam = 1.3f;
const float penaltyOverhangHalf = 10.f;
// Penalty for visible seams.
for (size_t i = 0; i < polygon.points.size(); ++ i) {
@ -2143,10 +2141,14 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou
// Signed distance is positive outside the object, negative inside the object.
// The point is considered at an overhang, if it is more than nozzle radius
// outside of the lower layer contour.
bool found = (*lower_layer_edge_grid)->signed_distance(p, search_r, dist);
#ifdef NDEBUG // to suppress unused variable warning in release mode
(*lower_layer_edge_grid)->signed_distance(p, search_r, dist);
#else
bool found = (*lower_layer_edge_grid)->signed_distance(p, search_r, dist);
#endif
// If the approximate Signed Distance Field was initialized over lower_layer_edge_grid,
// then the signed distnace shall always be known.
assert(found);
assert(found);
penalties[i] += extrudate_overlap_penalty(float(nozzle_r), penaltyOverhangHalf, float(dist));
}
}

View File

@ -672,7 +672,7 @@ std::string CoolingBuffer::apply_layer_cooldown(
#define EXTRUDER_CONFIG(OPT) config.OPT.get_at(m_current_extruder)
int min_fan_speed = EXTRUDER_CONFIG(min_fan_speed);
int fan_speed_new = EXTRUDER_CONFIG(fan_always_on) ? min_fan_speed : 0;
if (layer_id >= EXTRUDER_CONFIG(disable_fan_first_layers)) {
if (layer_id >= (size_t)EXTRUDER_CONFIG(disable_fan_first_layers)) {
int max_fan_speed = EXTRUDER_CONFIG(max_fan_speed);
float slowdown_below_layer_time = float(EXTRUDER_CONFIG(slowdown_below_layer_time));
float fan_below_layer_time = float(EXTRUDER_CONFIG(fan_below_layer_time));

View File

@ -404,6 +404,8 @@ std::string GCodePreviewData::get_legend_title() const
return L("Tool");
case Extrusion::ColorPrint:
return L("Color Print");
case Extrusion::Num_View_Types:
break; // just to supress warning about non-handled value
}
return "";
@ -505,6 +507,8 @@ GCodePreviewData::LegendItemsList GCodePreviewData::get_legend_items(const std::
}
break;
}
case Extrusion::Num_View_Types:
break; // just to supress warning about non-handled value
}
return items;

View File

@ -24,7 +24,7 @@ std::string SpiralVase::process_layer(const std::string &gcode)
// Get total XY length for this layer by summing all extrusion moves.
float total_layer_length = 0;
float layer_height = 0;
float z;
float z = 0.f;
bool set_z = false;
{

View File

@ -324,9 +324,8 @@ void ToolOrdering::fill_wipe_tower_partitions(const PrintConfig &config, coordf_
m_layer_tools[j].has_wipe_tower = true;
} else {
LayerTools &lt_extra = *m_layer_tools.insert(m_layer_tools.begin() + j, lt_new);
LayerTools &lt_prev = m_layer_tools[j - 1];
LayerTools &lt_next = m_layer_tools[j + 1];
assert(! lt_prev.extruders.empty() && ! lt_next.extruders.empty());
assert(! m_layer_tools[j - 1].extruders.empty() && ! lt_next.extruders.empty());
// FIXME: Following assert tripped when running combine_infill.t. I decided to comment it out for now.
// If it is a bug, it's likely not critical, because this code is unchanged for a long time. It might
// still be worth looking into it more and decide if it is a bug or an obsolete assert.
@ -495,9 +494,6 @@ float WipingExtrusions::mark_wiping_extrusions(const Print& print, unsigned int
if (!is_overriddable(*fill, print.config(), *object, region))
continue;
// What extruder would this normally be printed with?
unsigned int correct_extruder = Print::get_extruder(*fill, region);
if (volume_to_wipe<=0)
continue;

View File

@ -912,7 +912,7 @@ MedialAxis::build(ThickPolylines* polylines)
}
*/
typedef const VD::vertex_type vert_t;
//typedef const VD::vertex_type vert_t;
typedef const VD::edge_type edge_t;
// collect valid edges (i.e. prune those not belonging to MAT)

View File

@ -201,7 +201,7 @@ void LayerRegion::process_external_surfaces(const Layer* lower_layer)
size_t n_groups = 0;
for (size_t i = 0; i < bridges.size(); ++ i) {
// A grup id for this bridge.
size_t group_id = (bridge_group[i] == -1) ? (n_groups ++) : bridge_group[i];
size_t group_id = (bridge_group[i] == size_t(-1)) ? (n_groups ++) : bridge_group[i];
bridge_group[i] = group_id;
// For all possibly overlaping bridges:
for (size_t j = i + 1; j < bridges.size(); ++ j) {
@ -210,7 +210,7 @@ void LayerRegion::process_external_surfaces(const Layer* lower_layer)
if (intersection(bridges_grown[i], bridges_grown[j], false).empty())
continue;
// The two bridge regions intersect. Give them the same group id.
if (bridge_group[j] != -1) {
if (bridge_group[j] != size_t(-1)) {
// The j'th bridge has been merged with some other bridge before.
size_t group_id_new = bridge_group[j];
for (size_t k = 0; k < j; ++ k)

View File

@ -22,7 +22,6 @@ Linef3 transform(const Linef3& line, const Transform3d& t)
bool Line::intersection_infinite(const Line &other, Point* point) const
{
Vec2d a1 = this->a.cast<double>();
Vec2d a2 = other.a.cast<double>();
Vec2d v12 = (other.a - this->a).cast<double>();
Vec2d v1 = (this->b - this->a).cast<double>();
Vec2d v2 = (other.b - other.a).cast<double>();

View File

@ -332,7 +332,7 @@ Polyline MotionPlannerGraph::shortest_path(size_t node_start, size_t node_end) c
queue.pop();
map_node_to_queue_id[u] = size_t(-1);
// Stop searching if we reached our destination.
if (u == node_end)
if (size_t(u) == node_end)
break;
// Visit each edge starting at node u.
for (const Neighbor& neighbor : m_adjacency_list[u])

View File

@ -175,7 +175,7 @@ void PerimeterGenerator::process()
const PerimeterGeneratorLoop &loop = contours_d[i];
// find the contour loop that contains it
for (int t = d - 1; t >= 0; -- t) {
for (int j = 0; j < contours[t].size(); ++ j) {
for (size_t j = 0; j < contours[t].size(); ++ j) {
PerimeterGeneratorLoop &candidate_parent = contours[t][j];
if (candidate_parent.polygon.contains(loop.polygon.first_point())) {
candidate_parent.children.push_back(loop);
@ -397,7 +397,7 @@ static inline ExtrusionPaths thick_polyline_to_extrusion_paths(const ThickPolyli
pp.push_back(line.b);
width.push_back(line.b_width);
assert(pp.size() == segments + 1);
assert(pp.size() == segments + 1u);
assert(width.size() == segments*2);
}

View File

@ -521,7 +521,6 @@ namespace client
static void regex_op(expr &lhs, boost::iterator_range<Iterator> &rhs, char op)
{
const std::string *subject = nullptr;
const std::string *mask = nullptr;
if (lhs.type == TYPE_STRING) {
// One type is string, the other could be converted to string.
subject = &lhs.s();
@ -563,7 +562,6 @@ namespace client
static void ternary_op(expr &lhs, expr &rhs1, expr &rhs2)
{
bool value = false;
if (lhs.type != TYPE_BOOL)
lhs.throw_exception("Not a boolean expression");
if (lhs.b())
@ -975,7 +973,7 @@ namespace client
// depending on the context->just_boolean_expression flag. This way a single static expression parser
// could serve both purposes.
start = eps[px::bind(&MyContext::evaluate_full_macro, _r1, _a)] >
( eps(_a==true) > text_block(_r1) [_val=_1]
( (eps(_a==true) > text_block(_r1) [_val=_1])
| conditional_expression(_r1) [ px::bind(&expr<Iterator>::evaluate_boolean_to_string, _1, _val) ]
) > eoi;
start.name("start");
@ -1245,7 +1243,7 @@ static std::string process_macro(const std::string &templ, client::MyContext &co
std::string::const_iterator end = templ.end();
// Accumulator for the processed template.
std::string output;
bool res = phrase_parse(iter, end, macro_processor_instance(&context), space, output);
phrase_parse(iter, end, macro_processor_instance(&context), space, output);
if (!context.error_message.empty()) {
if (context.error_message.back() != '\n' && context.error_message.back() != '\r')
context.error_message += '\n';

View File

@ -61,7 +61,7 @@ Polylines PolylineCollection::_chained_path_from(
while (! endpoints.empty()) {
// find nearest point
int endpoint_index = nearest_point_index<double>(endpoints, start_near, no_reverse);
assert(endpoint_index >= 0 && endpoint_index < endpoints.size() * 2);
assert(endpoint_index >= 0 && size_t(endpoint_index) < endpoints.size() * 2);
if (move_from_src) {
retval.push_back(std::move(src[endpoints[endpoint_index/2].idx]));
} else {

View File

@ -18,7 +18,7 @@
#include <boost/filesystem/path.hpp>
#include <boost/log/trivial.hpp>
//! macro used to mark string used at localization,
//! macro used to mark string used at localization,
//! return same string
#define L(s) Slic3r::I18N::translate(s)
@ -1116,7 +1116,7 @@ Print::ApplyStatus Print::apply(const Model &model, const DynamicPrintConfig &co
region_id = map_volume_to_region[volume_id];
// Assign volume to a region.
if (fresh) {
if (region_id >= print_object.region_volumes.size() || print_object.region_volumes[region_id].empty())
if ((size_t)region_id >= print_object.region_volumes.size() || print_object.region_volumes[region_id].empty())
++ m_regions[region_id]->m_refcnt;
print_object.add_region_volume(region_id, volume_id);
}
@ -1259,11 +1259,10 @@ std::string Print::validate() const
if (has_custom_layering) {
const std::vector<coordf_t> &layer_height_profile_tallest = layer_height_profiles[tallest_object_idx];
for (size_t idx_object = 0; idx_object < m_objects.size(); ++ idx_object) {
const PrintObject *object = m_objects[idx_object];
const std::vector<coordf_t> &layer_height_profile = layer_height_profiles[idx_object];
bool failed = false;
if (layer_height_profile_tallest.size() >= layer_height_profile.size()) {
int i = 0;
size_t i = 0;
while (i < layer_height_profile.size() && i < layer_height_profile_tallest.size()) {
if (std::abs(layer_height_profile_tallest[i] - layer_height_profile[i])) {
failed = true;
@ -1628,7 +1627,7 @@ void Print::_make_skirt()
}
// Number of skirt loops per skirt layer.
int n_skirts = m_config.skirts.value;
size_t n_skirts = m_config.skirts.value;
if (this->has_infinite_skirt() && n_skirts == 0)
n_skirts = 1;
@ -1640,7 +1639,7 @@ void Print::_make_skirt()
// Draw outlines from outside to inside.
// Loop while we have less skirts than required or any extruder hasn't reached the min length if any.
std::vector<coordf_t> extruded_length(extruders.size(), 0.);
for (int i = n_skirts, extruder_idx = 0; i > 0; -- i) {
for (size_t i = n_skirts, extruder_idx = 0; i > 0; -- i) {
this->throw_if_canceled();
// Offset the skirt outside.
distance += coord_t(scale_(spacing));

View File

@ -120,7 +120,7 @@ public:
void clear_support_layers();
SupportLayer* get_support_layer(int idx) { return m_support_layers[idx]; }
SupportLayer* add_support_layer(int id, coordf_t height, coordf_t print_z);
SupportLayerPtrs::const_iterator insert_support_layer(SupportLayerPtrs::const_iterator pos, int id, coordf_t height, coordf_t print_z, coordf_t slice_z);
SupportLayerPtrs::const_iterator insert_support_layer(SupportLayerPtrs::const_iterator pos, size_t id, coordf_t height, coordf_t print_z, coordf_t slice_z);
void delete_support_layer(int idx);
// Initialize the layer_height_profile from the model_object's layer_height_profile, from model_object's layer height table, or from slicing parameters.

View File

@ -36,7 +36,6 @@ PrintConfigDef::PrintConfigDef()
void PrintConfigDef::init_common_params()
{
t_optiondef_map &Options = this->options;
ConfigOptionDef* def;
def = this->add("printer_technology", coEnum);
@ -102,7 +101,6 @@ void PrintConfigDef::init_common_params()
void PrintConfigDef::init_fff_params()
{
t_optiondef_map &Options = this->options;
ConfigOptionDef* def;
// Maximum extruder temperature, bumped to 1500 to support printing of glass.
@ -1085,16 +1083,16 @@ void PrintConfigDef::init_fff_params()
// Add the machine feedrate limits for XYZE axes. (M203)
def = this->add("machine_max_feedrate_" + axis.name, coFloats);
def->full_label = (boost::format("Maximum feedrate %1%") % axis_upper).str();
L("Maximum feedrate X");
L("Maximum feedrate Y");
L("Maximum feedrate Z");
L("Maximum feedrate E");
(void)L("Maximum feedrate X");
(void)L("Maximum feedrate Y");
(void)L("Maximum feedrate Z");
(void)L("Maximum feedrate E");
def->category = L("Machine limits");
def->tooltip = (boost::format("Maximum feedrate of the %1% axis") % axis_upper).str();
L("Maximum feedrate of the X axis");
L("Maximum feedrate of the Y axis");
L("Maximum feedrate of the Z axis");
L("Maximum feedrate of the E axis");
(void)L("Maximum feedrate of the X axis");
(void)L("Maximum feedrate of the Y axis");
(void)L("Maximum feedrate of the Z axis");
(void)L("Maximum feedrate of the E axis");
def->sidetext = L("mm/s");
def->min = 0;
def->width = machine_limits_opt_width;
@ -1103,16 +1101,16 @@ void PrintConfigDef::init_fff_params()
// Add the machine acceleration limits for XYZE axes (M201)
def = this->add("machine_max_acceleration_" + axis.name, coFloats);
def->full_label = (boost::format("Maximum acceleration %1%") % axis_upper).str();
L("Maximum acceleration X");
L("Maximum acceleration Y");
L("Maximum acceleration Z");
L("Maximum acceleration E");
(void)L("Maximum acceleration X");
(void)L("Maximum acceleration Y");
(void)L("Maximum acceleration Z");
(void)L("Maximum acceleration E");
def->category = L("Machine limits");
def->tooltip = (boost::format("Maximum acceleration of the %1% axis") % axis_upper).str();
L("Maximum acceleration of the X axis");
L("Maximum acceleration of the Y axis");
L("Maximum acceleration of the Z axis");
L("Maximum acceleration of the E axis");
(void)L("Maximum acceleration of the X axis");
(void)L("Maximum acceleration of the Y axis");
(void)L("Maximum acceleration of the Z axis");
(void)L("Maximum acceleration of the E axis");
def->sidetext = L("mm/s²");
def->min = 0;
def->width = machine_limits_opt_width;
@ -1121,16 +1119,16 @@ void PrintConfigDef::init_fff_params()
// Add the machine jerk limits for XYZE axes (M205)
def = this->add("machine_max_jerk_" + axis.name, coFloats);
def->full_label = (boost::format("Maximum jerk %1%") % axis_upper).str();
L("Maximum jerk X");
L("Maximum jerk Y");
L("Maximum jerk Z");
L("Maximum jerk E");
(void)L("Maximum jerk X");
(void)L("Maximum jerk Y");
(void)L("Maximum jerk Z");
(void)L("Maximum jerk E");
def->category = L("Machine limits");
def->tooltip = (boost::format("Maximum jerk of the %1% axis") % axis_upper).str();
L("Maximum jerk of the X axis");
L("Maximum jerk of the Y axis");
L("Maximum jerk of the Z axis");
L("Maximum jerk of the E axis");
(void)L("Maximum jerk of the X axis");
(void)L("Maximum jerk of the Y axis");
(void)L("Maximum jerk of the Z axis");
(void)L("Maximum jerk of the E axis");
def->sidetext = L("mm/s");
def->min = 0;
def->width = machine_limits_opt_width;
@ -2228,7 +2226,6 @@ void PrintConfigDef::init_fff_params()
void PrintConfigDef::init_sla_params()
{
t_optiondef_map &Options = this->options;
ConfigOptionDef* def;
// SLA Printer settings

View File

@ -18,7 +18,7 @@
#include <Shiny/Shiny.h>
//! macro used to mark string used at localization,
//! macro used to mark string used at localization,
//! return same string
#define L(s) Slic3r::I18N::translate(s)
@ -430,7 +430,7 @@ SupportLayer* PrintObject::add_support_layer(int id, coordf_t height, coordf_t p
return m_support_layers.back();
}
SupportLayerPtrs::const_iterator PrintObject::insert_support_layer(SupportLayerPtrs::const_iterator pos, int id, coordf_t height, coordf_t print_z, coordf_t slice_z)
SupportLayerPtrs::const_iterator PrintObject::insert_support_layer(SupportLayerPtrs::const_iterator pos, size_t id, coordf_t height, coordf_t print_z, coordf_t slice_z)
{
return m_support_layers.insert(pos, new SupportLayer(id, this, height, print_z, slice_z));
}
@ -620,7 +620,7 @@ void PrintObject::detect_surfaces_type()
// should be visible.
bool interface_shells = m_config.interface_shells.value;
for (int idx_region = 0; idx_region < this->region_volumes.size(); ++ idx_region) {
for (size_t idx_region = 0; idx_region < this->region_volumes.size(); ++ idx_region) {
BOOST_LOG_TRIVIAL(debug) << "Detecting solid surfaces for region " << idx_region << " in parallel - start";
#ifdef SLIC3R_DEBUG_SLICE_PROCESSING
for (Layer *layer : m_layers)
@ -806,8 +806,6 @@ void PrintObject::process_external_surfaces()
BOOST_LOG_TRIVIAL(info) << "Processing external surfaces..." << log_memory_info();
for (size_t region_id = 0; region_id < this->region_volumes.size(); ++region_id) {
const PrintRegion &region = *m_print->regions()[region_id];
BOOST_LOG_TRIVIAL(debug) << "Processing external surfaces for region " << region_id << " in parallel - start";
tbb::parallel_for(
tbb::blocked_range<size_t>(0, m_layers.size()),
@ -1028,7 +1026,6 @@ void PrintObject::discover_vertical_shells()
bool hole_first = true;
for (int n = (int)idx_layer - n_extra_bottom_layers; n <= (int)idx_layer + n_extra_top_layers; ++ n)
if (n >= 0 && n < (int)m_layers.size()) {
Layer &neighbor_layer = *m_layers[n];
const DiscoverVerticalShellsCacheEntry &cache = cache_top_botom_regions[n];
if (hole_first) {
hole_first = false;
@ -2154,7 +2151,7 @@ void PrintObject::discover_horizontal_shells()
BOOST_LOG_TRIVIAL(trace) << "discover_horizontal_shells()";
for (size_t region_id = 0; region_id < this->region_volumes.size(); ++ region_id) {
for (int i = 0; i < int(m_layers.size()); ++ i) {
for (size_t i = 0; i < m_layers.size(); ++ i) {
m_print->throw_if_canceled();
LayerRegion *layerm = m_layers[i]->regions()[region_id];
const PrintRegionConfig &region_config = layerm->region()->config();
@ -2171,7 +2168,7 @@ void PrintObject::discover_horizontal_shells()
if (region_config.ensure_vertical_shell_thickness.value)
continue;
for (int idx_surface_type = 0; idx_surface_type < 3; ++ idx_surface_type) {
for (size_t idx_surface_type = 0; idx_surface_type < 3; ++ idx_surface_type) {
m_print->throw_if_canceled();
SurfaceType type = (idx_surface_type == 0) ? stTop : (idx_surface_type == 1) ? stBottom : stBottomBridge;
// Find slices of current type for current layer.
@ -2345,7 +2342,7 @@ void PrintObject::combine_infill()
// Work on each region separately.
for (size_t region_id = 0; region_id < this->region_volumes.size(); ++ region_id) {
const PrintRegion *region = this->print()->regions()[region_id];
const int every = region->config().infill_every_layers.value;
const size_t every = region->config().infill_every_layers.value;
if (every < 2 || region->config().fill_density == 0.)
continue;
// Limit the number of combined layers to the maximum height allowed by this regions' nozzle.

View File

@ -59,8 +59,6 @@ SLAAutoSupports::SLAAutoSupports(const TriangleMesh& mesh, const sla::EigenMesh3
void SLAAutoSupports::project_onto_mesh(std::vector<sla::SupportPoint>& points) const
{
// The function makes sure that all the points are really exactly placed on the mesh.
igl::Hit hit_up{0, 0, 0.f, 0.f, 0.f};
igl::Hit hit_down{0, 0, 0.f, 0.f, 0.f};
// Use a reasonable granularity to account for the worker thread synchronization cost.
tbb::parallel_for(tbb::blocked_range<size_t>(0, points.size(), 64),
@ -140,7 +138,6 @@ static std::vector<SLAAutoSupports::MyLayer> make_layers(
SLAAutoSupports::MyLayer &layer_above = layers[layer_id];
SLAAutoSupports::MyLayer &layer_below = layers[layer_id - 1];
//FIXME WTF?
const float height = (layer_id>2 ? heights[layer_id-3] : heights[0]-(heights[1]-heights[0]));
const float layer_height = (layer_id!=0 ? heights[layer_id]-heights[layer_id-1] : heights[0]);
const float safe_angle = 5.f * (float(M_PI)/180.f); // smaller number - less supports
const float between_layers_offset = float(scale_(layer_height / std::tan(safe_angle)));
@ -212,7 +209,7 @@ void SLAAutoSupports::process(const std::vector<ExPolygons>& slices, const std::
for (Structure &top : layer_top->islands)
for (Structure::Link &bottom_link : top.islands_below) {
Structure &bottom = *bottom_link.island;
float centroids_dist = (bottom.centroid - top.centroid).norm();
//float centroids_dist = (bottom.centroid - top.centroid).norm();
// Penalization resulting from centroid offset:
// bottom.supports_force *= std::min(1.f, 1.f - std::min(1.f, (1600.f * layer_height) * centroids_dist * centroids_dist / bottom.area));
float &support_force = support_force_bottom[&bottom - layer_bottom->islands.data()];
@ -239,7 +236,7 @@ void SLAAutoSupports::process(const std::vector<ExPolygons>& slices, const std::
// s.supports_force_inherited /= std::max(1.f, (layer_height / 0.3f) * e_area / s.area);
s.supports_force_inherited /= std::max(1.f, 0.17f * (s.overhangs_area) / s.area);
float force_deficit = s.support_force_deficit(m_config.tear_pressure());
//float force_deficit = s.support_force_deficit(m_config.tear_pressure());
if (s.islands_below.empty()) { // completely new island - needs support no doubt
uniformly_cover({ *s.polygon }, s, point_grid, true);
} else if (! s.dangling_areas.empty()) {
@ -380,7 +377,7 @@ static inline std::vector<Vec2f> poisson_disk_from_samples(const std::vector<Vec
{
typename Cells::iterator last_cell_id_it;
Vec2i last_cell_id(-1, -1);
for (int i = 0; i < raw_samples_sorted.size(); ++ i) {
for (size_t i = 0; i < raw_samples_sorted.size(); ++ i) {
const RawSample &sample = raw_samples_sorted[i];
if (sample.cell_id == last_cell_id) {
// This sample is in the same cell as the previous, so just increase the count. Cells are

View File

@ -441,12 +441,10 @@ SLAPrint::ApplyStatus SLAPrint::apply(const Model &model, const DynamicPrintConf
update_apply_status(this->invalidate_all_steps());
m_objects = print_objects_new;
// Delete the PrintObjects marked as Unknown or Deleted.
bool deleted_objects = false;
for (auto &pos : print_object_status)
if (pos.status == PrintObjectStatus::Unknown || pos.status == PrintObjectStatus::Deleted) {
update_apply_status(pos.print_object->invalidate_all_steps());
delete pos.print_object;
deleted_objects = true;
}
if (new_objects)
update_apply_status(false);

View File

@ -187,7 +187,6 @@ std::vector<coordf_t> layer_height_profile_from_ranges(
coordf_t hi = it_range->first.second;
coordf_t height = it_range->second;
coordf_t last_z = layer_height_profile.empty() ? 0. : layer_height_profile[layer_height_profile.size() - 2];
coordf_t last_height = layer_height_profile.empty() ? 0. : layer_height_profile[layer_height_profile.size() - 1];
if (lo > last_z + EPSILON) {
// Insert a step of normal layer height.
layer_height_profile.push_back(last_z);
@ -203,7 +202,6 @@ std::vector<coordf_t> layer_height_profile_from_ranges(
}
coordf_t last_z = layer_height_profile.empty() ? 0. : layer_height_profile[layer_height_profile.size() - 2];
coordf_t last_height = layer_height_profile.empty() ? 0. : layer_height_profile[layer_height_profile.size() - 1];
if (last_z < slicing_params.object_print_z_height()) {
// Insert a step of normal layer height up to the object top.
layer_height_profile.push_back(last_z);
@ -245,7 +243,6 @@ std::vector<coordf_t> layer_height_profile_adaptive(
}
coordf_t slice_z = slicing_params.first_object_layer_height;
coordf_t height = slicing_params.first_object_layer_height;
coordf_t cusp_height = 0.;
int current_facet = 0;
while ((slice_z - height) <= slicing_params.object_print_z_height()) {
height = 999;
@ -401,7 +398,6 @@ void adjust_layer_height_profile(
}
// Adjust height by layer_thickness_delta.
coordf_t weight = std::abs(zz - z) < 0.5 * band_width ? (0.5 + 0.5 * cos(2. * M_PI * (zz - z) / band_width)) : 0.;
coordf_t height_new = height;
switch (action) {
case LAYER_HEIGHT_EDIT_ACTION_INCREASE:
case LAYER_HEIGHT_EDIT_ACTION_DECREASE:

View File

@ -361,17 +361,17 @@ void PrintObjectSupportMaterial::generate(PrintObject &object)
std::sort(layers_sorted.begin(), layers_sorted.end(), MyLayersPtrCompare());
int layer_id = 0;
assert(object.support_layers().empty());
for (int i = 0; i < int(layers_sorted.size());) {
for (size_t i = 0; i < layers_sorted.size();) {
// Find the last layer with roughly the same print_z, find the minimum layer height of all.
// Due to the floating point inaccuracies, the print_z may not be the same even if in theory they should.
int j = i + 1;
size_t j = i + 1;
coordf_t zmax = layers_sorted[i]->print_z + EPSILON;
for (; j < layers_sorted.size() && layers_sorted[j]->print_z <= zmax; ++j) ;
// Assign an average print_z to the set of layers with nearly equal print_z.
coordf_t zavg = 0.5 * (layers_sorted[i]->print_z + layers_sorted[j - 1]->print_z);
coordf_t height_min = layers_sorted[i]->height;
bool empty = true;
for (int u = i; u < j; ++u) {
for (size_t u = i; u < j; ++u) {
MyLayer &layer = *layers_sorted[u];
if (! layer.polygons.empty())
empty = false;
@ -1042,7 +1042,7 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
float fw = float(layerm->flow(frExternalPerimeter).scaled_width());
no_interface_offset = (no_interface_offset == 0.f) ? fw : std::min(no_interface_offset, fw);
float lower_layer_offset =
(layer_id < m_object_config->support_material_enforce_layers.value) ?
(layer_id < (size_t)m_object_config->support_material_enforce_layers.value) ?
// Enforce a full possible support, ignore the overhang angle.
0.f :
(threshold_rad > 0. ?
@ -1352,7 +1352,7 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
{
// Find the span of layers, which are to be printed at the first layer height.
int j = 0;
for (; j < contact_out.size() && contact_out[j]->print_z < m_slicing_params.first_print_layer_height + this->m_support_layer_height_min - EPSILON; ++ j);
for (; j < (int)contact_out.size() && contact_out[j]->print_z < m_slicing_params.first_print_layer_height + this->m_support_layer_height_min - EPSILON; ++ j);
if (j > 0) {
// Merge the contact_out layers (0) to (j - 1) into the contact_out[0].
MyLayer &dst = *contact_out.front();
@ -1377,7 +1377,7 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
// Find the span of layers closer than m_support_layer_height_min.
int j = i + 1;
coordf_t zmax = contact_out[i]->print_z + m_support_layer_height_min + EPSILON;
for (; j < contact_out.size() && contact_out[j]->print_z < zmax; ++ j) ;
for (; j < (int)contact_out.size() && contact_out[j]->print_z < zmax; ++ j) ;
if (i + 1 < j) {
// Merge the contact_out layers (i + 1) to (j - 1) into the contact_out[i].
MyLayer &dst = *contact_out[i];
@ -1395,7 +1395,7 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
contact_out[k] = contact_out[i];
i = j;
}
if (k < contact_out.size())
if (k < (int)contact_out.size())
contact_out.erase(contact_out.begin() + k, contact_out.end());
}
@ -2566,11 +2566,11 @@ void LoopInterfaceProcessor::generate(MyLayerExtruded &top_contact_layer, const
{
// make more loops
Polygons loop_polygons = loops0;
for (size_t i = 1; i < n_contact_loops; ++ i)
for (int i = 1; i < n_contact_loops; ++ i)
polygons_append(loop_polygons,
offset2(
loops0,
- int(i) * flow.scaled_spacing() - 0.5f * flow.scaled_spacing(),
- i * flow.scaled_spacing() - 0.5f * flow.scaled_spacing(),
0.5f * flow.scaled_spacing()));
// Clip such loops to the side oriented towards the object.
// Collect split points, so they will be recognized after the clipping.

View File

@ -414,13 +414,13 @@ std::string format_memsize_MB(size_t n)
scale *= 1000;
}
char buf[8];
sprintf(buf, "%d", n);
sprintf(buf, "%d", (int)n);
out = buf;
while (scale != 1) {
scale /= 1000;
n = n2 / scale;
n2 = n2 % scale;
sprintf(buf, ",%03d", n);
sprintf(buf, ",%03d", (int)n);
out += buf;
}
return out + "MB";