diff options
| author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2018-06-15 10:46:15 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marcjeanmougin@free.fr> | 2018-06-18 12:27:01 +0000 |
| commit | f4349fb3e45bd44cef0e2b69af4c9b4cf35dcf43 (patch) | |
| tree | 7c6044fd3a17a2665841959dac9b3b2110b27924 /src/extension | |
| parent | Run clang-tidy’s modernize-use-override pass. (diff) | |
| download | inkscape-f4349fb3e45bd44cef0e2b69af4c9b4cf35dcf43.tar.gz inkscape-f4349fb3e45bd44cef0e2b69af4c9b4cf35dcf43.zip | |
Run clang-tidy’s modernize-use-nullptr pass.
This replaces all NULL or 0 with nullptr when assigned to or returned as
a pointer.
Diffstat (limited to 'src/extension')
85 files changed, 1024 insertions, 1024 deletions
diff --git a/src/extension/db.cpp b/src/extension/db.cpp index e885d3531..8d6ad7e0e 100644 --- a/src/extension/db.cpp +++ b/src/extension/db.cpp @@ -112,8 +112,8 @@ struct ModuleOutputCmp { void DB::register_ext (Extension *module) { - g_return_if_fail(module != NULL); - g_return_if_fail(module->get_id() != NULL); + g_return_if_fail(module != nullptr); + g_return_if_fail(module->get_id() != nullptr); // only add to list if it's a never-before-seen module bool add_to_list = @@ -134,8 +134,8 @@ DB::register_ext (Extension *module) void DB::unregister_ext (Extension * module) { - g_return_if_fail(module != NULL); - g_return_if_fail(module->get_id() != NULL); + g_return_if_fail(module != nullptr); + g_return_if_fail(module->get_id() != nullptr); // printf("Extension DB: removing %s\n", module->get_id()); moduledict.erase(moduledict.find(module->get_id())); @@ -157,11 +157,11 @@ DB::unregister_ext (Extension * module) Extension * DB::get (const gchar *key) { - if (key == NULL) return NULL; + if (key == nullptr) return nullptr; Extension *mod = moduledict[key]; if ( !mod || mod->deactivated() ) - return NULL; + return nullptr; return mod; } diff --git a/src/extension/db.h b/src/extension/db.h index 0014f4449..73e735ac0 100644 --- a/src/extension/db.h +++ b/src/extension/db.h @@ -36,9 +36,9 @@ private: to find the different extensions in the hash map. */ struct ltstr { bool operator()(const char* s1, const char* s2) const { - if ( (s1 == NULL) && (s2 != NULL) ) { + if ( (s1 == nullptr) && (s2 != nullptr) ) { return true; - } else if (s1 == NULL || s2 == NULL) { + } else if (s1 == nullptr || s2 == nullptr) { return false; } else { return strcmp(s1, s2) < 0; diff --git a/src/extension/dependency.cpp b/src/extension/dependency.cpp index 5e843ee11..07462e5e7 100644 --- a/src/extension/dependency.cpp +++ b/src/extension/dependency.cpp @@ -51,20 +51,20 @@ Dependency::Dependency (Inkscape::XML::Node * in_repr) _type = TYPE_FILE; _location = LOCATION_PATH; _repr = in_repr; - _string = NULL; - _description = NULL; + _string = nullptr; + _description = nullptr; Inkscape::GC::anchor(_repr); if (const gchar * location = _repr->attribute("location")) { - for (int i = 0; i < LOCATION_CNT && location != NULL; i++) { + for (int i = 0; i < LOCATION_CNT && location != nullptr; i++) { if (!strcmp(location, _location_str[i])) { _location = (location_t)i; break; } } } else if (const gchar * location = _repr->attribute("reldir")) { - for (int i = 0; i < LOCATION_CNT && location != NULL; i++) { + for (int i = 0; i < LOCATION_CNT && location != nullptr; i++) { if (!strcmp(location, _location_str[i])) { _location = (location_t)i; break; @@ -73,7 +73,7 @@ Dependency::Dependency (Inkscape::XML::Node * in_repr) } const gchar * type = _repr->attribute("type"); - for (int i = 0; i < TYPE_CNT && type != NULL; i++) { + for (int i = 0; i < TYPE_CNT && type != nullptr; i++) { if (!strcmp(type, _type_str[i])) { _type = (type_t)i; break; @@ -83,7 +83,7 @@ Dependency::Dependency (Inkscape::XML::Node * in_repr) _string = _repr->firstChild()->content(); _description = _repr->attribute("description"); - if (_description == NULL) + if (_description == nullptr) _description = _repr->attribute("_description"); return; @@ -133,12 +133,12 @@ bool Dependency::check (void) const { // std::cout << "Checking: " << *this << std::endl; - if (_string == NULL) return FALSE; + if (_string == nullptr) return FALSE; switch (_type) { case TYPE_EXTENSION: { Extension * myext = db.get(_string); - if (myext == NULL) return FALSE; + if (myext == nullptr) return FALSE; if (myext->deactivated()) return FALSE; break; } @@ -171,7 +171,7 @@ bool Dependency::check (void) const default: { gchar * path = g_strdup(g_getenv("PATH")); - if (path == NULL) { + if (path == nullptr) { /* There is no `PATH' in the environment. The default search path is the current directory */ path = g_strdup(G_SEARCHPATH_SEPARATOR_S); @@ -179,7 +179,7 @@ bool Dependency::check (void) const gchar * orig_path = path; - for (; path != NULL;) { + for (; path != nullptr;) { gchar * local_path; // to have the path after detection of the separator Glib::ustring final_name; @@ -188,7 +188,7 @@ bool Dependency::check (void) const /* Not sure whether this is UTF8 happy, but it would seem like it considering that I'm searching (and finding) the ':' character */ - if (path != NULL) { + if (path != nullptr) { path[0] = '\0'; path++; } @@ -255,7 +255,7 @@ operator<< (std::ostream &out_file, const Dependency & in_dep) out_file << _(" location: ") << _(in_dep._location_str[in_dep._location]) << '\n'; out_file << _(" string: ") << in_dep._string << '\n'; - if (in_dep._description != NULL) { + if (in_dep._description != nullptr) { out_file << _(" description: ") << _(in_dep._description) << '\n'; } diff --git a/src/extension/effect.cpp b/src/extension/effect.cpp index 0a9b56ed6..8be5287a2 100644 --- a/src/extension/effect.cpp +++ b/src/extension/effect.cpp @@ -26,9 +26,9 @@ namespace Inkscape { namespace Extension { -Effect * Effect::_last_effect = NULL; -Inkscape::XML::Node * Effect::_effects_list = NULL; -Inkscape::XML::Node * Effect::_filters_list = NULL; +Effect * Effect::_last_effect = nullptr; +Inkscape::XML::Node * Effect::_effects_list = nullptr; +Inkscape::XML::Node * Effect::_filters_list = nullptr; #define EFFECTS_LIST "effects-list" #define FILTERS_LIST "filters-list" @@ -37,12 +37,12 @@ Effect::Effect (Inkscape::XML::Node * in_repr, Implementation::Implementation * : Extension(in_repr, in_imp), _id_noprefs(Glib::ustring(get_id()) + ".noprefs"), _name_noprefs(Glib::ustring(_(get_name())) + _(" (No preferences)")), - _verb(get_id(), get_name(), NULL, NULL, this, true), - _verb_nopref(_id_noprefs.c_str(), _name_noprefs.c_str(), NULL, NULL, this, false), - _menu_node(NULL), _workingDialog(true), - _prefDialog(NULL) + _verb(get_id(), get_name(), nullptr, nullptr, this, true), + _verb_nopref(_id_noprefs.c_str(), _name_noprefs.c_str(), nullptr, nullptr, this, false), + _menu_node(nullptr), _workingDialog(true), + _prefDialog(nullptr) { - Inkscape::XML::Node * local_effects_menu = NULL; + Inkscape::XML::Node * local_effects_menu = nullptr; // This is a weird hack if (!strcmp(this->get_id(), "org.inkscape.filter.dropshadow")) @@ -53,9 +53,9 @@ Effect::Effect (Inkscape::XML::Node * in_repr, Implementation::Implementation * no_doc = false; no_live_preview = false; - if (repr != NULL) { + if (repr != nullptr) { - for (Inkscape::XML::Node *child = repr->firstChild(); child != NULL; child = child->next()) { + for (Inkscape::XML::Node *child = repr->firstChild(); child != nullptr; child = child->next()) { if (!strcmp(child->name(), INKSCAPE_EXTENSION_NS "effect")) { if (child->attribute("needs-document") && !strcmp(child->attribute("needs-document"), "false")) { no_doc = true; @@ -63,7 +63,7 @@ Effect::Effect (Inkscape::XML::Node * in_repr, Implementation::Implementation * if (child->attribute("needs-live-preview") && !strcmp(child->attribute("needs-live-preview"), "false")) { no_live_preview = true; } - for (Inkscape::XML::Node *effect_child = child->firstChild(); effect_child != NULL; effect_child = effect_child->next()) { + for (Inkscape::XML::Node *effect_child = child->firstChild(); effect_child != nullptr; effect_child = effect_child->next()) { if (!strcmp(effect_child->name(), INKSCAPE_EXTENSION_NS "effects-menu")) { // printf("Found local effects menu in %s\n", this->get_name()); local_effects_menu = effect_child->firstChild(); @@ -90,13 +90,13 @@ Effect::Effect (Inkscape::XML::Node * in_repr, Implementation::Implementation * // \TODO this gets called from the Inkscape::Application constructor, where it initializes the menus. // But in the constructor, our object isn't quite there yet! if (Inkscape::Application::exists() && INKSCAPE.use_gui()) { - if (_effects_list == NULL) + if (_effects_list == nullptr) _effects_list = find_menu(INKSCAPE.get_menus(), EFFECTS_LIST); - if (_filters_list == NULL) + if (_filters_list == nullptr) _filters_list = find_menu(INKSCAPE.get_menus(), FILTERS_LIST); } - if ((_effects_list != NULL || _filters_list != NULL)) { + if ((_effects_list != nullptr || _filters_list != nullptr)) { Inkscape::XML::Document *xml_doc; xml_doc = _effects_list->document(); _menu_node = xml_doc->createElement("verb"); @@ -123,22 +123,22 @@ Effect::merge_menu (Inkscape::XML::Node * base, Inkscape::XML::Node * pattern, Inkscape::XML::Node * merge) { Glib::ustring mergename; - Inkscape::XML::Node * tomerge = NULL; - Inkscape::XML::Node * submenu = NULL; + Inkscape::XML::Node * tomerge = nullptr; + Inkscape::XML::Node * submenu = nullptr; /* printf("Merge menu with '%s' '%s' '%s'\n", base != NULL ? base->name() : "NULL", pattern != NULL ? pattern->name() : "NULL", merge != NULL ? merge->name() : "NULL"); */ - if (pattern == NULL) { + if (pattern == nullptr) { // Merge the verb name tomerge = merge; mergename = _(this->get_name()); } else { gchar const * menuname = pattern->attribute("name"); - if (menuname == NULL) menuname = pattern->attribute("_name"); - if (menuname == NULL) return; + if (menuname == nullptr) menuname = pattern->attribute("_name"); + if (menuname == nullptr) return; Inkscape::XML::Document *xml_doc; xml_doc = base->document(); @@ -150,28 +150,28 @@ Effect::merge_menu (Inkscape::XML::Node * base, int position = -1; - if (start != NULL) { + if (start != nullptr) { Inkscape::XML::Node * menupass; - for (menupass = start; menupass != NULL && strcmp(menupass->name(), "separator"); menupass = menupass->next()) { - gchar const * compare_char = NULL; + for (menupass = start; menupass != nullptr && strcmp(menupass->name(), "separator"); menupass = menupass->next()) { + gchar const * compare_char = nullptr; if (!strcmp(menupass->name(), "verb")) { gchar const * verbid = menupass->attribute("verb-id"); Inkscape::Verb * verb = Inkscape::Verb::getbyid(verbid); - if (verb == NULL) { + if (verb == nullptr) { g_warning("Unable to find verb '%s' which is referred to in the menus.", verbid); continue; } compare_char = verb->get_name(); } else if (!strcmp(menupass->name(), "submenu")) { compare_char = menupass->attribute("name"); - if (compare_char == NULL) + if (compare_char == nullptr) compare_char = menupass->attribute("_name"); } position = menupass->position() + 1; /* This will cause us to skip tags we don't understand */ - if (compare_char == NULL) { + if (compare_char == nullptr) { continue; } @@ -179,7 +179,7 @@ Effect::merge_menu (Inkscape::XML::Node * base, if (mergename == compare) { Inkscape::GC::release(tomerge); - tomerge = NULL; + tomerge = nullptr; submenu = menupass; break; } @@ -191,15 +191,15 @@ Effect::merge_menu (Inkscape::XML::Node * base, } // for menu items } // start != NULL - if (tomerge != NULL) { + if (tomerge != nullptr) { base->appendChild(tomerge); Inkscape::GC::release(tomerge); if (position != -1) tomerge->setPosition(position); } - if (pattern != NULL) { - if (submenu == NULL) + if (pattern != nullptr) { + if (submenu == nullptr) submenu = tomerge; merge_menu(submenu, submenu->firstChild(), pattern->firstChild(), merge); } @@ -210,7 +210,7 @@ Effect::merge_menu (Inkscape::XML::Node * base, Effect::~Effect (void) { if (get_last_effect() == this) - set_last_effect(NULL); + set_last_effect(nullptr); if (_menu_node) Inkscape::GC::release(_menu_node); return; @@ -222,9 +222,9 @@ Effect::check (void) if (!Extension::check()) { /** \todo Check to see if parent has this as its only child, if so, delete it too */ - if (_menu_node != NULL) + if (_menu_node != nullptr) sp_repr_unparent(_menu_node); - _menu_node = NULL; + _menu_node = nullptr; return false; } return true; @@ -233,7 +233,7 @@ Effect::check (void) bool Effect::prefs (Inkscape::UI::View::View * doc) { - if (_prefDialog != NULL) { + if (_prefDialog != nullptr) { _prefDialog->raise(); return true; } @@ -247,7 +247,7 @@ Effect::prefs (Inkscape::UI::View::View * doc) set_state(Extension::STATE_LOADED); if (!loaded()) return false; - _prefDialog = new PrefDialog(this->get_name(), this->get_help(), NULL, this); + _prefDialog = new PrefDialog(this->get_name(), this->get_help(), nullptr, this); _prefDialog->show(); return true; @@ -312,12 +312,12 @@ Effect::set_last_effect (Effect * in_effect) if (strncmp(verb_id, help_id_prefix, strlen(help_id_prefix)) == 0) return; } - if (in_effect == NULL) { - Inkscape::Verb::get(SP_VERB_EFFECT_LAST)->sensitive(NULL, false); - Inkscape::Verb::get(SP_VERB_EFFECT_LAST_PREF)->sensitive(NULL, false); - } else if (_last_effect == NULL) { - Inkscape::Verb::get(SP_VERB_EFFECT_LAST)->sensitive(NULL, true); - Inkscape::Verb::get(SP_VERB_EFFECT_LAST_PREF)->sensitive(NULL, true); + if (in_effect == nullptr) { + Inkscape::Verb::get(SP_VERB_EFFECT_LAST)->sensitive(nullptr, false); + Inkscape::Verb::get(SP_VERB_EFFECT_LAST_PREF)->sensitive(nullptr, false); + } else if (_last_effect == nullptr) { + Inkscape::Verb::get(SP_VERB_EFFECT_LAST)->sensitive(nullptr, true); + Inkscape::Verb::get(SP_VERB_EFFECT_LAST_PREF)->sensitive(nullptr, true); } _last_effect = in_effect; @@ -327,21 +327,21 @@ Effect::set_last_effect (Effect * in_effect) Inkscape::XML::Node * Effect::find_menu (Inkscape::XML::Node * menustruct, const gchar *name) { - if (menustruct == NULL) return NULL; + if (menustruct == nullptr) return nullptr; for (Inkscape::XML::Node * child = menustruct; - child != NULL; + child != nullptr; child = child->next()) { if (!strcmp(child->name(), name)) { return child; } Inkscape::XML::Node * firstchild = child->firstChild(); - if (firstchild != NULL) { + if (firstchild != nullptr) { Inkscape::XML::Node *found = find_menu (firstchild, name); if (found) return found; } } - return NULL; + return nullptr; } @@ -380,7 +380,7 @@ Effect::EffectVerb::perform( SPAction *action, void * data ) Effect::EffectVerb * ev = reinterpret_cast<Effect::EffectVerb *>(data); Effect * effect = ev->_effect; - if (effect == NULL) return; + if (effect == nullptr) return; if (ev->_showPrefs) { effect->prefs(current_view); diff --git a/src/extension/effect.h b/src/extension/effect.h index a0f478978..5481d420a 100644 --- a/src/extension/effect.h +++ b/src/extension/effect.h @@ -70,10 +70,10 @@ class Effect : public Extension { Verb(id, _(name), _(tip), image, _("Extensions")), _effect(effect), _showPrefs(showPrefs), - _elip_name(NULL) { + _elip_name(nullptr) { /* No clue why, but this is required */ this->set_default_sensitive(true); - if (_showPrefs && effect != NULL && effect->param_visible_count() != 0) { + if (_showPrefs && effect != nullptr && effect->param_visible_count() != 0) { _elip_name = g_strdup_printf("%s...", _(name)); set_name(_elip_name); } @@ -81,7 +81,7 @@ class Effect : public Extension { /** \brief Destructor */ ~EffectVerb() override { - if (_elip_name != NULL) { + if (_elip_name != nullptr) { g_free(_elip_name); } } diff --git a/src/extension/execution-env.cpp b/src/extension/execution-env.cpp index 0c979660d..0e0688f44 100644 --- a/src/extension/execution-env.cpp +++ b/src/extension/execution-env.cpp @@ -46,8 +46,8 @@ namespace Extension { */ ExecutionEnv::ExecutionEnv (Effect * effect, Inkscape::UI::View::View * doc, Implementation::ImplementationDocumentCache * docCache, bool show_working, bool show_errors) : _state(ExecutionEnv::INIT), - _visibleDialog(NULL), - _mainloop(NULL), + _visibleDialog(nullptr), + _mainloop(nullptr), _doc(doc), _docCache(docCache), _effect(effect), @@ -64,10 +64,10 @@ ExecutionEnv::ExecutionEnv (Effect * effect, Inkscape::UI::View::View * doc, Imp Destroys the dialog if created and the document cache. */ ExecutionEnv::~ExecutionEnv (void) { - if (_visibleDialog != NULL) { + if (_visibleDialog != nullptr) { _visibleDialog->hide(); delete _visibleDialog; - _visibleDialog = NULL; + _visibleDialog = nullptr; } killDocCache(); return; @@ -80,7 +80,7 @@ ExecutionEnv::~ExecutionEnv (void) { */ void ExecutionEnv::genDocCache (void) { - if (_docCache == NULL) { + if (_docCache == nullptr) { // printf("Gen Doc Cache\n"); _docCache = _effect->get_imp()->newDocCache(_effect, _doc); } @@ -93,10 +93,10 @@ ExecutionEnv::genDocCache (void) { */ void ExecutionEnv::killDocCache (void) { - if (_docCache != NULL) { + if (_docCache != nullptr) { // printf("Killed Doc Cache\n"); delete _docCache; - _docCache = NULL; + _docCache = nullptr; } return; } @@ -108,10 +108,10 @@ ExecutionEnv::killDocCache (void) { */ void ExecutionEnv::createWorkingDialog (void) { - if (_visibleDialog != NULL) { + if (_visibleDialog != nullptr) { _visibleDialog->hide(); delete _visibleDialog; - _visibleDialog = NULL; + _visibleDialog = nullptr; } SPDesktop *desktop = (SPDesktop *)_doc; diff --git a/src/extension/execution-env.h b/src/extension/execution-env.h index f75e97efa..5ae7beb42 100644 --- a/src/extension/execution-env.h +++ b/src/extension/execution-env.h @@ -78,7 +78,7 @@ public: */ ExecutionEnv (Effect * effect, Inkscape::UI::View::View * doc, - Implementation::ImplementationDocumentCache * docCache = NULL, + Implementation::ImplementationDocumentCache * docCache = nullptr, bool show_working = true, bool show_errors = true); virtual ~ExecutionEnv (void); diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp index f07d334af..55b5f68fc 100644 --- a/src/extension/extension.cpp +++ b/src/extension/extension.cpp @@ -54,29 +54,29 @@ std::ofstream Extension::error_file; a name and an ID the module will be left in an errored state. */ Extension::Extension (Inkscape::XML::Node * in_repr, Implementation::Implementation * in_imp) - : _help(NULL) + : _help(nullptr) , silent(false) , _gui(true) - , execution_env(NULL) + , execution_env(nullptr) { repr = in_repr; Inkscape::GC::anchor(in_repr); - id = NULL; - name = NULL; + id = nullptr; + name = nullptr; _state = STATE_UNLOADED; - if (in_imp == NULL) { + if (in_imp == nullptr) { imp = new Implementation::Implementation(); } else { imp = in_imp; } // printf("Extension Constructor: "); - if (repr != NULL) { + if (repr != nullptr) { Inkscape::XML::Node *child_repr = repr->firstChild(); /* TODO: Handle what happens if we don't have these two */ - while (child_repr != NULL) { + while (child_repr != nullptr) { char const * chname = child_repr->name(); if (!strncmp(chname, INKSCAPE_EXTENSION_NS_NC, strlen(INKSCAPE_EXTENSION_NS_NC))) { chname += strlen(INKSCAPE_EXTENSION_NS); @@ -96,14 +96,14 @@ Extension::Extension (Inkscape::XML::Node * in_repr, Implementation::Implementat if (!strcmp(chname, "param") || !strcmp(chname, "_param")) { Parameter * param; param = Parameter::make(child_repr, this); - if (param != NULL) + if (param != nullptr) parameters.push_back(param); } /* param || _param */ if (!strcmp(chname, "dependency")) { _deps.push_back(new Dependency(child_repr)); } /* dependency */ if (!strcmp(chname, "script")) { - for (Inkscape::XML::Node *child = child_repr->firstChild(); child != NULL ; child = child->next()) { + for (Inkscape::XML::Node *child = child_repr->firstChild(); child != nullptr ; child = child->next()) { if (child->type() == Inkscape::XML::ELEMENT_NODE) { _deps.push_back(new Dependency(child)); break; @@ -119,7 +119,7 @@ Extension::Extension (Inkscape::XML::Node * in_repr, Implementation::Implementat db.register_ext (this); } // printf("%s\n", name); - timer = NULL; + timer = nullptr; return; } @@ -142,7 +142,7 @@ Extension::~Extension (void) g_free(id); g_free(name); delete timer; - timer = NULL; + timer = nullptr; /** \todo Need to do parameters here */ // delete parameters: @@ -180,7 +180,7 @@ Extension::set_state (state_t in_state) if (imp->load(this)) _state = STATE_LOADED; - if (timer != NULL) { + if (timer != nullptr) { delete timer; } timer = new ExpirationTimer(this); @@ -191,17 +191,17 @@ Extension::set_state (state_t in_state) imp->unload(this); _state = STATE_UNLOADED; - if (timer != NULL) { + if (timer != nullptr) { delete timer; - timer = NULL; + timer = nullptr; } break; case STATE_DEACTIVATED: _state = STATE_DEACTIVATED; - if (timer != NULL) { + if (timer != nullptr) { delete timer; - timer = NULL; + timer = nullptr; } break; default: @@ -270,19 +270,19 @@ Extension::check (void) retval = false; } #endif - if (id == NULL) { + if (id == nullptr) { printFailure(Glib::ustring(_("an ID was not defined for it.")) + inx_failure); retval = false; } - if (name == NULL) { + if (name == nullptr) { printFailure(Glib::ustring(_("there was no name defined for it.")) + inx_failure); retval = false; } - if (repr == NULL) { + if (repr == nullptr) { printFailure(Glib::ustring(_("the XML description of it got lost.")) + inx_failure); retval = false; } - if (imp == NULL) { + if (imp == nullptr) { printFailure(Glib::ustring(_("no implementation was defined for the extension.")) + inx_failure); retval = false; } @@ -396,7 +396,7 @@ Extension::deactivated (void) Parameter *Extension::get_param(gchar const *name) { - if (name == NULL) { + if (name == nullptr) { throw Extension::param_not_exist(); } if (this->parameters.empty()) { @@ -653,7 +653,7 @@ void Extension::error_file_open (void) { gchar * ext_error_file = Inkscape::IO::Resource::log_path(EXTENSION_ERROR_LOG_FILENAME); - gchar * filename = g_filename_from_utf8( ext_error_file, -1, NULL, NULL, NULL ); + gchar * filename = g_filename_from_utf8( ext_error_file, -1, nullptr, nullptr, nullptr ); error_file.open(filename); if (!error_file.is_open()) { g_warning(_("Could not create extension error log file '%s'"), @@ -717,7 +717,7 @@ public: Gtk::Widget * Extension::autogui (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) { - if (!_gui || param_visible_count() == 0) return NULL; + if (!_gui || param_visible_count() == 0) return nullptr; AutoGUI * agui = Gtk::manage(new AutoGUI()); agui->set_border_width(Parameter::GUI_BOX_MARGIN); @@ -798,7 +798,7 @@ Extension::get_help_widget(void) { Gtk::VBox * retval = Gtk::manage(new Gtk::VBox()); - if (_help == NULL) { + if (_help == nullptr) { Gtk::Label * content = Gtk::manage(new Gtk::Label(_("Currently there is no help available for this Extension. Please look on the Inkscape website or ask on the mailing lists if you have questions regarding this extension."))); retval->pack_start(*content, true, true, 5); content->set_line_wrap(true); diff --git a/src/extension/extension.h b/src/extension/extension.h index d66399d59..e927e1431 100644 --- a/src/extension/extension.h +++ b/src/extension/extension.h @@ -204,16 +204,16 @@ private: public: bool get_param_bool (const gchar * name, - const SPDocument * doc = NULL, - const Inkscape::XML::Node * node = NULL); + const SPDocument * doc = nullptr, + const Inkscape::XML::Node * node = nullptr); int get_param_int (const gchar * name, - const SPDocument * doc = NULL, - const Inkscape::XML::Node * node = NULL); + const SPDocument * doc = nullptr, + const Inkscape::XML::Node * node = nullptr); float get_param_float (const gchar * name, - const SPDocument * doc = NULL, - const Inkscape::XML::Node * node = NULL); + const SPDocument * doc = nullptr, + const Inkscape::XML::Node * node = nullptr); /** * Gets a parameter identified by name with the string placed in value. @@ -226,60 +226,60 @@ public: * @return A constant pointer to the string held by the parameters. */ gchar const *get_param_string(gchar const *name, - SPDocument const *doc = NULL, - Inkscape::XML::Node const *node = NULL) const; + SPDocument const *doc = nullptr, + Inkscape::XML::Node const *node = nullptr) const; guint32 get_param_color (const gchar * name, - const SPDocument * doc = NULL, - const Inkscape::XML::Node * node = NULL) const; + const SPDocument * doc = nullptr, + const Inkscape::XML::Node * node = nullptr) const; const gchar * get_param_enum (const gchar * name, - const SPDocument * doc = NULL, - const Inkscape::XML::Node * node = NULL) const; + const SPDocument * doc = nullptr, + const Inkscape::XML::Node * node = nullptr) const; gchar const *get_param_optiongroup( gchar const * name, - SPDocument const * doc = 0, - Inkscape::XML::Node const * node = 0) const; + SPDocument const * doc = nullptr, + Inkscape::XML::Node const * node = nullptr) const; bool get_param_enum_contains(gchar const * name, gchar const * value, - SPDocument * doc = 0x0, - Inkscape::XML::Node * node = 0x0) const; + SPDocument * doc = nullptr, + Inkscape::XML::Node * node = nullptr) const; bool set_param_bool (const gchar * name, bool value, - SPDocument * doc = NULL, - Inkscape::XML::Node * node = NULL); + SPDocument * doc = nullptr, + Inkscape::XML::Node * node = nullptr); int set_param_int (const gchar * name, int value, - SPDocument * doc = NULL, - Inkscape::XML::Node * node = NULL); + SPDocument * doc = nullptr, + Inkscape::XML::Node * node = nullptr); float set_param_float (const gchar * name, float value, - SPDocument * doc = NULL, - Inkscape::XML::Node * node = NULL); + SPDocument * doc = nullptr, + Inkscape::XML::Node * node = nullptr); const gchar * set_param_string (const gchar * name, const gchar * value, - SPDocument * doc = NULL, - Inkscape::XML::Node * node = NULL); + SPDocument * doc = nullptr, + Inkscape::XML::Node * node = nullptr); gchar const * set_param_optiongroup(gchar const * name, gchar const * value, - SPDocument * doc = 0, - Inkscape::XML::Node * node = 0); + SPDocument * doc = nullptr, + Inkscape::XML::Node * node = nullptr); gchar const * set_param_enum (gchar const * name, gchar const * value, - SPDocument * doc = 0x0, - Inkscape::XML::Node * node = 0x0); + SPDocument * doc = nullptr, + Inkscape::XML::Node * node = nullptr); guint32 set_param_color (const gchar * name, guint32 color, - SPDocument * doc = NULL, - Inkscape::XML::Node * node = NULL); + SPDocument * doc = nullptr, + Inkscape::XML::Node * node = nullptr); /* Error file handling */ public: @@ -287,7 +287,7 @@ public: static void error_file_close (void); public: - Gtk::Widget * autogui (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal = NULL); + Gtk::Widget * autogui (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal = nullptr); void paramListString (std::list <std::string> & retlist); void set_gui(bool s) { _gui = s; } diff --git a/src/extension/implementation/implementation.cpp b/src/extension/implementation/implementation.cpp index 6e6100d2b..2a6a76ff4 100644 --- a/src/extension/implementation/implementation.cpp +++ b/src/extension/implementation/implementation.cpp @@ -29,24 +29,24 @@ namespace Implementation { Gtk::Widget * Implementation::prefs_input(Inkscape::Extension::Input *module, gchar const */*filename*/) { - return module->autogui(NULL, NULL); + return module->autogui(nullptr, nullptr); } Gtk::Widget * Implementation::prefs_output(Inkscape::Extension::Output *module) { - return module->autogui(NULL, NULL); + return module->autogui(nullptr, nullptr); } Gtk::Widget *Implementation::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View * view, sigc::signal<void> * changeSignal, ImplementationDocumentCache * /*docCache*/) { if (module->param_visible_count() == 0) { - return NULL; + return nullptr; } SPDocument * current_document = view->doc(); auto selected = ((SPDesktop *) view)->getSelection()->items(); - Inkscape::XML::Node const* first_select = NULL; + Inkscape::XML::Node const* first_select = nullptr; if (!selected.empty()) { const SPItem * item = selected.front(); first_select = item->getRepr(); diff --git a/src/extension/implementation/implementation.h b/src/extension/implementation/implementation.h index cf41e5517..52542064b 100644 --- a/src/extension/implementation/implementation.h +++ b/src/extension/implementation/implementation.h @@ -88,7 +88,7 @@ public: * @return A new document cache that is valid as long as the document * is not changed. */ - virtual ImplementationDocumentCache * newDocCache (Inkscape::Extension::Extension * /*ext*/, Inkscape::UI::View::View * /*doc*/) { return NULL; } + virtual ImplementationDocumentCache * newDocCache (Inkscape::Extension::Extension * /*ext*/, Inkscape::UI::View::View * /*doc*/) { return nullptr; } /** Verify any dependencies. */ virtual bool check(Inkscape::Extension::Extension * /*module*/) { return true; } @@ -103,7 +103,7 @@ public: gchar const *filename); virtual SPDocument *open(Inkscape::Extension::Input * /*module*/, - gchar const * /*filename*/) { return NULL; } + gchar const * /*filename*/) { return nullptr; } // ----- Output functions ----- /** Find out information about the file. */ diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index 6b629934f..a8490fe73 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -93,7 +93,7 @@ Script::interpreter_t const Script::interpreterTab[] = { #endif {"ruby", "ruby-interpreter", "ruby" }, {"shell", "shell-interpreter", "sh" }, - { NULL, NULL, NULL } + { nullptr, nullptr, nullptr } }; @@ -105,7 +105,7 @@ Script::interpreter_t const Script::interpreterTab[] = { */ std::string Script::resolveInterpreterExecutable(const Glib::ustring &interpNameArg) { - interpreter_t const *interp = 0; + interpreter_t const *interp = nullptr; bool foundInterp = false; for (interp = interpreterTab ; interp->identity ; interp++ ){ if (interpNameArg == interp->identity) { @@ -156,7 +156,7 @@ std::string Script::resolveInterpreterExecutable(const Glib::ustring &interpName Script::Script() : Implementation() , _canceled(false) - , parent_window(NULL) + , parent_window(nullptr) { } @@ -294,12 +294,12 @@ bool Script::load(Inkscape::Extension::Extension *module) /* This should probably check to find the executable... */ Inkscape::XML::Node *child_repr = module->get_repr()->firstChild(); - while (child_repr != NULL) { + while (child_repr != nullptr) { if (!strcmp(child_repr->name(), INKSCAPE_EXTENSION_NS "script")) { - for (child_repr = child_repr->firstChild(); child_repr != NULL; child_repr = child_repr->next()) { + for (child_repr = child_repr->firstChild(); child_repr != nullptr; child_repr = child_repr->next()) { if (!strcmp(child_repr->name(), INKSCAPE_EXTENSION_NS "command")) { const gchar *interpretstr = child_repr->attribute("interpreter"); - if (interpretstr != NULL) { + if (interpretstr != nullptr) { std::string interpString = resolveInterpreterExecutable(interpretstr); if (interpString.empty()) { continue; // can't have a script extension with empty interpreter @@ -353,11 +353,11 @@ bool Script::check(Inkscape::Extension::Extension *module) { int script_count = 0; Inkscape::XML::Node *child_repr = module->get_repr()->firstChild(); - while (child_repr != NULL) { + while (child_repr != nullptr) { if (!strcmp(child_repr->name(), INKSCAPE_EXTENSION_NS "script")) { script_count++; child_repr = child_repr->firstChild(); - while (child_repr != NULL) { + while (child_repr != nullptr) { if (!strcmp(child_repr->name(), INKSCAPE_EXTENSION_NS "check")) { std::string command_text = solve_reldir(child_repr); if (!command_text.empty()) { @@ -373,7 +373,7 @@ bool Script::check(Inkscape::Extension::Extension *module) if (!strcmp(child_repr->name(), INKSCAPE_EXTENSION_NS "helper_extension")) { gchar const *helper = child_repr->firstChild()->content(); - if (Inkscape::Extension::db.get(helper) == NULL) { + if (Inkscape::Extension::db.get(helper) == nullptr) { return false; } } @@ -449,7 +449,7 @@ ImplementationDocumentCache *Script::newDocCache( Inkscape::Extension::Extension Gtk::Widget *Script::prefs_input(Inkscape::Extension::Input *module, const gchar */*filename*/) { - return module->autogui(NULL, NULL); + return module->autogui(nullptr, nullptr); } @@ -463,7 +463,7 @@ Gtk::Widget *Script::prefs_input(Inkscape::Extension::Input *module, */ Gtk::Widget *Script::prefs_output(Inkscape::Extension::Output *module) { - return module->autogui(NULL, NULL); + return module->autogui(nullptr, nullptr); } /** @@ -499,7 +499,7 @@ SPDocument *Script::open(Inkscape::Extension::Input *module, tempfd_out = Glib::file_open_tmp(tempfilename_out, "ink_ext_XXXXXX.svg"); } catch (...) { /// \todo Popup dialog here - return NULL; + return nullptr; } std::string lfilename = Glib::filename_from_utf8(filenameArg); @@ -508,7 +508,7 @@ SPDocument *Script::open(Inkscape::Extension::Input *module, int data_read = execute(command, params, lfilename, fileout); fileout.toFile(tempfilename_out); - SPDocument * mydoc = NULL; + SPDocument * mydoc = nullptr; if (data_read > 10) { if (helper_extension.size()==0) { mydoc = Inkscape::Extension::open( @@ -521,8 +521,8 @@ SPDocument *Script::open(Inkscape::Extension::Input *module, } } // data_read - if (mydoc != NULL) { - mydoc->setBase(0); + if (mydoc != nullptr) { + mydoc->setBase(nullptr); mydoc->changeUriAndHrefs(filenameArg); } @@ -646,15 +646,15 @@ void Script::effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View *doc, ImplementationDocumentCache * docCache) { - if (docCache == NULL) { + if (docCache == nullptr) { docCache = newDocCache(module, doc); } ScriptDocCache * dc = dynamic_cast<ScriptDocCache *>(docCache); - if (dc == NULL) { + if (dc == nullptr) { printf("TOO BAD TO LIVE!!!"); exit(1); } - if (doc == NULL) + if (doc == nullptr) { g_warning("Script::effect: View not defined"); return; @@ -709,7 +709,7 @@ void Script::effect(Inkscape::Extension::Effect *module, pump_events(); - SPDocument * mydoc = NULL; + SPDocument * mydoc = nullptr; if (data_read > 10) { try { mydoc = Inkscape::Extension::open( @@ -734,23 +734,23 @@ void Script::effect(Inkscape::Extension::Effect *module, if (mydoc) { SPDocument* vd=doc->doc(); - if (vd != NULL) + if (vd != nullptr) { vd->emitReconstructionStart(); copy_doc(vd->rroot, mydoc->rroot); vd->emitReconstructionFinish(); // Getting the named view from the document generated by the extension - SPNamedView *nv = sp_document_namedview(mydoc, NULL); + SPNamedView *nv = sp_document_namedview(mydoc, nullptr); //Check if it has a default layer set up - SPObject *layer = NULL; - if ( nv != NULL) + SPObject *layer = nullptr; + if ( nv != nullptr) { if( nv->default_layer_id != 0 ) { SPDocument *document = desktop->doc(); //If so, get that layer - if (document != NULL) + if (document != nullptr) { layer = document->getObjectById(g_quark_to_string(nv->default_layer_id)); } @@ -800,7 +800,7 @@ void Script::effect(Inkscape::Extension::Effect *module, */ void Script::copy_doc (Inkscape::XML::Node * oldroot, Inkscape::XML::Node * newroot) { - if ((oldroot == NULL) ||(newroot == NULL)) + if ((oldroot == nullptr) ||(newroot == nullptr)) { g_warning("Error on copy_doc: NULL pointer input."); return; @@ -822,7 +822,7 @@ void Script::copy_doc (Inkscape::XML::Node * oldroot, Inkscape::XML::Node * newr // Delete the attributes of the old root node. for (std::vector<gchar const *>::const_iterator it = attribs.begin(); it != attribs.end(); ++it) { - oldroot->setAttribute(*it, NULL); + oldroot->setAttribute(*it, nullptr); } // Set the new attributes. @@ -840,11 +840,11 @@ void Script::copy_doc (Inkscape::XML::Node * oldroot, Inkscape::XML::Node * newr // Make list for (Inkscape::XML::Node * child = oldroot->firstChild(); - child != NULL; + child != nullptr; child = child->next()) { if (!strcmp("sodipodi:namedview", child->name())) { for (Inkscape::XML::Node * oldroot_namedview_child = child->firstChild(); - oldroot_namedview_child != NULL; + oldroot_namedview_child != nullptr; oldroot_namedview_child = oldroot_namedview_child->next()) { delete_list.push_back(oldroot_namedview_child); } @@ -1014,7 +1014,7 @@ int Script::execute (const std::list<std::string> &in_command, static_cast<Glib::SpawnFlags>(0), // no flags sigc::slot<void>(), &_pid, // Pid - NULL, // STDIN + nullptr, // STDIN &stdout_pipe, // STDOUT &stderr_pipe); // STDERR } catch (Glib::Error &e) { diff --git a/src/extension/implementation/xslt.cpp b/src/extension/implementation/xslt.cpp index d11283db7..9e4a45483 100644 --- a/src/extension/implementation/xslt.cpp +++ b/src/extension/implementation/xslt.cpp @@ -48,8 +48,8 @@ namespace Implementation { XSLT::XSLT(void) : Implementation(), _filename(""), - _parsedDoc(NULL), - _stylesheet(NULL) + _parsedDoc(nullptr), + _stylesheet(nullptr) { } @@ -87,10 +87,10 @@ bool XSLT::load(Inkscape::Extension::Extension *module) if (module->loaded()) { return true; } Inkscape::XML::Node *child_repr = module->get_repr()->firstChild(); - while (child_repr != NULL) { + while (child_repr != nullptr) { if (!strcmp(child_repr->name(), INKSCAPE_EXTENSION_NS "xslt")) { child_repr = child_repr->firstChild(); - while (child_repr != NULL) { + while (child_repr != nullptr) { if (!strcmp(child_repr->name(), INKSCAPE_EXTENSION_NS "file")) { _filename = solve_reldir(child_repr); } @@ -103,7 +103,7 @@ bool XSLT::load(Inkscape::Extension::Extension *module) } _parsedDoc = xmlParseFile(_filename.c_str()); - if (_parsedDoc == NULL) { return false; } + if (_parsedDoc == nullptr) { return false; } _stylesheet = xsltParseStylesheetDoc(_parsedDoc); @@ -122,10 +122,10 @@ SPDocument * XSLT::open(Inkscape::Extension::Input */*module*/, gchar const *filename) { xmlDocPtr filein = xmlParseFile(filename); - if (filein == NULL) { return NULL; } + if (filein == nullptr) { return nullptr; } const char * params[1]; - params[0] = NULL; + params[0] = nullptr; xmlDocPtr result = xsltApplyStylesheet(_stylesheet, filein, params); xmlFreeDoc(filein); @@ -133,17 +133,17 @@ SPDocument * XSLT::open(Inkscape::Extension::Input */*module*/, Inkscape::XML::Document * rdoc = sp_repr_do_read( result, SP_SVG_NS_URI); xmlFreeDoc(result); - if (rdoc == NULL) { - return NULL; + if (rdoc == nullptr) { + return nullptr; } if (strcmp(rdoc->root()->name(), "svg:svg") != 0) { - return NULL; + return nullptr; } - gchar * base = NULL; - gchar * name = NULL; - gchar * s = NULL, * p = NULL; + gchar * base = nullptr; + gchar * name = nullptr; + gchar * s = nullptr, * p = nullptr; s = g_strdup(filename); p = strrchr(s, '/'); if (p) { @@ -151,12 +151,12 @@ SPDocument * XSLT::open(Inkscape::Extension::Input */*module*/, p[1] = '\0'; base = g_strdup(s); } else { - base = NULL; + base = nullptr; name = g_strdup(filename); } g_free(s); - SPDocument * doc = SPDocument::createDoc(rdoc, filename, base, name, true, NULL); + SPDocument * doc = SPDocument::createDoc(rdoc, filename, base, name, true, nullptr); g_free(base); g_free(name); @@ -167,8 +167,8 @@ void XSLT::save(Inkscape::Extension::Output *module, SPDocument *doc, gchar cons { /* TODO: Should we assume filename to be in utf8 or to be a raw filename? * See JavaFXOutput::save for discussion. */ - g_return_if_fail(doc != NULL); - g_return_if_fail(filename != NULL); + g_return_if_fail(doc != nullptr); + g_return_if_fail(filename != nullptr); Inkscape::XML::Node *repr = doc->getReprRoot(); @@ -188,7 +188,7 @@ void XSLT::save(Inkscape::Extension::Output *module, SPDocument *doc, gchar cons xmlDocPtr svgdoc = xmlParseFile(tempfilename_out.c_str()); close(tempfd_out); - if (svgdoc == NULL) { + if (svgdoc == nullptr) { return; } @@ -207,7 +207,7 @@ void XSLT::save(Inkscape::Extension::Output *module, SPDocument *doc, gchar cons xslt_params[count++] = g_strdup_printf("%s", parameter.str().c_str()); xslt_params[count++] = g_strdup_printf("'%s'", value.str().c_str()); } - xslt_params[count] = NULL; + xslt_params[count] = nullptr; xmlDocPtr newdoc = xsltApplyStylesheet(_stylesheet, svgdoc, xslt_params); //xmlSaveFile(filename, newdoc); diff --git a/src/extension/init.cpp b/src/extension/init.cpp index 17c07ae1d..d0487d473 100644 --- a/src/extension/init.cpp +++ b/src/extension/init.cpp @@ -260,7 +260,7 @@ check_extensions_internal(Extension *in_plug, gpointer in_data) { int *count = (int *)in_data; - if (in_plug == NULL) return; + if (in_plug == nullptr) return; if (!in_plug->deactivated() && !in_plug->check()) { in_plug->deactivate(); (*count)++; diff --git a/src/extension/input.cpp b/src/extension/input.cpp index 862d4a4d3..3fb330998 100644 --- a/src/extension/input.cpp +++ b/src/extension/input.cpp @@ -38,21 +38,21 @@ namespace Extension { */ Input::Input (Inkscape::XML::Node * in_repr, Implementation::Implementation * in_imp) : Extension(in_repr, in_imp) { - mimetype = NULL; - extension = NULL; - filetypename = NULL; - filetypetooltip = NULL; - output_extension = NULL; + mimetype = nullptr; + extension = nullptr; + filetypename = nullptr; + filetypetooltip = nullptr; + output_extension = nullptr; - if (repr != NULL) { + if (repr != nullptr) { Inkscape::XML::Node * child_repr; child_repr = repr->firstChild(); - while (child_repr != NULL) { + while (child_repr != nullptr) { if (!strcmp(child_repr->name(), INKSCAPE_EXTENSION_NS "input")) { child_repr = child_repr->firstChild(); - while (child_repr != NULL) { + while (child_repr != nullptr) { char const * chname = child_repr->name(); if (!strncmp(chname, INKSCAPE_EXTENSION_NS_NC, strlen(INKSCAPE_EXTENSION_NS_NC))) { chname += strlen(INKSCAPE_EXTENSION_NS); @@ -119,9 +119,9 @@ Input::~Input (void) bool Input::check (void) { - if (extension == NULL) + if (extension == nullptr) return FALSE; - if (mimetype == NULL) + if (mimetype == nullptr) return FALSE; return Extension::check(); @@ -144,7 +144,7 @@ Input::open (const gchar *uri) set_state(Extension::STATE_LOADED); } if (!loaded()) { - return NULL; + return nullptr; } timer->touch(); @@ -184,7 +184,7 @@ Input::get_extension(void) gchar * Input::get_filetypename(void) { - if (filetypename != NULL) + if (filetypename != nullptr) return filetypename; else return get_name(); @@ -218,7 +218,7 @@ Input::prefs (const gchar *uri) Gtk::Widget * controls; controls = imp->prefs_input(this, uri); - if (controls == NULL) { + if (controls == nullptr) { // std::cout << "No preferences for Input" << std::endl; return true; } diff --git a/src/extension/internal/bluredge.cpp b/src/extension/internal/bluredge.cpp index f04007d00..808023c7c 100644 --- a/src/extension/internal/bluredge.cpp +++ b/src/extension/internal/bluredge.cpp @@ -96,10 +96,10 @@ BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View /* Doing an inset here folks */ offset *= -1.0; prefs->setDoubleUnit("/options/defaultoffsetwidth/value", offset, "px"); - sp_action_perform(Inkscape::Verb::get(SP_VERB_SELECTION_INSET)->get_action(Inkscape::ActionContext(desktop)), NULL); + sp_action_perform(Inkscape::Verb::get(SP_VERB_SELECTION_INSET)->get_action(Inkscape::ActionContext(desktop)), nullptr); } else if (offset > 0.0) { prefs->setDoubleUnit("/options/defaultoffsetwidth/value", offset, "px"); - sp_action_perform(Inkscape::Verb::get(SP_VERB_SELECTION_OFFSET)->get_action(Inkscape::ActionContext(desktop)), NULL); + sp_action_perform(Inkscape::Verb::get(SP_VERB_SELECTION_OFFSET)->get_action(Inkscape::ActionContext(desktop)), nullptr); } selection->clear(); @@ -119,7 +119,7 @@ BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View Gtk::Widget * BlurEdge::prefs_effect(Inkscape::Extension::Effect * module, Inkscape::UI::View::View * /*view*/, sigc::signal<void> * changeSignal, Inkscape::Extension::Implementation::ImplementationDocumentCache * /*docCache*/) { - return module->autogui(NULL, NULL, changeSignal); + return module->autogui(nullptr, nullptr, changeSignal); } #include "clear-n_.h" diff --git a/src/extension/internal/cairo-png-out.cpp b/src/extension/internal/cairo-png-out.cpp index 3cdbee8c1..c3261fdce 100644 --- a/src/extension/internal/cairo-png-out.cpp +++ b/src/extension/internal/cairo-png-out.cpp @@ -66,7 +66,7 @@ png_render_document_to_file(SPDocument *doc, gchar const *filename) ctx = renderer->createContext(); /* Render document */ - bool ret = renderer->setupDocument(ctx, doc, TRUE, 0., NULL); + bool ret = renderer->setupDocument(ctx, doc, TRUE, 0., nullptr); if (ret) { renderer->renderItem(ctx, base); ctx->saveAsPng(filename); diff --git a/src/extension/internal/cairo-ps-out.cpp b/src/extension/internal/cairo-ps-out.cpp index 287cf636f..9815088de 100644 --- a/src/extension/internal/cairo-ps-out.cpp +++ b/src/extension/internal/cairo-ps-out.cpp @@ -46,7 +46,7 @@ namespace Internal { bool CairoPsOutput::check (Inkscape::Extension::Extension * /*module*/) { - if (NULL == Inkscape::Extension::db.get(SP_MODULE_KEY_PRINT_CAIRO_PS)) { + if (nullptr == Inkscape::Extension::db.get(SP_MODULE_KEY_PRINT_CAIRO_PS)) { return FALSE; } else { return TRUE; @@ -55,7 +55,7 @@ bool CairoPsOutput::check (Inkscape::Extension::Extension * /*module*/) bool CairoEpsOutput::check (Inkscape::Extension::Extension * /*module*/) { - if (NULL == Inkscape::Extension::db.get(SP_MODULE_KEY_PRINT_CAIRO_EPS)) { + if (nullptr == Inkscape::Extension::db.get(SP_MODULE_KEY_PRINT_CAIRO_EPS)) { return FALSE; } else { return TRUE; @@ -68,7 +68,7 @@ ps_print_document_to_file(SPDocument *doc, gchar const *filename, unsigned int l { doc->ensureUpToDate(); - SPItem *base = NULL; + SPItem *base = nullptr; bool pageBoundingBox = TRUE; if (exportId && strcmp(exportId, "")) { @@ -134,13 +134,13 @@ CairoPsOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar con unsigned int ret; ext = Inkscape::Extension::db.get(SP_MODULE_KEY_PRINT_CAIRO_PS); - if (ext == NULL) + if (ext == nullptr) return; int level = CAIRO_PS_LEVEL_2; try { const gchar *new_level = mod->get_param_enum("PSlevel"); - if((new_level != NULL) && (g_ascii_strcasecmp("PS3", new_level) == 0)) { + if((new_level != nullptr) && (g_ascii_strcasecmp("PS3", new_level) == 0)) { level = CAIRO_PS_LEVEL_3; } } catch(...) {} @@ -180,7 +180,7 @@ CairoPsOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar con bleedmargin_px = mod->get_param_float("bleed"); } catch(...) {} - const gchar *new_exportId = NULL; + const gchar *new_exportId = nullptr; try { new_exportId = mod->get_param_string("exportId"); } catch(...) {} @@ -223,13 +223,13 @@ CairoEpsOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar co unsigned int ret; ext = Inkscape::Extension::db.get(SP_MODULE_KEY_PRINT_CAIRO_EPS); - if (ext == NULL) + if (ext == nullptr) return; int level = CAIRO_PS_LEVEL_2; try { const gchar *new_level = mod->get_param_enum("PSlevel"); - if((new_level != NULL) && (g_ascii_strcasecmp("PS3", new_level) == 0)) { + if((new_level != nullptr) && (g_ascii_strcasecmp("PS3", new_level) == 0)) { level = CAIRO_PS_LEVEL_3; } } catch(...) {} @@ -269,7 +269,7 @@ CairoEpsOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar co bleedmargin_px = mod->get_param_float("bleed"); } catch(...) {} - const gchar *new_exportId = NULL; + const gchar *new_exportId = nullptr; try { new_exportId = mod->get_param_string("exportId"); } catch(...) {} diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index 23c20b968..36f73136b 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -119,15 +119,15 @@ CairoRenderContext::CairoRenderContext(CairoRenderer *parent) : _is_omittext(FALSE), _is_filtertobitmap(FALSE), _bitmapresolution(72), - _stream(NULL), + _stream(nullptr), _is_valid(FALSE), _vector_based_target(FALSE), - _cr(NULL), // Cairo context - _surface(NULL), + _cr(nullptr), // Cairo context + _surface(nullptr), _target(CAIRO_SURFACE_TYPE_IMAGE), _target_format(CAIRO_FORMAT_ARGB32), - _layout(NULL), - _state(NULL), + _layout(nullptr), + _state(nullptr), _renderer(parent), _render_mode(RENDER_MODE_NORMAL), _clip_mode(CLIP_MODE_MASK), @@ -251,12 +251,12 @@ bool CairoRenderContext::setPdfTarget(gchar const *utf8_fn) _vector_based_target = TRUE; #endif - FILE *osf = NULL; - FILE *osp = NULL; + FILE *osf = nullptr; + FILE *osp = nullptr; gsize bytesRead = 0; gsize bytesWritten = 0; - GError *error = NULL; + GError *error = nullptr; gchar *local_fn = g_filename_from_utf8(utf8_fn, -1, &bytesRead, &bytesWritten, &error); gchar const *fn = local_fn; @@ -266,7 +266,7 @@ bool CairoRenderContext::setPdfTarget(gchar const *utf8_fn) * the callers (sp_print_document_to_file, "ret = mod->begin(doc)") wrongly ignores the * return code. */ - if (fn != NULL) { + if (fn != nullptr) { if (*fn == '|') { fn += 1; while (isspace(*fn)) fn += 1; @@ -333,12 +333,12 @@ bool CairoRenderContext::setPsTarget(gchar const *utf8_fn) _vector_based_target = TRUE; #endif - FILE *osf = NULL; - FILE *osp = NULL; + FILE *osf = nullptr; + FILE *osp = nullptr; gsize bytesRead = 0; gsize bytesWritten = 0; - GError *error = NULL; + GError *error = nullptr; gchar *local_fn = g_filename_from_utf8(utf8_fn, -1, &bytesRead, &bytesWritten, &error); gchar const *fn = local_fn; @@ -348,7 +348,7 @@ bool CairoRenderContext::setPsTarget(gchar const *utf8_fn) * the callers (sp_print_document_to_file, "ret = mod->begin(doc)") wrongly ignores the * return code. */ - if (fn != NULL) { + if (fn != nullptr) { if (*fn == '|') { fn += 1; while (isspace(*fn)) fn += 1; @@ -522,7 +522,7 @@ CairoRenderContext::getClipMode(void) const CairoRenderState* CairoRenderContext::_createState(void) { CairoRenderState *state = static_cast<CairoRenderState*>(g_try_malloc(sizeof(CairoRenderState))); - g_assert( state != NULL ); + g_assert( state != nullptr ); state->has_filtereffect = FALSE; state->merge_opacity = TRUE; @@ -530,8 +530,8 @@ CairoRenderState* CairoRenderContext::_createState(void) state->need_layer = FALSE; state->has_overflow = FALSE; state->parent_has_userspace = FALSE; - state->clip_path = NULL; - state->mask = NULL; + state->clip_path = nullptr; + state->mask = nullptr; return state; } @@ -579,14 +579,14 @@ CairoRenderContext::popLayer(void) SPMask *mask = _state->mask; if (clip_path || mask) { - CairoRenderContext *clip_ctx = 0; - cairo_surface_t *clip_mask = 0; + CairoRenderContext *clip_ctx = nullptr; + cairo_surface_t *clip_mask = nullptr; // Apply any clip path first if (clip_path) { TRACE((" Applying clip\n")); if (_render_mode == RENDER_MODE_CLIP) - mask = NULL; // disable mask when performing nested clipping + mask = nullptr; // disable mask when performing nested clipping if (_vector_based_target) { setClipMode(CLIP_MODE_PATH); // Vector @@ -783,7 +783,7 @@ CairoRenderContext::setupSurface(double width, double height) if (_is_valid) return true; - if (_vector_based_target && _stream == NULL) + if (_vector_based_target && _stream == nullptr) return false; _width = width; @@ -796,7 +796,7 @@ CairoRenderContext::setupSurface(double width, double height) os_bbox << "%%BoundingBox: 0 0 " << (int)ceil(width) << (int)ceil(height); // apparently, the numbers should be integers. (see bug 380501) os_pagebbox << "%%PageBoundingBox: 0 0 " << (int)ceil(width) << (int)ceil(height); - cairo_surface_t *surface = NULL; + cairo_surface_t *surface = nullptr; cairo_matrix_t ctm; cairo_matrix_init_identity (&ctm); char buffer[25]; @@ -889,7 +889,7 @@ CairoRenderContext::setSurfaceTarget(cairo_surface_t *surface, bool is_vector, c bool CairoRenderContext::_finishSurfaceSetup(cairo_surface_t *surface, cairo_matrix_t *ctm) { - if(surface == NULL) { + if(surface == nullptr) { return false; } if(CAIRO_STATUS_SUCCESS != cairo_surface_status(surface)) { @@ -932,13 +932,13 @@ CairoRenderContext::finish(bool finish_surface) g_critical("error while rendering output: %s", cairo_status_to_string(status)); cairo_destroy(_cr); - _cr = NULL; + _cr = nullptr; if (finish_surface) cairo_surface_finish(_surface); status = cairo_surface_status(_surface); cairo_surface_destroy(_surface); - _surface = NULL; + _surface = nullptr; if (_layout) g_object_unref(_layout); @@ -950,7 +950,7 @@ CairoRenderContext::finish(bool finish_surface) (void) fflush(_stream); fclose(_stream); - _stream = NULL; + _stream = nullptr; } if (status == CAIRO_STATUS_SUCCESS) @@ -1133,7 +1133,7 @@ CairoRenderContext::_createPatternPainter(SPPaintServer const *const paintserver unsigned dkey = SPItem::display_key_new(1); // show items and render them - for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { + for (SPPattern *pat_i = pat; pat_i != nullptr; pat_i = pat_i->ref ? pat_i->ref->getObject() : nullptr) { if (pat_i && SP_IS_OBJECT(pat_i) && pattern_hasItemChildren(pat_i)) { // find the first one with item children for (auto& child: pat_i->children) { if (SP_IS_ITEM(&child)) { @@ -1162,7 +1162,7 @@ CairoRenderContext::_createPatternPainter(SPPaintServer const *const paintserver delete pattern_ctx; // hide all items - for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { + for (SPPattern *pat_i = pat; pat_i != nullptr; pat_i = pat_i->ref ? pat_i->ref->getObject() : nullptr) { if (pat_i && SP_IS_OBJECT(pat_i) && pattern_hasItemChildren(pat_i)) { // find the first one with item children for (auto& child: pat_i->children) { if (SP_IS_ITEM(&child)) { @@ -1257,7 +1257,7 @@ cairo_pattern_t* CairoRenderContext::_createPatternForPaintServer(SPPaintServer const *const paintserver, Geom::OptRect const &pbox, float alpha) { - cairo_pattern_t *pattern = NULL; + cairo_pattern_t *pattern = nullptr; bool apply_bbox2user = FALSE; if (SP_IS_LINEARGRADIENT (paintserver)) { @@ -1315,7 +1315,7 @@ CairoRenderContext::_createPatternForPaintServer(SPPaintServer const *const pain } else if ( dynamic_cast<SPHatch const *>(paintserver) ) { pattern = _createHatchPainter(paintserver, pbox); } else { - return NULL; + return nullptr; } if (pattern && SP_IS_GRADIENT(paintserver)) { @@ -1441,7 +1441,7 @@ CairoRenderContext::_setStrokeStyle(SPStyle const *style, Geom::OptRect const &p cairo_set_dash(_cr, dashes, ndashes, style->stroke_dashoffset.value); free(dashes); } else { - cairo_set_dash(_cr, NULL, 0, 0.0); // disable dashing + cairo_set_dash(_cr, nullptr, 0, 0.0); // disable dashing } cairo_set_line_width(_cr, style->stroke_width.computed); @@ -1567,7 +1567,7 @@ CairoRenderContext::renderPathVector(Geom::PathVector const & pathv, SPStyle con return true; bool need_layer = ( !_state->merge_opacity && !_state->need_layer && - ( _state->opacity != 1.0 || _state->clip_path != NULL || _state->mask != NULL ) ); + ( _state->opacity != 1.0 || _state->clip_path != nullptr || _state->mask != nullptr ) ); if (!need_layer) cairo_save(_cr); @@ -1689,7 +1689,7 @@ unsigned int CairoRenderContext::_showGlyphs(cairo_t *cr, PangoFont * /*font*/, unsigned int num_glyphs = glyphtext.size(); if (num_glyphs > GLYPH_ARRAY_SIZE) { glyphs = (cairo_glyph_t*)g_try_malloc(sizeof(cairo_glyph_t) * num_glyphs); - if(glyphs == NULL) { + if(glyphs == nullptr) { g_warning("CairorenderContext::_showGlyphs: can not allocate memory for %d glyphs.", num_glyphs); return 0; } @@ -1737,11 +1737,11 @@ CairoRenderContext::renderGlyphtext(PangoFont *font, Geom::Affine const &font_ma // create a cairo_font_face from PangoFont // double size = style->font_size.computed; /// \fixme why is this variable never used? gpointer fonthash = (gpointer)font; - cairo_font_face_t *font_face = NULL; + cairo_font_face_t *font_face = nullptr; if(font_table.find(fonthash)!=font_table.end()) font_face = font_table[fonthash]; - FcPattern *fc_pattern = NULL; + FcPattern *fc_pattern = nullptr; #ifdef USE_PANGO_WIN32 # ifdef CAIRO_HAS_WIN32_FONT @@ -1761,7 +1761,7 @@ CairoRenderContext::renderGlyphtext(PangoFont *font, Geom::Affine const &font_ma # ifdef CAIRO_HAS_FT_FONT PangoFcFont *fc_font = PANGO_FC_FONT(font); fc_pattern = fc_font->font_pattern; - if(font_face == NULL) { + if(font_face == nullptr) { font_face = cairo_ft_font_face_create_for_pattern(fc_pattern); font_table[fonthash] = font_face; } diff --git a/src/extension/internal/cairo-render-context.h b/src/extension/internal/cairo-render-context.h index 401b06885..2cefb297d 100644 --- a/src/extension/internal/cairo-render-context.h +++ b/src/extension/internal/cairo-render-context.h @@ -91,7 +91,7 @@ public: bool setPdfTarget(gchar const *utf8_fn); bool setPsTarget(gchar const *utf8_fn); /** Set the cairo_surface_t from an external source */ - bool setSurfaceTarget(cairo_surface_t *surface, bool is_vector, cairo_matrix_t *ctm=NULL); + bool setSurfaceTarget(cairo_surface_t *surface, bool is_vector, cairo_matrix_t *ctm=nullptr); void setPSLevel(unsigned int level); void setEPS(bool eps); @@ -215,7 +215,7 @@ protected: unsigned int _showGlyphs(cairo_t *cr, PangoFont *font, std::vector<CairoGlyphInfo> const &glyphtext, bool is_stroke); - bool _finishSurfaceSetup(cairo_surface_t *surface, cairo_matrix_t *ctm = NULL); + bool _finishSurfaceSetup(cairo_surface_t *surface, cairo_matrix_t *ctm = nullptr); void _setFillStyle(SPStyle const *style, Geom::OptRect const &pbox); void _setStrokeStyle(SPStyle const *style, Geom::OptRect const &pbox); diff --git a/src/extension/internal/cairo-renderer-pdf-out.cpp b/src/extension/internal/cairo-renderer-pdf-out.cpp index 5b9759c15..333c0eb42 100644 --- a/src/extension/internal/cairo-renderer-pdf-out.cpp +++ b/src/extension/internal/cairo-renderer-pdf-out.cpp @@ -49,7 +49,7 @@ bool CairoRendererPdfOutput::check(Inkscape::Extension::Extension * /*module*/) { bool result = true; - if (NULL == Inkscape::Extension::db.get("org.inkscape.output.pdf.cairorenderer")) { + if (nullptr == Inkscape::Extension::db.get("org.inkscape.output.pdf.cairorenderer")) { result = false; } @@ -65,7 +65,7 @@ pdf_render_document_to_file(SPDocument *doc, gchar const *filename, unsigned int /* Start */ - SPItem *base = NULL; + SPItem *base = nullptr; bool pageBoundingBox = TRUE; if (exportId && strcmp(exportId, "")) { @@ -136,13 +136,13 @@ CairoRendererPdfOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, unsigned int ret; ext = Inkscape::Extension::db.get("org.inkscape.output.pdf.cairorenderer"); - if (ext == NULL) + if (ext == nullptr) return; int level = 0; try { const gchar *new_level = mod->get_param_enum("PDFversion"); - if((new_level != NULL) && (g_ascii_strcasecmp("PDF-1.5", new_level) == 0)) { + if((new_level != nullptr) && (g_ascii_strcasecmp("PDF-1.5", new_level) == 0)) { level = 1; } } @@ -182,7 +182,7 @@ CairoRendererPdfOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, g_warning("Parameter <resolution> might not exist"); } - const gchar *new_exportId = NULL; + const gchar *new_exportId = nullptr; try { new_exportId = mod->get_param_string("exportId"); } diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index b48be2ed7..05605a9d9 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -117,9 +117,9 @@ CairoRenderContext* CairoRenderer::createContext(void) { CairoRenderContext *new_context = new CairoRenderContext(this); - g_assert( new_context != NULL ); + g_assert( new_context != nullptr ); - new_context->_state = NULL; + new_context->_state = nullptr; // create initial render state CairoRenderState *state = new_context->_createState(); @@ -516,7 +516,7 @@ static void sp_asbitmap_render(SPItem *item, CairoRenderContext *ctx) SPDocument *document = item->document; std::unique_ptr<Inkscape::Pixbuf> pb( - sp_generate_internal_bitmap(document, NULL, + sp_generate_internal_bitmap(document, nullptr, bbox->min()[Geom::X], bbox->min()[Geom::Y], bbox->max()[Geom::X], bbox->max()[Geom::Y], width, height, res, res, (guint32) 0xffffff00, item )); @@ -653,7 +653,7 @@ CairoRenderer::setupDocument(CairoRenderContext *ctx, SPDocument *doc, bool page { // PLEASE note when making changes to the boundingbox and transform calculation, corresponding changes should be made to PDFLaTeXRenderer::setupDocument !!! - g_assert( ctx != NULL ); + g_assert( ctx != nullptr ); if (!base) { base = doc->getRoot(); @@ -710,9 +710,9 @@ CairoRenderer::setupDocument(CairoRenderContext *ctx, SPDocument *doc, bool page void CairoRenderer::applyClipPath(CairoRenderContext *ctx, SPClipPath const *cp) { - g_assert( ctx != NULL && ctx->_is_valid ); + g_assert( ctx != nullptr && ctx->_is_valid ); - if (cp == NULL) + if (cp == nullptr) return; CairoRenderContext::CairoRenderMode saved_mode = ctx->getRenderMode(); @@ -766,9 +766,9 @@ CairoRenderer::applyClipPath(CairoRenderContext *ctx, SPClipPath const *cp) void CairoRenderer::applyMask(CairoRenderContext *ctx, SPMask const *mask) { - g_assert( ctx != NULL && ctx->_is_valid ); + g_assert( ctx != nullptr && ctx->_is_valid ); - if (mask == NULL) + if (mask == nullptr) return; // FIXME: the access to the first mask view to obtain the bbox is completely bogus diff --git a/src/extension/internal/cdr-input.cpp b/src/extension/internal/cdr-input.cpp index e6e7d4ed4..bf573cfac 100644 --- a/src/extension/internal/cdr-input.cpp +++ b/src/extension/internal/cdr-input.cpp @@ -245,7 +245,7 @@ SPDocument *CdrInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u #endif if (!libcdr::CDRDocument::isSupported(&input)) { - return NULL; + return nullptr; } RVNGStringVector output; @@ -256,11 +256,11 @@ SPDocument *CdrInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u #else if (!libcdr::CDRDocument::generateSVG(&input, output)) { #endif - return NULL; + return nullptr; } if (output.empty()) { - return NULL; + return nullptr; } std::vector<RVNGString> tmpSVGOutput; @@ -274,12 +274,12 @@ SPDocument *CdrInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u // If only one page is present, import that one without bothering user if (tmpSVGOutput.size() > 1) { - CdrImportDialog *dlg = 0; + CdrImportDialog *dlg = nullptr; if (INKSCAPE.use_gui()) { dlg = new CdrImportDialog(tmpSVGOutput); if (!dlg->showDialog()) { delete dlg; - return NULL; + return nullptr; } } diff --git a/src/extension/internal/emf-inout.cpp b/src/extension/internal/emf-inout.cpp index 54099271b..f8cedcb50 100644 --- a/src/extension/internal/emf-inout.cpp +++ b/src/extension/internal/emf-inout.cpp @@ -80,7 +80,7 @@ Emf::~Emf (void) //The destructor bool Emf::check (Inkscape::Extension::Extension * /*module*/) { - if (NULL == Inkscape::Extension::db.get(PRINT_EMF)) + if (nullptr == Inkscape::Extension::db.get(PRINT_EMF)) return FALSE; return TRUE; } @@ -121,8 +121,8 @@ Emf::print_document_to_file(SPDocument *doc, const gchar *filename) (void) mod->finish(); /* Release arena */ mod->base->invoke_hide(mod->dkey); - mod->base = NULL; - mod->root = NULL; // deleted by invoke_hide + mod->base = nullptr; + mod->root = nullptr; // deleted by invoke_hide /* end */ mod->set_param_string("destination", oldoutput); @@ -138,7 +138,7 @@ Emf::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filena Inkscape::Extension::Extension * ext; ext = Inkscape::Extension::db.get(PRINT_EMF); - if (ext == NULL) + if (ext == nullptr) return; bool new_val = mod->get_param_bool("textToPath"); @@ -166,7 +166,7 @@ Emf::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filena ext->set_param_bool("textToPath", new_val); // ensure usage of dot as decimal separator in scanf/printf functions (indepentendly of current locale) - char *oldlocale = g_strdup(setlocale(LC_NUMERIC, NULL)); + char *oldlocale = g_strdup(setlocale(LC_NUMERIC, nullptr)); setlocale(LC_NUMERIC, "C"); print_document_to_file(doc, filename); @@ -479,11 +479,11 @@ uint32_t Emf::add_image(PEMF_CALLBACK_DATA d, void *pEmr, uint32_t cbBits, uint int dibparams = U_BI_UNKNOWN; // type of image not yet determined MEMPNG mempng; // PNG in memory comes back in this - mempng.buffer = NULL; + mempng.buffer = nullptr; - char *rgba_px = NULL; // RGBA pixels - const char *px = NULL; // DIB pixels - const U_RGBQUAD *ct = NULL; // DIB color table + char *rgba_px = nullptr; // RGBA pixels + const char *px = nullptr; // DIB pixels + const U_RGBQUAD *ct = nullptr; // DIB color table U_RGBQUAD ct2[2]; uint32_t width, height, colortype, numCt, invert; // if needed these values will be set in get_DIB_params if(cbBits && cbBmi && (iUsage == U_DIB_RGB_COLORS)){ @@ -524,7 +524,7 @@ uint32_t Emf::add_image(PEMF_CALLBACK_DATA d, void *pEmr, uint32_t cbBits, uint } } - gchar *base64String=NULL; + gchar *base64String=nullptr; if(dibparams == U_BI_JPEG || dibparams==U_BI_PNG){ // image was binary png or jpg in source file base64String = g_base64_encode((guchar*) px, numCt ); } @@ -749,7 +749,7 @@ int Emf::in_clips(PEMF_CALLBACK_DATA d, const char *test){ void Emf::add_clips(PEMF_CALLBACK_DATA d, const char *clippath, unsigned int logic){ int op = combine_ops_to_livarot(logic); Geom::PathVector combined_vect; - char *combined = NULL; + char *combined = nullptr; if (op >= 0 && d->dc[d->level].clip_id) { unsigned int real_idx = d->dc[d->level].clip_id - 1; Geom::PathVector old_vect = sp_svg_read_pathv(d->clips.strings[real_idx]); @@ -1080,7 +1080,7 @@ std::string Emf::pix_to_xy(PEMF_CALLBACK_DATA d, double x, double y){ void Emf::select_pen(PEMF_CALLBACK_DATA d, int index) { - PU_EMRCREATEPEN pEmr = NULL; + PU_EMRCREATEPEN pEmr = nullptr; if (index >= 0 && index < d->n_obj){ pEmr = (PU_EMRCREATEPEN) d->emf_obj[index].lpEMFR; @@ -1167,7 +1167,7 @@ Emf::select_pen(PEMF_CALLBACK_DATA d, int index) void Emf::select_extpen(PEMF_CALLBACK_DATA d, int index) { - PU_EMREXTCREATEPEN pEmr = NULL; + PU_EMREXTCREATEPEN pEmr = nullptr; if (index >= 0 && index < d->n_obj) pEmr = (PU_EMREXTCREATEPEN) d->emf_obj[index].lpEMFR; @@ -1379,7 +1379,7 @@ Emf::select_brush(PEMF_CALLBACK_DATA d, int index) void Emf::select_font(PEMF_CALLBACK_DATA d, int index) { - PU_EMREXTCREATEFONTINDIRECTW pEmr = NULL; + PU_EMREXTCREATEFONTINDIRECTW pEmr = nullptr; if (index >= 0 && index < d->n_obj) pEmr = (PU_EMREXTCREATEFONTINDIRECTW) d->emf_obj[index].lpEMFR; @@ -1423,7 +1423,7 @@ Emf::select_font(PEMF_CALLBACK_DATA d, int index) d->dc[d->level].style.text_decoration_line.set = true; d->dc[d->level].style.text_decoration_line.inherit = false; // malformed EMF with empty filename may exist, ignore font change if encountered - char *ctmp = U_Utf16leToUtf8((uint16_t *) (pEmr->elfw.elfLogFont.lfFaceName), U_LF_FACESIZE, NULL); + char *ctmp = U_Utf16leToUtf8((uint16_t *) (pEmr->elfw.elfLogFont.lfFaceName), U_LF_FACESIZE, nullptr); if(ctmp){ if (d->dc[d->level].font_name){ free(d->dc[d->level].font_name); } if(*ctmp){ @@ -1448,7 +1448,7 @@ Emf::delete_object(PEMF_CALLBACK_DATA d, int index) // files too big to fit into memory. if (d->emf_obj[index].lpEMFR) free(d->emf_obj[index].lpEMFR); - d->emf_obj[index].lpEMFR = NULL; + d->emf_obj[index].lpEMFR = nullptr; } } @@ -1472,8 +1472,8 @@ int Emf::AI_hack(PU_EMRHEADER pEmr){ char *ptr; ptr = (char *)pEmr; PU_EMRSETMAPMODE nEmr = (PU_EMRSETMAPMODE) (ptr + pEmr->emr.nSize); - char *string = NULL; - if(pEmr->nDescription)string = U_Utf16leToUtf8((uint16_t *)((char *) pEmr + pEmr->offDescription), pEmr->nDescription, NULL); + char *string = nullptr; + if(pEmr->nDescription)string = U_Utf16leToUtf8((uint16_t *)((char *) pEmr + pEmr->offDescription), pEmr->nDescription, nullptr); if(string){ if((pEmr->nDescription >= 13) && (0==strcmp("Adobe Systems",string)) && @@ -1526,12 +1526,12 @@ void Emf::common_image_extraction(PEMF_CALLBACK_DATA d, void *pEmr, tmp_image << " y=\"" << dy << "\"\n x=\"" << dx <<"\"\n "; MEMPNG mempng; // PNG in memory comes back in this - mempng.buffer = NULL; + mempng.buffer = nullptr; - char *rgba_px = NULL; // RGBA pixels - char *sub_px = NULL; // RGBA pixels, subarray - const char *px = NULL; // DIB pixels - const U_RGBQUAD *ct = NULL; // DIB color table + char *rgba_px = nullptr; // RGBA pixels + char *sub_px = nullptr; // RGBA pixels, subarray + const char *px = nullptr; // DIB pixels + const U_RGBQUAD *ct = nullptr; // DIB color table uint32_t width, height, colortype, numCt, invert; // if needed these values will be set in get_DIB_params if(cbBits && cbBmi && (iUsage == U_DIB_RGB_COLORS)){ // next call returns pointers and values, but allocates no memory @@ -1573,7 +1573,7 @@ void Emf::common_image_extraction(PEMF_CALLBACK_DATA d, void *pEmr, } } - gchar *base64String=NULL; + gchar *base64String=nullptr; if(dibparams == U_BI_JPEG){ // image was binary jpg in source file tmp_image << " xlink:href=\"data:image/jpeg;base64,"; base64String = g_base64_encode((guchar*) px, numCt ); @@ -1630,14 +1630,14 @@ int Emf::myEnhMetaFileProc(char *contents, unsigned int length, PEMF_CALLBACK_DA int eDbgComment=0; int eDbgFinal=0; char const* eDbgString = getenv( "INKSCAPE_DBG_EMF" ); - if ( eDbgString != NULL ) { + if ( eDbgString != nullptr ) { if(strstr(eDbgString,"RECORD")){ eDbgRecord = 1; } if(strstr(eDbgString,"COMMENT")){ eDbgComment = 1; } if(strstr(eDbgString,"FINAL")){ eDbgFinal = 1; } } /* initialize the tsp for text reassembly */ - tsp.string = NULL; + tsp.string = nullptr; tsp.ori = 0.0; /* degrees */ tsp.fs = 12.0; /* font size */ tsp.x = 0.0; @@ -1874,14 +1874,14 @@ std::cout << "BEFORE DRAW" // Init the new emf_obj list elements to null, provided the // dynamic allocation succeeded. - if ( d->emf_obj != NULL ) + if ( d->emf_obj != nullptr ) { for( int i=0; i < d->n_obj; ++i ) - d->emf_obj[i].lpEMFR = NULL; + d->emf_obj[i].lpEMFR = nullptr; } //if } else { - d->emf_obj = NULL; + d->emf_obj = nullptr; } break; @@ -2352,7 +2352,7 @@ std::cout << "BEFORE DRAW" } if(d->dc[old_level].font_name){ free(d->dc[old_level].font_name); // else memory leak - d->dc[old_level].font_name = NULL; + d->dc[old_level].font_name = nullptr; } old_level--; } @@ -3095,7 +3095,7 @@ std::cout << "BEFORE DRAW" /* Rotation issues are handled entirely in libTERE now */ - uint32_t *dup_wt = NULL; + uint32_t *dup_wt = nullptr; if( lpEMFR->iType==U_EMR_EXTTEXTOUTA){ /* These should be JUST ASCII, but they might not be... @@ -3103,20 +3103,20 @@ std::cout << "BEFORE DRAW" If not, assume that it holds Latin1. If that fails then something is really screwed up! */ - dup_wt = U_Utf8ToUtf32le((char *) pEmr + pEmr->emrtext.offString, pEmr->emrtext.nChars, NULL); - if(!dup_wt)dup_wt = U_Latin1ToUtf32le((char *) pEmr + pEmr->emrtext.offString, pEmr->emrtext.nChars, NULL); + dup_wt = U_Utf8ToUtf32le((char *) pEmr + pEmr->emrtext.offString, pEmr->emrtext.nChars, nullptr); + if(!dup_wt)dup_wt = U_Latin1ToUtf32le((char *) pEmr + pEmr->emrtext.offString, pEmr->emrtext.nChars, nullptr); if(!dup_wt)dup_wt = unknown_chars(pEmr->emrtext.nChars); } else if( lpEMFR->iType==U_EMR_EXTTEXTOUTW){ - dup_wt = U_Utf16leToUtf32le((uint16_t *)((char *) pEmr + pEmr->emrtext.offString), pEmr->emrtext.nChars, NULL); + dup_wt = U_Utf16leToUtf32le((uint16_t *)((char *) pEmr + pEmr->emrtext.offString), pEmr->emrtext.nChars, nullptr); if(!dup_wt)dup_wt = unknown_chars(pEmr->emrtext.nChars); } else { // U_EMR_SMALLTEXTOUT if(pEmrS->fuOptions & U_ETO_SMALL_CHARS){ - dup_wt = U_Utf8ToUtf32le((char *) pEmrS + roff, cChars, NULL); + dup_wt = U_Utf8ToUtf32le((char *) pEmrS + roff, cChars, nullptr); } else { - dup_wt = U_Utf16leToUtf32le((uint16_t *)((char *) pEmrS + roff), cChars, NULL); + dup_wt = U_Utf16leToUtf32le((uint16_t *)((char *) pEmrS + roff), cChars, nullptr); } if(!dup_wt)dup_wt = unknown_chars(cChars); } @@ -3129,12 +3129,12 @@ std::cout << "BEFORE DRAW" } char *ansi_text; - ansi_text = (char *) U_Utf32leToUtf8((uint32_t *)dup_wt, 0, NULL); + ansi_text = (char *) U_Utf32leToUtf8((uint32_t *)dup_wt, 0, nullptr); free(dup_wt); // Empty string or starts with an invalid escape/control sequence, which is bogus text. Throw it out before g_markup_escape_text can make things worse if(*((uint8_t *)ansi_text) <= 0x1F){ free(ansi_text); - ansi_text=NULL; + ansi_text=nullptr; } if (ansi_text) { @@ -3528,18 +3528,18 @@ void Emf::free_emf_strings(EMF_STRINGS name){ SPDocument * Emf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) { - if (uri == NULL) { - return NULL; + if (uri == nullptr) { + return nullptr; } // ensure usage of dot as decimal separator in scanf/printf functions (indepentendly of current locale) - char *oldlocale = g_strdup(setlocale(LC_NUMERIC, NULL)); + char *oldlocale = g_strdup(setlocale(LC_NUMERIC, nullptr)); setlocale(LC_NUMERIC, "C"); EMF_CALLBACK_DATA d; d.n_obj = 0; //these might not be set otherwise if the input file is corrupt - d.emf_obj = NULL; + d.emf_obj = nullptr; d.dc[0].font_name = strdup("Arial"); // Default font, set only on lowest level, it copies up from there EMF spec says device can pick whatever it wants // set up the size default for patterns in defs. This might not be referenced if there are no patterns defined in the drawing. @@ -3556,12 +3556,12 @@ Emf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) size_t length; char *contents; - if(emf_readdata(uri, &contents, &length))return(NULL); + if(emf_readdata(uri, &contents, &length))return(nullptr); - d.pDesc = NULL; + d.pDesc = nullptr; // set up the text reassembly system - if(!(d.tri = trinfo_init(NULL)))return(NULL); + if(!(d.tri = trinfo_init(nullptr)))return(nullptr); (void) trinfo_load_ft_opts(d.tri, 1, FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP, FT_KERNING_UNSCALED); @@ -3573,7 +3573,7 @@ Emf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) // std::cout << "SVG Output: " << std::endl << d.outsvg << std::endl; - SPDocument *doc = NULL; + SPDocument *doc = nullptr; if (good) { doc = SPDocument::createNewDocFromMem(d.outsvg.c_str(), strlen(d.outsvg.c_str()), TRUE); } diff --git a/src/extension/internal/emf-inout.h b/src/extension/internal/emf-inout.h index 3c2a814aa..bef58b612 100644 --- a/src/extension/internal/emf-inout.h +++ b/src/extension/internal/emf-inout.h @@ -33,7 +33,7 @@ typedef struct emf_object { emf_object() : type(0), level(0), - lpEMFR(NULL) + lpEMFR(nullptr) {}; int type; int level; @@ -44,7 +44,7 @@ typedef struct emf_strings { emf_strings() : size(0), count(0), - strings(NULL) + strings(nullptr) {}; int size; // number of slots allocated in strings int count; // number of slots used in strings @@ -54,7 +54,7 @@ typedef struct emf_strings { typedef struct emf_device_context { emf_device_context() : // SPStyle: class with constructor - font_name(NULL), + font_name(nullptr), clip_id(0), stroke_set(false), stroke_mode(0), stroke_idx(0), stroke_recidx(0), fill_set(false), fill_mode(0), fill_idx(0), fill_recidx(0), @@ -67,7 +67,7 @@ typedef struct emf_device_context { textAlign(0) // worldTransform, cur { - font_name = NULL; + font_name = nullptr; sizeWnd = sizel_set( 0.0, 0.0 ); sizeView = sizel_set( 0.0, 0.0 ); winorg = point32_set( 0.0, 0.0 ); @@ -127,9 +127,9 @@ typedef struct emf_callback_data { dwRop2(U_R2_COPYPEN), dwRop3(0), MMX(0),MMY(0), drawtype(0), - pDesc(NULL), + pDesc(nullptr), // hatches, images, gradients, struct w/ constructor - tri(NULL), + tri(nullptr), n_obj(0) // emf_obj; {}; diff --git a/src/extension/internal/emf-print.cpp b/src/extension/internal/emf-print.cpp index 0b005f8da..ec4594eea 100644 --- a/src/extension/internal/emf-print.cpp +++ b/src/extension/internal/emf-print.cpp @@ -75,8 +75,8 @@ namespace Internal { /* globals */ static double PX2WORLD; static bool FixPPTCharPos, FixPPTDashLine, FixPPTGrad2Polys, FixPPTLinGrad, FixPPTPatternAsHatch, FixImageRot; -static EMFTRACK *et = NULL; -static EMFHANDLES *eht = NULL; +static EMFTRACK *et = nullptr; +static EMFHANDLES *eht = nullptr; void PrintEmf::smuggle_adxkyrtl_out(const char *string, uint32_t **adx, double *ky, int *rtl, int *ndx, float scale) { @@ -85,7 +85,7 @@ void PrintEmf::smuggle_adxkyrtl_out(const char *string, uint32_t **adx, double * uint32_t *ladx; const char *cptr = &string[strlen(string) + 1]; // this works because of the first fake terminator - *adx = NULL; + *adx = nullptr; *ky = 0.0; // set a default value sscanf(cptr, "%7d", ndx); if (!*ndx) { @@ -207,12 +207,12 @@ unsigned int PrintEmf::begin(Inkscape::Extension::Print *mod, SPDocument *doc) p = ansi_uri; } snprintf(buff, sizeof(buff) - 1, "Inkscape %s \1%s\1", Inkscape::version_string, p); - uint16_t *Description = U_Utf8ToUtf16le(buff, 0, NULL); + uint16_t *Description = U_Utf8ToUtf16le(buff, 0, nullptr); int cbDesc = 2 + wchar16len(Description); // also count the final terminator (void) U_Utf16leEdit(Description, '\1', '\0'); // swap the temporary \1 characters for nulls // construct the EMRHEADER record and append it to the EMF in memory - rec = U_EMRHEADER_set(rclBounds, rclFrame, NULL, cbDesc, Description, szlDev, szlMm, 0); + rec = U_EMRHEADER_set(rclBounds, rclFrame, nullptr, cbDesc, Description, szlDev, szlMm, 0); free(Description); if (!rec || emf_append((PU_ENHMETARECORD)rec, et, U_REC_FREE)) { g_error("Fatal programming error in PrintEmf::begin at EMRHEADER"); @@ -301,7 +301,7 @@ unsigned int PrintEmf::begin(Inkscape::Extension::Print *mod, SPDocument *doc) unsigned int PrintEmf::finish(Inkscape::Extension::Print * /*mod*/) { - do_clip_if_present(NULL); // Terminate any open clip. + do_clip_if_present(nullptr); // Terminate any open clip. char *rec; if (!et) { return 0; @@ -310,7 +310,7 @@ unsigned int PrintEmf::finish(Inkscape::Extension::Print * /*mod*/) // earlier versions had flush of fill here, but it never executed and was removed - rec = U_EMREOF_set(0, NULL, et); // generate the EOF record + rec = U_EMREOF_set(0, nullptr, et); // generate the EOF record if (!rec || emf_append((PU_ENHMETARECORD)rec, et, U_REC_FREE)) { g_error("Fatal programming error in PrintEmf::finish"); } @@ -410,8 +410,8 @@ int PrintEmf::create_brush(SPStyle const *style, PU_COLORREF fcolor) } else if (SP_IS_GRADIENT(SP_STYLE_FILL_SERVER(style))) { // must be a gradient // currently we do not do anything with gradients, the code below just sets the color to the average of the stops SPPaintServer *paintserver = style->fill.value.href->getObject(); - SPLinearGradient *lg = NULL; - SPRadialGradient *rg = NULL; + SPLinearGradient *lg = nullptr; + SPRadialGradient *rg = nullptr; if (SP_IS_LINEARGRADIENT(paintserver)) { lg = SP_LINEARGRADIENT(paintserver); @@ -533,8 +533,8 @@ int PrintEmf::create_pen(SPStyle const *style, const Geom::Affine &transform) { U_EXTLOGPEN *elp; U_NUM_STYLEENTRY n_dash = 0; - U_STYLEENTRY *dash = NULL; - char *rec = NULL; + U_STYLEENTRY *dash = nullptr; + char *rec = nullptr; int linestyle = U_PS_SOLID; int linecap = 0; int linejoin = 0; @@ -545,14 +545,14 @@ int PrintEmf::create_pen(SPStyle const *style, const Geom::Affine &transform) U_COLORREF hatchColor; U_COLORREF bkColor; uint32_t width, height; - char *px = NULL; + char *px = nullptr; char *rgba_px; uint32_t cbPx = 0; uint32_t colortype; - PU_RGBQUAD ct = NULL; + PU_RGBQUAD ct = nullptr; int numCt = 0; U_BITMAPINFOHEADER Bmih; - PU_BITMAPINFO Bmi = NULL; + PU_BITMAPINFO Bmi = nullptr; if (!et) { return 0; @@ -729,7 +729,7 @@ int PrintEmf::create_pen(SPStyle const *style, const Geom::Affine &transform) U_RGB(0, 0, 0), U_HS_HORIZONTAL, 0, - NULL); + nullptr); } rec = extcreatepen_set(&pen, eht, Bmi, cbPx, px, elp); @@ -772,7 +772,7 @@ int PrintEmf::create_pen(SPStyle const *style, const Geom::Affine &transform) // set the current pen to the stock object NULL_PEN and then delete the defined pen object, if there is one. void PrintEmf::destroy_pen() { - char *rec = NULL; + char *rec = nullptr; // before an object may be safely deleted it must no longer be selected // select in a stock object to deselect this one, the stock object should // never be used because we always select in a new one before drawing anythingrestore previous brush, necessary??? Would using a default stock object not work? @@ -987,14 +987,14 @@ U_TRIVERTEX PrintEmf::make_trivertex(Geom::Point Pt, U_COLORREF uc){ */ void PrintEmf::do_clip_if_present(SPStyle const *style){ char *rec; - static SPClipPath *scpActive = NULL; + static SPClipPath *scpActive = nullptr; if(!style){ if(scpActive){ // clear the existing clip rec = U_EMRRESTOREDC_set(-1); if (!rec || emf_append((PU_ENHMETARECORD)rec, et, U_REC_FREE)) { g_error("Fatal programming error in PrintEmf::fill at U_EMRRESTOREDC_set"); } - scpActive=NULL; + scpActive=nullptr; } } else { /* The current implementation converts only one level of clipping. If there were more @@ -1005,10 +1005,10 @@ void PrintEmf::do_clip_if_present(SPStyle const *style){ Note, to debug this section of code use print statements on sp_svg_write_path(combined_pathvector). */ /* find the first clip_ref at object or up the stack. There may not be one. */ - SPClipPath *scp = NULL; + SPClipPath *scp = nullptr; SPItem *item = SP_ITEM(style->object); while(1) { - scp = (item->clip_ref ? item->clip_ref->getObject() : NULL); + scp = (item->clip_ref ? item->clip_ref->getObject() : nullptr); if(scp)break; item = SP_ITEM(item->parent); if(!item || SP_IS_ROOT(item))break; // this will never be a clipping path @@ -1020,7 +1020,7 @@ void PrintEmf::do_clip_if_present(SPStyle const *style){ if (!rec || emf_append((PU_ENHMETARECORD)rec, et, U_REC_FREE)) { g_error("Fatal programming error in PrintEmf::fill at U_EMRRESTOREDC_set"); } - scpActive = NULL; + scpActive = nullptr; } if (scp) { // set the new clip @@ -1067,7 +1067,7 @@ void PrintEmf::do_clip_if_present(SPStyle const *style){ } } else { - scpActive = NULL; // no valid path available to draw, so no DC was saved, so no signal to restore + scpActive = nullptr; // no valid path available to draw, so no DC was saved, so no signal to restore } } // change or remove clipping } // scp exists @@ -1133,7 +1133,7 @@ unsigned int PrintEmf::fill( fill_transform = tf; - int brush_stat = create_brush(style, NULL); + int brush_stat = create_brush(style, nullptr); /* native linear gradients are only used if the object is a rectangle AND the gradient is parallel to the sides of the object */ bool is_Rect = false; @@ -1428,7 +1428,7 @@ unsigned int PrintEmf::stroke( Geom::OptRect const &/*pbox*/, Geom::OptRect const &/*dbox*/, Geom::OptRect const &/*bbox*/) { - char *rec = NULL; + char *rec = nullptr; Geom::Affine tf = m_tr_stack.top(); do_clip_if_present(style); // If clipping is needed set it up @@ -1508,7 +1508,7 @@ bool PrintEmf::print_simple_shape(Geom::PathVector const &pathv, const Geom::Aff int moves = 0; int lines = 0; int curves = 0; - char *rec = NULL; + char *rec = nullptr; for (Geom::PathVector::iterator pit = pv.begin(); pit != pv.end(); ++pit) { moves++; @@ -1718,7 +1718,7 @@ unsigned int PrintEmf::image( SPStyle const *style) /** provides indirect link to image object */ { double x1, y1, dw, dh; - char *rec = NULL; + char *rec = nullptr; Geom::Affine tf = m_tr_stack.top(); do_clip_if_present(style); // If clipping is needed set it up @@ -1923,7 +1923,7 @@ unsigned int PrintEmf::draw_pathv_to_EMF(Geom::PathVector const &pathv, const Ge unsigned int PrintEmf::print_pathv(Geom::PathVector const &pathv, const Geom::Affine &transform) { Geom::Affine tf = transform; - char *rec = NULL; + char *rec = nullptr; simple_shape = print_simple_shape(pathv, tf); if (simple_shape || pathv.empty()) { @@ -1976,7 +1976,7 @@ unsigned int PrintEmf::text(Inkscape::Extension::Print * /*mod*/, char const *te } do_clip_if_present(style); // If clipping is needed set it up - char *rec = NULL; + char *rec = nullptr; int ccount, newfont; int fix90n = 0; uint32_t hfont = 0; @@ -2006,7 +2006,7 @@ unsigned int PrintEmf::text(Inkscape::Extension::Print * /*mod*/, char const *te } char *text2 = strdup(text); // because U_Utf8ToUtf16le calls iconv which does not like a const char * - uint16_t *unicode_text = U_Utf8ToUtf16le(text2, 0, NULL); + uint16_t *unicode_text = U_Utf8ToUtf16le(text2, 0, nullptr); free(text2); //translates Unicode to NonUnicode, if possible. If any translate, all will, and all to //the same font, because of code in Layout::print @@ -2058,9 +2058,9 @@ unsigned int PrintEmf::text(Inkscape::Extension::Print * /*mod*/, char const *te // of the special fonts. uint16_t *wfacename; if (!newfont) { - wfacename = U_Utf8ToUtf16le(style->font_family.value, 0, NULL); + wfacename = U_Utf8ToUtf16le(style->font_family.value, 0, nullptr); } else { - wfacename = U_Utf8ToUtf16le(FontName(newfont), 0, NULL); + wfacename = U_Utf8ToUtf16le(FontName(newfont), 0, nullptr); } // Scale the text to the minimum stretch. (It tends to stay within bounding rectangles even if @@ -2084,7 +2084,7 @@ unsigned int PrintEmf::text(Inkscape::Extension::Print * /*mod*/, char const *te wfacename); free(wfacename); - rec = extcreatefontindirectw_set(&hfont, eht, (char *) &lf, NULL); + rec = extcreatefontindirectw_set(&hfont, eht, (char *) &lf, nullptr); if (!rec || emf_append((PU_ENHMETARECORD)rec, et, U_REC_FREE)) { g_error("Fatal programming error in PrintEmf::text at extcreatefontindirectw_set"); } diff --git a/src/extension/internal/filter/bevels.h b/src/extension/internal/filter/bevels.h index 91fe2f8cf..4c2ddc719 100644 --- a/src/extension/internal/filter/bevels.h +++ b/src/extension/internal/filter/bevels.h @@ -45,7 +45,7 @@ protected: public: DiffuseLight ( ) : Filter() { }; - ~DiffuseLight ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~DiffuseLight ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -73,7 +73,7 @@ public: gchar const * DiffuseLight::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream smooth; std::ostringstream elevation; @@ -125,7 +125,7 @@ protected: public: MatteJelly ( ) : Filter() { }; - ~MatteJelly ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~MatteJelly ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -154,7 +154,7 @@ public: gchar const * MatteJelly::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream smooth; std::ostringstream bright; @@ -209,7 +209,7 @@ protected: public: SpecularLight ( ) : Filter() { }; - ~SpecularLight ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~SpecularLight ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -238,7 +238,7 @@ public: gchar const * SpecularLight::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream smooth; std::ostringstream bright; diff --git a/src/extension/internal/filter/blurs.h b/src/extension/internal/filter/blurs.h index 0956b23b6..c99b9efac 100644 --- a/src/extension/internal/filter/blurs.h +++ b/src/extension/internal/filter/blurs.h @@ -46,7 +46,7 @@ protected: public: Blur ( ) : Filter() { }; - ~Blur ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Blur ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -73,7 +73,7 @@ public: gchar const * Blur::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream bbox; std::ostringstream hblur; @@ -117,7 +117,7 @@ protected: public: CleanEdges ( ) : Filter() { }; - ~CleanEdges ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~CleanEdges ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -142,7 +142,7 @@ public: gchar const * CleanEdges::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream blur; @@ -177,7 +177,7 @@ protected: public: CrossBlur ( ) : Filter() { }; - ~CrossBlur ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~CrossBlur ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -211,7 +211,7 @@ public: gchar const * CrossBlur::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream bright; std::ostringstream fade; @@ -252,7 +252,7 @@ protected: public: Feather ( ) : Filter() { }; - ~Feather ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Feather ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -277,7 +277,7 @@ public: gchar const * Feather::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream blur; @@ -317,7 +317,7 @@ protected: public: ImageBlur ( ) : Filter() { }; - ~ImageBlur ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~ImageBlur ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -361,7 +361,7 @@ public: gchar const * ImageBlur::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream hblur; std::ostringstream vblur; diff --git a/src/extension/internal/filter/bumps.h b/src/extension/internal/filter/bumps.h index 95f6170f3..0eaee7a5f 100644 --- a/src/extension/internal/filter/bumps.h +++ b/src/extension/internal/filter/bumps.h @@ -72,7 +72,7 @@ protected: public: Bump ( ) : Filter() { }; - ~Bump ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Bump ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -152,7 +152,7 @@ public: gchar const * Bump::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream simplifyImage; std::ostringstream simplifyBump; @@ -301,7 +301,7 @@ protected: public: WaxBump ( ) : Filter() { }; - ~WaxBump ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~WaxBump ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -372,7 +372,7 @@ public: gchar const * WaxBump::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream simplifyImage; std::ostringstream simplifyBump; diff --git a/src/extension/internal/filter/color.h b/src/extension/internal/filter/color.h index 063073267..ae6bc718c 100644 --- a/src/extension/internal/filter/color.h +++ b/src/extension/internal/filter/color.h @@ -66,7 +66,7 @@ protected: public: Brilliance ( ) : Filter() { }; - ~Brilliance ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Brilliance ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -93,7 +93,7 @@ public: gchar const * Brilliance::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream brightness; std::ostringstream sat; @@ -146,7 +146,7 @@ protected: public: ChannelPaint ( ) : Filter() { }; - ~ChannelPaint ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~ChannelPaint ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -182,7 +182,7 @@ public: gchar const * ChannelPaint::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream saturation; std::ostringstream red; @@ -247,7 +247,7 @@ protected: public: ColorBlindness ( ) : Filter() { }; - ~ColorBlindness ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~ColorBlindness ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -293,7 +293,7 @@ public: gchar const * ColorBlindness::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream type; type << ext->get_param_enum("type"); @@ -322,7 +322,7 @@ protected: public: ColorShift ( ) : Filter() { }; - ~ColorShift ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~ColorShift ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -348,7 +348,7 @@ public: gchar const * ColorShift::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream shift; std::ostringstream sat; @@ -385,7 +385,7 @@ protected: public: Colorize ( ) : Filter() { }; - ~Colorize ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Colorize ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -433,7 +433,7 @@ public: gchar const * Colorize::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream a; std::ostringstream r; @@ -492,7 +492,7 @@ protected: public: ComponentTransfer ( ) : Filter() { }; - ~ComponentTransfer ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~ComponentTransfer ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -522,7 +522,7 @@ public: gchar const * ComponentTransfer::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream CTfunction; const gchar *type = ext->get_param_enum("type"); @@ -577,7 +577,7 @@ protected: public: Duochrome ( ) : Filter() { }; - ~Duochrome ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Duochrome ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -618,7 +618,7 @@ public: gchar const * Duochrome::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream a1; std::ostringstream r1; @@ -702,7 +702,7 @@ protected: public: ExtractChannel ( ) : Filter() { }; - ~ExtractChannel ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~ExtractChannel ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -739,7 +739,7 @@ public: gchar const * ExtractChannel::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream blend; std::ostringstream colors; @@ -808,7 +808,7 @@ protected: public: FadeToBW ( ) : Filter() { }; - ~FadeToBW ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~FadeToBW ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -836,7 +836,7 @@ public: gchar const * FadeToBW::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream level; std::ostringstream wlevel; @@ -887,7 +887,7 @@ protected: public: Greyscale ( ) : Filter() { }; - ~Greyscale ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Greyscale ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -915,7 +915,7 @@ public: gchar const * Greyscale::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream red; std::ostringstream green; @@ -973,7 +973,7 @@ protected: public: Invert ( ) : Filter() { }; - ~Invert ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Invert ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -1007,7 +1007,7 @@ public: gchar const * Invert::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream line1; std::ostringstream line2; @@ -1108,7 +1108,7 @@ protected: public: Lighting ( ) : Filter() { }; - ~Lighting ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Lighting ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -1134,7 +1134,7 @@ public: gchar const * Lighting::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream amplitude; std::ostringstream exponent; @@ -1179,7 +1179,7 @@ protected: public: LightnessContrast ( ) : Filter() { }; - ~LightnessContrast ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~LightnessContrast ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -1204,7 +1204,7 @@ public: gchar const * LightnessContrast::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream lightness; std::ostringstream contrast; @@ -1258,7 +1258,7 @@ protected: public: NudgeRGB ( ) : Filter() { }; - ~NudgeRGB ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~NudgeRGB ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -1297,7 +1297,7 @@ public: gchar const * NudgeRGB::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream rx; std::ostringstream ry; @@ -1370,7 +1370,7 @@ protected: public: NudgeCMY ( ) : Filter() { }; - ~NudgeCMY ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~NudgeCMY ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -1409,7 +1409,7 @@ public: gchar const * NudgeCMY::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream cx; std::ostringstream cy; @@ -1476,7 +1476,7 @@ protected: public: Quadritone ( ) : Filter() { }; - ~Quadritone ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Quadritone ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -1515,7 +1515,7 @@ public: gchar const * Quadritone::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream dist; std::ostringstream colors; @@ -1559,7 +1559,7 @@ protected: public: SimpleBlend ( ) : Filter() { }; - ~SimpleBlend ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~SimpleBlend ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -1600,7 +1600,7 @@ public: gchar const * SimpleBlend::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream a; std::ostringstream r; @@ -1645,7 +1645,7 @@ protected: public: Solarize ( ) : Filter() { }; - ~Solarize ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Solarize ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -1674,7 +1674,7 @@ public: gchar const * Solarize::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream rotate; std::ostringstream blend1; @@ -1732,7 +1732,7 @@ protected: public: Tritone ( ) : Filter() { }; - ~Tritone ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Tritone ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -1785,7 +1785,7 @@ public: gchar const * Tritone::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream dist; std::ostringstream a; diff --git a/src/extension/internal/filter/distort.h b/src/extension/internal/filter/distort.h index 6d1fc0a75..f1654d075 100644 --- a/src/extension/internal/filter/distort.h +++ b/src/extension/internal/filter/distort.h @@ -59,7 +59,7 @@ protected: public: FeltFeather ( ) : Filter() { }; - ~FeltFeather ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~FeltFeather ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -106,7 +106,7 @@ public: gchar const * FeltFeather::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream hblur; @@ -182,7 +182,7 @@ protected: public: Roughen ( ) : Filter() { }; - ~Roughen ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Roughen ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -215,7 +215,7 @@ public: gchar const * Roughen::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream type; std::ostringstream hfreq; diff --git a/src/extension/internal/filter/filter-file.cpp b/src/extension/internal/filter/filter-file.cpp index 07a7eb0af..241f0f52c 100644 --- a/src/extension/internal/filter/filter-file.cpp +++ b/src/extension/internal/filter/filter-file.cpp @@ -34,7 +34,7 @@ void filters_load_file (Glib::ustring filename, gchar * menuname) { Inkscape::XML::Document *doc = sp_repr_read_file(filename.c_str(), INKSCAPE_EXTENSION_URI); - if (doc == NULL) { + if (doc == nullptr) { g_warning("File (%s) is not parseable as XML. Ignored.", filename.c_str()); return; } @@ -47,10 +47,10 @@ filters_load_file (Glib::ustring filename, gchar * menuname) } for (Inkscape::XML::Node * child = root->firstChild(); - child != NULL; child = child->next()) { + child != nullptr; child = child->next()) { if (!strcmp(child->name(), "svg:defs")) { for (Inkscape::XML::Node * defs = child->firstChild(); - defs != NULL; defs = defs->next()) { + defs != nullptr; defs = defs->next()) { if (!strcmp(defs->name(), "svg:filter")) { Filter::filters_load_node(defs, menuname); } // oh! a filter @@ -97,7 +97,7 @@ Filter::filters_load_node (Inkscape::XML::Node * node, gchar * menuname) gchar const * menu_tooltip = node->attribute("inkscape:menu-tooltip"); gchar const * id = node->attribute("id"); - if (label == NULL) { + if (label == nullptr) { label = id; } diff --git a/src/extension/internal/filter/filter.cpp b/src/extension/internal/filter/filter.cpp index 166e5406f..8e32bc05d 100644 --- a/src/extension/internal/filter/filter.cpp +++ b/src/extension/internal/filter/filter.cpp @@ -27,7 +27,7 @@ namespace Filter { Filter::Filter() : Inkscape::Extension::Implementation::Implementation(), - _filter(NULL) { + _filter(nullptr) { return; } @@ -38,8 +38,8 @@ Filter::Filter(gchar const * filter) : } Filter::~Filter (void) { - if (_filter != NULL) { - _filter = NULL; + if (_filter != nullptr) { + _filter = nullptr; } return; @@ -53,7 +53,7 @@ bool Filter::load(Inkscape::Extension::Extension * /*module*/) Inkscape::Extension::Implementation::ImplementationDocumentCache *Filter::newDocCache(Inkscape::Extension::Extension * /*ext*/, Inkscape::UI::View::View * /*doc*/) { - return NULL; + return nullptr; } gchar const *Filter::get_filter_text(Inkscape::Extension::Extension * /*ext*/) @@ -64,7 +64,7 @@ gchar const *Filter::get_filter_text(Inkscape::Extension::Extension * /*ext*/) Inkscape::XML::Document * Filter::get_filter (Inkscape::Extension::Extension * ext) { gchar const * filter = get_filter_text(ext); - return sp_repr_read_mem(filter, strlen(filter), NULL); + return sp_repr_read_mem(filter, strlen(filter), nullptr); } void @@ -72,7 +72,7 @@ Filter::merge_filters( Inkscape::XML::Node * to, Inkscape::XML::Node * from, Inkscape::XML::Document * doc, gchar const * srcGraphic, gchar const * srcGraphicAlpha) { - if (from == NULL) return; + if (from == nullptr) return; // copy attributes for ( Inkscape::Util::List<Inkscape::XML::AttributeRecord const> iter = from->attributeList() ; @@ -83,11 +83,11 @@ Filter::merge_filters( Inkscape::XML::Node * to, Inkscape::XML::Node * from, to->setAttribute(attr, from->attribute(attr)); if (!strcmp(attr, "in") || !strcmp(attr, "in2") || !strcmp(attr, "in3")) { - if (srcGraphic != NULL && !strcmp(from->attribute(attr), "SourceGraphic")) { + if (srcGraphic != nullptr && !strcmp(from->attribute(attr), "SourceGraphic")) { to->setAttribute(attr, srcGraphic); } - if (srcGraphicAlpha != NULL && !strcmp(from->attribute(attr), "SourceAlpha")) { + if (srcGraphicAlpha != nullptr && !strcmp(from->attribute(attr), "SourceAlpha")) { to->setAttribute(attr, srcGraphicAlpha); } } @@ -95,7 +95,7 @@ Filter::merge_filters( Inkscape::XML::Node * to, Inkscape::XML::Node * from, // for each child call recursively for (Inkscape::XML::Node * from_child = from->firstChild(); - from_child != NULL ; from_child = from_child->next()) { + from_child != nullptr ; from_child = from_child->next()) { Glib::ustring name = "svg:"; name += from_child->name(); @@ -103,7 +103,7 @@ Filter::merge_filters( Inkscape::XML::Node * to, Inkscape::XML::Node * from, to->appendChild(to_child); merge_filters(to_child, from_child, doc, srcGraphic, srcGraphicAlpha); - if (from_child == from->firstChild() && !strcmp("filter", from->name()) && srcGraphic != NULL && to_child->attribute("in") == NULL) { + if (from_child == from->firstChild() && !strcmp("filter", from->name()) && srcGraphic != nullptr && to_child->attribute("in") == nullptr) { to_child->setAttribute("in", srcGraphic); } Inkscape::GC::release(to_child); @@ -117,7 +117,7 @@ void Filter::effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::Vie Inkscape::Extension::Implementation::ImplementationDocumentCache * /*docCache*/) { Inkscape::XML::Document *filterdoc = get_filter(module); - if (filterdoc == NULL) { + if (filterdoc == nullptr) { return; // could not parse the XML source of the filter; typically parser will stderr a warning } @@ -136,9 +136,9 @@ void Filter::effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::Vie Inkscape::XML::Node * node = spitem->getRepr(); SPCSSAttr * css = sp_repr_css_attr(node, "style"); - gchar const * filter = sp_repr_css_property(css, "filter", NULL); + gchar const * filter = sp_repr_css_property(css, "filter", nullptr); - if (filter == NULL) { + if (filter == nullptr) { Inkscape::XML::Node * newfilterroot = xmldoc->createElement("svg:filter"); merge_filters(newfilterroot, filterdoc->root(), xmldoc); @@ -159,8 +159,8 @@ void Filter::effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::Vie } gchar * lfilter = g_strndup(filter + 5, strlen(filter) - 6); - Inkscape::XML::Node * filternode = NULL; - for (Inkscape::XML::Node * child = defsrepr->firstChild(); child != NULL; child = child->next()) { + Inkscape::XML::Node * filternode = nullptr; + for (Inkscape::XML::Node * child = defsrepr->firstChild(); child != nullptr; child = child->next()) { if (!strcmp(lfilter, child->attribute("id"))) { filternode = child; break; @@ -169,12 +169,12 @@ void Filter::effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::Vie g_free(lfilter); // no filter - if (filternode == NULL) { + if (filternode == nullptr) { g_warning("no assigned filter found!"); continue; } - if (filternode->lastChild() == NULL) { + if (filternode->lastChild() == nullptr) { // empty filter, we insert merge_filters(filternode, filterdoc->root(), xmldoc); } else { diff --git a/src/extension/internal/filter/filter.h b/src/extension/internal/filter/filter.h index ea4ae2302..3a5b8a811 100644 --- a/src/extension/internal/filter/filter.h +++ b/src/extension/internal/filter/filter.h @@ -37,7 +37,7 @@ protected: private: Inkscape::XML::Document * get_filter (Inkscape::Extension::Extension * ext); - void merge_filters (Inkscape::XML::Node * to, Inkscape::XML::Node * from, Inkscape::XML::Document * doc, gchar const * srcGraphic = NULL, gchar const * srcGraphicAlpha = NULL); + void merge_filters (Inkscape::XML::Node * to, Inkscape::XML::Node * from, Inkscape::XML::Document * doc, gchar const * srcGraphic = nullptr, gchar const * srcGraphicAlpha = nullptr); public: Filter(); diff --git a/src/extension/internal/filter/image.h b/src/extension/internal/filter/image.h index 9cbe05e2f..592e41b9f 100644 --- a/src/extension/internal/filter/image.h +++ b/src/extension/internal/filter/image.h @@ -41,7 +41,7 @@ protected: public: EdgeDetect ( ) : Filter() { }; - ~EdgeDetect ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~EdgeDetect ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -72,7 +72,7 @@ public: gchar const * EdgeDetect::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream matrix; std::ostringstream inverted; diff --git a/src/extension/internal/filter/morphology.h b/src/extension/internal/filter/morphology.h index 025cca8fe..905e71e67 100644 --- a/src/extension/internal/filter/morphology.h +++ b/src/extension/internal/filter/morphology.h @@ -50,7 +50,7 @@ protected: public: Crosssmooth ( ) : Filter() { }; - ~Crosssmooth ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Crosssmooth ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -86,7 +86,7 @@ public: gchar const * Crosssmooth::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream type; std::ostringstream width; @@ -158,7 +158,7 @@ protected: public: Outline ( ) : Filter() { }; - ~Outline ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Outline ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -213,7 +213,7 @@ public: gchar const * Outline::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream width1; std::ostringstream dilat1; diff --git a/src/extension/internal/filter/overlays.h b/src/extension/internal/filter/overlays.h index a0436e2ad..e0f78be9c 100644 --- a/src/extension/internal/filter/overlays.h +++ b/src/extension/internal/filter/overlays.h @@ -48,7 +48,7 @@ protected: public: NoiseFill ( ) : Filter() { }; - ~NoiseFill ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~NoiseFill ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -90,7 +90,7 @@ public: gchar const * NoiseFill::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream type; std::ostringstream hfreq; diff --git a/src/extension/internal/filter/paint.h b/src/extension/internal/filter/paint.h index 653008fc6..aae71fcf3 100644 --- a/src/extension/internal/filter/paint.h +++ b/src/extension/internal/filter/paint.h @@ -63,7 +63,7 @@ protected: public: Chromolitho ( ) : Filter() { }; - ~Chromolitho ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Chromolitho ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -122,7 +122,7 @@ public: gchar const * Chromolitho::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream b1in; std::ostringstream b2in; @@ -224,7 +224,7 @@ protected: public: CrossEngraving ( ) : Filter() { }; - ~CrossEngraving ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~CrossEngraving ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -253,7 +253,7 @@ public: gchar const * CrossEngraving::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream clean; std::ostringstream dilat; @@ -323,7 +323,7 @@ protected: public: Drawing ( ) : Filter() { }; - ~Drawing ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Drawing ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -372,7 +372,7 @@ public: gchar const * Drawing::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream simply; std::ostringstream clean; @@ -486,7 +486,7 @@ protected: public: Electrize ( ) : Filter() { }; - ~Electrize ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Electrize ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -516,7 +516,7 @@ public: gchar const * Electrize::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream blur; std::ostringstream type; @@ -576,7 +576,7 @@ protected: public: NeonDraw ( ) : Filter() { }; - ~NeonDraw ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~NeonDraw ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -611,7 +611,7 @@ public: gchar const * NeonDraw::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream blend; std::ostringstream simply; @@ -679,7 +679,7 @@ protected: public: PointEngraving ( ) : Filter() { }; - ~PointEngraving ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~PointEngraving ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -735,7 +735,7 @@ public: gchar const * PointEngraving::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream type; std::ostringstream hfreq; @@ -842,7 +842,7 @@ protected: public: Posterize ( ) : Filter() { }; - ~Posterize ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Posterize ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -886,7 +886,7 @@ public: gchar const * Posterize::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream table; std::ostringstream blendmode; @@ -965,7 +965,7 @@ protected: public: PosterizeBasic ( ) : Filter() { }; - ~PosterizeBasic ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~PosterizeBasic ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -990,7 +990,7 @@ public: gchar const * PosterizeBasic::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream blur; std::ostringstream transf; diff --git a/src/extension/internal/filter/protrusions.h b/src/extension/internal/filter/protrusions.h index c4cd2a688..0abac91e7 100644 --- a/src/extension/internal/filter/protrusions.h +++ b/src/extension/internal/filter/protrusions.h @@ -39,7 +39,7 @@ protected: public: Snow ( ) : Filter() { }; - ~Snow ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Snow ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } public: static void init (void) { @@ -65,7 +65,7 @@ public: gchar const * Snow::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream drift; drift << ext->get_param_float("drift"); diff --git a/src/extension/internal/filter/shadows.h b/src/extension/internal/filter/shadows.h index cca34e2a2..19cfdaba7 100644 --- a/src/extension/internal/filter/shadows.h +++ b/src/extension/internal/filter/shadows.h @@ -49,7 +49,7 @@ protected: public: ColorizableDropShadow ( ) : Filter() { }; - ~ColorizableDropShadow ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~ColorizableDropShadow ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -91,7 +91,7 @@ public: gchar const * ColorizableDropShadow::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream blur; std::ostringstream a; diff --git a/src/extension/internal/filter/textures.h b/src/extension/internal/filter/textures.h index 39b1789b3..3340643a5 100644 --- a/src/extension/internal/filter/textures.h +++ b/src/extension/internal/filter/textures.h @@ -53,7 +53,7 @@ protected: public: InkBlot ( ) : Filter() { }; - ~InkBlot ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~InkBlot ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } public: static void init (void) { @@ -101,7 +101,7 @@ public: gchar const * InkBlot::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream type; std::ostringstream freq; diff --git a/src/extension/internal/filter/transparency.h b/src/extension/internal/filter/transparency.h index b3498a638..1239c1fac 100644 --- a/src/extension/internal/filter/transparency.h +++ b/src/extension/internal/filter/transparency.h @@ -45,7 +45,7 @@ protected: public: Blend ( ) : Filter() { }; - ~Blend ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Blend ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -80,7 +80,7 @@ public: gchar const * Blend::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream source; std::ostringstream mode; @@ -122,7 +122,7 @@ protected: public: ChannelTransparency ( ) : Filter() { }; - ~ChannelTransparency ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~ChannelTransparency ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -150,7 +150,7 @@ public: gchar const * ChannelTransparency::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream red; std::ostringstream green; @@ -197,7 +197,7 @@ protected: public: LightEraser ( ) : Filter() { }; - ~LightEraser ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~LightEraser ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -224,7 +224,7 @@ public: gchar const * LightEraser::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream expand; std::ostringstream erode; @@ -271,7 +271,7 @@ protected: public: Opacity ( ) : Filter() { }; - ~Opacity ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Opacity ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -297,7 +297,7 @@ public: gchar const * Opacity::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream matrix; std::ostringstream opacity; @@ -333,7 +333,7 @@ protected: public: Silhouette ( ) : Filter() { }; - ~Silhouette ( ) override { if (_filter != NULL) g_free((void *)_filter); return; } + ~Silhouette ( ) override { if (_filter != nullptr) g_free((void *)_filter); return; } static void init (void) { Inkscape::Extension::build_from_mem( @@ -360,7 +360,7 @@ public: gchar const * Silhouette::get_filter_text (Inkscape::Extension::Extension * ext) { - if (_filter != NULL) g_free((void *)_filter); + if (_filter != nullptr) g_free((void *)_filter); std::ostringstream a; std::ostringstream r; diff --git a/src/extension/internal/gdkpixbuf-input.cpp b/src/extension/internal/gdkpixbuf-input.cpp index efac1a02e..ba90c747e 100644 --- a/src/extension/internal/gdkpixbuf-input.cpp +++ b/src/extension/internal/gdkpixbuf-input.cpp @@ -64,14 +64,14 @@ GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri) } bool embed = ( link.compare( "embed" ) == 0 ); - SPDocument *doc = NULL; + SPDocument *doc = nullptr; std::unique_ptr<Inkscape::Pixbuf> pb(Inkscape::Pixbuf::create_from_file(uri)); // TODO: the pixbuf is created again from the base64-encoded attribute in SPImage. // Find a way to create the pixbuf only once. if (pb) { - doc = SPDocument::createNewDoc(NULL, TRUE, TRUE); + doc = SPDocument::createNewDoc(nullptr, TRUE, TRUE); bool saved = DocumentUndo::getUndoSensitive(doc); DocumentUndo::setUndoSensitive(doc, false); // no need to undo in this temporary document @@ -79,7 +79,7 @@ GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri) double height = pb->height(); double defaultxdpi = prefs->getDouble("/dialogs/import/defaultxdpi/value", Inkscape::Util::Quantity::convert(1, "in", "px")); //bool forcexdpi = prefs->getBool("/dialogs/import/forcexdpi"); - ImageResolution *ir = 0; + ImageResolution *ir = nullptr; double xscale = 1; double yscale = 1; @@ -126,7 +126,7 @@ GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri) sp_embed_image(image_node, pb.get()); } else { // convert filename to uri - gchar* _uri = g_filename_to_uri(uri, NULL, NULL); + gchar* _uri = g_filename_to_uri(uri, nullptr, nullptr); if(_uri) { image_node->setAttribute("xlink:href", _uri); g_free(_uri); @@ -174,8 +174,8 @@ GdkpixbufInput::init(void) gchar **extensions = gdk_pixbuf_format_get_extensions(pixformat); gchar **mimetypes = gdk_pixbuf_format_get_mime_types(pixformat); - for (int i = 0; extensions[i] != NULL; i++) { - for (int j = 0; mimetypes[j] != NULL; j++) { + for (int i = 0; extensions[i] != nullptr; i++) { + for (int j = 0; mimetypes[j] != nullptr; j++) { /* thanks but no thanks, we'll handle SVG extensions... */ if (strcmp(extensions[i], "svg") == 0) { diff --git a/src/extension/internal/gimpgrad.cpp b/src/extension/internal/gimpgrad.cpp index e6a429d34..1323ca7bc 100644 --- a/src/extension/internal/gimpgrad.cpp +++ b/src/extension/internal/gimpgrad.cpp @@ -133,13 +133,13 @@ GimpGrad::open (Inkscape::Extension::Input */*module*/, gchar const *filename) { Inkscape::IO::dump_fopen_call(filename, "I"); FILE *gradient = Inkscape::IO::fopen_utf8name(filename, "r"); - if (gradient == NULL) { - return NULL; + if (gradient == nullptr) { + return nullptr; } { char tempstr[1024]; - if (fgets(tempstr, 1024, gradient) == 0) { + if (fgets(tempstr, 1024, gradient) == nullptr) { // std::cout << "Seems that the read failed" << std::endl; goto error; } @@ -149,7 +149,7 @@ GimpGrad::open (Inkscape::Extension::Input */*module*/, gchar const *filename) } /* Name field. */ - if (fgets(tempstr, 1024, gradient) == 0) { + if (fgets(tempstr, 1024, gradient) == nullptr) { // std::cout << "Seems that the second read failed" << std::endl; goto error; } @@ -157,18 +157,18 @@ GimpGrad::open (Inkscape::Extension::Input */*module*/, gchar const *filename) goto error; } /* Handle very long names. (And also handle nul bytes gracefully: don't use strlen.) */ - while (memchr(tempstr, '\n', sizeof(tempstr) - 1) == NULL) { - if (fgets(tempstr, sizeof(tempstr), gradient) == 0) { + while (memchr(tempstr, '\n', sizeof(tempstr) - 1) == nullptr) { + if (fgets(tempstr, sizeof(tempstr), gradient) == nullptr) { goto error; } } /* n. segments */ - if (fgets(tempstr, 1024, gradient) == 0) { + if (fgets(tempstr, 1024, gradient) == nullptr) { // std::cout << "Seems that the third read failed" << std::endl; goto error; } - char *endptr = NULL; + char *endptr = nullptr; long const n_segs = strtol(tempstr, &endptr, 10); if ((*endptr != '\n') || n_segs < 1) { @@ -183,11 +183,11 @@ GimpGrad::open (Inkscape::Extension::Input */*module*/, gchar const *filename) Glib::ustring outsvg("<svg><defs><linearGradient>\n"); long n_segs_found = 0; double prev_right = 0.0; - while (fgets(tempstr, 1024, gradient) != 0) { + while (fgets(tempstr, 1024, gradient) != nullptr) { double dbls[3 + 4 + 4]; gchar *p = tempstr; for (unsigned i = 0; i < G_N_ELEMENTS(dbls); ++i) { - gchar *end = NULL; + gchar *end = nullptr; double const xi = g_ascii_strtod(p, &end); if (!end || end == p || !g_ascii_isspace(*end)) { goto error; @@ -260,7 +260,7 @@ GimpGrad::open (Inkscape::Extension::Input */*module*/, gchar const *filename) error: fclose(gradient); - return NULL; + return nullptr; } #include "clear-n_.h" diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp index c7ebf2494..5347eaa86 100644 --- a/src/extension/internal/grid.cpp +++ b/src/extension/internal/grid.cpp @@ -180,7 +180,7 @@ Grid::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View SPDocument * current_document = view->doc(); auto selected = ((SPDesktop *) view)->getSelection()->items(); - Inkscape::XML::Node * first_select = NULL; + Inkscape::XML::Node * first_select = nullptr; if (!selected.empty()) { first_select = selected.front()->getRepr(); } diff --git a/src/extension/internal/image-resolution.cpp b/src/extension/internal/image-resolution.cpp index 558276999..e5b1e4619 100644 --- a/src/extension/internal/image-resolution.cpp +++ b/src/extension/internal/image-resolution.cpp @@ -110,18 +110,18 @@ void ImageResolution::readpng(char const *fn) { return; } - png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0); + png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); if (!png_ptr) return; png_infop info_ptr = png_create_info_struct(png_ptr); if (!info_ptr) { - png_destroy_read_struct(&png_ptr, 0, 0); + png_destroy_read_struct(&png_ptr, nullptr, nullptr); return; } if (setjmp(png_jmpbuf(png_ptr))) { - png_destroy_read_struct(&png_ptr, &info_ptr, 0); + png_destroy_read_struct(&png_ptr, &info_ptr, nullptr); fclose(fp); return; } @@ -153,7 +153,7 @@ void ImageResolution::readpng(char const *fn) { } #endif - png_destroy_read_struct(&png_ptr, &info_ptr, 0); + png_destroy_read_struct(&png_ptr, &info_ptr, nullptr); fclose(fp); if (ok_) { diff --git a/src/extension/internal/javafx-out.cpp b/src/extension/internal/javafx-out.cpp index d4666fcee..5646eeefd 100644 --- a/src/extension/internal/javafx-out.cpp +++ b/src/extension/internal/javafx-out.cpp @@ -65,11 +65,11 @@ namespace Internal static void err(const char *fmt, ...) { va_list args; - g_log(NULL, G_LOG_LEVEL_WARNING, "javafx-out err: "); + g_log(nullptr, G_LOG_LEVEL_WARNING, "javafx-out err: "); va_start(args, fmt); - g_logv(NULL, G_LOG_LEVEL_WARNING, fmt, args); + g_logv(nullptr, G_LOG_LEVEL_WARNING, fmt, args); va_end(args); - g_log(NULL, G_LOG_LEVEL_WARNING, "\n"); + g_log(nullptr, G_LOG_LEVEL_WARNING, "\n"); } @@ -222,7 +222,7 @@ void JavaFXOutput::out(const char *fmt, ...) */ bool JavaFXOutput::doHeader() { - time_t tim = time(NULL); + time_t tim = time(nullptr); out("/*###################################################################\n"); out("### This JavaFX document was generated by Inkscape\n"); out("### http://www.inkscape.org\n"); diff --git a/src/extension/internal/latex-pstricks-out.cpp b/src/extension/internal/latex-pstricks-out.cpp index 0581f8edd..e1da0bab6 100644 --- a/src/extension/internal/latex-pstricks-out.cpp +++ b/src/extension/internal/latex-pstricks-out.cpp @@ -40,7 +40,7 @@ LatexOutput::~LatexOutput (void) //The destructor bool LatexOutput::check(Inkscape::Extension::Extension * /*module*/) { - bool result = Inkscape::Extension::db.get("org.inkscape.print.latex") != NULL; + bool result = Inkscape::Extension::db.get("org.inkscape.print.latex") != nullptr; return result; } @@ -69,8 +69,8 @@ void LatexOutput::save(Inkscape::Extension::Output * /*mod2*/, SPDocument *doc, mod->finish(); // Release things (mod->base)->invoke_hide(mod->dkey); - mod->base = NULL; - mod->root = NULL; // should have been deleted by invoke_hide + mod->base = nullptr; + mod->root = nullptr; // should have been deleted by invoke_hide // end mod->set_param_string("destination", oldoutput); diff --git a/src/extension/internal/latex-pstricks.cpp b/src/extension/internal/latex-pstricks.cpp index 83100d11e..aa90c4f59 100644 --- a/src/extension/internal/latex-pstricks.cpp +++ b/src/extension/internal/latex-pstricks.cpp @@ -39,7 +39,7 @@ namespace Internal { PrintLatex::PrintLatex (void): _width(0), _height(0), - _stream(NULL) + _stream(nullptr) { } @@ -63,11 +63,11 @@ unsigned int PrintLatex::begin (Inkscape::Extension::Print *mod, SPDocument *doc { Inkscape::SVGOStringStream os; int res; - FILE *osf = NULL; - const gchar * fn = NULL; + FILE *osf = nullptr; + const gchar * fn = nullptr; gsize bytesRead = 0; gsize bytesWritten = 0; - GError* error = NULL; + GError* error = nullptr; os.setf(std::ios::fixed); fn = mod->get_param_string("destination"); @@ -80,7 +80,7 @@ unsigned int PrintLatex::begin (Inkscape::Extension::Print *mod, SPDocument *doc * the callers (sp_print_document_to_file, "ret = mod->begin(doc)") wrongly ignores the * return code. */ - if (fn != NULL) { + if (fn != nullptr) { while (isspace(*fn)) fn += 1; Inkscape::IO::dump_fopen_call(fn, "K"); osf = Inkscape::IO::fopen_utf8name(fn, "w+"); @@ -110,7 +110,7 @@ unsigned int PrintLatex::begin (Inkscape::Extension::Print *mod, SPDocument *doc g_print("Printing failed\n"); /* fixme: should use pclose() for pipes */ fclose(_stream); - _stream = NULL; + _stream = nullptr; fflush(stdout); return 0; } @@ -144,7 +144,7 @@ unsigned int PrintLatex::finish(Inkscape::Extension::Print * /*mod*/) fflush(_stream); fclose(_stream); - _stream = NULL; + _stream = nullptr; } return 0; } diff --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp index 85426e376..c61a95922 100644 --- a/src/extension/internal/latex-text-renderer.cpp +++ b/src/extension/internal/latex-text-renderer.cpp @@ -64,7 +64,7 @@ latex_render_document_text_to_file( SPDocument *doc, gchar const *filename, { doc->ensureUpToDate(); - SPItem *base = NULL; + SPItem *base = nullptr; bool pageBoundingBox = true; if (exportId && strcmp(exportId, "")) { @@ -102,8 +102,8 @@ latex_render_document_text_to_file( SPDocument *doc, gchar const *filename, } LaTeXTextRenderer::LaTeXTextRenderer(bool pdflatex) - : _stream(NULL), - _filename(NULL), + : _stream(nullptr), + _filename(nullptr), _pdflatex(pdflatex), _omittext_state(EMPTY), _omittext_page(1) @@ -136,7 +136,7 @@ LaTeXTextRenderer::~LaTeXTextRenderer(void) */ bool LaTeXTextRenderer::setTargetFile(gchar const *filename) { - if (filename != NULL) { + if (filename != nullptr) { while (isspace(*filename)) filename += 1; _filename = g_path_get_basename(filename); @@ -171,7 +171,7 @@ LaTeXTextRenderer::setTargetFile(gchar const *filename) { g_print("Output to LaTeX file failed\n"); /* fixme: should use pclose() for pipes */ fclose(_stream); - _stream = NULL; + _stream = nullptr; fflush(stdout); return false; } @@ -281,8 +281,8 @@ void LaTeXTextRenderer::sp_text_render(SPText *textobj) // get position and alignment // Align vertically on the baseline of the font (retrieved from the anchor point) // Align horizontally on anchorpoint - gchar const *alignment = NULL; - gchar const *aligntabular = NULL; + gchar const *alignment = nullptr; + gchar const *aligntabular = nullptr; switch (style->text_anchor.computed) { case SP_CSS_TEXT_ANCHOR_START: alignment = "[lt]"; @@ -437,7 +437,7 @@ Flowing in rectangle is possible, not in arb shape. SPStyle *style = flowtext->style; - SPItem *frame_item = flowtext->get_frame(NULL); + SPItem *frame_item = flowtext->get_frame(nullptr); SPRect *frame = dynamic_cast<SPRect *>(frame_item); if (!frame_item || !frame) { g_warning("LaTeX export: non-rectangular flowed text shapes are not supported, skipping text."); diff --git a/src/extension/internal/metafile-inout.cpp b/src/extension/internal/metafile-inout.cpp index ae79c8a8a..b90af9529 100644 --- a/src/extension/internal/metafile-inout.cpp +++ b/src/extension/internal/metafile-inout.cpp @@ -93,32 +93,32 @@ Metafile::my_png_write_data(png_structp png_ptr, png_bytep data, png_size_t leng void Metafile::toPNG(PMEMPNG accum, int width, int height, const char *px){ bitmap_t bmStore; bitmap_t *bitmap = &bmStore; - accum->buffer=NULL; // PNG constructed in memory will end up here, caller must free(). + accum->buffer=nullptr; // PNG constructed in memory will end up here, caller must free(). accum->size=0; bitmap->pixels=(pixel_t *)px; bitmap->width = width; bitmap->height = height; - png_structp png_ptr = NULL; - png_infop info_ptr = NULL; + png_structp png_ptr = nullptr; + png_infop info_ptr = nullptr; size_t x, y; - png_byte ** row_pointers = NULL; + png_byte ** row_pointers = nullptr; /* The following number is set by trial and error only. I cannot see where it it is documented in the libpng manual. */ int pixel_size = 3; int depth = 8; - png_ptr = png_create_write_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); - if (png_ptr == NULL){ - accum->buffer=NULL; + png_ptr = png_create_write_struct (PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); + if (png_ptr == nullptr){ + accum->buffer=nullptr; return; } info_ptr = png_create_info_struct (png_ptr); - if (info_ptr == NULL){ + if (info_ptr == nullptr){ png_destroy_write_struct (&png_ptr, &info_ptr); - accum->buffer=NULL; + accum->buffer=nullptr; return; } @@ -126,7 +126,7 @@ void Metafile::toPNG(PMEMPNG accum, int width, int height, const char *px){ if (setjmp (png_jmpbuf (png_ptr))) { png_destroy_write_struct (&png_ptr, &info_ptr); - accum->buffer=NULL; + accum->buffer=nullptr; return; } @@ -163,9 +163,9 @@ void Metafile::toPNG(PMEMPNG accum, int width, int height, const char *px){ png_set_rows (png_ptr, info_ptr, row_pointers); - png_set_write_fn(png_ptr, accum, my_png_write_data, NULL); + png_set_write_fn(png_ptr, accum, my_png_write_data, nullptr); - png_write_png (png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL); + png_write_png (png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, nullptr); for (y = 0; y < bitmap->height; y++) { png_free (png_ptr, row_pointers[y]); @@ -186,7 +186,7 @@ void Metafile::setViewBoxIfMissing(SPDocument *doc) { doc->ensureUpToDate(); // Set document unit - Inkscape::XML::Node *repr = sp_document_namedview(doc, 0)->getRepr(); + Inkscape::XML::Node *repr = sp_document_namedview(doc, nullptr)->getRepr(); Inkscape::SVGOStringStream os; Inkscape::Util::Unit const* doc_unit = doc->getWidth().unit; os << doc_unit->abbr; diff --git a/src/extension/internal/metafile-print.cpp b/src/extension/internal/metafile-print.cpp index fb44f8499..4bb8eae32 100644 --- a/src/extension/internal/metafile-print.cpp +++ b/src/extension/internal/metafile-print.cpp @@ -89,7 +89,7 @@ bool PrintMetafile::_load_ppt_fontfix_data() //this is not called by any other return (ppt_fontfix_available = false); } - char *oldlocale = g_strdup(setlocale(LC_NUMERIC, NULL)); + char *oldlocale = g_strdup(setlocale(LC_NUMERIC, nullptr)); setlocale(LC_NUMERIC, "C"); std::string instr; @@ -271,7 +271,7 @@ void PrintMetafile::hatch_classify(char *name, int *hatchType, U_COLORREF *hatch void PrintMetafile::brush_classify(SPObject *parent, int depth, Inkscape::Pixbuf **epixbuf, int *hatchType, U_COLORREF *hatchColor, U_COLORREF *bkColor) { if (depth == 0) { - *epixbuf = NULL; + *epixbuf = nullptr; *hatchType = -1; *hatchColor = U_RGB(0, 0, 0); *bkColor = U_RGB(255, 255, 255); @@ -279,7 +279,7 @@ void PrintMetafile::brush_classify(SPObject *parent, int depth, Inkscape::Pixbuf depth++; // first look along the pattern chain, if there is one if (SP_IS_PATTERN(parent)) { - for (SPPattern *pat_i = SP_PATTERN(parent); pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { + for (SPPattern *pat_i = SP_PATTERN(parent); pat_i != nullptr; pat_i = pat_i->ref ? pat_i->ref->getObject() : nullptr) { if (SP_IS_IMAGE(pat_i)) { *epixbuf = ((SPImage *)pat_i)->pixbuf; return; diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp index 42c2bbae3..2c25ea1f4 100644 --- a/src/extension/internal/odf.cpp +++ b/src/extension/internal/odf.cpp @@ -218,7 +218,7 @@ private: virtual void init() { badval = 0.0; - d = NULL; + d = nullptr; rows = 0; cols = 0; size = 0; @@ -229,7 +229,7 @@ private: if (d) { delete[] d; - d = 0; + d = nullptr; } rows = other.rows; cols = other.cols; @@ -289,7 +289,7 @@ public: SingularValueDecomposition (const SVDMatrix &mat) : A (mat), U (), - s (NULL), + s (nullptr), s_size (0), V () { @@ -1010,7 +1010,7 @@ static void gatherText(Inkscape::XML::Node *node, Glib::ustring &buf) } for (Inkscape::XML::Node *child = node->firstChild() ; - child != NULL; child = child->next()) + child != nullptr; child = child->next()) { gatherText(child, buf); } @@ -1466,7 +1466,7 @@ bool OdfOutput::processGradient(SPItem *item, //## Gradient SPGradient *gradient = SP_GRADIENT((checkFillGradient?(SP_STYLE_FILL_SERVER(style)) :(SP_STYLE_STROKE_SERVER(style)))); - if (gradient == NULL) + if (gradient == nullptr) { return false; } @@ -1644,7 +1644,7 @@ bool OdfOutput::writeTree(Writer &couts, Writer &souts, analyzeTransform(tf, rotate, xskew, yskew, xscale, yscale); //# Do our stuff - SPCurve *curve = NULL; + SPCurve *curve = nullptr; if (nodeName == "svg" || nodeName == "svg:svg") { @@ -2038,7 +2038,7 @@ bool OdfOutput::writeContent(ZipFile &zf, Inkscape::XML::Node *node) //# Descend into the tree, doing all of our conversions //# to both files at the same time - char *oldlocale = g_strdup (setlocale (LC_NUMERIC, NULL)); + char *oldlocale = g_strdup (setlocale (LC_NUMERIC, nullptr)); setlocale (LC_NUMERIC, "C"); if (!writeTree(couts, souts, node)) { diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp index 552051eed..d078b5a9b 100644 --- a/src/extension/internal/pdfinput/pdf-input.cpp +++ b/src/extension/internal/pdfinput/pdf-input.cpp @@ -357,7 +357,7 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/) _preview_height = 300; // Init preview - _thumb_data = NULL; + _thumb_data = nullptr; _pageNumberSpin_adj->set_value(1.0); _current_page = 1; _setPreviewPage(_current_page); @@ -594,7 +594,7 @@ void PdfImportDialog::_setPreviewPage(int page) { if (!_render_thumb) { if (_thumb_data) { gfree(_thumb_data); - _thumb_data = NULL; + _thumb_data = nullptr; } if (!_previewed_page->loadThumb(&_thumb_data, &_thumb_width, &_thumb_height, &_thumb_rowstride)) { @@ -714,7 +714,7 @@ PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) { // poppler does not use glib g_open. So on win32 we must use unicode call. code was copied from // glib gstdio.c GooString *filename_goo = new GooString(uri); - PDFDoc *pdf_doc = new PDFDoc(filename_goo, NULL, NULL, NULL); // TODO: Could ask for password + PDFDoc *pdf_doc = new PDFDoc(filename_goo, nullptr, nullptr, nullptr); // TODO: Could ask for password //delete filename_goo; #else wchar_t *wfilename = reinterpret_cast<wchar_t*>(g_utf8_to_utf16 (uri, -1, NULL, NULL, NULL)); @@ -754,17 +754,17 @@ PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) { g_message("Failed to load document from data (error %d)", error); } - return NULL; + return nullptr; } - PdfImportDialog *dlg = NULL; + PdfImportDialog *dlg = nullptr; if (INKSCAPE.use_gui()) { dlg = new PdfImportDialog(pdf_doc, uri); if (!dlg->showDialog()) { _cancelled = true; delete dlg; delete pdf_doc; - return NULL; + return nullptr; } } @@ -779,12 +779,12 @@ PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) { #endif } - SPDocument *doc = NULL; + SPDocument *doc = nullptr; bool saved = false; if(!is_importvia_poppler) { // native importer - doc = SPDocument::createNewDoc(NULL, TRUE, TRUE); + doc = SPDocument::createNewDoc(nullptr, TRUE, TRUE); saved = DocumentUndo::getUndoSensitive(doc); DocumentUndo::setUndoSensitive(doc, false); // No need to undo in this temporary document @@ -802,7 +802,7 @@ PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) { dlg->getImportSettings(prefs); // Apply crop settings - PDFRectangle *clipToBox = NULL; + PDFRectangle *clipToBox = nullptr; double crop_setting; sp_repr_get_double(prefs, "cropTo", &crop_setting); diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp index caaeca18e..fbcb708fe 100644 --- a/src/extension/internal/pdfinput/pdf-parser.cpp +++ b/src/extension/internal/pdfinput/pdf-parser.cpp @@ -264,13 +264,13 @@ GfxPatch blankPatch() class ClipHistoryEntry { public: - ClipHistoryEntry(GfxPath *clipPath = NULL, GfxClipType clipType = clipNormal); + ClipHistoryEntry(GfxPath *clipPath = nullptr, GfxClipType clipType = clipNormal); virtual ~ClipHistoryEntry(); // Manipulate clip path stack ClipHistoryEntry *save(); ClipHistoryEntry *restore(); - GBool hasSaves() { return saved != NULL; } + GBool hasSaves() { return saved != nullptr; } void setClip(GfxPath *newClipPath, GfxClipType newClipType = clipNormal); GfxPath *getClipPath() { return clipPath; } GfxClipType getClipType() { return clipType; } @@ -300,18 +300,18 @@ PdfParser::PdfParser(XRef *xrefA, builder(builderA), subPage(gFalse), printCommands(false), - res(new GfxResources(xref, resDict, NULL)), // start the resource stack + res(new GfxResources(xref, resDict, nullptr)), // start the resource stack state(new GfxState(72.0, 72.0, box, rotate, gTrue)), fontChanged(gFalse), clip(clipNone), ignoreUndef(0), baseMatrix(), formDepth(0), - parser(NULL), + parser(nullptr), colorDeltas(), maxDepths(), clipHistory(new ClipHistoryEntry()), - operatorHistory(NULL) + operatorHistory(nullptr) { setDefaultApproximationPrecision(); builder->setDocumentSize(Inkscape::Util::Quantity::convert(state->getPageWidth(), "pt", "px"), @@ -357,18 +357,18 @@ PdfParser::PdfParser(XRef *xrefA, builder(builderA), subPage(gTrue), printCommands(false), - res(new GfxResources(xref, resDict, NULL)), // start the resource stack + res(new GfxResources(xref, resDict, nullptr)), // start the resource stack state(new GfxState(72, 72, box, 0, gFalse)), fontChanged(gFalse), clip(clipNone), ignoreUndef(0), baseMatrix(), formDepth(0), - parser(NULL), + parser(nullptr), colorDeltas(), maxDepths(), clipHistory(new ClipHistoryEntry()), - operatorHistory(NULL) + operatorHistory(nullptr) { setDefaultApproximationPrecision(); @@ -399,12 +399,12 @@ PdfParser::~PdfParser() { if (state) { delete state; - state = NULL; + state = nullptr; } if (clipHistory) { delete clipHistory; - clipHistory = NULL; + clipHistory = nullptr; } } @@ -436,7 +436,7 @@ void PdfParser::parse(Object *obj, GBool topLevel) { parser = new Parser(xref, new Lexer(xref, obj), gFalse); go(topLevel); delete parser; - parser = NULL; + parser = nullptr; } void PdfParser::go(GBool /*topLevel*/) @@ -531,38 +531,38 @@ void PdfParser::pushOperator(const char *name) { OpHistoryEntry *newEntry = new OpHistoryEntry; newEntry->name = name; - newEntry->state = NULL; - newEntry->depth = (operatorHistory != NULL ? (operatorHistory->depth+1) : 0); + newEntry->state = nullptr; + newEntry->depth = (operatorHistory != nullptr ? (operatorHistory->depth+1) : 0); newEntry->next = operatorHistory; operatorHistory = newEntry; // Truncate list if needed if (operatorHistory->depth > maxOperatorHistoryDepth) { OpHistoryEntry *curr = operatorHistory; - OpHistoryEntry *prev = NULL; - while (curr && curr->next != NULL) { + OpHistoryEntry *prev = nullptr; + while (curr && curr->next != nullptr) { curr->depth--; prev = curr; curr = curr->next; } if (prev) { - if (curr->state != NULL) + if (curr->state != nullptr) delete curr->state; delete curr; - prev->next = NULL; + prev->next = nullptr; } } } const char *PdfParser::getPreviousOperator(unsigned int look_back) { - OpHistoryEntry *prev = NULL; - if (operatorHistory != NULL && look_back > 0) { + OpHistoryEntry *prev = nullptr; + if (operatorHistory != nullptr && look_back > 0) { prev = operatorHistory->next; - while (--look_back > 0 && prev != NULL) { + while (--look_back > 0 && prev != nullptr) { prev = prev->next; } } - if (prev != NULL) { + if (prev != nullptr) { return prev->name; } else { return ""; @@ -635,7 +635,7 @@ PdfOperator* PdfParser::findOp(char *name) { a = b = m; } if (cmp != 0) - return NULL; + return nullptr; return &opTab[a]; } @@ -712,7 +712,7 @@ void PdfParser::opConcat(Object args[], int /*numArgs*/) // TODO not good that numArgs is ignored but args[] is used: void PdfParser::opSetDash(Object args[], int /*numArgs*/) { - double *dash = 0; + double *dash = nullptr; Array *a = args[0].getArray(); int length = a->getLength(); @@ -770,7 +770,7 @@ void PdfParser::opSetLineWidth(Object args[], int /*numArgs*/) void PdfParser::opSetExtGState(Object args[], int /*numArgs*/) { Object obj1, obj2, obj3, obj4, obj5; - Function *funcs[4] = {0, 0, 0, 0}; + Function *funcs[4] = {nullptr, nullptr, nullptr, nullptr}; GfxColor backdropColor; GBool haveBackdropColor = gFalse; GBool alpha = gFalse; @@ -876,7 +876,7 @@ void PdfParser::opSetExtGState(Object args[], int /*numArgs*/) } if (obj2.isName(const_cast<char*>("Default")) || obj2.isName(const_cast<char*>("Identity"))) { - funcs[0] = funcs[1] = funcs[2] = funcs[3] = NULL; + funcs[0] = funcs[1] = funcs[2] = funcs[3] = nullptr; state->setTransfer(funcs); } else if (obj2.isArray() && obj2.arrayGetLength() == 4) { int pos = 4; @@ -900,7 +900,7 @@ void PdfParser::opSetExtGState(Object args[], int /*numArgs*/) } } else if (obj2.isName() || obj2.isDict() || obj2.isStream()) { if ((funcs[0] = Function::parse(&obj2))) { - funcs[1] = funcs[2] = funcs[3] = NULL; + funcs[1] = funcs[2] = funcs[3] = nullptr; state->setTransfer(funcs); } } else if (!obj2.isNull()) { @@ -931,7 +931,7 @@ void PdfParser::opSetExtGState(Object args[], int /*numArgs*/) #if !defined(POPPLER_NEW_OBJECT_API) obj3.free(); #endif - funcs[0] = NULL; + funcs[0] = nullptr; #if defined(POPPLER_NEW_OBJECT_API) if (!((obj3 = obj2.dictLookup(const_cast<char*>("TR"))).isNull())) { #else @@ -942,7 +942,7 @@ void PdfParser::opSetExtGState(Object args[], int /*numArgs*/) funcs[0]->getOutputSize() != 1) { error(errSyntaxError, getPos(), "Invalid transfer function in soft mask in ExtGState"); delete funcs[0]; - funcs[0] = NULL; + funcs[0] = nullptr; } } #if defined(POPPLER_NEW_OBJECT_API) @@ -976,7 +976,7 @@ void PdfParser::opSetExtGState(Object args[], int /*numArgs*/) if (obj2.dictLookup(const_cast<char*>("G"), &obj3)->isStream()) { if (obj3.streamGetDict()->lookup(const_cast<char*>("Group"), &obj4)->isDict()) { #endif - GfxColorSpace *blendingColorSpace = 0; + GfxColorSpace *blendingColorSpace = nullptr; GBool isolated = gFalse; GBool knockout = gFalse; #if defined(POPPLER_NEW_OBJECT_API) @@ -985,7 +985,7 @@ void PdfParser::opSetExtGState(Object args[], int /*numArgs*/) if (!obj4.dictLookup(const_cast<char*>("CS"), &obj5)->isNull()) { #endif #if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API) - blendingColorSpace = GfxColorSpace::parse(NULL, &obj5, NULL, NULL); + blendingColorSpace = GfxColorSpace::parse(nullptr, &obj5, nullptr, nullptr); #elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API) blendingColorSpace = GfxColorSpace::parse(&obj5, NULL, NULL); #else @@ -1140,7 +1140,7 @@ void PdfParser::doSoftMask(Object *str, GBool alpha, #else dict->lookup(const_cast<char*>("Resources"), &obj1); #endif - resDict = obj1.isDict() ? obj1.getDict() : (Dict *)NULL; + resDict = obj1.isDict() ? obj1.getDict() : (Dict *)nullptr; // draw it ++formDepth; @@ -1170,7 +1170,7 @@ void PdfParser::opSetFillGray(Object args[], int /*numArgs*/) { GfxColor color; - state->setFillPattern(NULL); + state->setFillPattern(nullptr); state->setFillColorSpace(new GfxDeviceGrayColorSpace()); color.c[0] = dblToCol(args[0].getNum()); state->setFillColor(&color); @@ -1182,7 +1182,7 @@ void PdfParser::opSetStrokeGray(Object args[], int /*numArgs*/) { GfxColor color; - state->setStrokePattern(NULL); + state->setStrokePattern(nullptr); state->setStrokeColorSpace(new GfxDeviceGrayColorSpace()); color.c[0] = dblToCol(args[0].getNum()); state->setStrokeColor(&color); @@ -1195,7 +1195,7 @@ void PdfParser::opSetFillCMYKColor(Object args[], int /*numArgs*/) GfxColor color; int i; - state->setFillPattern(NULL); + state->setFillPattern(nullptr); state->setFillColorSpace(new GfxDeviceCMYKColorSpace()); for (i = 0; i < 4; ++i) { color.c[i] = dblToCol(args[i].getNum()); @@ -1209,7 +1209,7 @@ void PdfParser::opSetStrokeCMYKColor(Object args[], int /*numArgs*/) { GfxColor color; - state->setStrokePattern(NULL); + state->setStrokePattern(nullptr); state->setStrokeColorSpace(new GfxDeviceCMYKColorSpace()); for (int i = 0; i < 4; ++i) { color.c[i] = dblToCol(args[i].getNum()); @@ -1223,7 +1223,7 @@ void PdfParser::opSetFillRGBColor(Object args[], int /*numArgs*/) { GfxColor color; - state->setFillPattern(NULL); + state->setFillPattern(nullptr); state->setFillColorSpace(new GfxDeviceRGBColorSpace()); for (int i = 0; i < 3; ++i) { color.c[i] = dblToCol(args[i].getNum()); @@ -1236,7 +1236,7 @@ void PdfParser::opSetFillRGBColor(Object args[], int /*numArgs*/) void PdfParser::opSetStrokeRGBColor(Object args[], int /*numArgs*/) { GfxColor color; - state->setStrokePattern(NULL); + state->setStrokePattern(nullptr); state->setStrokeColorSpace(new GfxDeviceRGBColorSpace()); for (int i = 0; i < 3; ++i) { color.c[i] = dblToCol(args[i].getNum()); @@ -1250,19 +1250,19 @@ void PdfParser::opSetFillColorSpace(Object args[], int /*numArgs*/) { Object obj; - state->setFillPattern(NULL); + state->setFillPattern(nullptr); #if defined(POPPLER_NEW_OBJECT_API) obj = res->lookupColorSpace(args[0].getName()); #else res->lookupColorSpace(args[0].getName(), &obj); #endif - GfxColorSpace *colorSpace = 0; + GfxColorSpace *colorSpace = nullptr; #if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API) if (obj.isNull()) { - colorSpace = GfxColorSpace::parse(NULL, &args[0], NULL, NULL); + colorSpace = GfxColorSpace::parse(nullptr, &args[0], nullptr, nullptr); } else { - colorSpace = GfxColorSpace::parse(NULL, &obj, NULL, NULL); + colorSpace = GfxColorSpace::parse(nullptr, &obj, nullptr, nullptr); } #elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API) if (obj.isNull()) { @@ -1295,9 +1295,9 @@ void PdfParser::opSetFillColorSpace(Object args[], int /*numArgs*/) void PdfParser::opSetStrokeColorSpace(Object args[], int /*numArgs*/) { Object obj; - GfxColorSpace *colorSpace = 0; + GfxColorSpace *colorSpace = nullptr; - state->setStrokePattern(NULL); + state->setStrokePattern(nullptr); #if defined(POPPLER_NEW_OBJECT_API) obj = res->lookupColorSpace(args[0].getName()); #else @@ -1305,9 +1305,9 @@ void PdfParser::opSetStrokeColorSpace(Object args[], int /*numArgs*/) #endif #if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API) if (obj.isNull()) { - colorSpace = GfxColorSpace::parse(NULL, &args[0], NULL, NULL); + colorSpace = GfxColorSpace::parse(nullptr, &args[0], nullptr, nullptr); } else { - colorSpace = GfxColorSpace::parse(NULL, &obj, NULL, NULL); + colorSpace = GfxColorSpace::parse(nullptr, &obj, nullptr, nullptr); } #elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API) if (obj.isNull()) { @@ -1344,7 +1344,7 @@ void PdfParser::opSetFillColor(Object args[], int numArgs) { error(errSyntaxError, getPos(), "Incorrect number of arguments in 'sc' command"); return; } - state->setFillPattern(NULL); + state->setFillPattern(nullptr); for (i = 0; i < numArgs; ++i) { color.c[i] = dblToCol(args[i].getNum()); } @@ -1360,7 +1360,7 @@ void PdfParser::opSetStrokeColor(Object args[], int numArgs) { error(errSyntaxError, getPos(), "Incorrect number of arguments in 'SC' command"); return; } - state->setStrokePattern(NULL); + state->setStrokePattern(nullptr); for (i = 0; i < numArgs; ++i) { color.c[i] = dblToCol(args[i].getNum()); } @@ -1391,7 +1391,7 @@ void PdfParser::opSetFillColorN(Object args[], int numArgs) { GfxPattern *pattern; #if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API) if (args[numArgs-1].isName() && - (pattern = res->lookupPattern(args[numArgs-1].getName(), NULL, NULL))) { + (pattern = res->lookupPattern(args[numArgs-1].getName(), nullptr, nullptr))) { state->setFillPattern(pattern); builder->updateStyle(state); } @@ -1408,7 +1408,7 @@ void PdfParser::opSetFillColorN(Object args[], int numArgs) { error(errSyntaxError, getPos(), "Incorrect number of arguments in 'scn' command"); return; } - state->setFillPattern(NULL); + state->setFillPattern(nullptr); for (i = 0; i < numArgs && i < gfxColorMaxComps; ++i) { if (args[i].isNum()) { color.c[i] = dblToCol(args[i].getNum()); @@ -1443,7 +1443,7 @@ void PdfParser::opSetStrokeColorN(Object args[], int numArgs) { GfxPattern *pattern; #if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API) if (args[numArgs-1].isName() && - (pattern = res->lookupPattern(args[numArgs-1].getName(), NULL, NULL))) { + (pattern = res->lookupPattern(args[numArgs-1].getName(), nullptr, nullptr))) { state->setStrokePattern(pattern); builder->updateStyle(state); } @@ -1460,7 +1460,7 @@ void PdfParser::opSetStrokeColorN(Object args[], int numArgs) { error(errSyntaxError, getPos(), "Incorrect number of arguments in 'SCN' command"); return; } - state->setStrokePattern(NULL); + state->setStrokePattern(nullptr); for (i = 0; i < numArgs && i < gfxColorMaxComps; ++i) { if (args[i].isNum()) { color.c[i] = dblToCol(args[i].getNum()); @@ -1856,16 +1856,16 @@ void PdfParser::doShadingPatternFillFallback(GfxShadingPattern *sPat, // TODO not good that numArgs is ignored but args[] is used: void PdfParser::opShFill(Object args[], int /*numArgs*/) { - GfxShading *shading = 0; - GfxPath *savedPath = NULL; + GfxShading *shading = nullptr; + GfxPath *savedPath = nullptr; double xMin, yMin, xMax, yMax; double xTemp, yTemp; double gradientTransform[6]; - double *matrix = NULL; + double *matrix = nullptr; GBool savedState = gFalse; #if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API) - if (!(shading = res->lookupShading(args[0].getName(), NULL, NULL))) { + if (!(shading = res->lookupShading(args[0].getName(), nullptr, nullptr))) { return; } #else @@ -1883,7 +1883,7 @@ void PdfParser::opShFill(Object args[], int /*numArgs*/) // check proper operator sequence // first there should be one W(*) and then one 'cm' somewhere before 'sh' GBool seenClip, seenConcat; - seenClip = (clipHistory->getClipPath() != NULL); + seenClip = (clipHistory->getClipPath() != nullptr); seenConcat = gFalse; int i = 1; while (i <= maxOperatorHistoryDepth) { @@ -1909,7 +1909,7 @@ void PdfParser::opShFill(Object args[], int /*numArgs*/) // clip to bbox if (shading->getHasBBox()) { shading->getBBox(&xMin, &yMin, &xMax, &yMax); - if (matrix != NULL) { + if (matrix != nullptr) { xTemp = matrix[0]*xMin + matrix[2]*yMin + matrix[4]; yTemp = matrix[1]*xMin + matrix[3]*yMin + matrix[5]; state->moveTo(xTemp, yTemp); @@ -2374,7 +2374,7 @@ void PdfParser::opSetFont(Object args[], int /*numArgs*/) if (!font) { // unsetting the font (drawing no text) is better than using the // previous one and drawing random glyphs from it - state->setFont(NULL, args[1].getNum()); + state->setFont(nullptr, args[1].getNum()); fontChanged = gTrue; return; } @@ -2539,7 +2539,7 @@ void PdfParser::opMoveSetShowText(Object args[], int /*numArgs*/) // TODO not good that numArgs is ignored but args[] is used: void PdfParser::opShowSpaceText(Object args[], int /*numArgs*/) { - Array *a = 0; + Array *a = nullptr; Object obj; int wMode = 0; @@ -2586,7 +2586,7 @@ void PdfParser::doShowText(const GooString *s) { int wMode; double riseX, riseY; CharCode code; - Unicode *u = NULL; + Unicode *u = nullptr; double x, y, dx, dy, tdx, tdy; double originX, originY, tOriginX, tOriginY; double oldCTM[6], newCTM[6]; @@ -3009,7 +3009,7 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, GBool inlineImg) } if (!obj1.isNull()) { #if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API) - colorSpace = GfxColorSpace::parse(NULL, &obj1, NULL, NULL); + colorSpace = GfxColorSpace::parse(nullptr, &obj1, nullptr, nullptr); #elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API) colorSpace = GfxColorSpace::parse(&obj1, NULL, NULL); #else @@ -3022,7 +3022,7 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, GBool inlineImg) } else if (csMode == streamCSDeviceCMYK) { colorSpace = new GfxDeviceCMYKColorSpace(); } else { - colorSpace = NULL; + colorSpace = nullptr; } #if !defined(POPPLER_NEW_OBJECT_API) obj1.free(); @@ -3055,11 +3055,11 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, GBool inlineImg) // get the mask int maskColors[2*gfxColorMaxComps]; haveColorKeyMask = haveExplicitMask = haveSoftMask = gFalse; - Stream *maskStr = NULL; + Stream *maskStr = nullptr; int maskWidth = 0; int maskHeight = 0; maskInvert = gFalse; - GfxImageColorMap *maskColorMap = NULL; + GfxImageColorMap *maskColorMap = nullptr; #if defined(POPPLER_NEW_OBJECT_API) maskObj = dict->lookup(const_cast<char*>("Mask")); smaskObj = dict->lookup(const_cast<char*>("SMask")); @@ -3180,7 +3180,7 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, GBool inlineImg) } } #if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API) - GfxColorSpace *maskColorSpace = GfxColorSpace::parse(NULL, &obj1, NULL, NULL); + GfxColorSpace *maskColorSpace = GfxColorSpace::parse(nullptr, &obj1, nullptr, nullptr); #elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API) GfxColorSpace *maskColorSpace = GfxColorSpace::parse(&obj1, NULL, NULL); #else @@ -3355,7 +3355,7 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, GBool inlineImg) maskStr, maskWidth, maskHeight, maskInvert, maskInterpolate); } else { builder->addImage(state, str, width, height, colorMap, interpolate, - haveColorKeyMask ? maskColors : static_cast<int *>(NULL)); + haveColorKeyMask ? maskColors : static_cast<int *>(nullptr)); } delete colorMap; @@ -3468,11 +3468,11 @@ void PdfParser::doForm(Object *str) { #else dict->lookup(const_cast<char*>("Resources"), &resObj); #endif - resDict = resObj.isDict() ? resObj.getDict() : (Dict *)NULL; + resDict = resObj.isDict() ? resObj.getDict() : (Dict *)nullptr; // check for a transparency group transpGroup = isolated = knockout = gFalse; - blendingColorSpace = NULL; + blendingColorSpace = nullptr; #if defined(POPPLER_NEW_OBJECT_API) if ((obj1 = dict->lookup(const_cast<char*>("Group"))).isDict()) { if ((obj2 = obj1.dictLookup(const_cast<char*>("S"))).isName(const_cast<char*>("Transparency"))) { @@ -3487,7 +3487,7 @@ void PdfParser::doForm(Object *str) { if (!obj1.dictLookup(const_cast<char*>("CS"), &obj3)->isNull()) { #endif #if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API) - blendingColorSpace = GfxColorSpace::parse(NULL, &obj3, NULL, NULL); + blendingColorSpace = GfxColorSpace::parse(nullptr, &obj3, nullptr, nullptr); #elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API) blendingColorSpace = GfxColorSpace::parse(&obj3, NULL, NULL); #else @@ -3640,7 +3640,7 @@ void PdfParser::opBeginImage(Object /*args*/[], int /*numArgs*/) // display the image if (str) { - doImage(NULL, str, gTrue); + doImage(nullptr, str, gTrue); // skip 'EI' tag int c1 = str->getUndecodedStream()->getChar(); @@ -3701,7 +3701,7 @@ Stream *PdfParser::buildImageStream() { obj.free(); dict.free(); #endif - return NULL; + return nullptr; } #if !defined(POPPLER_NEW_OBJECT_API) obj.free(); @@ -3806,7 +3806,7 @@ void PdfParser::saveState() { bool is_radial = false; GfxPattern *pattern = state->getFillPattern(); - if (pattern != NULL) + if (pattern != nullptr) if (pattern->getType() == 2 ) { GfxShadingPattern *shading_pattern = static_cast<GfxShadingPattern *>(pattern); GfxShading *shading = shading_pattern->getShading(); @@ -3861,8 +3861,8 @@ void PdfParser::setApproximationPrecision(int shadingType, double colorDelta, //------------------------------------------------------------------------ ClipHistoryEntry::ClipHistoryEntry(GfxPath *clipPathA, GfxClipType clipTypeA) : - saved(NULL), - clipPath((clipPathA) ? clipPathA->copy() : NULL), + saved(nullptr), + clipPath((clipPathA) ? clipPathA->copy() : nullptr), clipType(clipTypeA) { } @@ -3871,7 +3871,7 @@ ClipHistoryEntry::~ClipHistoryEntry() { if (clipPath) { delete clipPath; - clipPath = NULL; + clipPath = nullptr; } } @@ -3884,7 +3884,7 @@ void ClipHistoryEntry::setClip(GfxPath *clipPathA, GfxClipType clipTypeA) { clipPath = clipPathA->copy(); clipType = clipTypeA; } else { - clipPath = NULL; + clipPath = nullptr; clipType = clipNormal; } } @@ -3901,7 +3901,7 @@ ClipHistoryEntry *ClipHistoryEntry::restore() { if (saved) { oldEntry = saved; - saved = NULL; + saved = nullptr; delete this; // TODO really should avoid deleting from inside. } else { oldEntry = this; @@ -3915,10 +3915,10 @@ ClipHistoryEntry::ClipHistoryEntry(ClipHistoryEntry *other) { this->clipPath = other->clipPath->copy(); this->clipType = other->clipType; } else { - this->clipPath = NULL; + this->clipPath = nullptr; this->clipType = clipNormal; } - saved = NULL; + saved = nullptr; } #endif /* HAVE_POPPLER */ diff --git a/src/extension/internal/pdfinput/pdf-parser.h b/src/extension/internal/pdfinput/pdf-parser.h index f985b15ca..755e6741b 100644 --- a/src/extension/internal/pdfinput/pdf-parser.h +++ b/src/extension/internal/pdfinput/pdf-parser.h @@ -295,10 +295,10 @@ private: void doForm(Object *str); void doForm1(Object *str, Dict *resDict, double *matrix, double *bbox, GBool transpGroup = gFalse, GBool softMask = gFalse, - GfxColorSpace *blendingColorSpace = NULL, + GfxColorSpace *blendingColorSpace = nullptr, GBool isolated = gFalse, GBool knockout = gFalse, - GBool alpha = gFalse, Function *transferFunc = NULL, - GfxColor *backdropColor = NULL); + GBool alpha = gFalse, Function *transferFunc = nullptr, + GfxColor *backdropColor = nullptr); // in-line image operators void opBeginImage(Object args[], int numArgs); diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp index 8e5a5f639..59481b9eb 100644 --- a/src/extension/internal/pdfinput/svg-builder.cpp +++ b/src/extension/internal/pdfinput/svg-builder.cpp @@ -109,14 +109,14 @@ SvgBuilder::~SvgBuilder() { } void SvgBuilder::_init() { - _font_style = NULL; - _current_font = NULL; - _font_specification = NULL; + _font_style = nullptr; + _current_font = nullptr; + _font_specification = nullptr; _font_scaling = 1; _need_font_update = true; _in_text_object = false; _invalidated_style = true; - _current_state = NULL; + _current_state = nullptr; _width = 0; _height = 0; @@ -128,9 +128,9 @@ void SvgBuilder::_init() { _availableFontNames.push_back(pango_font_family_get_name(*iter)); } - _transp_group_stack = NULL; + _transp_group_stack = nullptr; SvgGraphicsState initial_state; - initial_state.softmask = NULL; + initial_state.softmask = nullptr; initial_state.group_depth = 0; _state_stack.push_back(initial_state); _node_stack.push_back(_container); @@ -186,7 +186,7 @@ Inkscape::XML::Node *SvgBuilder::pushNode(const char *name) { } Inkscape::XML::Node *SvgBuilder::popNode() { - Inkscape::XML::Node *node = NULL; + Inkscape::XML::Node *node = nullptr; if ( _node_stack.size() > 1 ) { node = _node_stack.back(); _node_stack.pop_back(); @@ -215,7 +215,7 @@ Inkscape::XML::Node *SvgBuilder::pushGroup() { setAsLayer(_docname); } } - if (_container->parent()->attribute("inkscape:groupmode") != NULL) { + if (_container->parent()->attribute("inkscape:groupmode") != nullptr) { _ttm[0] = _ttm[3] = 1.0; // clear ttm if parent is a layer _ttm[1] = _ttm[2] = _ttm[4] = _ttm[5] = 0.0; _ttm_is_set = false; @@ -379,7 +379,7 @@ void SvgBuilder::_setStrokeStyle(SPCSSAttr *css, GfxState *state) { sp_repr_css_set_property(css, "stroke-dashoffset", os_offset.str().c_str()); } else { sp_repr_css_set_property(css, "stroke-dasharray", "none"); - sp_repr_css_set_property(css, "stroke-dashoffset", NULL); + sp_repr_css_set_property(css, "stroke-dashoffset", nullptr); } } @@ -503,7 +503,7 @@ void SvgBuilder::addShadedFill(GfxShading *shading, double *matrix, GfxPath *pat SPObject *clip_obj = _doc->getObjectById(clip_path_id); if (clip_obj) { clip_obj->deleteObject(); - node->setAttribute("clip-path", NULL); + node->setAttribute("clip-path", nullptr); TRACE(("removed clipping path: %s\n", clip_path_id)); } break; @@ -570,7 +570,7 @@ bool SvgBuilder::getTransform(double *transform) { void SvgBuilder::setTransform(double c0, double c1, double c2, double c3, double c4, double c5) { // do not remember the group which is a layer - if ((_container->attribute("inkscape:groupmode") == NULL) && !_ttm_is_set) { + if ((_container->attribute("inkscape:groupmode") == nullptr) && !_ttm_is_set) { _ttm[0] = c0; _ttm[1] = c1; _ttm[2] = c2; @@ -581,7 +581,7 @@ void SvgBuilder::setTransform(double c0, double c1, double c2, double c3, } // Avoid transforming a group with an already set clip-path - if ( _container->attribute("clip-path") != NULL ) { + if ( _container->attribute("clip-path") != nullptr ) { pushGroup(); } TRACE(("setTransform: %f %f %f %f %f %f\n", c0, c1, c2, c3, c4, c5)); @@ -598,7 +598,7 @@ void SvgBuilder::setTransform(double const *transform) { * Used by PdfParser to decide when to do fallback operations. */ bool SvgBuilder::isPatternTypeSupported(GfxPattern *pattern) { - if ( pattern != NULL ) { + if ( pattern != nullptr ) { if ( pattern->getType() == 2 ) { // shading pattern GfxShading *shading = (static_cast<GfxShadingPattern *>(pattern))->getShading(); int shadingType = shading->getType(); @@ -622,8 +622,8 @@ bool SvgBuilder::isPatternTypeSupported(GfxPattern *pattern) { * \return a url pointing to the created pattern */ gchar *SvgBuilder::_createPattern(GfxPattern *pattern, GfxState *state, bool is_stroke) { - gchar *id = NULL; - if ( pattern != NULL ) { + gchar *id = nullptr; + if ( pattern != nullptr ) { if ( pattern->getType() == 2 ) { // Shading pattern GfxShadingPattern *shading_pattern = static_cast<GfxShadingPattern *>(pattern); double *ptm; @@ -656,7 +656,7 @@ gchar *SvgBuilder::_createPattern(GfxPattern *pattern, GfxState *state, bool is_ id = _createTilingPattern(static_cast<GfxTilingPattern*>(pattern), state, is_stroke); } } else { - return NULL; + return nullptr; } gchar *urltext = g_strdup_printf ("url(#%s)", id); g_free(id); @@ -719,7 +719,7 @@ gchar *SvgBuilder::_createTilingPattern(GfxTilingPattern *tiling_pattern, GfxPatternColorSpace *pat_cs = (GfxPatternColorSpace *)( is_stroke ? state->getStrokeColorSpace() : state->getFillColorSpace() ); // Set fill/stroke colors if this is an uncolored tiling pattern - GfxColorSpace *cs = NULL; + GfxColorSpace *cs = nullptr; if ( tiling_pattern->getPaintType() == 2 && ( cs = pat_cs->getUnder() ) ) { GfxState *pattern_state = pdf_parser->getState(); pattern_state->setFillColorSpace(cs->copy()); @@ -785,7 +785,7 @@ gchar *SvgBuilder::_createGradient(GfxShading *shading, double *matrix, bool for num_funcs = radial_shading->getNFuncs(); func = radial_shading->getFunc(0); } else { // Unsupported shading type - return NULL; + return nullptr; } gradient->setAttribute("gradientUnits", "userSpaceOnUse"); // If needed, flip the gradient transform around the y axis @@ -807,7 +807,7 @@ gchar *SvgBuilder::_createGradient(GfxShading *shading, double *matrix, bool for if ( num_funcs > 1 || !_addGradientStops(gradient, shading, func) ) { Inkscape::GC::release(gradient); - return NULL; + return nullptr; } Inkscape::XML::Node *defs = _doc->getDefs()->getRepr(); @@ -827,8 +827,8 @@ void SvgBuilder::_addStopToGradient(Inkscape::XML::Node *gradient, double offset Inkscape::XML::Node *stop = _xml_doc->createElement("svg:stop"); SPCSSAttr *css = sp_repr_css_attr_new(); Inkscape::CSSOStringStream os_opacity; - gchar *color_text = NULL; - if ( _transp_group_stack != NULL && _transp_group_stack->for_softmask ) { + gchar *color_text = nullptr; + if ( _transp_group_stack != nullptr && _transp_group_stack->for_softmask ) { double gray = (double)color->r / 65535.0; gray = CLAMP(gray, 0.0, 1.0); os_opacity << gray; @@ -1028,9 +1028,9 @@ void SvgBuilder::updateFont(GfxState *state) { // Prune the font name to get the correct font family name // In a PDF font names can look like this: IONIPB+MetaPlusBold-Italic - char *font_family = NULL; - char *font_style = NULL; - char *font_style_lowercase = NULL; + char *font_family = nullptr; + char *font_style = nullptr; + char *font_style_lowercase = nullptr; char *plus_sign = strstr(_font_specification, "+"); if (plus_sign) { font_family = g_strdup(plus_sign + 1); @@ -1038,7 +1038,7 @@ void SvgBuilder::updateFont(GfxState *state) { } else { font_family = g_strdup(_font_specification); } - char *style_delim = NULL; + char *style_delim = nullptr; if ( ( style_delim = g_strrstr(font_family, "-") ) || ( style_delim = g_strrstr(font_family, ",") ) ) { font_style = style_delim + 1; @@ -1077,7 +1077,7 @@ void SvgBuilder::updateFont(GfxState *state) { // Font weight GfxFont::Weight font_weight = font->getWeight(); - char *css_font_weight = NULL; + char *css_font_weight = nullptr; if ( font_weight != GfxFont::WeightNotDefined ) { if ( font_weight == GfxFont::W400 ) { css_font_weight = (char*) "normal"; @@ -1109,7 +1109,7 @@ void SvgBuilder::updateFont(GfxState *state) { // Font stretch GfxFont::Stretch font_stretch = font->getStretch(); - gchar *stretch_value = NULL; + gchar *stretch_value = nullptr; switch (font_stretch) { case GfxFont::UltraCondensed: stretch_value = (char*) "ultra-condensed"; @@ -1141,7 +1141,7 @@ void SvgBuilder::updateFont(GfxState *state) { default: break; } - if ( stretch_value != NULL ) { + if ( stretch_value != nullptr ) { sp_repr_css_set_property(_font_style, "font-stretch", stretch_value); } @@ -1250,7 +1250,7 @@ void SvgBuilder::_flushText() { bool same_coords[2] = {true, true}; Geom::Point last_delta_pos; unsigned int glyphs_in_a_row = 0; - Inkscape::XML::Node *tspan_node = NULL; + Inkscape::XML::Node *tspan_node = nullptr; Glib::ustring x_coords; Glib::ustring y_coords; Glib::ustring text_buffer; @@ -1415,7 +1415,7 @@ void SvgBuilder::addChar(GfxState *state, double x, double y, uu[i] = u[i]; } - gchar *tmp = g_utf16_to_utf8(uu, uLen, NULL, NULL, NULL); + gchar *tmp = g_utf16_to_utf8(uu, uLen, nullptr, nullptr, nullptr); if ( tmp && *tmp ) { new_glyph.code = tmp; } else { @@ -1492,20 +1492,20 @@ Inkscape::XML::Node *SvgBuilder::_createImage(Stream *str, int width, int height bool invert_alpha) { // Create PNG write struct - png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); - if ( png_ptr == NULL ) { - return NULL; + png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); + if ( png_ptr == nullptr ) { + return nullptr; } // Create PNG info struct png_infop info_ptr = png_create_info_struct(png_ptr); - if ( info_ptr == NULL ) { - png_destroy_write_struct(&png_ptr, NULL); - return NULL; + if ( info_ptr == nullptr ) { + png_destroy_write_struct(&png_ptr, nullptr); + return nullptr; } // Set error handler if (setjmp(png_jmpbuf(png_ptr))) { png_destroy_write_struct(&png_ptr, &info_ptr); - return NULL; + return nullptr; } // Decide whether we should embed this image int attr_value = 1; @@ -1514,8 +1514,8 @@ Inkscape::XML::Node *SvgBuilder::_createImage(Stream *str, int width, int height // Set read/write functions Inkscape::IO::StringOutputStream base64_string; Inkscape::IO::Base64OutputStream base64_stream(base64_string); - FILE *fp = NULL; - gchar *file_name = NULL; + FILE *fp = nullptr; + gchar *file_name = nullptr; if (embed_image) { base64_stream.setColumnWidth(0); // Disable line breaks png_set_write_fn(png_ptr, &base64_stream, png_write_base64stream, png_flush_base64stream); @@ -1523,10 +1523,10 @@ Inkscape::XML::Node *SvgBuilder::_createImage(Stream *str, int width, int height static int counter = 0; file_name = g_strdup_printf("%s_img%d.png", _docname, counter++); fp = fopen(file_name, "wb"); - if ( fp == NULL ) { + if ( fp == nullptr ) { png_destroy_write_struct(&png_ptr, &info_ptr); g_free(file_name); - return NULL; + return nullptr; } png_init_io(png_ptr, fp); } @@ -1646,7 +1646,7 @@ Inkscape::XML::Node *SvgBuilder::_createImage(Stream *str, int width, int height fclose(fp); g_free(file_name); } - return NULL; + return nullptr; } delete image_stream; str->close(); @@ -1712,7 +1712,7 @@ Inkscape::XML::Node *SvgBuilder::_createMask(double width, double height) { if ( !( defs && !strcmp(defs->name(), "svg:defs") ) ) { // Create <defs> node defs = _xml_doc->createElement("svg:defs"); - _root->addChild(defs, NULL); + _root->addChild(defs, nullptr); Inkscape::GC::release(defs); defs = _root->firstChild(); } @@ -1754,12 +1754,12 @@ void SvgBuilder::addImageMask(GfxState *state, Stream *str, int width, int heigh // Scaling 1x1 surfaces might not work so skip setting a mask with this size if ( width > 1 || height > 1 ) { Inkscape::XML::Node *mask_image_node = - _createImage(str, width, height, NULL, interpolate, NULL, true, invert); + _createImage(str, width, height, nullptr, interpolate, nullptr, true, invert); if (mask_image_node) { // Create the mask Inkscape::XML::Node *mask_node = _createMask(1.0, 1.0); // Remove unnecessary transformation from the mask image - mask_image_node->setAttribute("transform", NULL); + mask_image_node->setAttribute("transform", nullptr); mask_node->appendChild(mask_image_node); Inkscape::GC::release(mask_image_node); gchar *mask_url = g_strdup_printf("url(#%s)", mask_node->attribute("id")); @@ -1779,13 +1779,13 @@ void SvgBuilder::addMaskedImage(GfxState * /*state*/, Stream *str, int width, in bool invert_mask, bool mask_interpolate) { Inkscape::XML::Node *mask_image_node = _createImage(mask_str, mask_width, mask_height, - NULL, mask_interpolate, NULL, true, invert_mask); - Inkscape::XML::Node *image_node = _createImage(str, width, height, color_map, interpolate, NULL); + nullptr, mask_interpolate, nullptr, true, invert_mask); + Inkscape::XML::Node *image_node = _createImage(str, width, height, color_map, interpolate, nullptr); if ( mask_image_node && image_node ) { // Create mask for the image Inkscape::XML::Node *mask_node = _createMask(1.0, 1.0); // Remove unnecessary transformation from the mask image - mask_image_node->setAttribute("transform", NULL); + mask_image_node->setAttribute("transform", nullptr); mask_node->appendChild(mask_image_node); // Scale the mask to the size of the image Geom::Affine mask_transform((double)width, 0.0, 0.0, (double)height, 0.0, 0.0); @@ -1812,13 +1812,13 @@ void SvgBuilder::addSoftMaskedImage(GfxState * /*state*/, Stream *str, int width GfxImageColorMap *mask_color_map, bool mask_interpolate) { Inkscape::XML::Node *mask_image_node = _createImage(mask_str, mask_width, mask_height, - mask_color_map, mask_interpolate, NULL, true); - Inkscape::XML::Node *image_node = _createImage(str, width, height, color_map, interpolate, NULL); + mask_color_map, mask_interpolate, nullptr, true); + Inkscape::XML::Node *image_node = _createImage(str, width, height, color_map, interpolate, nullptr); if ( mask_image_node && image_node ) { // Create mask for the image Inkscape::XML::Node *mask_node = _createMask(1.0, 1.0); // Remove unnecessary transformation from the mask image - mask_image_node->setAttribute("transform", NULL); + mask_image_node->setAttribute("transform", nullptr); mask_node->appendChild(mask_image_node); // Set mask and add image gchar *mask_url = g_strdup_printf("url(#%s)", mask_node->attribute("id")); @@ -1902,7 +1902,7 @@ void SvgBuilder::setSoftMask(GfxState * /*state*/, double * /*bbox*/, bool /*alp void SvgBuilder::clearSoftMask(GfxState * /*state*/) { if (_state_stack.back().softmask) { - _state_stack.back().softmask = NULL; + _state_stack.back().softmask = nullptr; popGroup(); } } diff --git a/src/extension/internal/pdfinput/svg-builder.h b/src/extension/internal/pdfinput/svg-builder.h index ed2a4d48e..499724a4c 100644 --- a/src/extension/internal/pdfinput/svg-builder.h +++ b/src/extension/internal/pdfinput/svg-builder.h @@ -94,7 +94,7 @@ public: // Property setting void setDocumentSize(double width, double height); // Document size in px - void setAsLayer(char *layer_name=NULL); + void setAsLayer(char *layer_name=nullptr); void setGroupOpacity(double opacity); Inkscape::XML::Node *getPreferences() { return _preferences; diff --git a/src/extension/internal/pov-out.cpp b/src/extension/internal/pov-out.cpp index 15acb97ec..2215fbb3e 100644 --- a/src/extension/internal/pov-out.cpp +++ b/src/extension/internal/pov-out.cpp @@ -59,11 +59,11 @@ namespace Internal static void err(const char *fmt, ...) { va_list args; - g_log(NULL, G_LOG_LEVEL_WARNING, "Pov-out err: "); + g_log(nullptr, G_LOG_LEVEL_WARNING, "Pov-out err: "); va_start(args, fmt); - g_logv(NULL, G_LOG_LEVEL_WARNING, fmt, args); + g_logv(nullptr, G_LOG_LEVEL_WARNING, fmt, args); va_end(args); - g_log(NULL, G_LOG_LEVEL_WARNING, "\n"); + g_log(nullptr, G_LOG_LEVEL_WARNING, "\n"); } @@ -211,7 +211,7 @@ void PovOutput::segment(int segNr, */ bool PovOutput::doHeader() { - time_t tim = time(NULL); + time_t tim = time(nullptr); out("/*###################################################################\n"); out("### This PovRay document was generated by Inkscape\n"); out("### http://www.inkscape.org\n"); diff --git a/src/extension/internal/svg.cpp b/src/extension/internal/svg.cpp index c4e12c174..f4e28e7ed 100644 --- a/src/extension/internal/svg.cpp +++ b/src/extension/internal/svg.cpp @@ -76,7 +76,7 @@ static void pruneExtendedNamespaces( Inkscape::XML::Node *repr ) } // Can't change the set we're interating over while we are iterating. for ( std::vector<gchar const*>::iterator it = attrsRemoved.begin(); it != attrsRemoved.end(); ++it ) { - repr->setAttribute(*it, 0); + repr->setAttribute(*it, nullptr); } } @@ -225,11 +225,11 @@ Svg::open (Inkscape::Extension::Input *mod, const gchar *uri) prefs->setBool("/dialogs/import/ask", !mod->get_param_bool("do_not_ask") ); } - SPDocument * doc = SPDocument::createNewDoc (NULL, TRUE, TRUE); + SPDocument * doc = SPDocument::createNewDoc (nullptr, TRUE, TRUE); if (link_svg.compare("include") != 0 && is_import) { bool embed = ( link_svg.compare( "embed" ) == 0 ); SPDocument * ret = SPDocument::createNewDoc(uri, TRUE); - SPNamedView *nv = sp_document_namedview(doc, NULL); + SPNamedView *nv = sp_document_namedview(doc, nullptr); Glib::ustring display_unit = nv->display_units->abbr; if (display_unit.empty()) { display_unit = "px"; @@ -259,7 +259,7 @@ Svg::open (Inkscape::Extension::Input *mod, const gchar *uri) sp_embed_svg(image_node, uri); } } else { - gchar* _uri = g_filename_to_uri(uri, NULL, NULL); + gchar* _uri = g_filename_to_uri(uri, nullptr, nullptr); if(_uri) { image_node->setAttribute("xlink:href", _uri); g_free(_uri); @@ -292,7 +292,7 @@ Svg::open (Inkscape::Extension::Input *mod, const gchar *uri) return SPDocument::createNewDocFromMem(contents, length, 1); } catch (Gio::Error &e) { g_warning("Could not load contents of non-local URI %s\n", uri); - return NULL; + return nullptr; } } else { uri = path.c_str(); @@ -329,8 +329,8 @@ Svg::open (Inkscape::Extension::Input *mod, const gchar *uri) void Svg::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filename) { - g_return_if_fail(doc != NULL); - g_return_if_fail(filename != NULL); + g_return_if_fail(doc != nullptr); + g_return_if_fail(filename != nullptr); Inkscape::XML::Document *rdoc = doc->rdoc; bool const exportExtensions = ( !mod->get_id() diff --git a/src/extension/internal/vsd-input.cpp b/src/extension/internal/vsd-input.cpp index b650e2876..765e67648 100644 --- a/src/extension/internal/vsd-input.cpp +++ b/src/extension/internal/vsd-input.cpp @@ -245,7 +245,7 @@ SPDocument *VsdInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u #endif if (!libvisio::VisioDocument::isSupported(&input)) { - return NULL; + return nullptr; } RVNGStringVector output; @@ -256,11 +256,11 @@ SPDocument *VsdInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u #else if (!libvisio::VisioDocument::generateSVG(&input, output)) { #endif - return NULL; + return nullptr; } if (output.empty()) { - return NULL; + return nullptr; } std::vector<RVNGString> tmpSVGOutput; @@ -274,12 +274,12 @@ SPDocument *VsdInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u // If only one page is present, import that one without bothering user if (tmpSVGOutput.size() > 1) { - VsdImportDialog *dlg = 0; + VsdImportDialog *dlg = nullptr; if (INKSCAPE.use_gui()) { dlg = new VsdImportDialog(tmpSVGOutput); if (!dlg->showDialog()) { delete dlg; - return NULL; + return nullptr; } } diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp index 45f59ec03..5941aaf1e 100644 --- a/src/extension/internal/wmf-inout.cpp +++ b/src/extension/internal/wmf-inout.cpp @@ -82,7 +82,7 @@ Wmf::~Wmf (void) //The destructor bool Wmf::check (Inkscape::Extension::Extension * /*module*/) { - if (NULL == Inkscape::Extension::db.get(PRINT_WMF)) + if (nullptr == Inkscape::Extension::db.get(PRINT_WMF)) return FALSE; return TRUE; } @@ -121,8 +121,8 @@ Wmf::print_document_to_file(SPDocument *doc, const gchar *filename) mod->finish(); /* Release arena */ mod->base->invoke_hide(mod->dkey); - mod->base = NULL; - mod->root = NULL; // deleted by invoke_hide + mod->base = nullptr; + mod->root = nullptr; // deleted by invoke_hide /* end */ mod->set_param_string("destination", oldoutput); @@ -138,7 +138,7 @@ Wmf::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filena Inkscape::Extension::Extension * ext; ext = Inkscape::Extension::db.get(PRINT_WMF); - if (ext == NULL) + if (ext == nullptr) return; bool new_val = mod->get_param_bool("textToPath"); @@ -162,7 +162,7 @@ Wmf::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filena ext->set_param_bool("textToPath", new_val); // ensure usage of dot as decimal separator in scanf/printf functions (indepentendly of current locale) - char *oldlocale = g_strdup(setlocale(LC_NUMERIC, NULL)); + char *oldlocale = g_strdup(setlocale(LC_NUMERIC, nullptr)); setlocale(LC_NUMERIC, "C"); print_document_to_file(doc, filename); @@ -452,11 +452,11 @@ uint32_t Wmf::add_dib_image(PWMF_CALLBACK_DATA d, const char *dib, uint32_t iUsa int dibparams = U_BI_UNKNOWN; // type of image not yet determined MEMPNG mempng; // PNG in memory comes back in this - mempng.buffer = NULL; + mempng.buffer = nullptr; - char *rgba_px = NULL; // RGBA pixels - const char *px = NULL; // DIB pixels - const U_RGBQUAD *ct = NULL; // DIB color table + char *rgba_px = nullptr; // RGBA pixels + const char *px = nullptr; // DIB pixels + const U_RGBQUAD *ct = nullptr; // DIB color table uint32_t numCt; int32_t width, height, colortype, invert; // if needed these values will be set by wget_DIB_params if(iUsage == U_DIB_RGB_COLORS){ @@ -484,7 +484,7 @@ uint32_t Wmf::add_dib_image(PWMF_CALLBACK_DATA d, const char *dib, uint32_t iUsa } } - gchar *base64String=NULL; + gchar *base64String=nullptr; if(dibparams == U_BI_JPEG || dibparams==U_BI_PNG){ // image was binary png or jpg in source file base64String = g_base64_encode((guchar*) px, numCt ); } @@ -551,10 +551,10 @@ uint32_t Wmf::add_bm16_image(PWMF_CALLBACK_DATA d, U_BITMAP16 Bm16, const char * char xywh[64]; // big enough MEMPNG mempng; // PNG in memory comes back in this - mempng.buffer = NULL; + mempng.buffer = nullptr; - char *rgba_px = NULL; // RGBA pixels - const U_RGBQUAD *ct = NULL; // color table, always NULL here + char *rgba_px = nullptr; // RGBA pixels + const U_RGBQUAD *ct = nullptr; // color table, always NULL here int32_t width, height, colortype, numCt, invert; numCt = 0; width = Bm16.Width; // bitmap width in pixels. @@ -582,7 +582,7 @@ uint32_t Wmf::add_bm16_image(PWMF_CALLBACK_DATA d, U_BITMAP16 Bm16, const char * free(rgba_px); } - gchar *base64String=NULL; + gchar *base64String=nullptr; if(mempng.buffer){ // image was Bm16 in source file, converted to png in this routine base64String = g_base64_encode((guchar*) mempng.buffer, mempng.size ); free(mempng.buffer); @@ -658,7 +658,7 @@ int Wmf::in_clips(PWMF_CALLBACK_DATA d, const char *test){ void Wmf::add_clips(PWMF_CALLBACK_DATA d, const char *clippath, unsigned int logic){ int op = combine_ops_to_livarot(logic); Geom::PathVector combined_vect; - char *combined = NULL; + char *combined = nullptr; if (op >= 0 && d->dc[d->level].clip_id) { unsigned int real_idx = d->dc[d->level].clip_id - 1; Geom::PathVector old_vect = sp_svg_read_pathv(d->clips.strings[real_idx]); @@ -967,7 +967,7 @@ void Wmf::select_pen(PWMF_CALLBACK_DATA d, int index) { int width; - char *record = NULL; + char *record = nullptr; U_PEN up; if (index < 0 && index >= d->n_obj){ return; } @@ -1153,7 +1153,7 @@ Wmf::select_brush(PWMF_CALLBACK_DATA d, int index) void Wmf::select_font(PWMF_CALLBACK_DATA d, int index) { - char *record = NULL; + char *record = nullptr; const char *memfont; const char *facename; U_FONT font; @@ -1221,7 +1221,7 @@ Wmf::select_font(PWMF_CALLBACK_DATA d, int index) int Wmf::insertable_object(PWMF_CALLBACK_DATA d) { int index = d->low_water; // Start looking from here, it may already have been filled - while(index < d->n_obj && d->wmf_obj[index].record != NULL){ index++; } + while(index < d->n_obj && d->wmf_obj[index].record != nullptr){ index++; } if(index >= d->n_obj)return(-1); // this is a big problem, percolate it back up so the program can get out of this gracefully d->low_water = index; // Could probably be index+1 return(index); @@ -1265,7 +1265,7 @@ Wmf::delete_object(PWMF_CALLBACK_DATA d, int index) // files too big to fit into memory. if (d->wmf_obj[index].record) free(d->wmf_obj[index].record); - d->wmf_obj[index].record = NULL; + d->wmf_obj[index].record = nullptr; if(index < d->low_water)d->low_water = index; } } @@ -1321,12 +1321,12 @@ void Wmf::common_dib_to_image(PWMF_CALLBACK_DATA d, const char *dib, tmp_image << " y=\"" << dy << "\"\n x=\"" << dx <<"\"\n "; MEMPNG mempng; // PNG in memory comes back in this - mempng.buffer = NULL; + mempng.buffer = nullptr; - char *rgba_px = NULL; // RGBA pixels - char *sub_px = NULL; // RGBA pixels, subarray - const char *px = NULL; // DIB pixels - const U_RGBQUAD *ct = NULL; // color table + char *rgba_px = nullptr; // RGBA pixels + char *sub_px = nullptr; // RGBA pixels, subarray + const char *px = nullptr; // DIB pixels + const U_RGBQUAD *ct = nullptr; // color table uint32_t numCt; int32_t width, height, colortype, invert; // if needed these values will be set in wget_DIB_params if(iUsage == U_DIB_RGB_COLORS){ @@ -1367,7 +1367,7 @@ void Wmf::common_dib_to_image(PWMF_CALLBACK_DATA d, const char *dib, } } - gchar *base64String=NULL; + gchar *base64String=nullptr; if(dibparams == U_BI_JPEG){ // image was binary jpg in source file tmp_image << " xlink:href=\"data:image/jpeg;base64,"; base64String = g_base64_encode((guchar*) px, numCt ); @@ -1422,11 +1422,11 @@ void Wmf::common_bm16_to_image(PWMF_CALLBACK_DATA d, U_BITMAP16 Bm16, const char tmp_image << " y=\"" << dy << "\"\n x=\"" << dx <<"\"\n "; MEMPNG mempng; // PNG in memory comes back in this - mempng.buffer = NULL; + mempng.buffer = nullptr; - char *rgba_px = NULL; // RGBA pixels - char *sub_px = NULL; // RGBA pixels, subarray - const U_RGBQUAD *ct = NULL; // color table + char *rgba_px = nullptr; // RGBA pixels + char *sub_px = nullptr; // RGBA pixels, subarray + const U_RGBQUAD *ct = nullptr; // color table int32_t width, height, colortype, numCt, invert; numCt = 0; @@ -1470,7 +1470,7 @@ void Wmf::common_bm16_to_image(PWMF_CALLBACK_DATA d, U_BITMAP16 Bm16, const char free(sub_px); } - gchar *base64String=NULL; + gchar *base64String=nullptr; if(mempng.buffer){ // image was Bm16 in source file, converted to png in this routine tmp_image << " xlink:href=\"data:image/png;base64,"; base64String = g_base64_encode((guchar*) mempng.buffer, mempng.size ); @@ -1541,14 +1541,14 @@ int Wmf::myMetaFileProc(const char *contents, unsigned int length, PWMF_CALLBACK int wDbgComment=0; int wDbgFinal=0; char const* wDbgString = getenv( "INKSCAPE_DBG_WMF" ); - if ( wDbgString != NULL ) { + if ( wDbgString != nullptr ) { if(strstr(wDbgString,"RECORD")){ wDbgRecord = 1; } if(strstr(wDbgString,"COMMENT")){ wDbgComment = 1; } if(strstr(wDbgString,"FINAL")){ wDbgFinal = 1; } } /* initialize the tsp for text reassembly */ - tsp.string = NULL; + tsp.string = nullptr; tsp.ori = 0.0; /* degrees */ tsp.fs = 12.0; /* font size */ tsp.x = 0.0; @@ -1592,10 +1592,10 @@ int Wmf::myMetaFileProc(const char *contents, unsigned int length, PWMF_CALLBACK // Init the new wmf_obj list elements to null, provided the // dynamic allocation succeeded. - if ( d->wmf_obj != NULL ) + if ( d->wmf_obj != nullptr ) { for( int i=0; i < d->n_obj; ++i ) - d->wmf_obj[i].record = NULL; + d->wmf_obj[i].record = nullptr; } //if if(!Placeable.Inch){ Placeable.Inch= 1440; } @@ -2445,7 +2445,7 @@ std::cout << "BEFORE DRAW" } if(d->dc[old_level].font_name){ free(d->dc[old_level].font_name); // else memory leak - d->dc[old_level].font_name = NULL; + d->dc[old_level].font_name = nullptr; } old_level--; } @@ -2557,9 +2557,9 @@ std::cout << "BEFORE DRAW" /* Rotation issues are handled entirely in libTERE now */ - uint32_t *dup_wt = NULL; + uint32_t *dup_wt = nullptr; - dup_wt = U_Latin1ToUtf32le(text, cChars, NULL); + dup_wt = U_Latin1ToUtf32le(text, cChars, nullptr); if(!dup_wt)dup_wt = unknown_chars(cChars); msdepua(dup_wt); //convert everything in Microsoft's private use area. For Symbol, Wingdings, Dingbats @@ -2570,12 +2570,12 @@ std::cout << "BEFORE DRAW" } char *ansi_text; - ansi_text = (char *) U_Utf32leToUtf8((uint32_t *)dup_wt, 0, NULL); + ansi_text = (char *) U_Utf32leToUtf8((uint32_t *)dup_wt, 0, nullptr); free(dup_wt); // Empty text or starts with an invalid escape/control sequence, which is bogus text. Throw it out before g_markup_escape_text can make things worse if(*((uint8_t *)ansi_text) <= 0x1F){ free(ansi_text); - ansi_text=NULL; + ansi_text=nullptr; } if (ansi_text) { @@ -3101,18 +3101,18 @@ SPDocument * Wmf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) { - if (uri == NULL) { - return NULL; + if (uri == nullptr) { + return nullptr; } // ensure usage of dot as decimal separator in scanf/printf functions (indepentendly of current locale) - char *oldlocale = g_strdup(setlocale(LC_NUMERIC, NULL)); + char *oldlocale = g_strdup(setlocale(LC_NUMERIC, nullptr)); setlocale(LC_NUMERIC, "C"); WMF_CALLBACK_DATA d; d.n_obj = 0; //these might not be set otherwise if the input file is corrupt - d.wmf_obj=NULL; + d.wmf_obj=nullptr; // Default font, WMF spec says device can pick whatever it wants. // WMF files that do not specify a font are unlikely to look very good! @@ -3150,10 +3150,10 @@ Wmf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) size_t length; char *contents; - if(wmf_readdata(uri, &contents, &length))return(NULL); + if(wmf_readdata(uri, &contents, &length))return(nullptr); // set up the text reassembly system - if(!(d.tri = trinfo_init(NULL)))return(NULL); + if(!(d.tri = trinfo_init(nullptr)))return(nullptr); (void) trinfo_load_ft_opts(d.tri, 1, FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP, FT_KERNING_UNSCALED); @@ -3163,7 +3163,7 @@ Wmf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) // std::cout << "SVG Output: " << std::endl << d.outsvg << std::endl; - SPDocument *doc = NULL; + SPDocument *doc = nullptr; if (good) { doc = SPDocument::createNewDocFromMem(d.outsvg.c_str(), strlen(d.outsvg.c_str()), TRUE); } diff --git a/src/extension/internal/wmf-inout.h b/src/extension/internal/wmf-inout.h index 02280f6d8..a9831a7c6 100644 --- a/src/extension/internal/wmf-inout.h +++ b/src/extension/internal/wmf-inout.h @@ -30,7 +30,7 @@ typedef struct wmf_object { wmf_object() : type(0), level(0), - record(NULL) + record(nullptr) {}; int type; int level; @@ -41,7 +41,7 @@ typedef struct wmf_strings { wmf_strings() : size(0), count(0), - strings(NULL) + strings(nullptr) {}; int size; // number of slots allocated in strings int count; // number of slots used in strings @@ -51,7 +51,7 @@ typedef struct wmf_strings { typedef struct wmf_device_context { wmf_device_context() : // SPStyle: class with constructor - font_name(NULL), + font_name(nullptr), clip_id(0), stroke_set(false), stroke_mode(0), stroke_idx(0), stroke_recidx(0), fill_set(false), fill_mode(0), fill_idx(0), fill_recidx(0), @@ -65,7 +65,7 @@ typedef struct wmf_device_context { textAlign(0) // worldTransform, cur { - font_name = NULL; + font_name = nullptr; sizeWnd = point16_set( 0.0, 0.0 ); sizeView = point16_set( 0.0, 0.0 ); winorg = point16_set( 0.0, 0.0 ); @@ -126,7 +126,7 @@ typedef struct wmf_callback_data { dwRop2(U_R2_COPYPEN), dwRop3(0), id(0), drawtype(0), // hatches, images, gradients, struct w/ constructor - tri(NULL), + tri(nullptr), n_obj(0), low_water(0) //wmf_obj diff --git a/src/extension/internal/wmf-print.cpp b/src/extension/internal/wmf-print.cpp index cdc59298b..d98d28b09 100644 --- a/src/extension/internal/wmf-print.cpp +++ b/src/extension/internal/wmf-print.cpp @@ -77,8 +77,8 @@ namespace Internal { /* globals */ static double PX2WORLD; // value set in begin() static bool FixPPTCharPos, FixPPTDashLine, FixPPTGrad2Polys, FixPPTPatternAsHatch; -static WMFTRACK *wt = NULL; -static WMFHANDLES *wht = NULL; +static WMFTRACK *wt = nullptr; +static WMFHANDLES *wht = nullptr; void PrintWmf::smuggle_adxky_out(const char *string, int16_t **adx, double *ky, int *rtl, int *ndx, float scale) { @@ -87,7 +87,7 @@ void PrintWmf::smuggle_adxky_out(const char *string, int16_t **adx, double *ky, int16_t *ladx; const char *cptr = &string[strlen(string) + 1]; // this works because of the first fake terminator - *adx = NULL; + *adx = nullptr; *ky = 0.0; // set a default value sscanf(cptr, "%7d", ndx); if (!*ndx) { @@ -403,8 +403,8 @@ int PrintWmf::create_brush(SPStyle const *style, U_COLORREF *fcolor) } else if (SP_IS_GRADIENT(SP_STYLE_FILL_SERVER(style))) { // must be a gradient // currently we do not do anything with gradients, the code below just sets the color to the average of the stops SPPaintServer *paintserver = style->fill.value.href->getObject(); - SPLinearGradient *lg = NULL; - SPRadialGradient *rg = NULL; + SPLinearGradient *lg = nullptr; + SPRadialGradient *rg = nullptr; if (SP_IS_LINEARGRADIENT(paintserver)) { lg = SP_LINEARGRADIENT(paintserver); @@ -524,7 +524,7 @@ void PrintWmf::destroy_brush() int PrintWmf::create_pen(SPStyle const *style, const Geom::Affine &transform) { - char *rec = NULL; + char *rec = nullptr; uint32_t pen; uint32_t penstyle; U_COLORREF penColor; @@ -642,7 +642,7 @@ int PrintWmf::create_pen(SPStyle const *style, const Geom::Affine &transform) // delete the defined pen object void PrintWmf::destroy_pen() { - char *rec = NULL; + char *rec = nullptr; // WMF lets any object be deleted whenever, and the chips fall where they may... if (hpen) { rec = wdeleteobject_set(&hpen, wht); @@ -676,7 +676,7 @@ unsigned int PrintWmf::fill( fill_transform = tf; - if (create_brush(style, NULL)) { + if (create_brush(style, nullptr)) { /* Handle gradients. Uses modified livarot as 2geom boolops is currently broken. Can handle gradients with multiple stops. @@ -861,7 +861,7 @@ unsigned int PrintWmf::stroke( Geom::OptRect const &/*pbox*/, Geom::OptRect const &/*dbox*/, Geom::OptRect const &/*bbox*/) { - char *rec = NULL; + char *rec = nullptr; Geom::Affine tf = m_tr_stack.top(); use_stroke = true; @@ -940,7 +940,7 @@ bool PrintWmf::print_simple_shape(Geom::PathVector const &pathv, const Geom::Aff int moves = 0; int lines = 0; int curves = 0; - char *rec = NULL; + char *rec = nullptr; for (Geom::PathVector::const_iterator pit = pv.begin(); pit != pv.end(); ++pit) { moves++; @@ -1126,7 +1126,7 @@ unsigned int PrintWmf::image( SPStyle const * /*style*/) /** provides indirect link to image object */ { double x1, y1, dw, dh; - char *rec = NULL; + char *rec = nullptr; Geom::Affine tf = m_tr_stack.top(); rec = U_WMRSETSTRETCHBLTMODE_set(U_COLORONCOLOR); @@ -1189,7 +1189,7 @@ unsigned int PrintWmf::image( // may also be called with a simple_shape or an empty path, whereupon it just returns without doing anything unsigned int PrintWmf::print_pathv(Geom::PathVector const &pathv, const Geom::Affine &transform) { - char *rec = NULL; + char *rec = nullptr; U_POINT16 *pt16hold, *pt16ptr; uint16_t *n16hold; uint16_t *n16ptr; @@ -1349,7 +1349,7 @@ unsigned int PrintWmf::text(Inkscape::Extension::Print * /*mod*/, char const *te return 0; } - char *rec = NULL; + char *rec = nullptr; int ccount, newfont; int fix90n = 0; uint32_t hfont = 0; @@ -1379,14 +1379,14 @@ unsigned int PrintWmf::text(Inkscape::Extension::Print * /*mod*/, char const *te } char *text2 = strdup(text); // because U_Utf8ToUtf16le calls iconv which does not like a const char * - uint16_t *unicode_text = U_Utf8ToUtf16le(text2, 0, NULL); + uint16_t *unicode_text = U_Utf8ToUtf16le(text2, 0, nullptr); free(text2); //translates Unicode as Utf16le to NonUnicode, if possible. If any translate, all will, and all to //the same font, because of code in Layout::print UnicodeToNon(unicode_text, &ccount, &newfont); // The preceding hopefully handled conversions to symbol, wingdings or zapf dingbats. Now slam everything // else down into latin1, which is all WMF can handle. If the language isn't English expect terrible results. - char *latin1_text = U_Utf16leToLatin1(unicode_text, 0, NULL); + char *latin1_text = U_Utf16leToLatin1(unicode_text, 0, nullptr); free(unicode_text); // in some cases a UTF string may reduce to NO latin1 characters, which returns NULL @@ -1439,9 +1439,9 @@ unsigned int PrintWmf::text(Inkscape::Extension::Print * /*mod*/, char const *te // of the special fonts. char *facename; if (!newfont) { - facename = U_Utf8ToLatin1(style->font_family.value, 0, NULL); + facename = U_Utf8ToLatin1(style->font_family.value, 0, nullptr); } else { - facename = U_Utf8ToLatin1(FontName(newfont), 0, NULL); + facename = U_Utf8ToLatin1(FontName(newfont), 0, nullptr); } // Scale the text to the minimum stretch. (It tends to stay within bounding rectangles even if diff --git a/src/extension/internal/wpg-input.cpp b/src/extension/internal/wpg-input.cpp index 2f3bfe27b..0953e5696 100644 --- a/src/extension/internal/wpg-input.cpp +++ b/src/extension/internal/wpg-input.cpp @@ -111,7 +111,7 @@ SPDocument *WpgInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u // fprintf(stderr, "ERROR: Unsupported file format (unsupported version) or file is encrypted!\n"); // printf("I'm giving up not supported\n"); delete input; - return NULL; + return nullptr; } #if WITH_LIBWPG03 @@ -120,7 +120,7 @@ SPDocument *WpgInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u if (!libwpg::WPGraphics::parse(input, &generator) || vec.empty() || vec[0].empty()) { delete input; - return NULL; + return nullptr; } RVNGString output("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n"); diff --git a/src/extension/loader.cpp b/src/extension/loader.cpp index 164a5cecf..7761b79bd 100644 --- a/src/extension/loader.cpp +++ b/src/extension/loader.cpp @@ -26,9 +26,9 @@ typedef const gchar *(*_getInkscapeVersion)(void); bool Loader::load_dependency(Dependency *dep) { - GModule *module = NULL; + GModule *module = nullptr; module = g_module_open(dep->get_name(), (GModuleFlags)0); - if (module == NULL) { + if (module == nullptr) { return false; } return true; @@ -47,7 +47,7 @@ Implementation::Implementation *Loader::load_implementation(Inkscape::XML::Docum Inkscape::XML::Node *child_repr = repr->firstChild(); // Iterate over the xml content - while (child_repr != NULL) { + while (child_repr != nullptr) { char const *chname = child_repr->name(); if (!strncmp(chname, INKSCAPE_EXTENSION_NS_NC, strlen(INKSCAPE_EXTENSION_NS_NC))) { chname += strlen(INKSCAPE_EXTENSION_NS); @@ -62,7 +62,7 @@ Implementation::Implementation *Loader::load_implementation(Inkscape::XML::Docum // Could not load dependency, we abort const char *res = g_module_error(); g_warning("Unable to load dependency %s of plugin %s.\nDetails: %s\n", dep.get_name(), "<todo>", res); - return NULL; + return nullptr; } } @@ -71,20 +71,20 @@ Implementation::Implementation *Loader::load_implementation(Inkscape::XML::Docum // The name of the plugin is actually the library file we want to load if (const gchar *name = child_repr->attribute("name")) { - GModule *module = NULL; - _getImplementation GetImplementation = NULL; - _getInkscapeVersion GetInkscapeVersion = NULL; + GModule *module = nullptr; + _getImplementation GetImplementation = nullptr; + _getInkscapeVersion GetInkscapeVersion = nullptr; // build the path where to look for the plugin - gchar *path = g_build_filename(_baseDirectory.c_str(), name, (char *) NULL); + gchar *path = g_build_filename(_baseDirectory.c_str(), name, (char *) nullptr); module = g_module_open(path, G_MODULE_BIND_LOCAL); g_free(path); - if (module == NULL) { + if (module == nullptr) { // we were not able to load the plugin, write warning and abort const char *res = g_module_error(); g_warning("Unable to load extension %s.\nDetails: %s\n", name, res); - return NULL; + return nullptr; } // Get a handle to the version function of the module @@ -92,7 +92,7 @@ Implementation::Implementation *Loader::load_implementation(Inkscape::XML::Docum // This didn't work, write warning and abort const char *res = g_module_error(); g_warning("Unable to load extension %s.\nDetails: %s\n", name, res); - return NULL; + return nullptr; } // Get a handle to the function that delivers the implementation @@ -100,7 +100,7 @@ Implementation::Implementation *Loader::load_implementation(Inkscape::XML::Docum // This didn't work, write warning and abort const char *res = g_module_error(); g_warning("Unable to load extension %s.\nDetails: %s\n", name, res); - return NULL; + return nullptr; } // Get version and test against this version @@ -121,7 +121,7 @@ Implementation::Implementation *Loader::load_implementation(Inkscape::XML::Docum } catch (std::exception &e) { g_warning("Unable to load extension."); } - return NULL; + return nullptr; } } // namespace Extension diff --git a/src/extension/output.cpp b/src/extension/output.cpp index 50b00f972..d6f95c19a 100644 --- a/src/extension/output.cpp +++ b/src/extension/output.cpp @@ -37,21 +37,21 @@ namespace Extension { */ Output::Output (Inkscape::XML::Node * in_repr, Implementation::Implementation * in_imp) : Extension(in_repr, in_imp) { - mimetype = NULL; - extension = NULL; - filetypename = NULL; - filetypetooltip = NULL; + mimetype = nullptr; + extension = nullptr; + filetypename = nullptr; + filetypetooltip = nullptr; dataloss = TRUE; - if (repr != NULL) { + if (repr != nullptr) { Inkscape::XML::Node * child_repr; child_repr = repr->firstChild(); - while (child_repr != NULL) { + while (child_repr != nullptr) { if (!strcmp(child_repr->name(), INKSCAPE_EXTENSION_NS "output")) { child_repr = child_repr->firstChild(); - while (child_repr != NULL) { + while (child_repr != nullptr) { char const * chname = child_repr->name(); if (!strncmp(chname, INKSCAPE_EXTENSION_NS_NC, strlen(INKSCAPE_EXTENSION_NS_NC))) { chname += strlen(INKSCAPE_EXTENSION_NS); @@ -115,9 +115,9 @@ Output::~Output (void) bool Output::check (void) { - if (extension == NULL) + if (extension == nullptr) return FALSE; - if (mimetype == NULL) + if (mimetype == nullptr) return FALSE; return Extension::check(); @@ -150,7 +150,7 @@ Output::get_extension(void) gchar * Output::get_filetypename(void) { - if (filetypename != NULL) + if (filetypename != nullptr) return filetypename; else return get_name(); @@ -181,7 +181,7 @@ Output::prefs (void) Gtk::Widget * controls; controls = imp->prefs_output(this); - if (controls == NULL) { + if (controls == nullptr) { // std::cout << "No preferences for Output" << std::endl; return true; } diff --git a/src/extension/output.h b/src/extension/output.h index c28706cf4..4f2924852 100644 --- a/src/extension/output.h +++ b/src/extension/output.h @@ -34,7 +34,7 @@ public: class export_id_not_found { /**< The object ID requested for export could not be found in the document */ public: const gchar * const id; - export_id_not_found(const gchar * const id = NULL) : id{id} {}; + export_id_not_found(const gchar * const id = nullptr) : id{id} {}; }; Output (Inkscape::XML::Node * in_repr, diff --git a/src/extension/param/bool.cpp b/src/extension/param/bool.cpp index 80bc89138..eea660f69 100644 --- a/src/extension/param/bool.cpp +++ b/src/extension/param/bool.cpp @@ -33,12 +33,12 @@ ParamBool::ParamBool(const gchar * name, : Parameter(name, text, description, hidden, indent, ext) , _value(false) { - const char * defaultval = NULL; - if (xml->firstChild() != NULL) { + const char * defaultval = nullptr; + if (xml->firstChild() != nullptr) { defaultval = xml->firstChild()->content(); } - if (defaultval != NULL && (!strcmp(defaultval, "true") || !strcmp(defaultval, "1"))) { + if (defaultval != nullptr && (!strcmp(defaultval, "true") || !strcmp(defaultval, "1"))) { _value = true; } else { _value = false; @@ -85,7 +85,7 @@ public: */ ParamBoolCheckButton (ParamBool * param, gchar * label, SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) : Gtk::CheckButton(label), _pref(param), _doc(doc), _node(node), _changeSignal(changeSignal) { - this->set_active(_pref->get(NULL, NULL) /**\todo fix */); + this->set_active(_pref->get(nullptr, nullptr) /**\todo fix */); this->signal_toggled().connect(sigc::mem_fun(this, &ParamBoolCheckButton::on_toggle)); return; } @@ -106,8 +106,8 @@ private: void ParamBoolCheckButton::on_toggle(void) { - _pref->set(this->get_active(), NULL /**\todo fix this */, NULL); - if (_changeSignal != NULL) { + _pref->set(this->get_active(), nullptr /**\todo fix this */, nullptr); + if (_changeSignal != nullptr) { _changeSignal->emit(); } return; @@ -127,7 +127,7 @@ void ParamBool::string(std::string &string) const Gtk::Widget *ParamBool::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) { if (_hidden) { - return NULL; + return nullptr; } auto hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, Parameter::GUI_PARAM_WIDGETS_SPACING)); diff --git a/src/extension/param/color.cpp b/src/extension/param/color.cpp index 035c43ba8..1e3b1dc4c 100644 --- a/src/extension/param/color.cpp +++ b/src/extension/param/color.cpp @@ -60,10 +60,10 @@ ParamColor::ParamColor(const gchar * name, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) : Parameter(name, text, description, hidden, indent, ext) - , _changeSignal(0) + , _changeSignal(nullptr) { - const char * defaulthex = NULL; - if (xml->firstChild() != NULL) + const char * defaulthex = nullptr; + if (xml->firstChild() != nullptr) defaulthex = xml->firstChild()->content(); gchar * pref_name = this->pref_name(); @@ -92,7 +92,7 @@ Gtk::Widget *ParamColor::get_widget( SPDocument * /*doc*/, Inkscape::XML::Node * { using Inkscape::UI::Widget::ColorNotebook; - if (_hidden) return NULL; + if (_hidden) return nullptr; if (changeSignal) { _changeSignal = new sigc::signal<void>(*changeSignal); diff --git a/src/extension/param/description.cpp b/src/extension/param/description.cpp index cf94918f7..d795514c3 100644 --- a/src/extension/param/description.cpp +++ b/src/extension/param/description.cpp @@ -37,15 +37,15 @@ ParamDescription::ParamDescription(const gchar * name, Inkscape::XML::Node * xml, AppearanceMode mode) : Parameter(name, text, description, hidden, indent, ext) - , _value(NULL) + , _value(nullptr) , _mode(mode) { // construct the text content by concatenating all (non-empty) text nodes, // removing all other nodes (e.g. comment nodes) and replacing <extension:br> elements with "<br/>" Glib::ustring value; Inkscape::XML::Node * cur_child = xml->firstChild(); - while (cur_child != NULL) { - if (cur_child->type() == XML::TEXT_NODE && cur_child->content() != NULL) { + while (cur_child != nullptr) { + if (cur_child->type() == XML::TEXT_NODE && cur_child->content() != nullptr) { value += cur_child->content(); } else if (cur_child->type() == XML::ELEMENT_NODE && !g_strcmp0(cur_child->name(), "extension:br")) { value += "<br/>"; @@ -71,8 +71,8 @@ ParamDescription::ParamDescription(const gchar * name, // translate if underscored version (_param) was used if (g_str_has_prefix(xml->name(), "extension:_")) { const gchar * context = xml->attribute("msgctxt"); - if (context != NULL) { - value = g_dpgettext2(NULL, context, value.c_str()); + if (context != nullptr) { + value = g_dpgettext2(nullptr, context, value.c_str()); } else { value = _(value.c_str()); } @@ -91,10 +91,10 @@ Gtk::Widget * ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal<void> * /*changeSignal*/) { if (_hidden) { - return NULL; + return nullptr; } - if (_value == NULL) { - return NULL; + if (_value == nullptr) { + return nullptr; } Glib::ustring newtext = _value; diff --git a/src/extension/param/enum.cpp b/src/extension/param/enum.cpp index ddcbb358b..c5ee5f6b9 100644 --- a/src/extension/param/enum.cpp +++ b/src/extension/param/enum.cpp @@ -39,27 +39,27 @@ ParamComboBox::ParamComboBox(const gchar * name, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) : Parameter(name, text, description, hidden, indent, ext) - , _value(NULL) + , _value(nullptr) { - const char *xmlval = NULL; // the value stored in XML + const char *xmlval = nullptr; // the value stored in XML - if (xml != NULL) { + if (xml != nullptr) { // Read XML tree to add enumeration items: for (Inkscape::XML::Node *node = xml->firstChild(); node; node = node->next()) { char const * chname = node->name(); if (!strcmp(chname, INKSCAPE_EXTENSION_NS "item") || !strcmp(chname, INKSCAPE_EXTENSION_NS "_item")) { Glib::ustring newtext, newvalue; - const char * contents = NULL; + const char * contents = nullptr; if (node->firstChild()) { contents = node->firstChild()->content(); } - if (contents != NULL) { + if (contents != nullptr) { // don't translate when 'item' but do translate when '_item' // NOTE: internal extensions use build_from_mem and don't need _item but // still need to include if are to be localized if (!strcmp(chname, INKSCAPE_EXTENSION_NS "_item")) { - if (node->attribute("msgctxt") != NULL) { - newtext = g_dpgettext2(NULL, node->attribute("msgctxt"), contents); + if (node->attribute("msgctxt") != nullptr) { + newtext = g_dpgettext2(nullptr, node->attribute("msgctxt"), contents); } else { newtext = _(contents); } @@ -70,7 +70,7 @@ ParamComboBox::ParamComboBox(const gchar * name, continue; const char * val = node->attribute("value"); - if (val != NULL) { + if (val != nullptr) { newvalue = val; } else { newvalue = contents; @@ -128,8 +128,8 @@ ParamComboBox::~ParamComboBox (void) */ const gchar *ParamComboBox::set(const gchar * in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/) { - if (in == NULL) { - return NULL; /* Can't have NULL string */ + if (in == nullptr) { + return nullptr; /* Can't have NULL string */ } Glib::ustring settext; @@ -140,7 +140,7 @@ const gchar *ParamComboBox::set(const gchar * in, SPDocument * /*doc*/, Inkscape } } if (!settext.empty()) { - if (_value != NULL) { + if (_value != nullptr) { g_free(_value); } _value = g_strdup(settext.data()); @@ -158,7 +158,7 @@ const gchar *ParamComboBox::set(const gchar * in, SPDocument * /*doc*/, Inkscape */ bool ParamComboBox::contains(const gchar * text, SPDocument const * /*doc*/, Inkscape::XML::Node const * /*node*/) const { - if (text == NULL) { + if (text == nullptr) { return false; /* Can't have NULL string */ } @@ -214,7 +214,7 @@ ParamComboBoxEntry::changed (void) { Glib::ustring data = this->get_active_text(); _pref->set(data.c_str(), _doc, _node); - if (_changeSignal != NULL) { + if (_changeSignal != nullptr) { _changeSignal->emit(); } } @@ -225,7 +225,7 @@ ParamComboBoxEntry::changed (void) Gtk::Widget *ParamComboBox::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) { if (_hidden) { - return NULL; + return nullptr; } Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, Parameter::GUI_PARAM_WIDGETS_SPACING)); diff --git a/src/extension/param/float.cpp b/src/extension/param/float.cpp index 1dd3f073b..aaf871068 100644 --- a/src/extension/param/float.cpp +++ b/src/extension/param/float.cpp @@ -40,27 +40,27 @@ ParamFloat::ParamFloat(const gchar * name, , _min(0.0) , _max(10.0) { - const gchar * defaultval = NULL; - if (xml->firstChild() != NULL) { + const gchar * defaultval = nullptr; + if (xml->firstChild() != nullptr) { defaultval = xml->firstChild()->content(); } - if (defaultval != NULL) { - _value = g_ascii_strtod (defaultval,NULL); + if (defaultval != nullptr) { + _value = g_ascii_strtod (defaultval,nullptr); } const char * maxval = xml->attribute("max"); - if (maxval != NULL) { - _max = g_ascii_strtod (maxval,NULL); + if (maxval != nullptr) { + _max = g_ascii_strtod (maxval,nullptr); } const char * minval = xml->attribute("min"); - if (minval != NULL) { - _min = g_ascii_strtod (minval,NULL); + if (minval != nullptr) { + _min = g_ascii_strtod (minval,nullptr); } _precision = 1; const char * precision = xml->attribute("precision"); - if (precision != NULL) { + if (precision != nullptr) { _precision = atoi(precision); } @@ -136,7 +136,7 @@ public: describing the parameter. */ ParamFloatAdjustment (ParamFloat * param, SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) : Gtk::Adjustment(0.0, param->min(), param->max(), 0.1, 1.0, 0), _pref(param), _doc(doc), _node(node), _changeSignal(changeSignal) { - this->set_value(_pref->get(NULL, NULL) /* \todo fix */); + this->set_value(_pref->get(nullptr, nullptr) /* \todo fix */); this->signal_value_changed().connect(sigc::mem_fun(this, &ParamFloatAdjustment::val_changed)); return; }; @@ -154,7 +154,7 @@ void ParamFloatAdjustment::val_changed(void) { //std::cout << "Value Changed to: " << this->get_value() << std::endl; _pref->set(this->get_value(), _doc, _node); - if (_changeSignal != NULL) { + if (_changeSignal != nullptr) { _changeSignal->emit(); } return; @@ -168,7 +168,7 @@ void ParamFloatAdjustment::val_changed(void) Gtk::Widget * ParamFloat::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) { if (_hidden) { - return NULL; + return nullptr; } Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, Parameter::GUI_PARAM_WIDGETS_SPACING)); @@ -179,7 +179,7 @@ Gtk::Widget * ParamFloat::get_widget(SPDocument * doc, Inkscape::XML::Node * nod if (_mode == FULL) { Glib::ustring text; - if (_text != NULL) + if (_text != nullptr) text = _text; UI::Widget::SpinScale *scale = new UI::Widget::SpinScale(text, fadjust, _precision); scale->set_size_request(400, -1); diff --git a/src/extension/param/int.cpp b/src/extension/param/int.cpp index 9ad9b591c..1c946d8b8 100644 --- a/src/extension/param/int.cpp +++ b/src/extension/param/int.cpp @@ -40,21 +40,21 @@ ParamInt::ParamInt(const gchar * name, , _min(0) , _max(10) { - const char * defaultval = NULL; - if (xml->firstChild() != NULL) { + const char * defaultval = nullptr; + if (xml->firstChild() != nullptr) { defaultval = xml->firstChild()->content(); } - if (defaultval != NULL) { + if (defaultval != nullptr) { _value = atoi(defaultval); } const char * maxval = xml->attribute("max"); - if (maxval != NULL) { + if (maxval != nullptr) { _max = atoi(maxval); } const char * minval = xml->attribute("min"); - if (minval != NULL) { + if (minval != nullptr) { _min = atoi(minval); } /* We're handling this by just killing both values */ @@ -118,7 +118,7 @@ public: describing the parameter. */ ParamIntAdjustment (ParamInt * param, SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) : Gtk::Adjustment(0.0, param->min(), param->max(), 1.0, 10.0, 0), _pref(param), _doc(doc), _node(node), _changeSignal(changeSignal) { - this->set_value(_pref->get(NULL, NULL) /* \todo fix */); + this->set_value(_pref->get(nullptr, nullptr) /* \todo fix */); this->signal_value_changed().connect(sigc::mem_fun(this, &ParamIntAdjustment::val_changed)); }; @@ -135,7 +135,7 @@ void ParamIntAdjustment::val_changed(void) { //std::cout << "Value Changed to: " << this->get_value() << std::endl; _pref->set((int)this->get_value(), _doc, _node); - if (_changeSignal != NULL) { + if (_changeSignal != nullptr) { _changeSignal->emit(); } } @@ -149,7 +149,7 @@ Gtk::Widget * ParamInt::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) { if (_hidden) { - return NULL; + return nullptr; } Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, Parameter::GUI_PARAM_WIDGETS_SPACING)); @@ -160,7 +160,7 @@ ParamInt::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal if (_mode == FULL) { Glib::ustring text; - if (_text != NULL) + if (_text != nullptr) text = _text; UI::Widget::SpinScale *scale = new UI::Widget::SpinScale(text, fadjust, 0); scale->set_size_request(400, -1); diff --git a/src/extension/param/notebook.cpp b/src/extension/param/notebook.cpp index e47644f45..d00693db4 100644 --- a/src/extension/param/notebook.cpp +++ b/src/extension/param/notebook.cpp @@ -51,9 +51,9 @@ ParamNotebook::ParamNotebookPage::ParamNotebookPage(const gchar * name, { // Read XML to build page - if (xml != NULL) { + if (xml != nullptr) { Inkscape::XML::Node *child_repr = xml->firstChild(); - while (child_repr != NULL) { + while (child_repr != nullptr) { char const * chname = child_repr->name(); if (!strncmp(chname, INKSCAPE_EXTENSION_NS_NC, strlen(INKSCAPE_EXTENSION_NS_NC))) { chname += strlen(INKSCAPE_EXTENSION_NS); @@ -63,7 +63,7 @@ ParamNotebook::ParamNotebookPage::ParamNotebookPage(const gchar * name, if (!strcmp(chname, "param") || !strcmp(chname, "_param")) { Parameter * param; param = Parameter::make(child_repr, ext); - if (param != NULL) parameters.push_back(param); + if (param != nullptr) parameters.push_back(param); } child_repr = child_repr->next(); } @@ -122,13 +122,13 @@ ParamNotebook::ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inksc name = in_repr->attribute("name"); text = in_repr->attribute("gui-text"); - if (text == NULL) + if (text == nullptr) text = in_repr->attribute("_gui-text"); description = in_repr->attribute("gui-description"); - if (description == NULL) + if (description == nullptr) description = in_repr->attribute("_gui-description"); hide = in_repr->attribute("gui-hidden"); - if (hide != NULL) { + if (hide != nullptr) { if (strcmp(hide, "1") == 0 || strcmp(hide, "true") == 0) { hidden = true; @@ -137,8 +137,8 @@ ParamNotebook::ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inksc } /* In this case we just don't have enough information */ - if (name == NULL) { - return NULL; + if (name == nullptr) { + return nullptr; } ParamNotebookPage * page = new ParamNotebookPage(name, text, description, hidden, in_ext, in_repr); @@ -157,7 +157,7 @@ ParamNotebook::ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inksc Gtk::Widget * ParamNotebook::ParamNotebookPage::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) { if (_hidden) { - return NULL; + return nullptr; } Gtk::VBox * vbox = Gtk::manage(new Gtk::VBox); @@ -194,7 +194,7 @@ Gtk::Widget * ParamNotebook::ParamNotebookPage::get_widget(SPDocument * doc, Ink /** Search the parameter's name in the page content. */ Parameter *ParamNotebook::ParamNotebookPage::get_param(const gchar * name) { - if (name == NULL) { + if (name == nullptr) { throw Extension::param_not_exist(); } if (this->parameters.empty()) { @@ -208,7 +208,7 @@ Parameter *ParamNotebook::ParamNotebookPage::get_param(const gchar * name) } } - return NULL; + return nullptr; } /** End ParamNotebookPage **/ @@ -224,9 +224,9 @@ ParamNotebook::ParamNotebook(const gchar * name, : Parameter(name, text, description, hidden, indent, ext) { // Read XML tree to add pages: - if (xml != NULL) { + if (xml != nullptr) { Inkscape::XML::Node *child_repr = xml->firstChild(); - while (child_repr != NULL) { + while (child_repr != nullptr) { char const * chname = child_repr->name(); if (!strncmp(chname, INKSCAPE_EXTENSION_NS_NC, strlen(INKSCAPE_EXTENSION_NS_NC))) { chname += strlen(INKSCAPE_EXTENSION_NS); @@ -236,14 +236,14 @@ ParamNotebook::ParamNotebook(const gchar * name, if (!strcmp(chname, "page")) { ParamNotebookPage * page; page = ParamNotebookPage::makepage(child_repr, ext); - if (page != NULL) pages.push_back(page); + if (page != nullptr) pages.push_back(page); } child_repr = child_repr->next(); } } // Initialize _value with the current page - const char * defaultval = NULL; + const char * defaultval = nullptr; // set first page as default if (!pages.empty()) { defaultval = pages[0]->name(); @@ -256,7 +256,7 @@ ParamNotebook::ParamNotebook(const gchar * name, if (!paramval.empty()) defaultval = paramval.data(); - if (defaultval != NULL) + if (defaultval != nullptr) _value = g_strdup(defaultval); // allocate space for _value } @@ -290,9 +290,9 @@ const gchar *ParamNotebook::set(const int in, SPDocument * /*doc*/, Inkscape::XM int i = in < pages.size() ? in : pages.size()-1; ParamNotebookPage * page = pages[i]; - if (page == NULL) return _value; + if (page == nullptr) return _value; - if (_value != NULL) g_free(_value); + if (_value != nullptr) g_free(_value); _value = g_strdup(page->name()); gchar * prefname = this->pref_name(); @@ -359,7 +359,7 @@ void ParamNotebookWdg::changed_page(Gtk::Widget * /*page*/, guint pagenum) /** Search the parameter's name in the notebook content. */ Parameter *ParamNotebook::get_param(const gchar * name) { - if (name == NULL) { + if (name == nullptr) { throw Extension::param_not_exist(); } for (auto page:pages) { @@ -369,7 +369,7 @@ Parameter *ParamNotebook::get_param(const gchar * name) } } - return NULL; + return nullptr; } @@ -381,7 +381,7 @@ Parameter *ParamNotebook::get_param(const gchar * name) Gtk::Widget * ParamNotebook::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) { if (_hidden) { - return NULL; + return nullptr; } ParamNotebookWdg * nb = Gtk::manage(new ParamNotebookWdg(this, doc, node)); diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index f9a69de05..d897903cb 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -52,37 +52,37 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex // we can't create a parameter without type if (!type) { - return NULL; + return nullptr; } // also require name unless it's a pure UI element that does not store its value if (!name) { static std::vector<std::string> ui_elements = {"description"}; if (std::find(ui_elements.begin(), ui_elements.end(), type) == ui_elements.end()) { - return NULL; + return nullptr; } } const char *text = in_repr->attribute("gui-text"); - if (text == NULL) { + if (text == nullptr) { text = in_repr->attribute("_gui-text"); - if (text == NULL) { + if (text == nullptr) { // text = ""; // probably better to require devs to explicitly set an empty gui-text if this is what they want } else { const char *context = in_repr->attribute("msgctxt"); - if (context != NULL) { - text = g_dpgettext2(NULL, context, text); + if (context != nullptr) { + text = g_dpgettext2(nullptr, context, text); } else { text = _(text); } } } const char *description = in_repr->attribute("gui-description"); - if (description == NULL) { + if (description == nullptr) { description = in_repr->attribute("_gui-description"); - if (description != NULL) { + if (description != nullptr) { const char *context = in_repr->attribute("msgctxt"); - if (context != NULL) { - description = g_dpgettext2(NULL, context, description); + if (context != nullptr) { + description = g_dpgettext2(nullptr, context, description); } else { description = _(description); } @@ -91,7 +91,7 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex bool hidden = false; { const char *gui_hide = in_repr->attribute("gui-hidden"); - if (gui_hide != NULL) { + if (gui_hide != nullptr) { if (strcmp(gui_hide, "1") == 0 || strcmp(gui_hide, "true") == 0) { hidden = true; @@ -102,7 +102,7 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex int indent = 0; { const char *indent_attr = in_repr->attribute("indent"); - if (indent_attr != NULL) { + if (indent_attr != nullptr) { if (strcmp(indent_attr, "true") == 0) { indent = 1; } else { @@ -112,7 +112,7 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex } const gchar* appearance = in_repr->attribute("appearance"); - Parameter * param = NULL; + Parameter * param = nullptr; if (!strcmp(type, "boolean")) { param = new ParamBool(name, text, description, hidden, indent, in_ext, in_repr); } else if (!strcmp(type, "int")) { @@ -130,7 +130,7 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex } else if (!strcmp(type, "string")) { param = new ParamString(name, text, description, hidden, indent, in_ext, in_repr); gchar const * max_length = in_repr->attribute("max_length"); - if (max_length != NULL) { + if (max_length != nullptr) { ParamString * ps = dynamic_cast<ParamString *>(param); ps->setMaxLength(atoi(max_length)); } @@ -237,7 +237,7 @@ guint32 Parameter::get_color(const SPDocument* doc, Inkscape::XML::Node const *n bool Parameter::set_bool(bool in, SPDocument * doc, Inkscape::XML::Node * node) { ParamBool * boolpntr = dynamic_cast<ParamBool *>(this); - if (boolpntr == NULL) + if (boolpntr == nullptr) throw Extension::param_not_bool_param(); return boolpntr->set(in, doc, node); } @@ -245,7 +245,7 @@ bool Parameter::set_bool(bool in, SPDocument * doc, Inkscape::XML::Node * node) int Parameter::set_int(int in, SPDocument * doc, Inkscape::XML::Node * node) { ParamInt * intpntr = dynamic_cast<ParamInt *>(this); - if (intpntr == NULL) + if (intpntr == nullptr) throw Extension::param_not_int_param(); return intpntr->set(in, doc, node); } @@ -256,7 +256,7 @@ Parameter::set_float (float in, SPDocument * doc, Inkscape::XML::Node * node) { ParamFloat * floatpntr; floatpntr = dynamic_cast<ParamFloat *>(this); - if (floatpntr == NULL) + if (floatpntr == nullptr) throw Extension::param_not_float_param(); return floatpntr->set(in, doc, node); } @@ -266,7 +266,7 @@ gchar const * Parameter::set_string (gchar const * in, SPDocument * doc, Inkscape::XML::Node * node) { ParamString * stringpntr = dynamic_cast<ParamString *>(this); - if (stringpntr == NULL) + if (stringpntr == nullptr) throw Extension::param_not_string_param(); return stringpntr->set(in, doc, node); } @@ -295,7 +295,7 @@ guint32 Parameter::set_color (guint32 in, SPDocument * doc, Inkscape::XML::Node * node) { ParamColor* param = dynamic_cast<ParamColor *>(this); - if (param == NULL) + if (param == nullptr) throw Extension::param_not_color_param(); return param->set(in, doc, node); } @@ -303,22 +303,22 @@ Parameter::set_color (guint32 in, SPDocument * doc, Inkscape::XML::Node * node) /** Oop, now that we need a parameter, we need it's name. */ Parameter::Parameter(gchar const * name, gchar const * text, gchar const * description, bool hidden, int indent, Inkscape::Extension::Extension * ext) : - _description(0), - _text(0), + _description(nullptr), + _text(nullptr), _hidden(hidden), _indent(indent), _extension(ext), - _name(0) + _name(nullptr) { - if (name != NULL) { + if (name != nullptr) { _name = g_strdup(name); } - if (description != NULL) { + if (description != nullptr) { _description = g_strdup(description); } - if (text != NULL) { + if (text != nullptr) { _text = g_strdup(text); } else { _text = g_strdup(name); @@ -329,17 +329,17 @@ Parameter::Parameter(gchar const * name, gchar const * text, gchar const * descr /** Oop, now that we need a parameter, we need it's name. */ Parameter::Parameter (gchar const * name, gchar const * text, Inkscape::Extension::Extension * ext) : - _description(0), - _text(0), + _description(nullptr), + _text(nullptr), _hidden(false), _indent(0), _extension(ext), - _name(0) + _name(nullptr) { - if (name != NULL) { + if (name != nullptr) { _name = g_strdup(name); } - if (text != NULL) { + if (text != nullptr) { _text = g_strdup(text); } else { _text = g_strdup(name); @@ -351,13 +351,13 @@ Parameter::Parameter (gchar const * name, gchar const * text, Inkscape::Extensio Parameter::~Parameter(void) { g_free(_name); - _name = 0; + _name = nullptr; g_free(_text); - _text = 0; + _text = nullptr; g_free(_description); - _description = 0; + _description = nullptr; } gchar *Parameter::pref_name(void) const @@ -387,12 +387,12 @@ Inkscape::XML::Node *Parameter::document_param_node(SPDocument * doc) { Inkscape::XML::Document *xml_doc = doc->getReprDoc(); Inkscape::XML::Node * defs = doc->getDefs()->getRepr(); - Inkscape::XML::Node * params = NULL; + Inkscape::XML::Node * params = nullptr; GQuark const name_quark = g_quark_from_string("inkscape:extension-params"); for (Inkscape::XML::Node * child = defs->firstChild(); - child != NULL; + child != nullptr; child = child->next()) { if ((GQuark)child->code() == name_quark && !strcmp(child->attribute("extension"), _extension->get_id())) { @@ -401,7 +401,7 @@ Inkscape::XML::Node *Parameter::document_param_node(SPDocument * doc) } } - if (params == NULL) { + if (params == nullptr) { params = xml_doc->createElement("inkscape:extension-param"); params->setAttribute("extension", _extension->get_id()); defs->appendChild(params); @@ -415,7 +415,7 @@ Inkscape::XML::Node *Parameter::document_param_node(SPDocument * doc) Gtk::Widget * Parameter::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal<void> * /*changeSignal*/) { - return NULL; + return nullptr; } /** If I'm not sure which it is, just don't return a value. */ @@ -441,7 +441,7 @@ void Parameter::string(std::list <std::string> &list) const Parameter *Parameter::get_param(gchar const * /*name*/) { - return NULL; + return nullptr; } Glib::ustring const extension_pref_root = "/extensions/"; diff --git a/src/extension/param/radiobutton.cpp b/src/extension/param/radiobutton.cpp index 5598081f3..45869378a 100644 --- a/src/extension/param/radiobutton.cpp +++ b/src/extension/param/radiobutton.cpp @@ -51,25 +51,25 @@ ParamRadioButton::ParamRadioButton(const gchar * name, Inkscape::XML::Node * xml, AppearanceMode mode) : Parameter(name, text, description, hidden, indent, ext) - , _value(0) + , _value(nullptr) , _mode(mode) { // Read XML tree to add enumeration items: // printf("Extension Constructor: "); - if (xml != NULL) { + if (xml != nullptr) { Inkscape::XML::Node *child_repr = xml->firstChild(); - while (child_repr != NULL) { + while (child_repr != nullptr) { char const * chname = child_repr->name(); if (!strcmp(chname, INKSCAPE_EXTENSION_NS "option") || !strcmp(chname, INKSCAPE_EXTENSION_NS "_option")) { - Glib::ustring * newtext = NULL; - Glib::ustring * newvalue = NULL; + Glib::ustring * newtext = nullptr; + Glib::ustring * newvalue = nullptr; const char * contents = child_repr->firstChild()->content(); - if (contents != NULL) { + if (contents != nullptr) { // don't translate when 'item' but do translate when '_option' if (!strcmp(chname, INKSCAPE_EXTENSION_NS "_option")) { - if (child_repr->attribute("msgctxt") != NULL) { - newtext = new Glib::ustring(g_dpgettext2(NULL, child_repr->attribute("msgctxt"), contents)); + if (child_repr->attribute("msgctxt") != nullptr) { + newtext = new Glib::ustring(g_dpgettext2(nullptr, child_repr->attribute("msgctxt"), contents)); } else { newtext = new Glib::ustring(_(contents)); } @@ -82,7 +82,7 @@ ParamRadioButton::ParamRadioButton(const gchar * name, const char * val = child_repr->attribute("value"); - if (val != NULL) { + if (val != nullptr) { newvalue = new Glib::ustring(val); } else { newvalue = new Glib::ustring(contents); @@ -98,7 +98,7 @@ ParamRadioButton::ParamRadioButton(const gchar * name, // Initialize _value with the default value from xml // for simplicity : default to the contents of the first xml-child - const char * defaultval = NULL; + const char * defaultval = nullptr; if (!choices.empty()) { defaultval = (static_cast<optionentry*> (choices[0]))->value->c_str(); } @@ -111,7 +111,7 @@ ParamRadioButton::ParamRadioButton(const gchar * name, if (!paramval.empty()) { defaultval = paramval.data(); } - if (defaultval != NULL) { + if (defaultval != nullptr) { _value = g_strdup(defaultval); // allocate space for _value } } @@ -143,11 +143,11 @@ ParamRadioButton::~ParamRadioButton (void) */ const gchar *ParamRadioButton::set(const gchar * in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/) { - if (in == NULL) { - return NULL; /* Can't have NULL string */ + if (in == nullptr) { + return nullptr; /* Can't have NULL string */ } - Glib::ustring * settext = NULL; + Glib::ustring * settext = nullptr; for (auto entr:choices) { if ( !entr->value->compare(in) ) { settext = entr->value; @@ -155,7 +155,7 @@ const gchar *ParamRadioButton::set(const gchar * in, SPDocument * /*doc*/, Inksc } } if (settext) { - if (_value != NULL) { + if (_value != nullptr) { g_free(_value); } _value = g_strdup(settext->c_str()); @@ -215,7 +215,7 @@ void ParamRadioButtonWdg::changed(void) Glib::ustring value = _pref->value_from_label(this->get_label()); _pref->set(value.c_str(), _doc, _node); } - if (_changeSignal != NULL) { + if (_changeSignal != nullptr) { _changeSignal->emit(); } } @@ -247,7 +247,7 @@ void ComboWdg::changed(void) Glib::ustring value = _base->value_from_label(get_active_text()); _base->set(value.c_str(), _doc, _node); } - if (_changeSignal != NULL) { + if (_changeSignal != nullptr) { _changeSignal->emit(); } } @@ -276,7 +276,7 @@ Glib::ustring ParamRadioButton::value_from_label(const Glib::ustring label) Gtk::Widget * ParamRadioButton::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) { if (_hidden) { - return NULL; + return nullptr; } auto hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, Parameter::GUI_PARAM_WIDGETS_SPACING)); @@ -288,7 +288,7 @@ Gtk::Widget * ParamRadioButton::get_widget(SPDocument * doc, Inkscape::XML::Node label->show(); hbox->pack_start(*label, false, false); - Gtk::ComboBoxText* cbt = 0; + Gtk::ComboBoxText* cbt = nullptr; bool comboSet = false; if (_mode == MINIMAL) { cbt = Gtk::manage(new ComboWdg(this, doc, node, changeSignal)); diff --git a/src/extension/param/string.cpp b/src/extension/param/string.cpp index 51b5dfdf3..775bf62ee 100644 --- a/src/extension/param/string.cpp +++ b/src/extension/param/string.cpp @@ -30,7 +30,7 @@ namespace Extension { ParamString::~ParamString(void) { g_free(_value); - _value = 0; + _value = nullptr; } /** @@ -50,11 +50,11 @@ ParamString::~ParamString(void) */ const gchar * ParamString::set(const gchar * in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/) { - if (in == NULL) { - return NULL; /* Can't have NULL string */ + if (in == nullptr) { + return nullptr; /* Can't have NULL string */ } - if (_value != NULL) { + if (_value != nullptr) { g_free(_value); } @@ -84,10 +84,10 @@ ParamString::ParamString(const gchar * name, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) : Parameter(name, text, description, hidden, indent, ext) - , _value(NULL) + , _value(nullptr) { - const char * defaultval = NULL; - if (xml->firstChild() != NULL) { + const char * defaultval = nullptr; + if (xml->firstChild() != nullptr) { defaultval = xml->firstChild()->content(); } @@ -99,11 +99,11 @@ ParamString::ParamString(const gchar * name, if (!paramval.empty()) { defaultval = paramval.data(); } - if (defaultval != NULL) { + if (defaultval != nullptr) { char const * chname = xml->name(); if (!strcmp(chname, INKSCAPE_EXTENSION_NS "_param")) { - if (xml->attribute("msgctxt") != NULL) { - _value = g_strdup(g_dpgettext2(NULL, xml->attribute("msgctxt"), defaultval)); + if (xml->attribute("msgctxt") != nullptr) { + _value = g_strdup(g_dpgettext2(nullptr, xml->attribute("msgctxt"), defaultval)); } else { _value = g_strdup(_(defaultval)); } @@ -130,8 +130,8 @@ public: */ ParamStringEntry (ParamString * pref, SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) : Gtk::Entry(), _pref(pref), _doc(doc), _node(node), _changeSignal(changeSignal) { - if (_pref->get(NULL, NULL) != NULL) { - this->set_text(Glib::ustring(_pref->get(NULL, NULL))); + if (_pref->get(nullptr, nullptr) != nullptr) { + this->set_text(Glib::ustring(_pref->get(nullptr, nullptr))); } this->set_max_length(_pref->getMaxLength()); //Set the max length - default zero means no maximum this->signal_changed().connect(sigc::mem_fun(this, &ParamStringEntry::changed_text)); @@ -150,7 +150,7 @@ void ParamStringEntry::changed_text(void) { Glib::ustring data = this->get_text(); _pref->set(data.c_str(), _doc, _node); - if (_changeSignal != NULL) { + if (_changeSignal != nullptr) { _changeSignal->emit(); } } @@ -163,7 +163,7 @@ void ParamStringEntry::changed_text(void) Gtk::Widget * ParamString::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) { if (_hidden) { - return NULL; + return nullptr; } Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, Parameter::GUI_PARAM_WIDGETS_SPACING)); diff --git a/src/extension/patheffect.cpp b/src/extension/patheffect.cpp index 1e9e093ef..82d75dcb3 100644 --- a/src/extension/patheffect.cpp +++ b/src/extension/patheffect.cpp @@ -39,33 +39,33 @@ void PathEffect::processPathEffects (SPDocument * doc, Inkscape::XML::Node * path) { gchar const * patheffectlist = path->attribute("inkscape:path-effects"); - if (patheffectlist == NULL) + if (patheffectlist == nullptr) return; gchar ** patheffects = g_strsplit(patheffectlist, ";", 128); Inkscape::XML::Node * defs = doc->getDefs()->getRepr(); - for (int i = 0; (i < 128) && (patheffects[i] != NULL); i++) { + for (int i = 0; (i < 128) && (patheffects[i] != nullptr); i++) { gchar * patheffect = patheffects[i]; // This is weird, they should all be references... but anyway if (patheffect[0] != '#') continue; Inkscape::XML::Node * prefs = sp_repr_lookup_child(defs, "id", &(patheffect[1])); - if (prefs == NULL) { + if (prefs == nullptr) { continue; } gchar const * ext_id = prefs->attribute("extension"); - if (ext_id == NULL) { + if (ext_id == nullptr) { continue; } Inkscape::Extension::PathEffect * peffect; peffect = dynamic_cast<Inkscape::Extension::PathEffect *>(Inkscape::Extension::db.get(ext_id)); - if (peffect != NULL) { + if (peffect != nullptr) { peffect->processPath(doc, path, prefs); } } diff --git a/src/extension/plugins/grid2/grid.cpp b/src/extension/plugins/grid2/grid.cpp index 256bb8dc2..3ebe85b3e 100644 --- a/src/extension/plugins/grid2/grid.cpp +++ b/src/extension/plugins/grid2/grid.cpp @@ -187,7 +187,7 @@ Grid::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View SPDocument * current_document = view->doc(); auto selected = ((SPDesktop *) view)->getSelection()->items(); - Inkscape::XML::Node * first_select = NULL; + Inkscape::XML::Node * first_select = nullptr; if (!selected.empty()) { first_select = selected.front()->getRepr(); } diff --git a/src/extension/prefdialog.cpp b/src/extension/prefdialog.cpp index b5b1f9bfe..47ed14405 100644 --- a/src/extension/prefdialog.cpp +++ b/src/extension/prefdialog.cpp @@ -45,22 +45,22 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co Gtk::Dialog(_(name.c_str()), true), _help(help), _name(name), - _button_ok(NULL), - _button_cancel(NULL), - _button_preview(NULL), - _param_preview(NULL), + _button_ok(nullptr), + _button_cancel(nullptr), + _button_preview(nullptr), + _param_preview(nullptr), _effect(effect), - _exEnv(NULL) + _exEnv(nullptr) { this->set_default_size(0,0); // we want the window to be as small as possible instead of clobbering up space Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox()); - if (controls == NULL) { - if (_effect == NULL) { + if (controls == nullptr) { + if (_effect == nullptr) { std::cout << "AH!!! No controls and no effect!!!" << std::endl; return; } - controls = _effect->get_imp()->prefs_effect(_effect, SP_ACTIVE_DESKTOP, &_signal_param_change, NULL); + controls = _effect->get_imp()->prefs_effect(_effect, SP_ACTIVE_DESKTOP, &_signal_param_change, nullptr); _signal_param_change.connect(sigc::mem_fun(this, &PrefDialog::param_change)); } @@ -74,15 +74,15 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co if (_help == NULL) help_button->set_sensitive(false); */ - _button_cancel = add_button(_effect == NULL ? _("_Cancel") : _("_Close"), Gtk::RESPONSE_CANCEL); - _button_ok = add_button(_effect == NULL ? _("_OK") : _("_Apply"), Gtk::RESPONSE_OK); + _button_cancel = add_button(_effect == nullptr ? _("_Cancel") : _("_Close"), Gtk::RESPONSE_CANCEL); + _button_ok = add_button(_effect == nullptr ? _("_OK") : _("_Apply"), Gtk::RESPONSE_OK); set_default_response(Gtk::RESPONSE_OK); _button_ok->grab_focus(); - if (_effect != NULL && !_effect->no_live_preview) { - if (_param_preview == NULL) { - XML::Document * doc = sp_repr_read_mem(live_param_xml, strlen(live_param_xml), NULL); - if (doc == NULL) { + if (_effect != nullptr && !_effect->no_live_preview) { + if (_param_preview == nullptr) { + XML::Document * doc = sp_repr_read_mem(live_param_xml, strlen(live_param_xml), nullptr); + if (doc == nullptr) { std::cout << "Error encountered loading live parameter XML !!!" << std::endl; return; } @@ -96,7 +96,7 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co hbox = Gtk::manage(new Gtk::HBox()); hbox->set_border_width(Parameter::GUI_BOX_MARGIN); - _button_preview = _param_preview->get_widget(NULL, NULL, &_signal_preview); + _button_preview = _param_preview->get_widget(nullptr, nullptr, &_signal_preview); _button_preview->show(); hbox->pack_start(*_button_preview, true, true, 0); hbox->show(); @@ -104,7 +104,7 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co this->get_content_area()->pack_start(*hbox, false, false, 0); Gtk::Box * hbox = dynamic_cast<Gtk::Box *>(_button_preview); - if (hbox != NULL) { + if (hbox != nullptr) { _checkbox_preview = dynamic_cast<Gtk::CheckButton *>(hbox->get_children().front()); } @@ -113,7 +113,7 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co } // Set window modality for effects that don't use live preview - if (_effect != NULL && _effect->no_live_preview) { + if (_effect != nullptr && _effect->no_live_preview) { set_modal(false); } @@ -125,20 +125,20 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co PrefDialog::~PrefDialog ( ) { - if (_param_preview != NULL) { + if (_param_preview != nullptr) { delete _param_preview; - _param_preview = NULL; + _param_preview = nullptr; } - if (_exEnv != NULL) { + if (_exEnv != nullptr) { _exEnv->cancel(); delete _exEnv; - _exEnv = NULL; + _exEnv = nullptr; _effect->set_execution_env(_exEnv); } - if (_effect != NULL) { - _effect->set_pref_dialog(NULL); + if (_effect != nullptr) { + _effect->set_pref_dialog(nullptr); } return; @@ -176,21 +176,21 @@ PrefDialog::preview_toggle (void) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; SPDocument *document = SP_ACTIVE_DOCUMENT; bool modified = document->isModifiedSinceSave(); - if(_param_preview->get_bool(NULL, NULL)) { - if (_exEnv == NULL) { + if(_param_preview->get_bool(nullptr, nullptr)) { + if (_exEnv == nullptr) { set_modal(true); - _exEnv = new ExecutionEnv(_effect, SP_ACTIVE_DESKTOP, NULL, false, false); + _exEnv = new ExecutionEnv(_effect, SP_ACTIVE_DESKTOP, nullptr, false, false); _effect->set_execution_env(_exEnv); _exEnv->run(); } } else { set_modal(false); - if (_exEnv != NULL) { + if (_exEnv != nullptr) { _exEnv->cancel(); _exEnv->undo(); _exEnv->reselect(); delete _exEnv; - _exEnv = NULL; + _exEnv = nullptr; _effect->set_execution_env(_exEnv); } } @@ -199,7 +199,7 @@ PrefDialog::preview_toggle (void) { void PrefDialog::param_change (void) { - if (_exEnv != NULL) { + if (_exEnv != nullptr) { if (!_effect->loaded()) { _effect->set_state(Extension::STATE_LOADED); } @@ -214,7 +214,7 @@ PrefDialog::param_change (void) { bool PrefDialog::param_timer_expire (void) { - if (_exEnv != NULL) { + if (_exEnv != nullptr) { _exEnv->cancel(); _exEnv->undo(); _exEnv->run(); @@ -226,8 +226,8 @@ PrefDialog::param_timer_expire (void) { void PrefDialog::on_response (int signal) { if (signal == Gtk::RESPONSE_OK) { - if (_exEnv == NULL) { - if (_effect != NULL) { + if (_exEnv == nullptr) { + if (_effect != nullptr) { _effect->effect(SP_ACTIVE_DESKTOP); } else { // Shutdown run() @@ -241,16 +241,16 @@ PrefDialog::on_response (int signal) { _exEnv->reselect(); } delete _exEnv; - _exEnv = NULL; + _exEnv = nullptr; _effect->set_execution_env(_exEnv); } } - if (_param_preview != NULL) { + if (_param_preview != nullptr) { _checkbox_preview->set_active(false); } - if ((signal == Gtk::RESPONSE_CANCEL || signal == Gtk::RESPONSE_DELETE_EVENT) && _effect != NULL) { + if ((signal == Gtk::RESPONSE_CANCEL || signal == Gtk::RESPONSE_DELETE_EVENT) && _effect != nullptr) { delete this; } return; diff --git a/src/extension/prefdialog.h b/src/extension/prefdialog.h index 0c0bfcb88..f2ff60770 100644 --- a/src/extension/prefdialog.h +++ b/src/extension/prefdialog.h @@ -71,8 +71,8 @@ class PrefDialog : public Gtk::Dialog { public: PrefDialog (Glib::ustring name, gchar const * help, - Gtk::Widget * controls = NULL, - Effect * effect = NULL); + Gtk::Widget * controls = nullptr, + Effect * effect = nullptr); ~PrefDialog () override; }; diff --git a/src/extension/print.cpp b/src/extension/print.cpp index c37e9425c..ad9836a66 100644 --- a/src/extension/print.cpp +++ b/src/extension/print.cpp @@ -17,9 +17,9 @@ namespace Extension { Print::Print (Inkscape::XML::Node *in_repr, Implementation::Implementation *in_imp) : Extension(in_repr, in_imp) - , base(NULL) - , drawing(NULL) - , root(NULL) + , base(nullptr) + , drawing(nullptr) + , root(nullptr) , dkey(0) { } diff --git a/src/extension/system.cpp b/src/extension/system.cpp index 5b039948a..6802050b0 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -70,9 +70,9 @@ static Extension *build_from_reprdoc(Inkscape::XML::Document *doc, Implementatio */ SPDocument *open(Extension *key, gchar const *filename) { - Input *imod = NULL; + Input *imod = nullptr; - if (key == NULL) { + if (key == nullptr) { gpointer parray[2]; parray[0] = (gpointer)filename; parray[1] = (gpointer)&imod; @@ -82,12 +82,12 @@ SPDocument *open(Extension *key, gchar const *filename) } bool last_chance_svg = false; - if (key == NULL && imod == NULL) { + if (key == nullptr && imod == nullptr) { last_chance_svg = true; imod = dynamic_cast<Input *>(db.get(SP_MODULE_KEY_INPUT_SVG)); } - if (imod == NULL) { + if (imod == nullptr) { throw Input::no_extension_found(); } @@ -119,7 +119,7 @@ SPDocument *open(Extension *key, gchar const *filename) } if (!imod->prefs(filename)) { - return NULL; + return nullptr; } SPDocument *doc = imod->open(filename); @@ -219,21 +219,21 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, Inkscape::Extension::FileSaveMethod save_method) { Output *omod; - if (key == NULL) { + if (key == nullptr) { gpointer parray[2]; parray[0] = (gpointer)filename; parray[1] = (gpointer)&omod; - omod = NULL; + omod = nullptr; db.foreach(save_internal, (gpointer)&parray); /* This is a nasty hack, but it is required to ensure that autodetect will always save with the Inkscape extensions if they are available. */ - if (omod != NULL && !strcmp(omod->get_id(), SP_MODULE_KEY_OUTPUT_SVG)) { + if (omod != nullptr && !strcmp(omod->get_id(), SP_MODULE_KEY_OUTPUT_SVG)) { omod = dynamic_cast<Output *>(db.get(SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE)); } /* If autodetect fails, save as Inkscape SVG */ - if (omod == NULL) { + if (omod == nullptr) { // omod = dynamic_cast<Output *>(db.get(SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE)); use exception and let user choose } } else { @@ -254,7 +254,7 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, throw Output::save_cancelled(); } - gchar *fileName = NULL; + gchar *fileName = nullptr; if (setextension) { gchar *lowerfile = g_utf8_strdown(filename, -1); gchar *lowerext = g_utf8_strdown(omod->get_extension(), -1); @@ -267,7 +267,7 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, g_free(lowerext); } - if (fileName == NULL) { + if (fileName == nullptr) { fileName = g_strdup(filename); } @@ -288,8 +288,8 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, // remember attributes in case this is an unofficial save and/or overwrite fails gchar *saved_uri = g_strdup(doc->getURI()); - gchar *saved_output_extension = NULL; - gchar *saved_dataloss = NULL; + gchar *saved_output_extension = nullptr; + gchar *saved_dataloss = nullptr; bool saved_modified = doc->isModifiedSinceSave(); saved_output_extension = g_strdup(get_file_save_extension(save_method).c_str()); saved_dataloss = g_strdup(repr->attribute("inkscape:dataloss")); @@ -306,7 +306,7 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, // also save the extension for next use store_file_extension_in_prefs (omod->get_id(), save_method); // set the "dataloss" attribute if the chosen extension is lossy - repr->setAttribute("inkscape:dataloss", NULL); + repr->setAttribute("inkscape:dataloss", nullptr); if (omod->causes_dataloss()) { repr->setAttribute("inkscape:dataloss", "true"); } @@ -446,17 +446,17 @@ build_from_reprdoc(Inkscape::XML::Document *doc, Implementation::Implementation MODULE_UNKNOWN_FUNC } module_functional_type = MODULE_UNKNOWN_FUNC; - g_return_val_if_fail(doc != NULL, NULL); + g_return_val_if_fail(doc != nullptr, NULL); Inkscape::XML::Node *repr = doc->root(); if (strcmp(repr->name(), INKSCAPE_EXTENSION_NS "inkscape-extension")) { g_warning("Extension definition started with <%s> instead of <" INKSCAPE_EXTENSION_NS "inkscape-extension>. Extension will not be created. See http://wiki.inkscape.org/wiki/index.php/Extensions for reference.\n", repr->name()); - return NULL; + return nullptr; } Inkscape::XML::Node *child_repr = repr->firstChild(); - while (child_repr != NULL) { + while (child_repr != nullptr) { char const *element_name = child_repr->name(); /* printf("Child: %s\n", child_repr->name()); */ if (!strcmp(element_name, INKSCAPE_EXTENSION_NS "input")) { @@ -483,7 +483,7 @@ build_from_reprdoc(Inkscape::XML::Document *doc, Implementation::Implementation } Implementation::Implementation *imp; - if (in_imp == NULL) { + if (in_imp == nullptr) { switch (module_implementation_type) { case MODULE_EXTENSION: { Implementation::Script *script = new Implementation::Script(); @@ -497,14 +497,14 @@ build_from_reprdoc(Inkscape::XML::Document *doc, Implementation::Implementation } case MODULE_PLUGIN: { Inkscape::Extension::Loader loader = Inkscape::Extension::Loader(); - if( baseDir != NULL){ + if( baseDir != nullptr){ loader.set_base_directory ( *baseDir ); } imp = loader.load_implementation(doc); break; } default: { - imp = NULL; + imp = nullptr; break; } } @@ -512,7 +512,7 @@ build_from_reprdoc(Inkscape::XML::Document *doc, Implementation::Implementation imp = in_imp; } - Extension *module = NULL; + Extension *module = nullptr; switch (module_functional_type) { case MODULE_INPUT: { module = new Input(repr, imp); @@ -556,8 +556,8 @@ build_from_file(gchar const *filename) { Inkscape::XML::Document *doc = sp_repr_read_file(filename, INKSCAPE_EXTENSION_URI); std::string dir = Glib::path_get_dirname(filename); - Extension *ext = build_from_reprdoc(doc, NULL, &dir); - if (ext != NULL) + Extension *ext = build_from_reprdoc(doc, nullptr, &dir); + if (ext != nullptr) Inkscape::GC::release(doc); else g_warning("Unable to create extension from definition file %s.\n", filename); @@ -577,8 +577,8 @@ Extension * build_from_mem(gchar const *buffer, Implementation::Implementation *in_imp) { Inkscape::XML::Document *doc = sp_repr_read_mem(buffer, strlen(buffer), INKSCAPE_EXTENSION_URI); - g_return_val_if_fail(doc != NULL, NULL); - Extension *ext = build_from_reprdoc(doc, in_imp, NULL); + g_return_val_if_fail(doc != nullptr, NULL); + Extension *ext = build_from_reprdoc(doc, in_imp, nullptr); Inkscape::GC::release(doc); return ext; } diff --git a/src/extension/timer.cpp b/src/extension/timer.cpp index b32c04f30..5fb727409 100644 --- a/src/extension/timer.cpp +++ b/src/extension/timer.cpp @@ -20,8 +20,8 @@ namespace Extension { #define TIMER_SCALE_VALUE 20 -ExpirationTimer * ExpirationTimer::timer_list = NULL; -ExpirationTimer * ExpirationTimer::idle_start = NULL; +ExpirationTimer * ExpirationTimer::timer_list = nullptr; +ExpirationTimer * ExpirationTimer::idle_start = nullptr; long ExpirationTimer::timeout = 240; bool ExpirationTimer::timer_started = false; @@ -38,7 +38,7 @@ ExpirationTimer::ExpirationTimer (Extension * in_extension): extension(in_extension) { /* Fix Me! */ - if (timer_list == NULL) { + if (timer_list == nullptr) { next = this; timer_list = this; } else { @@ -86,8 +86,8 @@ ExpirationTimer::~ExpirationTimer(void) } else { /* If we're the only entry in the list, the list needs to go to NULL */ - timer_list = NULL; - idle_start = NULL; + timer_list = nullptr; + idle_start = nullptr; } return; @@ -151,7 +151,7 @@ ExpirationTimer::idle_func (void) // std::cout << "Idle func pass: " << idle_cnt++ << " timer list: " << timer_list << std::endl; /* see if this is the last */ - if (timer_list == NULL) { + if (timer_list == nullptr) { timer_started = false; return false; } @@ -162,7 +162,7 @@ ExpirationTimer::idle_func (void) } /* see if this is the last */ - if (timer_list == NULL) { + if (timer_list == nullptr) { timer_started = false; return false; } |
