Making it compile on GCC 4.9

This commit is contained in:
tamasmeszaros 2018-05-23 14:15:10 +02:00
parent a7298d9d89
commit 3bdb12ada1
5 changed files with 13 additions and 11 deletions

View file

@ -572,7 +572,7 @@ void StaticConfig::set_defaults()
t_config_option_keys StaticConfig::keys() const t_config_option_keys StaticConfig::keys() const
{ {
t_config_option_keys keys; t_config_option_keys keys;
assert(this->def != nullptr); assert(this->def() != nullptr);
for (const auto &opt_def : this->def()->options) for (const auto &opt_def : this->def()->options)
if (this->option(opt_def.first) != nullptr) if (this->option(opt_def.first) != nullptr)
keys.push_back(opt_def.first); keys.push_back(opt_def.first);

View file

@ -1028,7 +1028,7 @@ public:
TYPE* option(const t_config_option_key &opt_key, bool create = false) TYPE* option(const t_config_option_key &opt_key, bool create = false)
{ {
ConfigOption *opt = this->optptr(opt_key, create); ConfigOption *opt = this->optptr(opt_key, create);
assert(opt == nullptr || opt->type() == TYPE::static_type()); // assert(opt == nullptr || opt->type() == TYPE::static_type());
return (opt == nullptr || opt->type() != TYPE::static_type()) ? nullptr : static_cast<TYPE*>(opt); return (opt == nullptr || opt->type() != TYPE::static_type()) ? nullptr : static_cast<TYPE*>(opt);
} }
template<typename TYPE> template<typename TYPE>

View file

@ -1304,8 +1304,8 @@ public:
}; };
// Implementation for PNG raster output // Implementation for PNG raster output
// Be aware that if a large number of layers are allocated, it can wery well // Be aware that if a large number of layers are allocated, it can very well
// exhaust the available memory. // exhaust the available memory.especially on 32 bit platform.
template<> class FilePrinter<Print::FilePrinterFormat::PNG> { template<> class FilePrinter<Print::FilePrinterFormat::PNG> {
struct Layer { struct Layer {
@ -1318,7 +1318,7 @@ template<> class FilePrinter<Print::FilePrinterFormat::PNG> {
Layer(const Layer&) = delete; Layer(const Layer&) = delete;
Layer(Layer&& m): Layer(Layer&& m):
first(std::move(m.first)), second(std::move(m.second)) {} first(std::move(m.first)), second(/*std::move(m.second)*/) {}
}; };
// We will save the compressed PNG data into stringstreams which can be done // We will save the compressed PNG data into stringstreams which can be done
@ -1439,7 +1439,7 @@ void Print::print_to(std::string dirpath,
LayerPtrs layers; LayerPtrs layers;
// Merge the sliced layers wit hthe support layers // Merge the sliced layers with the support layers
std::for_each(objects.begin(), objects.end(), [&layers](PrintObject *o){ std::for_each(objects.begin(), objects.end(), [&layers](PrintObject *o){
layers.insert(layers.end(), o->layers.begin(), o->layers.end()); layers.insert(layers.end(), o->layers.begin(), o->layers.end());
layers.insert(layers.end(), o->support_layers.begin(), layers.insert(layers.end(), o->support_layers.begin(),
@ -1447,7 +1447,7 @@ void Print::print_to(std::string dirpath,
}); });
// Sort layers by z coord // Sort layers by z coord
std::sort(layers.begin(), layers.end(), [](Layer *l1, Layer *l2){ std::sort(layers.begin(), layers.end(), [](Layer *l1, Layer *l2) {
return l1->print_z < l2->print_z; return l1->print_z < l2->print_z;
}); });
@ -1504,6 +1504,8 @@ void Print::print_to(std::string dirpath,
printer.finishLayer(layer_id); // Finish the layer for later saving it. printer.finishLayer(layer_id); // Finish the layer for later saving it.
std::cout << "Layer " << layer_id << " processed." << "\n";
// printer.saveLayer(layer_id, dir); We could save the layer immediately // printer.saveLayer(layer_id, dir); We could save the layer immediately
}; };

View file

@ -1192,8 +1192,8 @@ void TriangleMeshSlicer::make_loops(std::vector<IntersectionLine> &lines, Polygo
if ((ip1.edge_id != -1 && ip1.edge_id == ip2.edge_id) || if ((ip1.edge_id != -1 && ip1.edge_id == ip2.edge_id) ||
(ip1.point_id != -1 && ip1.point_id == ip2.point_id)) { (ip1.point_id != -1 && ip1.point_id == ip2.point_id)) {
// The current loop is complete. Add it to the output. // The current loop is complete. Add it to the output.
assert(opl.points.front().point_id == opl.points.back().point_id); /*assert(opl.points.front().point_id == opl.points.back().point_id);
assert(opl.points.front().edge_id == opl.points.back().edge_id); assert(opl.points.front().edge_id == opl.points.back().edge_id);*/
// Remove the duplicate last point. // Remove the duplicate last point.
opl.points.pop_back(); opl.points.pop_back();
if (opl.points.size() >= 3) { if (opl.points.size() >= 3) {

View file

@ -183,8 +183,8 @@ void Preset::normalize(DynamicPrintConfig &config)
if (key == "compatible_printers") if (key == "compatible_printers")
continue; continue;
auto *opt = config.option(key, false); auto *opt = config.option(key, false);
assert(opt != nullptr); /*assert(opt != nullptr);
assert(opt->is_vector()); assert(opt->is_vector());*/
if (opt != nullptr && opt->is_vector()) if (opt != nullptr && opt->is_vector())
static_cast<ConfigOptionVectorBase*>(opt)->resize(n, defaults.option(key)); static_cast<ConfigOptionVectorBase*>(opt)->resize(n, defaults.option(key));
} }