Skip to content

Commit

Permalink
Prevent implicit unsigned to signed conversions (#2149)
Browse files Browse the repository at this point in the history
  • Loading branch information
HellAholic authored Oct 18, 2024
2 parents 13a4f07 + 5cedf86 commit dabbdac
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/FffGcodeWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ void FffGcodeWriter::writeGCode(SliceDataStorage& storage, TimeKeeper& time_keep
{
if (extruder_is_used_in_filler_layers)
{
process_layer_starting_layer_nr = -Raft::getFillerLayerCount();
process_layer_starting_layer_nr = -static_cast<int>(Raft::getFillerLayerCount());
break;
}
}
Expand Down Expand Up @@ -2860,7 +2860,7 @@ size_t FffGcodeWriter::findUsedExtruderIndex(const SliceDataStorage& storage, co
{
return last ? extruder_use.back().extruder_nr : extruder_use.front().extruder_nr;
}
else if (layer_nr <= -Raft::getTotalExtraLayers())
else if (layer_nr <= -LayerIndex(Raft::getTotalExtraLayers()))
{
// Asking for extruder use below first layer, give first extruder
return getStartExtruder(storage);
Expand Down
2 changes: 1 addition & 1 deletion src/PrimeTower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ const Shape& PrimeTower::getOuterPoly(const LayerIndex& layer_nr) const

const Shape& PrimeTower::getGroundPoly() const
{
return getOuterPoly(-Raft::getTotalExtraLayers());
return getOuterPoly(-LayerIndex(Raft::getTotalExtraLayers()));
}

void PrimeTower::gotoStartLocation(LayerPlan& gcode_layer, const int extruder_nr) const
Expand Down
2 changes: 1 addition & 1 deletion src/PrimeTower/PrimeTower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ bool PrimeTower::extruderRequiresPrime(const std::vector<bool>& extruder_is_used
void PrimeTower::gotoStartLocation(LayerPlan& gcode_layer, const size_t extruder_nr) const
{
LayerIndex layer_nr = gcode_layer.getLayerNr();
if (layer_nr != -Raft::getTotalExtraLayers())
if (layer_nr != -LayerIndex(Raft::getTotalExtraLayers()))
{
coord_t wipe_radius;
auto iterator = base_occupied_outline_.iterator_at(gcode_layer.getLayerNr());
Expand Down
13 changes: 5 additions & 8 deletions src/raft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,26 +199,23 @@ Raft::LayerType Raft::getLayerType(LayerIndex layer_index)
const auto interface_layers = Raft::getInterfaceLayers();
const auto surface_layers = Raft::getSurfaceLayers();

if (layer_index < -airgap - surface_layers - interface_layers)
if (layer_index < -LayerIndex(airgap + surface_layers + interface_layers))
{
return LayerType::RaftBase;
}
else if (layer_index < -airgap - surface_layers)
if (layer_index < -LayerIndex(airgap + surface_layers))
{
return LayerType::RaftInterface;
}
else if (layer_index < -airgap)
if (layer_index < -LayerIndex(airgap))
{
return LayerType::RaftSurface;
}
else if (layer_index < 0)
if (layer_index < LayerIndex(0))
{
return LayerType::Airgap;
}
else
{
return LayerType::Model;
}
return LayerType::Model;
}

size_t Raft::getLayersAmount(const std::string& extruder_nr_setting_name, const std::string& target_raft_section)
Expand Down

0 comments on commit dabbdac

Please sign in to comment.