Fixing Clang warnings 3

This commit is contained in:
Lukas Matena 2021-01-29 18:08:04 +01:00
parent b85de89751
commit 1834ebe981
21 changed files with 25 additions and 29 deletions

View file

@ -395,7 +395,7 @@ std::vector<std::string> AppConfig::get_mouse_device_names() const
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)
for (const auto& key_value_pair : m_storage)
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;

View file

@ -1358,11 +1358,11 @@ public:
// Initialize the map.
const t_config_enum_values &enum_keys_map = ConfigOptionEnum<T>::get_enum_values();
int cnt = 0;
for (const std::pair<std::string, int> &kvp : enum_keys_map)
for (const auto& kvp : enum_keys_map)
cnt = std::max(cnt, kvp.second);
cnt += 1;
names.assign(cnt, "");
for (const std::pair<std::string, int> &kvp : enum_keys_map)
for (const auto& kvp : enum_keys_map)
names[kvp.second] = kvp.first;
}
return names;

View file

@ -124,7 +124,6 @@ const char* VALID_OBJECT_TYPES[] =
"model"
};
const unsigned int INVALID_OBJECT_TYPES_COUNT = 4;
const char* INVALID_OBJECT_TYPES[] =
{
"solidsupport",

View file

@ -851,7 +851,7 @@ namespace DoExport {
double extruded_volume = extruder.extruded_volume() + (has_wipe_tower ? wipe_tower_data.used_filament[extruder.id()] * 2.4052f : 0.f); // assumes 1.75mm filament diameter
double filament_weight = extruded_volume * extruder.filament_density() * 0.001;
double filament_cost = filament_weight * extruder.filament_cost() * 0.001;
auto append = [&extruder, &extruders](std::pair<std::string, unsigned int> &dst, const char *tmpl, double value) {
auto append = [&extruder](std::pair<std::string, unsigned int> &dst, const char *tmpl, double value) {
while (dst.second < extruder.id()) {
// Fill in the non-printing extruders with zeros.
dst.first += (dst.second > 0) ? ", 0" : "0";

View file

@ -664,7 +664,7 @@ static std::vector<size_t> find_enforcer_centers(const Polygon& polygon,
if (polygon.size() < 2 || enforcers_idxs.empty())
return out;
auto get_center_idx = [&polygon, &lengths](size_t start_idx, size_t end_idx) -> size_t {
auto get_center_idx = [&lengths](size_t start_idx, size_t end_idx) -> size_t {
assert(end_idx >= start_idx);
if (start_idx == end_idx)
return start_idx;

View file

@ -915,7 +915,7 @@ void PresetBundle::load_config_file_config_bundle(const std::string &path, const
std::string bundle_name = std::string(" - ") + boost::filesystem::path(path).filename().string();
// 2) Extract active configs from the config bundle, copy them and activate them in this bundle.
auto load_one = [this, &path, &bundle_name](PresetCollection &collection_dst, PresetCollection &collection_src, const std::string &preset_name_src, bool activate) -> std::string {
auto load_one = [&path, &bundle_name](PresetCollection &collection_dst, PresetCollection &collection_src, const std::string &preset_name_src, bool activate) -> std::string {
Preset *preset_src = collection_src.find_preset(preset_name_src, false);
Preset *preset_dst = collection_dst.find_preset(preset_name_src, false);
assert(preset_src != nullptr);

View file

@ -1405,7 +1405,7 @@ std::string Print::validate() const
return L("One or more object were assigned an extruder that the printer does not have.");
#endif
auto validate_extrusion_width = [min_nozzle_diameter, max_nozzle_diameter](const ConfigBase &config, const char *opt_key, double layer_height, std::string &err_msg) -> bool {
auto validate_extrusion_width = [/*min_nozzle_diameter,*/ max_nozzle_diameter](const ConfigBase &config, const char *opt_key, double layer_height, std::string &err_msg) -> bool {
// This may change in the future, if we switch to "extrusion width wrt. nozzle diameter"
// instead of currently used logic "extrusion width wrt. layer height", see GH issues #1923 #2829.
// double extrusion_width_min = config.get_abs_value(opt_key, min_nozzle_diameter);

View file

@ -908,7 +908,7 @@ void PrintObject::detect_surfaces_type()
// Fill in layerm->fill_surfaces by trimming the layerm->slices by the cummulative layerm->fill_surfaces.
tbb::parallel_for(
tbb::blocked_range<size_t>(0, m_layers.size()),
[this, idx_region, interface_shells](const tbb::blocked_range<size_t>& range) {
[this, idx_region](const tbb::blocked_range<size_t>& range) {
for (size_t idx_layer = range.begin(); idx_layer < range.end(); ++ idx_layer) {
m_print->throw_if_canceled();
LayerRegion *layerm = m_layers[idx_layer]->m_regions[idx_region];

View file

@ -55,8 +55,6 @@ public:
}
};
static const constexpr double MESH_EPS = 1e-6;
IndexedMesh::IndexedMesh(const TriangleMesh& tmesh)
: m_aabb(new AABBImpl()), m_tm(&tmesh)
{

View file

@ -1423,7 +1423,7 @@ static inline void do_crossover(const std::vector<FlipEdge> &edges_in, std::vect
const std::pair<size_t, size_t> &span2, bool reversed2, bool flipped2,
const std::pair<size_t, size_t> &span3, bool reversed3, bool flipped3) {
auto it_edges_out = edges_out.begin();
auto copy_span = [&edges_in, &edges_out, &it_edges_out](std::pair<size_t, size_t> span, bool reversed, bool flipped) {
auto copy_span = [&edges_in, &it_edges_out](std::pair<size_t, size_t> span, bool reversed, bool flipped) {
assert(span.first < span.second);
auto it = it_edges_out;
if (reversed)
@ -1466,7 +1466,7 @@ static inline void do_crossover(const std::vector<FlipEdge> &edges_in, std::vect
const std::pair<size_t, size_t> &span3, bool reversed3, bool flipped3,
const std::pair<size_t, size_t> &span4, bool reversed4, bool flipped4) {
auto it_edges_out = edges_out.begin();
auto copy_span = [&edges_in, &edges_out, &it_edges_out](std::pair<size_t, size_t> span, bool reversed, bool flipped) {
auto copy_span = [&edges_in, &it_edges_out](std::pair<size_t, size_t> span, bool reversed, bool flipped) {
assert(span.first < span.second);
auto it = it_edges_out;
if (reversed)