diff options
Diffstat (limited to 'src/extension/implementation')
| -rw-r--r-- | src/extension/implementation/implementation.cpp | 8 | ||||
| -rw-r--r-- | src/extension/implementation/implementation.h | 4 | ||||
| -rw-r--r-- | src/extension/implementation/script.cpp | 58 | ||||
| -rw-r--r-- | src/extension/implementation/xslt.cpp | 38 |
4 files changed, 54 insertions, 54 deletions
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); |
