From d612bf02a40d143993af85c3945bf64814252e5e Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Wed, 4 Jul 2018 13:44:51 -0500 Subject: [PATCH] C++11/14 code cleanup: NULL to nullptr for default_value options. --- xs/src/libslic3r/ConfigBase.cpp | 10 +++++----- xs/src/libslic3r/ConfigBase.hpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/xs/src/libslic3r/ConfigBase.cpp b/xs/src/libslic3r/ConfigBase.cpp index 161c96212..03a8dcf6b 100644 --- a/xs/src/libslic3r/ConfigBase.cpp +++ b/xs/src/libslic3r/ConfigBase.cpp @@ -189,7 +189,7 @@ operator!= (const ConfigOption &a, const ConfigOption &b) } ConfigOptionDef::ConfigOptionDef(const ConfigOptionDef &other) - : type(other.type), default_value(NULL), + : type(other.type), default_value(nullptr), gui_type(other.gui_type), gui_flags(other.gui_flags), label(other.label), full_label(other.full_label), category(other.category), tooltip(other.tooltip), sidetext(other.sidetext), cli(other.cli), ratio_over(other.ratio_over), @@ -198,13 +198,13 @@ ConfigOptionDef::ConfigOptionDef(const ConfigOptionDef &other) aliases(other.aliases), shortcut(other.shortcut), enum_values(other.enum_values), enum_labels(other.enum_labels), enum_keys_map(other.enum_keys_map) { - if (other.default_value != NULL) + if (other.default_value != nullptr) this->default_value = other.default_value->clone(); } ConfigOptionDef::~ConfigOptionDef() { - if (this->default_value != NULL) + if (this->default_value != nullptr) delete this->default_value; } @@ -457,7 +457,7 @@ DynamicConfig::optptr(const t_config_option_key &opt_key, bool create) { const ConfigOptionDef* optdef = this->def->get(opt_key); if (optdef == NULL) return NULL; ConfigOption* opt; - if (optdef->default_value != NULL) { + if (optdef->default_value != nullptr) { opt = optdef->default_value->clone(); } else if (optdef->type == coFloat) { opt = new ConfigOptionFloat (); @@ -639,7 +639,7 @@ StaticConfig::set_defaults() t_config_option_keys keys = this->keys(); for (t_config_option_keys::const_iterator it = keys.begin(); it != keys.end(); ++it) { const ConfigOptionDef* def = this->def->get(*it); - if (def->default_value != NULL) + if (def->default_value != nullptr) this->option(*it)->set(*def->default_value); } } diff --git a/xs/src/libslic3r/ConfigBase.hpp b/xs/src/libslic3r/ConfigBase.hpp index 1db0f9a96..818c7a4ce 100644 --- a/xs/src/libslic3r/ConfigBase.hpp +++ b/xs/src/libslic3r/ConfigBase.hpp @@ -640,7 +640,7 @@ class ConfigOptionDef /// Initialized by ConfigOptionEnum::get_enum_values() t_config_enum_values enum_keys_map; - ConfigOptionDef() : type(coNone), default_value(NULL), + ConfigOptionDef() : type(coNone), default_value(nullptr), multiline(false), full_width(false), readonly(false), height(-1), width(-1), min(INT_MIN), max(INT_MAX) {}; ConfigOptionDef(const ConfigOptionDef &other);