From f4349fb3e45bd44cef0e2b69af4c9b4cf35dcf43 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Fri, 15 Jun 2018 12:46:15 +0200 Subject: =?UTF-8?q?Run=20clang-tidy=E2=80=99s=20modernize-use-nullptr=20pa?= =?UTF-8?q?ss.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This replaces all NULL or 0 with nullptr when assigned to or returned as a pointer. --- src/object/sp-pattern.cpp | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'src/object/sp-pattern.cpp') diff --git a/src/object/sp-pattern.cpp b/src/object/sp-pattern.cpp index ebe78d63c..911f0873a 100644 --- a/src/object/sp-pattern.cpp +++ b/src/object/sp-pattern.cpp @@ -92,7 +92,7 @@ void SPPattern::release() this->_modified_connection.disconnect(); this->ref->detach(); delete this->ref; - this->ref = NULL; + this->ref = nullptr; } SPPaintServer::release(); @@ -222,7 +222,7 @@ void SPPattern::set(unsigned int key, const gchar *value) void SPPattern::_getChildren(std::list &l) { - for (SPPattern *pat_i = this; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { + for (SPPattern *pat_i = this; pat_i != nullptr; pat_i = pat_i->ref ? pat_i->ref->getObject() : nullptr) { if (pat_i->firstChild()) { // find the first one with children for (auto& child: pat_i->children) { l.push_back(&child); @@ -248,13 +248,13 @@ void SPPattern::update(SPCtx *ctx, unsigned int flags) for (SPObjectIterator it = l.begin(); it != l.end(); ++it) { SPObject *child = *it; - sp_object_ref(child, NULL); + sp_object_ref(child, nullptr); if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) { child->updateDisplay(ctx, flags); } - sp_object_unref(child, NULL); + sp_object_unref(child, nullptr); } } @@ -274,13 +274,13 @@ void SPPattern::modified(unsigned int flags) for (SPObjectIterator it = l.begin(); it != l.end(); ++it) { SPObject *child = *it; - sp_object_ref(child, NULL); + sp_object_ref(child, nullptr); if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) { child->emitModified(flags); } - sp_object_unref(child, NULL); + sp_object_unref(child, nullptr); } } @@ -337,7 +337,7 @@ SPPattern *SPPattern::_chain() const Glib::ustring parent_ref = Glib::ustring::compose("#%1", getRepr()->attribute("id")); repr->setAttribute("xlink:href", parent_ref); - defsrepr->addChild(repr, NULL); + defsrepr->addChild(repr, nullptr); const gchar *child_id = repr->attribute("id"); SPObject *child = document->getObjectById(child_id); g_assert(SP_IS_PATTERN(child)); @@ -411,7 +411,7 @@ const gchar *SPPattern::produce(const std::vector &reprs, dup_transform = Geom::identity(); dup_transform *= move; - copy->doWriteTransform(dup_transform, NULL, false); + copy->doWriteTransform(dup_transform, nullptr, false); } Inkscape::GC::release(repr); @@ -420,7 +420,7 @@ const gchar *SPPattern::produce(const std::vector &reprs, SPPattern *SPPattern::rootPattern() { - for (SPPattern *pat_i = this; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { + for (SPPattern *pat_i = this; pat_i != nullptr; pat_i = pat_i->ref ? pat_i->ref->getObject() : nullptr) { if (pat_i->firstChild()) { // find the first one with children return pat_i; } @@ -436,7 +436,7 @@ SPPattern *SPPattern::rootPattern() SPPattern::PatternUnits SPPattern::patternUnits() const { - for (SPPattern const *pat_i = this; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { + for (SPPattern const *pat_i = this; pat_i != nullptr; pat_i = pat_i->ref ? pat_i->ref->getObject() : nullptr) { if (pat_i->_pattern_units_set) return pat_i->_pattern_units; } @@ -445,7 +445,7 @@ SPPattern::PatternUnits SPPattern::patternUnits() const SPPattern::PatternUnits SPPattern::patternContentUnits() const { - for (SPPattern const *pat_i = this; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { + for (SPPattern const *pat_i = this; pat_i != nullptr; pat_i = pat_i->ref ? pat_i->ref->getObject() : nullptr) { if (pat_i->_pattern_content_units_set) return pat_i->_pattern_content_units; } @@ -454,7 +454,7 @@ SPPattern::PatternUnits SPPattern::patternContentUnits() const Geom::Affine const &SPPattern::getTransform() const { - for (SPPattern const *pat_i = this; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { + for (SPPattern const *pat_i = this; pat_i != nullptr; pat_i = pat_i->ref ? pat_i->ref->getObject() : nullptr) { if (pat_i->_pattern_transform_set) return pat_i->_pattern_transform; } @@ -463,7 +463,7 @@ Geom::Affine const &SPPattern::getTransform() const gdouble SPPattern::x() const { - for (SPPattern const *pat_i = this; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { + for (SPPattern const *pat_i = this; pat_i != nullptr; pat_i = pat_i->ref ? pat_i->ref->getObject() : nullptr) { if (pat_i->_x._set) return pat_i->_x.computed; } @@ -472,7 +472,7 @@ gdouble SPPattern::x() const gdouble SPPattern::y() const { - for (SPPattern const *pat_i = this; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { + for (SPPattern const *pat_i = this; pat_i != nullptr; pat_i = pat_i->ref ? pat_i->ref->getObject() : nullptr) { if (pat_i->_y._set) return pat_i->_y.computed; } @@ -481,7 +481,7 @@ gdouble SPPattern::y() const gdouble SPPattern::width() const { - for (SPPattern const *pat_i = this; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { + for (SPPattern const *pat_i = this; pat_i != nullptr; pat_i = pat_i->ref ? pat_i->ref->getObject() : nullptr) { if (pat_i->_width._set) return pat_i->_width.computed; } @@ -490,7 +490,7 @@ gdouble SPPattern::width() const gdouble SPPattern::height() const { - for (SPPattern const *pat_i = this; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { + for (SPPattern const *pat_i = this; pat_i != nullptr; pat_i = pat_i->ref ? pat_i->ref->getObject() : nullptr) { if (pat_i->_height._set) return pat_i->_height.computed; } @@ -500,7 +500,7 @@ gdouble SPPattern::height() const Geom::OptRect SPPattern::viewbox() const { Geom::OptRect viewbox; - for (SPPattern const *pat_i = this; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { + for (SPPattern const *pat_i = this; pat_i != nullptr; pat_i = pat_i->ref ? pat_i->ref->getObject() : nullptr) { if (pat_i->viewBox_set) { viewbox = pat_i->viewBox; break; @@ -537,13 +537,13 @@ cairo_pattern_t *SPPattern::pattern_new(cairo_t *base_ct, Geom::OptRect const &b bool visible = opacity >= 1e-3; if (!visible) { - return NULL; + return nullptr; } /* Show items */ - SPPattern *shown = NULL; + SPPattern *shown = nullptr; - for (SPPattern *pat_i = this; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { + for (SPPattern *pat_i = this; pat_i != nullptr; pat_i = pat_i->ref ? pat_i->ref->getObject() : nullptr) { // find the first one with item children if (pat_i && SP_IS_OBJECT(pat_i) && pat_i->_hasItemChildren()) { shown = pat_i; -- cgit v1.2.3