summaryrefslogtreecommitdiffstats
path: root/src/object
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-06-15 10:46:15 +0000
committerMarc Jeanmougin <marcjeanmougin@free.fr>2018-06-18 12:27:01 +0000
commitf4349fb3e45bd44cef0e2b69af4c9b4cf35dcf43 (patch)
tree7c6044fd3a17a2665841959dac9b3b2110b27924 /src/object
parentRun clang-tidy’s modernize-use-override pass. (diff)
downloadinkscape-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/object')
-rw-r--r--src/object/box3d-side.cpp8
-rw-r--r--src/object/box3d.cpp10
-rw-r--r--src/object/color-profile.cpp110
-rw-r--r--src/object/filters/blend.cpp8
-rw-r--r--src/object/filters/colormatrix.cpp6
-rw-r--r--src/object/filters/componenttransfer.cpp8
-rw-r--r--src/object/filters/composite.cpp16
-rw-r--r--src/object/filters/convolvematrix.cpp6
-rw-r--r--src/object/filters/diffuselighting.cpp30
-rw-r--r--src/object/filters/displacementmap.cpp8
-rw-r--r--src/object/filters/distantlight.cpp4
-rw-r--r--src/object/filters/flood.cpp18
-rw-r--r--src/object/filters/image.cpp20
-rw-r--r--src/object/filters/merge.cpp6
-rw-r--r--src/object/filters/morphology.cpp6
-rw-r--r--src/object/filters/offset.cpp6
-rw-r--r--src/object/filters/pointlight.cpp6
-rw-r--r--src/object/filters/sp-filter-primitive.cpp4
-rw-r--r--src/object/filters/specularlighting.cpp28
-rw-r--r--src/object/filters/spotlight.cpp16
-rw-r--r--src/object/filters/tile.cpp6
-rw-r--r--src/object/filters/turbulence.cpp8
-rw-r--r--src/object/object-set.cpp8
-rw-r--r--src/object/object-set.h2
-rw-r--r--src/object/persp3d-reference.cpp16
-rw-r--r--src/object/persp3d.cpp16
-rw-r--r--src/object/persp3d.h2
-rw-r--r--src/object/sp-anchor.cpp16
-rw-r--r--src/object/sp-clippath.cpp10
-rw-r--r--src/object/sp-clippath.h4
-rw-r--r--src/object/sp-conn-end-pair.cpp22
-rw-r--r--src/object/sp-conn-end.cpp14
-rw-r--r--src/object/sp-defs.cpp4
-rw-r--r--src/object/sp-ellipse.cpp70
-rw-r--r--src/object/sp-factory.cpp2
-rw-r--r--src/object/sp-filter.cpp32
-rw-r--r--src/object/sp-flowdiv.cpp34
-rw-r--r--src/object/sp-flowregion.cpp36
-rw-r--r--src/object/sp-flowtext.cpp68
-rw-r--r--src/object/sp-font-face.cpp54
-rw-r--r--src/object/sp-font.cpp12
-rw-r--r--src/object/sp-glyph-kerning.cpp10
-rw-r--r--src/object/sp-glyph.cpp12
-rw-r--r--src/object/sp-gradient.cpp40
-rw-r--r--src/object/sp-guide.cpp14
-rw-r--r--src/object/sp-hatch-path.cpp10
-rw-r--r--src/object/sp-hatch.cpp34
-rw-r--r--src/object/sp-hatch.h2
-rw-r--r--src/object/sp-image.cpp68
-rw-r--r--src/object/sp-item-group.cpp82
-rw-r--r--src/object/sp-item-rm-unsatisfied-cns.cpp2
-rw-r--r--src/object/sp-item-update-cns.cpp2
-rw-r--r--src/object/sp-item.cpp114
-rw-r--r--src/object/sp-item.h4
-rw-r--r--src/object/sp-lpe-item.cpp50
-rw-r--r--src/object/sp-lpe-item.h6
-rw-r--r--src/object/sp-marker.cpp30
-rw-r--r--src/object/sp-mask.cpp14
-rw-r--r--src/object/sp-mask.h4
-rw-r--r--src/object/sp-mesh-array.cpp4
-rw-r--r--src/object/sp-mesh-array.h2
-rw-r--r--src/object/sp-mesh-gradient.cpp2
-rw-r--r--src/object/sp-mesh-patch.cpp6
-rw-r--r--src/object/sp-mesh-row.cpp4
-rw-r--r--src/object/sp-metadata.cpp8
-rw-r--r--src/object/sp-missing-glyph.cpp10
-rw-r--r--src/object/sp-namedview.cpp76
-rw-r--r--src/object/sp-object-group.cpp4
-rw-r--r--src/object/sp-object.cpp202
-rw-r--r--src/object/sp-object.h20
-rw-r--r--src/object/sp-offset.cpp76
-rw-r--r--src/object/sp-paint-server.cpp4
-rw-r--r--src/object/sp-paint-server.h2
-rw-r--r--src/object/sp-path.cpp18
-rw-r--r--src/object/sp-pattern.cpp40
-rw-r--r--src/object/sp-polygon.cpp4
-rw-r--r--src/object/sp-polyline.cpp2
-rw-r--r--src/object/sp-rect.cpp4
-rw-r--r--src/object/sp-root.cpp12
-rw-r--r--src/object/sp-script.cpp2
-rw-r--r--src/object/sp-shape.cpp42
-rw-r--r--src/object/sp-spiral.cpp16
-rw-r--r--src/object/sp-star.cpp20
-rw-r--r--src/object/sp-stop.cpp14
-rw-r--r--src/object/sp-string.cpp4
-rw-r--r--src/object/sp-style-elem.cpp52
-rw-r--r--src/object/sp-switch.cpp10
-rw-r--r--src/object/sp-symbol.cpp4
-rw-r--r--src/object/sp-tag-use-reference.cpp24
-rw-r--r--src/object/sp-tag-use.cpp18
-rw-r--r--src/object/sp-tag.cpp6
-rw-r--r--src/object/sp-text.cpp38
-rw-r--r--src/object/sp-tref-reference.h2
-rw-r--r--src/object/sp-tref.cpp28
-rw-r--r--src/object/sp-tspan.cpp30
-rw-r--r--src/object/sp-use-reference.cpp22
-rw-r--r--src/object/sp-use.cpp52
-rw-r--r--src/object/uri-references.cpp34
-rw-r--r--src/object/uri.cpp12
99 files changed, 1094 insertions, 1094 deletions
diff --git a/src/object/box3d-side.cpp b/src/object/box3d-side.cpp
index b6b9bbbf7..b085b88ae 100644
--- a/src/object/box3d-side.cpp
+++ b/src/object/box3d-side.cpp
@@ -60,7 +60,7 @@ Inkscape::XML::Node* Box3DSide::write(Inkscape::XML::Document *xml_doc, Inkscape
//Nulls might be possible if this called iteratively
if ( !curve ) {
- return NULL;
+ return nullptr;
}
char *d = sp_svg_write_path ( curve->get_pathvector() );
@@ -121,7 +121,7 @@ void Box3DSide::update(SPCtx* ctx, guint flags) {
/* Create a new Box3DSide and append it to the parent box */
Box3DSide * Box3DSide::createBox3DSide(SPBox3D *box)
{
- Box3DSide *box3d_side = 0;
+ Box3DSide *box3d_side = nullptr;
Inkscape::XML::Document *xml_doc = box->document->rdoc;
Inkscape::XML::Node *repr_side = xml_doc->createElement("svg:path");
repr_side->setAttribute("sodipodi:type", "inkscape:box3dside");
@@ -247,8 +247,8 @@ box3d_side_compute_corner_ids(Box3DSide *side, unsigned int corners[4]) {
Persp3D *
box3d_side_perspective(Box3DSide *side) {
- SPBox3D *box = side ? dynamic_cast<SPBox3D *>(side->parent) : NULL;
- return box ? box->persp_ref->getObject() : NULL;
+ SPBox3D *box = side ? dynamic_cast<SPBox3D *>(side->parent) : nullptr;
+ return box ? box->persp_ref->getObject() : nullptr;
}
Inkscape::XML::Node *box3d_side_convert_to_path(Box3DSide *side) {
diff --git a/src/object/box3d.cpp b/src/object/box3d.cpp
index af1d00b0f..08190edfd 100644
--- a/src/object/box3d.cpp
+++ b/src/object/box3d.cpp
@@ -44,7 +44,7 @@ SPBox3D::SPBox3D() : SPGroup() {
this->my_counter = 0;
this->swapped = Box3D::NONE;
- this->persp_href = NULL;
+ this->persp_href = nullptr;
this->persp_ref = new Persp3DReference(this);
/* we initialize the z-orders to zero so that they are updated during dragging */
@@ -93,7 +93,7 @@ void SPBox3D::release() {
if (box->persp_ref) {
box->persp_ref->detach();
delete box->persp_ref;
- box->persp_ref = NULL;
+ box->persp_ref = nullptr;
}
if (persp) {
@@ -126,7 +126,7 @@ void SPBox3D::set(unsigned int key, const gchar* value) {
} else {
if (box->persp_href) {
g_free(box->persp_href);
- box->persp_href = NULL;
+ box->persp_href = nullptr;
}
if (value) {
box->persp_href = g_strdup(value);
@@ -434,7 +434,7 @@ box3d_snap (SPBox3D *box, int id, Proj::Pt3 const &pt_proj, Proj::Pt3 const &sta
SPBox3D * SPBox3D::createBox3D(SPItem * parent)
{
- SPBox3D *box3d = 0;
+ SPBox3D *box3d = nullptr;
Inkscape::XML::Document *xml_doc = parent->document->rdoc;
Inkscape::XML::Node *repr = xml_doc->createElement("svg:g");
repr->setAttribute("sodipodi:type", "inkscape:box3d");
@@ -1297,7 +1297,7 @@ SPGroup *box3d_convert_to_group(SPBox3D *box)
grepr->setAttribute("id", id);
SPGroup *group = dynamic_cast<SPGroup *>(doc->getObjectByRepr(grepr));
- g_assert(group != NULL);
+ g_assert(group != nullptr);
return group;
}
diff --git a/src/object/color-profile.cpp b/src/object/color-profile.cpp
index 7bdde9b6d..4b12df21b 100644
--- a/src/object/color-profile.cpp
+++ b/src/object/color-profile.cpp
@@ -147,19 +147,19 @@ cmsProfileClassSignature asICColorProfileClassSig(ColorProfileClassSig const & s
ColorProfileImpl::ColorProfileImpl()
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
:
- _profHandle(0),
+ _profHandle(nullptr),
_profileClass(cmsSigInputClass),
_profileSpace(cmsSigRgbData),
- _transf(0),
- _revTransf(0),
- _gamutTransf(0)
+ _transf(nullptr),
+ _revTransf(nullptr),
+ _gamutTransf(nullptr)
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
{
}
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
-cmsHPROFILE ColorProfileImpl::_sRGBProf = 0;
+cmsHPROFILE ColorProfileImpl::_sRGBProf = nullptr;
cmsHPROFILE ColorProfileImpl::getSRGBProfile() {
if ( !_sRGBProf ) {
@@ -168,7 +168,7 @@ cmsHPROFILE ColorProfileImpl::getSRGBProfile() {
return ColorProfileImpl::_sRGBProf;
}
-cmsHPROFILE ColorProfileImpl::_NullProf = 0;
+cmsHPROFILE ColorProfileImpl::_NullProf = nullptr;
cmsHPROFILE ColorProfileImpl::getNULLProfile() {
if ( !_NullProf ) {
@@ -208,10 +208,10 @@ bool ColorProfile::FilePlusHomeAndName::operator<(ColorProfile::FilePlusHomeAndN
ColorProfile::ColorProfile() : SPObject() {
this->impl = new ColorProfileImpl();
- this->href = 0;
- this->local = 0;
- this->name = 0;
- this->intentStr = 0;
+ this->href = nullptr;
+ this->local = nullptr;
+ this->name = nullptr;
+ this->intentStr = nullptr;
this->rendering_intent = Inkscape::RENDERING_INTENT_UNKNOWN;
}
@@ -238,22 +238,22 @@ void ColorProfile::release() {
if ( this->href ) {
g_free( this->href );
- this->href = 0;
+ this->href = nullptr;
}
if ( this->local ) {
g_free( this->local );
- this->local = 0;
+ this->local = nullptr;
}
if ( this->name ) {
g_free( this->name );
- this->name = 0;
+ this->name = nullptr;
}
if ( this->intentStr ) {
g_free( this->intentStr );
- this->intentStr = 0;
+ this->intentStr = nullptr;
}
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
@@ -261,7 +261,7 @@ void ColorProfile::release() {
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
delete this->impl;
- this->impl = 0;
+ this->impl = nullptr;
}
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
@@ -271,19 +271,19 @@ void ColorProfileImpl::_clearProfile()
if ( _transf ) {
cmsDeleteTransform( _transf );
- _transf = 0;
+ _transf = nullptr;
}
if ( _revTransf ) {
cmsDeleteTransform( _revTransf );
- _revTransf = 0;
+ _revTransf = nullptr;
}
if ( _gamutTransf ) {
cmsDeleteTransform( _gamutTransf );
- _gamutTransf = 0;
+ _gamutTransf = nullptr;
}
if ( _profHandle ) {
cmsCloseProfile( _profHandle );
- _profHandle = 0;
+ _profHandle = nullptr;
}
}
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
@@ -292,10 +292,10 @@ void ColorProfileImpl::_clearProfile()
* Callback: set attributes from associated repr.
*/
void ColorProfile::build(SPDocument *document, Inkscape::XML::Node *repr) {
- g_assert(this->href == 0);
- g_assert(this->local == 0);
- g_assert(this->name == 0);
- g_assert(this->intentStr == 0);
+ g_assert(this->href == nullptr);
+ g_assert(this->local == nullptr);
+ g_assert(this->name == nullptr);
+ g_assert(this->intentStr == nullptr);
SPObject::build(document, repr);
@@ -320,7 +320,7 @@ void ColorProfile::set(unsigned key, gchar const *value) {
case SP_ATTR_XLINK_HREF:
if ( this->href ) {
g_free( this->href );
- this->href = 0;
+ this->href = nullptr;
}
if ( value ) {
this->href = g_strdup( value );
@@ -368,7 +368,7 @@ void ColorProfile::set(unsigned key, gchar const *value) {
}
DEBUG_MESSAGE( lcmsOne, "cmsOpenProfileFromFile( '%s'...) = %p", fullname, (void*)this->impl->_profHandle );
g_free(escaped);
- escaped = 0;
+ escaped = nullptr;
g_free(fullname);
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
}
@@ -379,7 +379,7 @@ void ColorProfile::set(unsigned key, gchar const *value) {
case SP_ATTR_LOCAL:
if ( this->local ) {
g_free( this->local );
- this->local = 0;
+ this->local = nullptr;
}
this->local = g_strdup( value );
this->requestModified(SP_OBJECT_MODIFIED_FLAG);
@@ -388,7 +388,7 @@ void ColorProfile::set(unsigned key, gchar const *value) {
case SP_ATTR_NAME:
if ( this->name ) {
g_free( this->name );
- this->name = 0;
+ this->name = nullptr;
}
this->name = g_strdup( value );
DEBUG_MESSAGE( lcmsTwo, "<color-profile> name set to '%s'", this->name );
@@ -398,7 +398,7 @@ void ColorProfile::set(unsigned key, gchar const *value) {
case SP_ATTR_RENDERING_INTENT:
if ( this->intentStr ) {
g_free( this->intentStr );
- this->intentStr = 0;
+ this->intentStr = nullptr;
}
this->intentStr = g_strdup( value );
@@ -517,7 +517,7 @@ static int getLcmsIntent( guint svgIntent )
static SPObject* bruteFind( SPDocument* document, gchar const* name )
{
- SPObject* result = 0;
+ SPObject* result = nullptr;
std::vector<SPObject *> current = document->getResourceList("iccprofile");
for (std::vector<SPObject *>::const_iterator it = current.begin(); (!result) && (it != current.end()); ++it) {
if ( IS_COLORPROFILE(*it) ) {
@@ -536,7 +536,7 @@ static SPObject* bruteFind( SPDocument* document, gchar const* name )
cmsHPROFILE Inkscape::CMSSystem::getHandle( SPDocument* document, guint* intent, gchar const* name )
{
- cmsHPROFILE prof = 0;
+ cmsHPROFILE prof = nullptr;
SPObject* thing = bruteFind( document, name );
if ( thing ) {
@@ -914,7 +914,7 @@ Glib::ustring getNameFromProfile(cmsHPROFILE profile)
}
nameStr = (name) ? name : C_("Profile name", "None");
#elif HAVE_LIBLCMS2
- cmsUInt32Number byteLen = cmsGetProfileInfo(profile, cmsInfoDescription, "en", "US", NULL, 0);
+ cmsUInt32Number byteLen = cmsGetProfileInfo(profile, cmsInfoDescription, "en", "US", nullptr, 0);
if (byteLen > 0) {
// TODO investigate wchar_t and cmsGetProfileInfo()
std::vector<char> data(byteLen);
@@ -926,7 +926,7 @@ Glib::ustring getNameFromProfile(cmsHPROFILE profile)
}
nameStr = Glib::ustring(data.begin(), data.end());
}
- if (nameStr.empty() || !g_utf8_validate(nameStr.c_str(), -1, NULL)) {
+ if (nameStr.empty() || !g_utf8_validate(nameStr.c_str(), -1, nullptr)) {
nameStr = _("(invalid UTF-8 string)");
}
#endif
@@ -960,7 +960,7 @@ void loadProfiles()
if ( prof ) {
ProfileInfo info( prof, Glib::filename_to_utf8( profile.filename.c_str() ) );
cmsCloseProfile( prof );
- prof = 0;
+ prof = nullptr;
bool sameName = false;
for(auto &knownProfile: knownProfiles) {
@@ -990,12 +990,12 @@ static bool lastPreserveBlack = false;
#endif // defined(cmsFLAGS_PRESERVEBLACK)
static int lastIntent = INTENT_PERCEPTUAL;
static int lastProofIntent = INTENT_PERCEPTUAL;
-static cmsHTRANSFORM transf = 0;
+static cmsHTRANSFORM transf = nullptr;
namespace {
cmsHPROFILE getSystemProfileHandle()
{
- static cmsHPROFILE theOne = 0;
+ static cmsHPROFILE theOne = nullptr;
static Glib::ustring lastURI;
loadProfiles();
@@ -1011,7 +1011,7 @@ cmsHPROFILE getSystemProfileHandle()
}
if ( transf ) {
cmsDeleteTransform( transf );
- transf = 0;
+ transf = nullptr;
}
theOne = cmsOpenProfileFromFile( uri.data(), "r" );
if ( theOne ) {
@@ -1022,11 +1022,11 @@ cmsHPROFILE getSystemProfileHandle()
if ( profClass != cmsSigDisplayClass ) {
g_warning("Not a display profile");
cmsCloseProfile( theOne );
- theOne = 0;
+ theOne = nullptr;
} else if ( space != cmsSigRgbData ) {
g_warning("Not an RGB profile");
cmsCloseProfile( theOne );
- theOne = 0;
+ theOne = nullptr;
} else {
lastURI = uri;
}
@@ -1034,11 +1034,11 @@ cmsHPROFILE getSystemProfileHandle()
}
} else if ( theOne ) {
cmsCloseProfile( theOne );
- theOne = 0;
+ theOne = nullptr;
lastURI.clear();
if ( transf ) {
cmsDeleteTransform( transf );
- transf = 0;
+ transf = nullptr;
}
}
@@ -1048,7 +1048,7 @@ cmsHPROFILE getSystemProfileHandle()
cmsHPROFILE getProofProfileHandle()
{
- static cmsHPROFILE theOne = 0;
+ static cmsHPROFILE theOne = nullptr;
static Glib::ustring lastURI;
loadProfiles();
@@ -1065,7 +1065,7 @@ cmsHPROFILE getProofProfileHandle()
}
if ( transf ) {
cmsDeleteTransform( transf );
- transf = 0;
+ transf = nullptr;
}
theOne = cmsOpenProfileFromFile( uri.data(), "r" );
if ( theOne ) {
@@ -1094,11 +1094,11 @@ cmsHPROFILE getProofProfileHandle()
}
} else if ( theOne ) {
cmsCloseProfile( theOne );
- theOne = 0;
+ theOne = nullptr;
lastURI.clear();
if ( transf ) {
cmsDeleteTransform( transf );
- transf = 0;
+ transf = nullptr;
}
}
@@ -1115,9 +1115,9 @@ cmsHTRANSFORM Inkscape::CMSSystem::getDisplayTransform()
if ( fromDisplay ) {
if ( transf ) {
cmsDeleteTransform(transf);
- transf = 0;
+ transf = nullptr;
}
- return 0;
+ return nullptr;
}
bool warn = prefs->getBool( "/options/softproof/gamutwarn");
@@ -1152,7 +1152,7 @@ cmsHTRANSFORM Inkscape::CMSSystem::getDisplayTransform()
// Fetch these now, as they might clear the transform as a side effect.
cmsHPROFILE hprof = getSystemProfileHandle();
- cmsHPROFILE proofProf = hprof ? getProofProfileHandle() : 0;
+ cmsHPROFILE proofProf = hprof ? getProofProfileHandle() : nullptr;
if ( !transf ) {
if ( hprof && proofProf ) {
@@ -1205,8 +1205,8 @@ public:
MemProfile::MemProfile() :
id(),
- hprof(0),
- transf(0)
+ hprof(nullptr),
+ transf(nullptr)
{
}
@@ -1220,13 +1220,13 @@ void free_transforms()
{
if ( transf ) {
cmsDeleteTransform(transf);
- transf = 0;
+ transf = nullptr;
}
for ( auto profile : perMonitorProfiles ) {
if ( profile.transf ) {
cmsDeleteTransform(profile.transf);
- profile.transf = 0;
+ profile.transf = nullptr;
}
}
}
@@ -1253,7 +1253,7 @@ Glib::ustring Inkscape::CMSSystem::setDisplayPer( gpointer buf, guint bufLen, in
if ( item.hprof ) {
cmsCloseProfile( item.hprof );
- item.hprof = 0;
+ item.hprof = nullptr;
}
Glib::ustring id;
@@ -1273,9 +1273,9 @@ Glib::ustring Inkscape::CMSSystem::setDisplayPer( gpointer buf, guint bufLen, in
cmsHTRANSFORM Inkscape::CMSSystem::getDisplayPer( Glib::ustring const& id )
{
- cmsHTRANSFORM result = 0;
+ cmsHTRANSFORM result = nullptr;
if ( id.empty() ) {
- return 0;
+ return nullptr;
}
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
@@ -1316,7 +1316,7 @@ cmsHTRANSFORM Inkscape::CMSSystem::getDisplayPer( Glib::ustring const& id )
}
// Fetch these now, as they might clear the transform as a side effect.
- cmsHPROFILE proofProf = item.hprof ? getProofProfileHandle() : 0;
+ cmsHPROFILE proofProf = item.hprof ? getProofProfileHandle() : nullptr;
if ( !item.transf ) {
if ( item.hprof && proofProf ) {
diff --git a/src/object/filters/blend.cpp b/src/object/filters/blend.cpp
index e23b2aa57..6137843a3 100644
--- a/src/object/filters/blend.cpp
+++ b/src/object/filters/blend.cpp
@@ -254,7 +254,7 @@ Inkscape::XML::Node* SPFeBlend::write(Inkscape::XML::Document *doc, Inkscape::XM
case Inkscape::Filters::BLEND_LUMINOSITY:
mode = "luminosity"; break;
default:
- mode = 0;
+ mode = nullptr;
}
repr->setAttribute("mode", mode);
@@ -265,13 +265,13 @@ Inkscape::XML::Node* SPFeBlend::write(Inkscape::XML::Document *doc, Inkscape::XM
}
void SPFeBlend::build_renderer(Inkscape::Filters::Filter* filter) {
- g_assert(this != NULL);
- g_assert(filter != NULL);
+ g_assert(this != nullptr);
+ g_assert(filter != nullptr);
int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_BLEND);
Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n);
Inkscape::Filters::FilterBlend *nr_blend = dynamic_cast<Inkscape::Filters::FilterBlend*>(nr_primitive);
- g_assert(nr_blend != NULL);
+ g_assert(nr_blend != nullptr);
sp_filter_primitive_renderer_common(this, nr_primitive);
diff --git a/src/object/filters/colormatrix.cpp b/src/object/filters/colormatrix.cpp
index 0e8398ace..ebeab56c1 100644
--- a/src/object/filters/colormatrix.cpp
+++ b/src/object/filters/colormatrix.cpp
@@ -134,13 +134,13 @@ Inkscape::XML::Node* SPFeColorMatrix::write(Inkscape::XML::Document *doc, Inksca
}
void SPFeColorMatrix::build_renderer(Inkscape::Filters::Filter* filter) {
- g_assert(this != NULL);
- g_assert(filter != NULL);
+ g_assert(this != nullptr);
+ g_assert(filter != nullptr);
int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_COLORMATRIX);
Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n);
Inkscape::Filters::FilterColorMatrix *nr_colormatrix = dynamic_cast<Inkscape::Filters::FilterColorMatrix*>(nr_primitive);
- g_assert(nr_colormatrix != NULL);
+ g_assert(nr_colormatrix != nullptr);
sp_filter_primitive_renderer_common(this, nr_primitive);
nr_colormatrix->set_type(this->type);
diff --git a/src/object/filters/componenttransfer.cpp b/src/object/filters/componenttransfer.cpp
index dd13d85d1..fe488ce74 100644
--- a/src/object/filters/componenttransfer.cpp
+++ b/src/object/filters/componenttransfer.cpp
@@ -24,7 +24,7 @@
#include "xml/repr.h"
SPFeComponentTransfer::SPFeComponentTransfer()
- : SPFilterPrimitive(), renderer(NULL)
+ : SPFilterPrimitive(), renderer(nullptr)
{
}
@@ -160,13 +160,13 @@ Inkscape::XML::Node* SPFeComponentTransfer::write(Inkscape::XML::Document *doc,
}
void SPFeComponentTransfer::build_renderer(Inkscape::Filters::Filter* filter) {
- g_assert(this != NULL);
- g_assert(filter != NULL);
+ g_assert(this != nullptr);
+ g_assert(filter != nullptr);
int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_COMPONENTTRANSFER);
Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n);
Inkscape::Filters::FilterComponentTransfer *nr_componenttransfer = dynamic_cast<Inkscape::Filters::FilterComponentTransfer*>(nr_primitive);
- g_assert(nr_componenttransfer != NULL);
+ g_assert(nr_componenttransfer != nullptr);
this->renderer = nr_componenttransfer;
sp_filter_primitive_renderer_common(this, nr_primitive);
diff --git a/src/object/filters/composite.cpp b/src/object/filters/composite.cpp
index bca67774b..2b5cdf75e 100644
--- a/src/object/filters/composite.cpp
+++ b/src/object/filters/composite.cpp
@@ -280,7 +280,7 @@ Inkscape::XML::Node* SPFeComposite::write(Inkscape::XML::Document *doc, Inkscape
comp_op = "lighter"; break;
#endif
default:
- comp_op = 0;
+ comp_op = nullptr;
}
repr->setAttribute("operator", comp_op);
@@ -291,10 +291,10 @@ Inkscape::XML::Node* SPFeComposite::write(Inkscape::XML::Document *doc, Inkscape
sp_repr_set_svg_double(repr, "k3", this->k3);
sp_repr_set_svg_double(repr, "k4", this->k4);
} else {
- repr->setAttribute("k1", 0);
- repr->setAttribute("k2", 0);
- repr->setAttribute("k3", 0);
- repr->setAttribute("k4", 0);
+ repr->setAttribute("k1", nullptr);
+ repr->setAttribute("k2", nullptr);
+ repr->setAttribute("k3", nullptr);
+ repr->setAttribute("k4", nullptr);
}
SPFilterPrimitive::write(doc, repr, flags);
@@ -303,13 +303,13 @@ Inkscape::XML::Node* SPFeComposite::write(Inkscape::XML::Document *doc, Inkscape
}
void SPFeComposite::build_renderer(Inkscape::Filters::Filter* filter) {
- g_assert(this != NULL);
- g_assert(filter != NULL);
+ g_assert(this != nullptr);
+ g_assert(filter != nullptr);
int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_COMPOSITE);
Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n);
Inkscape::Filters::FilterComposite *nr_composite = dynamic_cast<Inkscape::Filters::FilterComposite*>(nr_primitive);
- g_assert(nr_composite != NULL);
+ g_assert(nr_composite != nullptr);
sp_filter_primitive_renderer_common(this, nr_primitive);
diff --git a/src/object/filters/convolvematrix.cpp b/src/object/filters/convolvematrix.cpp
index e856690ff..4f2588695 100644
--- a/src/object/filters/convolvematrix.cpp
+++ b/src/object/filters/convolvematrix.cpp
@@ -288,13 +288,13 @@ Inkscape::XML::Node* SPFeConvolveMatrix::write(Inkscape::XML::Document *doc, Ink
}
void SPFeConvolveMatrix::build_renderer(Inkscape::Filters::Filter* filter) {
- g_assert(this != NULL);
- g_assert(filter != NULL);
+ g_assert(this != nullptr);
+ g_assert(filter != nullptr);
int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_CONVOLVEMATRIX);
Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n);
Inkscape::Filters::FilterConvolveMatrix *nr_convolve = dynamic_cast<Inkscape::Filters::FilterConvolveMatrix*>(nr_primitive);
- g_assert(nr_convolve != NULL);
+ g_assert(nr_convolve != nullptr);
sp_filter_primitive_renderer_common(this, nr_primitive);
diff --git a/src/object/filters/diffuselighting.cpp b/src/object/filters/diffuselighting.cpp
index f23817993..a11ddf507 100644
--- a/src/object/filters/diffuselighting.cpp
+++ b/src/object/filters/diffuselighting.cpp
@@ -39,10 +39,10 @@ SPFeDiffuseLighting::SPFeDiffuseLighting() : SPFilterPrimitive() {
this->surfaceScale = 1;
this->diffuseConstant = 1;
this->lighting_color = 0xffffffff;
- this->icc = NULL;
+ this->icc = nullptr;
//TODO kernelUnit
- this->renderer = NULL;
+ this->renderer = nullptr;
this->surfaceScale_set = FALSE;
this->diffuseConstant_set = FALSE;
@@ -78,14 +78,14 @@ void SPFeDiffuseLighting::release() {
* Sets a specific value in the SPFeDiffuseLighting.
*/
void SPFeDiffuseLighting::set(unsigned int key, gchar const *value) {
- gchar const *cend_ptr = NULL;
- gchar *end_ptr = NULL;
+ gchar const *cend_ptr = nullptr;
+ gchar *end_ptr = nullptr;
switch(key) {
/*DEAL WITH SETTING ATTRIBUTES HERE*/
//TODO test forbidden values
case SP_ATTR_SURFACESCALE:
- end_ptr = NULL;
+ end_ptr = nullptr;
if (value) {
this->surfaceScale = g_ascii_strtod(value, &end_ptr);
@@ -107,7 +107,7 @@ void SPFeDiffuseLighting::set(unsigned int key, gchar const *value) {
this->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_DIFFUSECONSTANT:
- end_ptr = NULL;
+ end_ptr = nullptr;
if (value) {
this->diffuseConstant = g_ascii_strtod(value, &end_ptr);
@@ -115,7 +115,7 @@ void SPFeDiffuseLighting::set(unsigned int key, gchar const *value) {
if (end_ptr && this->diffuseConstant >= 0) {
this->diffuseConstant_set = TRUE;
} else {
- end_ptr = NULL;
+ end_ptr = nullptr;
g_warning("this: diffuseConstant should be a positive number ... defaulting to 1");
}
}
@@ -141,7 +141,7 @@ void SPFeDiffuseLighting::set(unsigned int key, gchar const *value) {
this->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_PROP_LIGHTING_COLOR:
- cend_ptr = NULL;
+ cend_ptr = nullptr;
this->lighting_color = sp_svg_read_color(value, &cend_ptr, 0xffffffff);
//if a value was read
@@ -157,7 +157,7 @@ void SPFeDiffuseLighting::set(unsigned int key, gchar const *value) {
if ( ! sp_svg_read_icc_color( cend_ptr, this->icc ) ) {
delete this->icc;
- this->icc = NULL;
+ this->icc = nullptr;
}
}
@@ -207,13 +207,13 @@ Inkscape::XML::Node* SPFeDiffuseLighting::write(Inkscape::XML::Document *doc, In
if (this->surfaceScale_set) {
sp_repr_set_css_double(repr, "surfaceScale", this->surfaceScale);
} else {
- repr->setAttribute("surfaceScale", NULL);
+ repr->setAttribute("surfaceScale", nullptr);
}
if (this->diffuseConstant_set) {
sp_repr_set_css_double(repr, "diffuseConstant", this->diffuseConstant);
} else {
- repr->setAttribute("diffuseConstant", NULL);
+ repr->setAttribute("diffuseConstant", nullptr);
}
/*TODO kernelUnits */
@@ -222,7 +222,7 @@ Inkscape::XML::Node* SPFeDiffuseLighting::write(Inkscape::XML::Document *doc, In
sp_svg_write_color(c, sizeof(c), this->lighting_color);
repr->setAttribute("lighting-color", c);
} else {
- repr->setAttribute("lighting-color", NULL);
+ repr->setAttribute("lighting-color", nullptr);
}
SPFilterPrimitive::write(doc, repr, flags);
@@ -277,13 +277,13 @@ static void sp_feDiffuseLighting_children_modified(SPFeDiffuseLighting *sp_diffu
}
void SPFeDiffuseLighting::build_renderer(Inkscape::Filters::Filter* filter) {
- g_assert(this != NULL);
- g_assert(filter != NULL);
+ g_assert(this != nullptr);
+ g_assert(filter != nullptr);
int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_DIFFUSELIGHTING);
Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n);
Inkscape::Filters::FilterDiffuseLighting *nr_diffuselighting = dynamic_cast<Inkscape::Filters::FilterDiffuseLighting*>(nr_primitive);
- g_assert(nr_diffuselighting != NULL);
+ g_assert(nr_diffuselighting != nullptr);
this->renderer = nr_diffuselighting;
sp_filter_primitive_renderer_common(this, nr_primitive);
diff --git a/src/object/filters/displacementmap.cpp b/src/object/filters/displacementmap.cpp
index 978fd517b..7d4106648 100644
--- a/src/object/filters/displacementmap.cpp
+++ b/src/object/filters/displacementmap.cpp
@@ -179,7 +179,7 @@ static char const * get_channelselector_name(FilterDisplacementMapChannelSelecto
case DISPLACEMENTMAP_CHANNEL_ALPHA:
return "A";
default:
- return 0;
+ return nullptr;
}
}
@@ -229,13 +229,13 @@ Inkscape::XML::Node* SPFeDisplacementMap::write(Inkscape::XML::Document *doc, In
}
void SPFeDisplacementMap::build_renderer(Inkscape::Filters::Filter* filter) {
- g_assert(this != NULL);
- g_assert(filter != NULL);
+ g_assert(this != nullptr);
+ g_assert(filter != nullptr);
int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_DISPLACEMENTMAP);
Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n);
Inkscape::Filters::FilterDisplacementMap *nr_displacement_map = dynamic_cast<Inkscape::Filters::FilterDisplacementMap*>(nr_primitive);
- g_assert(nr_displacement_map != NULL);
+ g_assert(nr_displacement_map != nullptr);
sp_filter_primitive_renderer_common(this, nr_primitive);
diff --git a/src/object/filters/distantlight.cpp b/src/object/filters/distantlight.cpp
index e2dd4ea1b..bec28f66f 100644
--- a/src/object/filters/distantlight.cpp
+++ b/src/object/filters/distantlight.cpp
@@ -71,7 +71,7 @@ void SPFeDistantLight::set(unsigned int key, gchar const *value) {
switch (key) {
case SP_ATTR_AZIMUTH:
- end_ptr =NULL;
+ end_ptr =nullptr;
if (value) {
this->azimuth = g_ascii_strtod(value, &end_ptr);
@@ -93,7 +93,7 @@ void SPFeDistantLight::set(unsigned int key, gchar const *value) {
}
break;
case SP_ATTR_ELEVATION:
- end_ptr =NULL;
+ end_ptr =nullptr;
if (value) {
this->elevation = g_ascii_strtod(value, &end_ptr);
diff --git a/src/object/filters/flood.cpp b/src/object/filters/flood.cpp
index 9132b2028..da0af4737 100644
--- a/src/object/filters/flood.cpp
+++ b/src/object/filters/flood.cpp
@@ -29,7 +29,7 @@ SPFeFlood::SPFeFlood() : SPFilterPrimitive() {
this->color = 0;
this->opacity = 1;
- this->icc = NULL;
+ this->icc = nullptr;
}
SPFeFlood::~SPFeFlood() {
@@ -59,8 +59,8 @@ void SPFeFlood::release() {
* Sets a specific value in the SPFeFlood.
*/
void SPFeFlood::set(unsigned int key, gchar const *value) {
- gchar const *cend_ptr = NULL;
- gchar *end_ptr = NULL;
+ gchar const *cend_ptr = nullptr;
+ gchar *end_ptr = nullptr;
guint32 read_color;
double read_num;
bool dirty = false;
@@ -68,7 +68,7 @@ void SPFeFlood::set(unsigned int key, gchar const *value) {
switch(key) {
/*DEAL WITH SETTING ATTRIBUTES HERE*/
case SP_PROP_FLOOD_COLOR:
- cend_ptr = NULL;
+ cend_ptr = nullptr;
read_color = sp_svg_read_color(value, &cend_ptr, 0xffffffff);
if (cend_ptr && read_color != this->color){
@@ -88,7 +88,7 @@ void SPFeFlood::set(unsigned int key, gchar const *value) {
if ( ! sp_svg_read_icc_color( cend_ptr, this->icc ) ) {
delete this->icc;
- this->icc = NULL;
+ this->icc = nullptr;
}
dirty = true;
@@ -103,7 +103,7 @@ void SPFeFlood::set(unsigned int key, gchar const *value) {
if (value) {
read_num = g_ascii_strtod(value, &end_ptr);
- if (end_ptr != NULL) {
+ if (end_ptr != nullptr) {
if (*end_ptr) {
g_warning("Unable to convert \"%s\" to number", value);
read_num = 1;
@@ -154,13 +154,13 @@ Inkscape::XML::Node* SPFeFlood::write(Inkscape::XML::Document *doc, Inkscape::XM
}
void SPFeFlood::build_renderer(Inkscape::Filters::Filter* filter) {
- g_assert(this != NULL);
- g_assert(filter != NULL);
+ g_assert(this != nullptr);
+ g_assert(filter != nullptr);
int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_FLOOD);
Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n);
Inkscape::Filters::FilterFlood *nr_flood = dynamic_cast<Inkscape::Filters::FilterFlood*>(nr_primitive);
- g_assert(nr_flood != NULL);
+ g_assert(nr_flood != nullptr);
sp_filter_primitive_renderer_common(this, nr_primitive);
diff --git a/src/object/filters/image.cpp b/src/object/filters/image.cpp
index 1eeb32111..25ac3024a 100644
--- a/src/object/filters/image.cpp
+++ b/src/object/filters/image.cpp
@@ -34,10 +34,10 @@
SPFeImage::SPFeImage() : SPFilterPrimitive() {
- this->href = NULL;
+ this->href = nullptr;
this->from_element = 0;
- this->SVGElemRef = NULL;
- this->SVGElem = NULL;
+ this->SVGElemRef = nullptr;
+ this->SVGElem = nullptr;
this->aspect_align = SP_ASPECT_XMID_YMID; // Default
this->aspect_clip = SP_ASPECT_MEET; // Default
@@ -88,7 +88,7 @@ static void sp_feImage_href_modified(SPObject* /*old_elem*/, SPObject* new_elem,
feImage->SVGElem = SP_ITEM(new_elem);
feImage->_image_modified_connection = ((SPObject*) feImage->SVGElem)->connectModified(sigc::bind(sigc::ptr_fun(&sp_feImage_elem_modified), obj));
} else {
- feImage->SVGElem = 0;
+ feImage->SVGElem = nullptr;
}
obj->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
@@ -104,11 +104,11 @@ void SPFeImage::set(unsigned int key, gchar const *value) {
if (this->href) {
g_free(this->href);
}
- this->href = (value) ? g_strdup (value) : NULL;
+ this->href = (value) ? g_strdup (value) : nullptr;
if (!this->href) return;
delete this->SVGElemRef;
- this->SVGElemRef = 0;
- this->SVGElem = 0;
+ this->SVGElemRef = nullptr;
+ this->SVGElem = nullptr;
this->_image_modified_connection.disconnect();
this->_href_modified_connection.disconnect();
try{
@@ -232,13 +232,13 @@ Inkscape::XML::Node* SPFeImage::write(Inkscape::XML::Document *doc, Inkscape::XM
}
void SPFeImage::build_renderer(Inkscape::Filters::Filter* filter) {
- g_assert(this != NULL);
- g_assert(filter != NULL);
+ g_assert(this != nullptr);
+ g_assert(filter != nullptr);
int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_IMAGE);
Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n);
Inkscape::Filters::FilterImage *nr_image = dynamic_cast<Inkscape::Filters::FilterImage*>(nr_primitive);
- g_assert(nr_image != NULL);
+ g_assert(nr_image != nullptr);
sp_filter_primitive_renderer_common(this, nr_primitive);
diff --git a/src/object/filters/merge.cpp b/src/object/filters/merge.cpp
index 8ec40cb46..ddd19e732 100644
--- a/src/object/filters/merge.cpp
+++ b/src/object/filters/merge.cpp
@@ -82,13 +82,13 @@ Inkscape::XML::Node* SPFeMerge::write(Inkscape::XML::Document *doc, Inkscape::XM
}
void SPFeMerge::build_renderer(Inkscape::Filters::Filter* filter) {
- g_assert(this != NULL);
- g_assert(filter != NULL);
+ g_assert(this != nullptr);
+ g_assert(filter != nullptr);
int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_MERGE);
Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n);
Inkscape::Filters::FilterMerge *nr_merge = dynamic_cast<Inkscape::Filters::FilterMerge*>(nr_primitive);
- g_assert(nr_merge != NULL);
+ g_assert(nr_merge != nullptr);
sp_filter_primitive_renderer_common(this, nr_primitive);
diff --git a/src/object/filters/morphology.cpp b/src/object/filters/morphology.cpp
index b3cfa0697..6f1006372 100644
--- a/src/object/filters/morphology.cpp
+++ b/src/object/filters/morphology.cpp
@@ -135,13 +135,13 @@ Inkscape::XML::Node* SPFeMorphology::write(Inkscape::XML::Document *doc, Inkscap
}
void SPFeMorphology::build_renderer(Inkscape::Filters::Filter* filter) {
- g_assert(this != NULL);
- g_assert(filter != NULL);
+ g_assert(this != nullptr);
+ g_assert(filter != nullptr);
int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_MORPHOLOGY);
Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n);
Inkscape::Filters::FilterMorphology *nr_morphology = dynamic_cast<Inkscape::Filters::FilterMorphology*>(nr_primitive);
- g_assert(nr_morphology != NULL);
+ g_assert(nr_morphology != nullptr);
sp_filter_primitive_renderer_common(this, nr_primitive);
diff --git a/src/object/filters/offset.cpp b/src/object/filters/offset.cpp
index a0057d722..ed674afbf 100644
--- a/src/object/filters/offset.cpp
+++ b/src/object/filters/offset.cpp
@@ -111,13 +111,13 @@ Inkscape::XML::Node* SPFeOffset::write(Inkscape::XML::Document *doc, Inkscape::X
}
void SPFeOffset::build_renderer(Inkscape::Filters::Filter* filter) {
- g_assert(this != NULL);
- g_assert(filter != NULL);
+ g_assert(this != nullptr);
+ g_assert(filter != nullptr);
int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_OFFSET);
Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n);
Inkscape::Filters::FilterOffset *nr_offset = dynamic_cast<Inkscape::Filters::FilterOffset*>(nr_primitive);
- g_assert(nr_offset != NULL);
+ g_assert(nr_offset != nullptr);
sp_filter_primitive_renderer_common(this, nr_primitive);
diff --git a/src/object/filters/pointlight.cpp b/src/object/filters/pointlight.cpp
index 942140c1b..c12d68ceb 100644
--- a/src/object/filters/pointlight.cpp
+++ b/src/object/filters/pointlight.cpp
@@ -74,7 +74,7 @@ void SPFePointLight::set(unsigned int key, gchar const *value) {
switch (key) {
case SP_ATTR_X:
- end_ptr = NULL;
+ end_ptr = nullptr;
if (value) {
this->x = g_ascii_strtod(value, &end_ptr);
@@ -96,7 +96,7 @@ void SPFePointLight::set(unsigned int key, gchar const *value) {
}
break;
case SP_ATTR_Y:
- end_ptr = NULL;
+ end_ptr = nullptr;
if (value) {
this->y = g_ascii_strtod(value, &end_ptr);
@@ -118,7 +118,7 @@ void SPFePointLight::set(unsigned int key, gchar const *value) {
}
break;
case SP_ATTR_Z:
- end_ptr = NULL;
+ end_ptr = nullptr;
if (value) {
this->z = g_ascii_strtod(value, &end_ptr);
diff --git a/src/object/filters/sp-filter-primitive.cpp b/src/object/filters/sp-filter-primitive.cpp
index e5381373d..7f93754b9 100644
--- a/src/object/filters/sp-filter-primitive.cpp
+++ b/src/object/filters/sp-filter-primitive.cpp
@@ -249,8 +249,8 @@ int sp_filter_primitive_name_previous_out(SPFilterPrimitive *prim) {
/* Common initialization for filter primitives */
void sp_filter_primitive_renderer_common(SPFilterPrimitive *sp_prim, Inkscape::Filters::FilterPrimitive *nr_prim)
{
- g_assert(sp_prim != NULL);
- g_assert(nr_prim != NULL);
+ g_assert(sp_prim != nullptr);
+ g_assert(nr_prim != nullptr);
nr_prim->set_input(sp_prim->image_in);
diff --git a/src/object/filters/specularlighting.cpp b/src/object/filters/specularlighting.cpp
index c46a21080..3e66d6f95 100644
--- a/src/object/filters/specularlighting.cpp
+++ b/src/object/filters/specularlighting.cpp
@@ -42,10 +42,10 @@ SPFeSpecularLighting::SPFeSpecularLighting() : SPFilterPrimitive() {
this->specularConstant = 1;
this->specularExponent = 1;
this->lighting_color = 0xffffffff;
- this->icc = NULL;
+ this->icc = nullptr;
//TODO kernelUnit
- this->renderer = NULL;
+ this->renderer = nullptr;
this->surfaceScale_set = FALSE;
this->specularConstant_set = FALSE;
@@ -83,14 +83,14 @@ void SPFeSpecularLighting::release() {
* Sets a specific value in the SPFeSpecularLighting.
*/
void SPFeSpecularLighting::set(unsigned int key, gchar const *value) {
- gchar const *cend_ptr = NULL;
- gchar *end_ptr = NULL;
+ gchar const *cend_ptr = nullptr;
+ gchar *end_ptr = nullptr;
switch(key) {
/*DEAL WITH SETTING ATTRIBUTES HERE*/
//TODO test forbidden values
case SP_ATTR_SURFACESCALE:
- end_ptr = NULL;
+ end_ptr = nullptr;
if (value) {
this->surfaceScale = g_ascii_strtod(value, &end_ptr);
if (end_ptr) {
@@ -111,13 +111,13 @@ void SPFeSpecularLighting::set(unsigned int key, gchar const *value) {
this->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_SPECULARCONSTANT:
- end_ptr = NULL;
+ end_ptr = nullptr;
if (value) {
this->specularConstant = g_ascii_strtod(value, &end_ptr);
if (end_ptr && this->specularConstant >= 0) {
this->specularConstant_set = TRUE;
} else {
- end_ptr = NULL;
+ end_ptr = nullptr;
g_warning("this: specularConstant should be a positive number ... defaulting to 1");
}
}
@@ -131,13 +131,13 @@ void SPFeSpecularLighting::set(unsigned int key, gchar const *value) {
this->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_SPECULAREXPONENT:
- end_ptr = NULL;
+ end_ptr = nullptr;
if (value) {
this->specularExponent = g_ascii_strtod(value, &end_ptr);
if (this->specularExponent >= 1 && this->specularExponent <= 128) {
this->specularExponent_set = TRUE;
} else {
- end_ptr = NULL;
+ end_ptr = nullptr;
g_warning("this: specularExponent should be a number in range [1, 128] ... defaulting to 1");
}
}
@@ -160,7 +160,7 @@ void SPFeSpecularLighting::set(unsigned int key, gchar const *value) {
this->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_PROP_LIGHTING_COLOR:
- cend_ptr = NULL;
+ cend_ptr = nullptr;
this->lighting_color = sp_svg_read_color(value, &cend_ptr, 0xffffffff);
//if a value was read
if (cend_ptr) {
@@ -171,7 +171,7 @@ void SPFeSpecularLighting::set(unsigned int key, gchar const *value) {
if (!this->icc) this->icc = new SVGICCColor();
if ( ! sp_svg_read_icc_color( cend_ptr, this->icc ) ) {
delete this->icc;
- this->icc = NULL;
+ this->icc = nullptr;
}
}
this->lighting_color_set = TRUE;
@@ -289,13 +289,13 @@ static void sp_feSpecularLighting_children_modified(SPFeSpecularLighting *sp_spe
}
void SPFeSpecularLighting::build_renderer(Inkscape::Filters::Filter* filter) {
- g_assert(this != NULL);
- g_assert(filter != NULL);
+ g_assert(this != nullptr);
+ g_assert(filter != nullptr);
int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_SPECULARLIGHTING);
Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n);
Inkscape::Filters::FilterSpecularLighting *nr_specularlighting = dynamic_cast<Inkscape::Filters::FilterSpecularLighting*>(nr_primitive);
- g_assert(nr_specularlighting != NULL);
+ g_assert(nr_specularlighting != nullptr);
this->renderer = nr_specularlighting;
sp_filter_primitive_renderer_common(this, nr_primitive);
diff --git a/src/object/filters/spotlight.cpp b/src/object/filters/spotlight.cpp
index a05691196..239391478 100644
--- a/src/object/filters/spotlight.cpp
+++ b/src/object/filters/spotlight.cpp
@@ -79,7 +79,7 @@ void SPFeSpotLight::set(unsigned int key, gchar const *value) {
switch (key) {
case SP_ATTR_X:
- end_ptr = NULL;
+ end_ptr = nullptr;
if (value) {
this->x = g_ascii_strtod(value, &end_ptr);
@@ -101,7 +101,7 @@ void SPFeSpotLight::set(unsigned int key, gchar const *value) {
}
break;
case SP_ATTR_Y:
- end_ptr = NULL;
+ end_ptr = nullptr;
if (value) {
this->y = g_ascii_strtod(value, &end_ptr);
@@ -123,7 +123,7 @@ void SPFeSpotLight::set(unsigned int key, gchar const *value) {
}
break;
case SP_ATTR_Z:
- end_ptr = NULL;
+ end_ptr = nullptr;
if (value) {
this->z = g_ascii_strtod(value, &end_ptr);
@@ -145,7 +145,7 @@ void SPFeSpotLight::set(unsigned int key, gchar const *value) {
}
break;
case SP_ATTR_POINTSATX:
- end_ptr = NULL;
+ end_ptr = nullptr;
if (value) {
this->pointsAtX = g_ascii_strtod(value, &end_ptr);
@@ -167,7 +167,7 @@ void SPFeSpotLight::set(unsigned int key, gchar const *value) {
}
break;
case SP_ATTR_POINTSATY:
- end_ptr = NULL;
+ end_ptr = nullptr;
if (value) {
this->pointsAtY = g_ascii_strtod(value, &end_ptr);
@@ -189,7 +189,7 @@ void SPFeSpotLight::set(unsigned int key, gchar const *value) {
}
break;
case SP_ATTR_POINTSATZ:
- end_ptr = NULL;
+ end_ptr = nullptr;
if (value) {
this->pointsAtZ = g_ascii_strtod(value, &end_ptr);
@@ -211,7 +211,7 @@ void SPFeSpotLight::set(unsigned int key, gchar const *value) {
}
break;
case SP_ATTR_SPECULAREXPONENT:
- end_ptr = NULL;
+ end_ptr = nullptr;
if (value) {
this->specularExponent = g_ascii_strtod(value, &end_ptr);
@@ -233,7 +233,7 @@ void SPFeSpotLight::set(unsigned int key, gchar const *value) {
}
break;
case SP_ATTR_LIMITINGCONEANGLE:
- end_ptr = NULL;
+ end_ptr = nullptr;
if (value) {
this->limitingConeAngle = g_ascii_strtod(value, &end_ptr);
diff --git a/src/object/filters/tile.cpp b/src/object/filters/tile.cpp
index 82e63c220..f36c5a758 100644
--- a/src/object/filters/tile.cpp
+++ b/src/object/filters/tile.cpp
@@ -86,13 +86,13 @@ Inkscape::XML::Node* SPFeTile::write(Inkscape::XML::Document *doc, Inkscape::XML
}
void SPFeTile::build_renderer(Inkscape::Filters::Filter* filter) {
- g_assert(this != NULL);
- g_assert(filter != NULL);
+ g_assert(this != nullptr);
+ g_assert(filter != nullptr);
int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_TILE);
Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n);
Inkscape::Filters::FilterTile *nr_tile = dynamic_cast<Inkscape::Filters::FilterTile*>(nr_primitive);
- g_assert(nr_tile != NULL);
+ g_assert(nr_tile != nullptr);
sp_filter_primitive_renderer_common(this, nr_primitive);
}
diff --git a/src/object/filters/turbulence.cpp b/src/object/filters/turbulence.cpp
index 9af51892e..657e44d6a 100644
--- a/src/object/filters/turbulence.cpp
+++ b/src/object/filters/turbulence.cpp
@@ -193,19 +193,19 @@ Inkscape::XML::Node* SPFeTurbulence::write(Inkscape::XML::Document *doc, Inkscap
SPFilterPrimitive::write(doc, repr, flags);
/* turbulence doesn't take input */
- repr->setAttribute("in", 0);
+ repr->setAttribute("in", nullptr);
return repr;
}
void SPFeTurbulence::build_renderer(Inkscape::Filters::Filter* filter) {
- g_assert(this != NULL);
- g_assert(filter != NULL);
+ g_assert(this != nullptr);
+ g_assert(filter != nullptr);
int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_TURBULENCE);
Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n);
Inkscape::Filters::FilterTurbulence *nr_turbulence = dynamic_cast<Inkscape::Filters::FilterTurbulence*>(nr_primitive);
- g_assert(nr_turbulence != NULL);
+ g_assert(nr_turbulence != nullptr);
sp_filter_primitive_renderer_common(this, nr_primitive);
diff --git a/src/object/object-set.cpp b/src/object/object-set.cpp
index 36ddac350..de45450a1 100644
--- a/src/object/object-set.cpp
+++ b/src/object/object-set.cpp
@@ -21,7 +21,7 @@
namespace Inkscape {
bool ObjectSet::add(SPObject* object, bool nosignal) {
- g_return_val_if_fail(object != NULL, false);
+ g_return_val_if_fail(object != nullptr, false);
g_return_val_if_fail(SP_IS_OBJECT(object), false);
// any ancestor is in the set - do nothing
@@ -43,7 +43,7 @@ bool ObjectSet::add(SPObject* object, bool nosignal) {
}
bool ObjectSet::remove(SPObject* object) {
- g_return_val_if_fail(object != NULL, false);
+ g_return_val_if_fail(object != nullptr, false);
g_return_val_if_fail(SP_IS_OBJECT(object), false);
// object is the top of subtree
@@ -65,7 +65,7 @@ bool ObjectSet::remove(SPObject* object) {
}
bool ObjectSet::includes(SPObject *object) {
- g_return_val_if_fail(object != NULL, false);
+ g_return_val_if_fail(object != nullptr, false);
g_return_val_if_fail(SP_IS_OBJECT(object), false);
return _container.get<hashed>().find(object) != _container.get<hashed>().end();
@@ -206,7 +206,7 @@ SPItem *ObjectSet::largestItem(CompareSize compare) {
SPItem *ObjectSet::_sizeistItem(bool sml, CompareSize compare) {
auto items = this->items();
gdouble max = sml ? 1e18 : 0;
- SPItem *ist = NULL;
+ SPItem *ist = nullptr;
for (auto i = items.begin(); i != items.end(); ++i) {
Geom::OptRect obox = SP_ITEM(*i)->documentPreferredBounds();
diff --git a/src/object/object-set.h b/src/object/object-set.h
index f9f02a213..d07ee2193 100644
--- a/src/object/object-set.h
+++ b/src/object/object-set.h
@@ -334,7 +334,7 @@ public:
* Returns a list of all 3D boxes in the current selection which are associated to @c
* persp. If @c pers is @c NULL, return all selected boxes.
*/
- std::list<SPBox3D *> const box3DList(Persp3D *persp = NULL);
+ std::list<SPBox3D *> const box3DList(Persp3D *persp = nullptr);
/**
* Returns the desktop the selection is bound to
diff --git a/src/object/persp3d-reference.cpp b/src/object/persp3d-reference.cpp
index 49510764e..c1e6526bb 100644
--- a/src/object/persp3d-reference.cpp
+++ b/src/object/persp3d-reference.cpp
@@ -17,9 +17,9 @@ static void persp3dreference_source_modified(SPObject *iSource, guint flags, Per
Persp3DReference::Persp3DReference(SPObject* i_owner) : URIReference(i_owner)
{
owner=i_owner;
- persp_href = NULL;
- persp_repr = NULL;
- persp = NULL;
+ persp_href = nullptr;
+ persp_repr = nullptr;
+ persp = nullptr;
_changed_connection = changedSignal().connect(sigc::bind(sigc::ptr_fun(persp3dreference_href_changed), this)); // listening to myself, this should be virtual instead
}
@@ -44,14 +44,14 @@ void
Persp3DReference::unlink(void)
{
g_free(persp_href);
- persp_href = NULL;
+ persp_href = nullptr;
detach();
}
void
Persp3DReference::start_listening(Persp3D* to)
{
- if ( to == NULL ) {
+ if ( to == nullptr ) {
return;
}
persp = to;
@@ -63,13 +63,13 @@ Persp3DReference::start_listening(Persp3D* to)
void
Persp3DReference::quit_listening(void)
{
- if ( persp == NULL ) {
+ if ( persp == nullptr ) {
return;
}
_modified_connection.disconnect();
_delete_connection.disconnect();
- persp_repr = NULL;
- persp = NULL;
+ persp_repr = nullptr;
+ persp = nullptr;
}
static void
diff --git a/src/object/persp3d.cpp b/src/object/persp3d.cpp
index ca39447a1..8020d0221 100644
--- a/src/object/persp3d.cpp
+++ b/src/object/persp3d.cpp
@@ -39,17 +39,17 @@ static int global_counter = 0;
Persp3DImpl::Persp3DImpl() :
tmat (Proj::TransfMat3x4 ()),
- document (NULL)
+ document (nullptr)
{
my_counter = global_counter++;
}
static Inkscape::XML::NodeEventVector const persp3d_repr_events = {
- NULL, /* child_added */
- NULL, /* child_removed */
+ nullptr, /* child_added */
+ nullptr, /* child_removed */
persp3d_on_repr_attr_changed,
- NULL, /* content_changed */
- NULL /* order_changed */
+ nullptr, /* content_changed */
+ nullptr /* order_changed */
};
@@ -192,7 +192,7 @@ Persp3D *persp3d_create_xml_element(SPDocument *document, Persp3DImpl *dup) {//
proj_origin = dup->tmat.column (Proj::W);
}
- gchar *str = NULL;
+ gchar *str = nullptr;
str = proj_vp_x.coord_string();
repr->setAttribute("inkscape:vp_x", str);
g_free (str);
@@ -207,7 +207,7 @@ Persp3D *persp3d_create_xml_element(SPDocument *document, Persp3DImpl *dup) {//
g_free (str);
/* Append the new persp3d to defs */
- defs->getRepr()->addChild(repr, NULL);
+ defs->getRepr()->addChild(repr, nullptr);
Inkscape::GC::release(repr);
return reinterpret_cast<Persp3D *>( defs->get_child_by_repr(repr) );
@@ -215,7 +215,7 @@ Persp3D *persp3d_create_xml_element(SPDocument *document, Persp3DImpl *dup) {//
Persp3D *persp3d_document_first_persp(SPDocument *document)
{
- Persp3D *first = 0;
+ Persp3D *first = nullptr;
for (auto& child: document->getDefs()->children) {
if (SP_IS_PERSP3D(&child)) {
first = SP_PERSP3D(&child);
diff --git a/src/object/persp3d.h b/src/object/persp3d.h
index eef0ff5b6..bcbc5c601 100644
--- a/src/object/persp3d.h
+++ b/src/object/persp3d.h
@@ -105,7 +105,7 @@ std::list<SPBox3D *> persp3d_list_of_boxes(Persp3D *persp);
bool persp3d_perspectives_coincide(Persp3D const *lhs, Persp3D const *rhs);
void persp3d_absorb(Persp3D *persp1, Persp3D *persp2);
-Persp3D * persp3d_create_xml_element (SPDocument *document, Persp3DImpl *dup = NULL);
+Persp3D * persp3d_create_xml_element (SPDocument *document, Persp3DImpl *dup = nullptr);
Persp3D * persp3d_document_first_persp (SPDocument *document);
bool persp3d_has_all_boxes_in_selection (Persp3D *persp, Inkscape::ObjectSet *set);
diff --git a/src/object/sp-anchor.cpp b/src/object/sp-anchor.cpp
index b40f53ee1..3baa7b7ca 100644
--- a/src/object/sp-anchor.cpp
+++ b/src/object/sp-anchor.cpp
@@ -23,10 +23,10 @@
#include "document.h"
SPAnchor::SPAnchor() : SPGroup() {
- this->href = NULL;
- this->type = NULL;
- this->title = NULL;
- this->page = NULL;
+ this->href = nullptr;
+ this->type = nullptr;
+ this->title = nullptr;
+ this->page = nullptr;
}
SPAnchor::~SPAnchor() {
@@ -48,19 +48,19 @@ void SPAnchor::build(SPDocument *document, Inkscape::XML::Node *repr) {
void SPAnchor::release() {
if (this->href) {
g_free(this->href);
- this->href = NULL;
+ this->href = nullptr;
}
if (this->type) {
g_free(this->type);
- this->type = NULL;
+ this->type = nullptr;
}
if (this->title) {
g_free(this->title);
- this->title = NULL;
+ this->title = nullptr;
}
if (this->page) {
g_free(this->page);
- this->page = NULL;
+ this->page = nullptr;
}
SPGroup::release();
diff --git a/src/object/sp-clippath.cpp b/src/object/sp-clippath.cpp
index 4afbf7e51..3ef849c14 100644
--- a/src/object/sp-clippath.cpp
+++ b/src/object/sp-clippath.cpp
@@ -45,7 +45,7 @@ SPClipPath::SPClipPath() : SPObjectGroup() {
this->clipPathUnits_set = FALSE;
this->clipPathUnits = SP_CONTENT_UNITS_USERSPACEONUSE;
- this->display = NULL;
+ this->display = nullptr;
}
SPClipPath::~SPClipPath() {
@@ -111,7 +111,7 @@ void SPClipPath::child_added(Inkscape::XML::Node* child, Inkscape::XML::Node* re
SPObject *ochild = this->document->getObjectByRepr(child);
if (SP_IS_ITEM(ochild)) {
- for (SPClipPathView *v = this->display; v != NULL; v = v->next) {
+ for (SPClipPathView *v = this->display; v != nullptr; v = v->next) {
Inkscape::DrawingItem *ac = SP_ITEM(ochild)->invoke_show(v->arenaitem->drawing(), v->key, SP_ITEM_REFERENCE_FLAGS);
if (ac) {
@@ -142,7 +142,7 @@ void SPClipPath::update(SPCtx* ctx, unsigned int flags) {
sp_object_unref(child);
}
- for (SPClipPathView *v = this->display; v != NULL; v = v->next) {
+ for (SPClipPathView *v = this->display; v != nullptr; v = v->next) {
Inkscape::DrawingGroup *g = dynamic_cast<Inkscape::DrawingGroup *>(v->arenaitem);
if (this->clipPathUnits == SP_CONTENT_UNITS_OBJECTBOUNDINGBOX && v->bbox) {
@@ -218,7 +218,7 @@ void SPClipPath::hide(unsigned int key) {
SP_ITEM(&child)->invoke_hide(key);
}
}
- for (SPClipPathView *v = display; v != NULL; v = v->next) {
+ for (SPClipPathView *v = display; v != nullptr; v = v->next) {
if (v->key == key) {
/* We simply unref and let item to manage this in handler */
display = sp_clippath_view_list_remove(display, v);
@@ -228,7 +228,7 @@ void SPClipPath::hide(unsigned int key) {
}
void SPClipPath::setBBox(unsigned int key, Geom::OptRect const &bbox) {
- for (SPClipPathView *v = display; v != NULL; v = v->next) {
+ for (SPClipPathView *v = display; v != nullptr; v = v->next) {
if (v->key == key) {
v->bbox = bbox;
break;
diff --git a/src/object/sp-clippath.h b/src/object/sp-clippath.h
index e2c60789a..57c3cf855 100644
--- a/src/object/sp-clippath.h
+++ b/src/object/sp-clippath.h
@@ -95,11 +95,11 @@ protected:
char const * owner_clippath = "";
char const * obj_name = "";
char const * obj_id = "";
- if (owner_repr != NULL) {
+ if (owner_repr != nullptr) {
owner_name = owner_repr->name();
owner_clippath = owner_repr->attribute("clippath");
}
- if (obj_repr != NULL) {
+ if (obj_repr != nullptr) {
obj_name = obj_repr->name();
obj_id = obj_repr->attribute("id");
}
diff --git a/src/object/sp-conn-end-pair.cpp b/src/object/sp-conn-end-pair.cpp
index b810df315..f05b211da 100644
--- a/src/object/sp-conn-end-pair.cpp
+++ b/src/object/sp-conn-end-pair.cpp
@@ -28,7 +28,7 @@
SPConnEndPair::SPConnEndPair(SPPath *const owner)
: _path(owner)
- , _connRef(NULL)
+ , _connRef(nullptr)
, _connType(SP_CONNECTOR_NOAVOID)
, _connCurvature(0.0)
, _transformed_connection()
@@ -46,7 +46,7 @@ SPConnEndPair::~SPConnEndPair()
{
for (unsigned handle_ix = 0; handle_ix < 2; ++handle_ix) {
delete this->_connEnd[handle_ix];
- this->_connEnd[handle_ix] = NULL;
+ this->_connEnd[handle_ix] = nullptr;
}
}
@@ -57,18 +57,18 @@ void SPConnEndPair::release()
this->_connEnd[handle_ix]->_delete_connection.disconnect();
this->_connEnd[handle_ix]->_transformed_connection.disconnect();
g_free(this->_connEnd[handle_ix]->href);
- this->_connEnd[handle_ix]->href = NULL;
+ this->_connEnd[handle_ix]->href = nullptr;
this->_connEnd[handle_ix]->ref.detach();
}
// If the document is being destroyed then the router instance
// and the ConnRefs will have been destroyed with it.
- const bool routerInstanceExists = (_path->document->router != NULL);
+ const bool routerInstanceExists = (_path->document->router != nullptr);
if (_connRef && routerInstanceExists) {
_connRef->router()->deleteConnector(_connRef);
}
- _connRef = NULL;
+ _connRef = nullptr;
_transformed_connection.disconnect();
}
@@ -116,14 +116,14 @@ void SPConnEndPair::setAttr(unsigned const key, gchar const *const value)
if (_connRef) {
_connRef->router()->deleteConnector(_connRef);
- _connRef = NULL;
+ _connRef = nullptr;
_transformed_connection.disconnect();
}
}
break;
case SP_ATTR_CONNECTOR_CURVATURE:
if (value) {
- _connCurvature = g_strtod(value, NULL);
+ _connCurvature = g_strtod(value, nullptr);
if (_connRef && _connRef->isInitialised()) {
// Redraw the connector, but only if it has been initialised.
sp_conn_reroute_path(_path);
@@ -167,7 +167,7 @@ void SPConnEndPair::getAttachedItems(SPItem *h2attItem[2]) const {
if (SP_GROUP(h2attItem[h])->getItemCount() == 0) {
// This group is empty, so detach.
sp_conn_end_detach(_path, h);
- h2attItem[h] = NULL;
+ h2attItem[h] = nullptr;
}
}
}
@@ -176,7 +176,7 @@ void SPConnEndPair::getAttachedItems(SPItem *h2attItem[2]) const {
void SPConnEndPair::getEndpoints(Geom::Point endPts[]) const
{
SPCurve const *curve = _path->getCurveForEdit(true);
- SPItem *h2attItem[2] = {0};
+ SPItem *h2attItem[2] = {nullptr};
getAttachedItems(h2attItem);
Geom::Affine i2d = _path->i2doc_affine();
@@ -213,7 +213,7 @@ bool SPConnEndPair::isOrthogonal() const
static void redrawConnectorCallback(void *ptr)
{
SPPath *path = SP_PATH(ptr);
- if (path->document == NULL) {
+ if (path->document == nullptr) {
// This can happen when the document is being destroyed.
return;
}
@@ -230,7 +230,7 @@ void SPConnEndPair::rerouteFromManipulation()
void SPConnEndPair::update()
{
if (_connType != SP_CONNECTOR_NOAVOID) {
- g_assert(_connRef != NULL);
+ g_assert(_connRef != nullptr);
if (!_connRef->isInitialised()) {
_updateEndPoints();
_connRef->setCallback(&redrawConnectorCallback, _path);
diff --git a/src/object/sp-conn-end.cpp b/src/object/sp-conn-end.cpp
index 996d8499a..d0c48edd3 100644
--- a/src/object/sp-conn-end.cpp
+++ b/src/object/sp-conn-end.cpp
@@ -18,7 +18,7 @@ static void change_endpts(SPCurve *const curve, double const endPos[2]);
SPConnEnd::SPConnEnd(SPObject *const owner)
: ref(owner)
- , href(NULL)
+ , href(nullptr)
// Default to center connection endpoint
, _changed_connection()
, _delete_connection()
@@ -31,7 +31,7 @@ static SPObject const *get_nearest_common_ancestor(SPObject const *const obj, SP
{
SPObject const *anc_sofar = obj;
for (unsigned i = 0; i < 2; ++i) {
- if ( objs[i] != NULL ) {
+ if ( objs[i] != nullptr ) {
anc_sofar = anc_sofar->nearestCommonAncestor(objs[i]);
}
}
@@ -141,7 +141,7 @@ static void sp_conn_get_route_and_redraw(SPPath *const path, const bool updatePa
return;
}
- SPItem *h2attItem[2] = {0};
+ SPItem *h2attItem[2] = {nullptr};
path->connEndPair.getAttachedItems(h2attItem);
SPObject const *const ancestor = get_nearest_common_ancestor(path, h2attItem);
@@ -221,13 +221,13 @@ static void sp_conn_end_deleted(SPObject *, SPObject *const owner, unsigned cons
{
char const * const attrs[] = {
"inkscape:connection-start", "inkscape:connection-end"};
- owner->getRepr()->setAttribute(attrs[handle_ix], NULL);
+ owner->getRepr()->setAttribute(attrs[handle_ix], nullptr);
/* I believe this will trigger sp_conn_end_href_changed. */
}
void sp_conn_end_detach(SPObject *const owner, unsigned const handle_ix)
{
- sp_conn_end_deleted(NULL, owner, handle_ix);
+ sp_conn_end_deleted(nullptr, owner, handle_ix);
}
void SPConnEnd::setAttacherHref(gchar const *value, SPPath* /*path*/)
@@ -255,7 +255,7 @@ void SPConnEnd::setAttacherHref(gchar const *value, SPPath* /*path*/)
if (!validRef) {
ref.detach();
g_free(href);
- href = NULL;
+ href = nullptr;
}
}
@@ -263,7 +263,7 @@ void SPConnEnd::setAttacherHref(gchar const *value, SPPath* /*path*/)
void sp_conn_end_href_changed(SPObject */*old_ref*/, SPObject */*ref*/,
SPConnEnd *connEndPtr, SPPath *const path, unsigned const handle_ix)
{
- g_return_if_fail(connEndPtr != NULL);
+ g_return_if_fail(connEndPtr != nullptr);
SPConnEnd &connEnd = *connEndPtr;
connEnd._delete_connection.disconnect();
connEnd._transformed_connection.disconnect();
diff --git a/src/object/sp-defs.cpp b/src/object/sp-defs.cpp
index 619a27c0f..4fb3e6688 100644
--- a/src/object/sp-defs.cpp
+++ b/src/object/sp-defs.cpp
@@ -75,13 +75,13 @@ Inkscape::XML::Node* SPDefs::write(Inkscape::XML::Document *xml_doc, Inkscape::X
std::vector<Inkscape::XML::Node *> l;
for (auto& child: children) {
- Inkscape::XML::Node *crepr = child.updateRepr(xml_doc, NULL, flags);
+ Inkscape::XML::Node *crepr = child.updateRepr(xml_doc, nullptr, flags);
if (crepr) {
l.push_back(crepr);
}
}
for (auto i=l.rbegin();i!=l.rend();++i) {
- repr->addChild(*i, NULL);
+ repr->addChild(*i, nullptr);
Inkscape::GC::release(*i);
}
} else {
diff --git a/src/object/sp-ellipse.cpp b/src/object/sp-ellipse.cpp
index 74ade912c..f30a06ca1 100644
--- a/src/object/sp-ellipse.cpp
+++ b/src/object/sp-ellipse.cpp
@@ -281,11 +281,11 @@ Inkscape::XML::Node *SPGenericEllipse::write(Inkscape::XML::Document *xml_doc, I
case SP_GENERIC_ELLIPSE_UNDEFINED:
case SP_GENERIC_ELLIPSE_ARC:
- repr->setAttribute("cx", NULL );
- repr->setAttribute("cy", NULL );
- repr->setAttribute("rx", NULL );
- repr->setAttribute("ry", NULL );
- repr->setAttribute("r", NULL );
+ repr->setAttribute("cx", nullptr );
+ repr->setAttribute("cy", nullptr );
+ repr->setAttribute("rx", nullptr );
+ repr->setAttribute("ry", nullptr );
+ repr->setAttribute("r", nullptr );
if (flags & SP_OBJECT_WRITE_EXT) {
@@ -302,7 +302,7 @@ Inkscape::XML::Node *SPGenericEllipse::write(Inkscape::XML::Document *xml_doc, I
switch ( arc_type ) {
case SP_GENERIC_ELLIPSE_ARC_TYPE_SLICE:
- repr->setAttribute("sodipodi:open", NULL); // For backwards compat.
+ repr->setAttribute("sodipodi:open", nullptr); // For backwards compat.
repr->setAttribute("sodipodi:arc-type", "slice");
break;
case SP_GENERIC_ELLIPSE_ARC_TYPE_CHORD:
@@ -318,10 +318,10 @@ Inkscape::XML::Node *SPGenericEllipse::write(Inkscape::XML::Document *xml_doc, I
std::cerr << "SPGenericEllipse::write: unknown arc-type." << std::endl;
}
} else {
- repr->setAttribute("sodipodi:end", NULL);
- repr->setAttribute("sodipodi:start", NULL);
- repr->setAttribute("sodipodi:open", NULL);
- repr->setAttribute("sodipodi:arc-type", NULL);
+ repr->setAttribute("sodipodi:end", nullptr);
+ repr->setAttribute("sodipodi:start", nullptr);
+ repr->setAttribute("sodipodi:open", nullptr);
+ repr->setAttribute("sodipodi:arc-type", nullptr);
}
}
@@ -333,18 +333,18 @@ Inkscape::XML::Node *SPGenericEllipse::write(Inkscape::XML::Document *xml_doc, I
sp_repr_set_svg_length(repr, "cx", cx);
sp_repr_set_svg_length(repr, "cy", cy);
sp_repr_set_svg_length(repr, "r", rx);
- repr->setAttribute("rx", NULL );
- repr->setAttribute("ry", NULL );
- repr->setAttribute("sodipodi:cx", NULL );
- repr->setAttribute("sodipodi:cy", NULL );
- repr->setAttribute("sodipodi:rx", NULL );
- repr->setAttribute("sodipodi:ry", NULL );
- repr->setAttribute("sodipodi:end", NULL );
- repr->setAttribute("sodipodi:start", NULL );
- repr->setAttribute("sodipodi:open", NULL );
- repr->setAttribute("sodipodi:arc-type", NULL);
- repr->setAttribute("sodipodi:type", NULL );
- repr->setAttribute("d", NULL );
+ repr->setAttribute("rx", nullptr );
+ repr->setAttribute("ry", nullptr );
+ repr->setAttribute("sodipodi:cx", nullptr );
+ repr->setAttribute("sodipodi:cy", nullptr );
+ repr->setAttribute("sodipodi:rx", nullptr );
+ repr->setAttribute("sodipodi:ry", nullptr );
+ repr->setAttribute("sodipodi:end", nullptr );
+ repr->setAttribute("sodipodi:start", nullptr );
+ repr->setAttribute("sodipodi:open", nullptr );
+ repr->setAttribute("sodipodi:arc-type", nullptr);
+ repr->setAttribute("sodipodi:type", nullptr );
+ repr->setAttribute("d", nullptr );
break;
case SP_GENERIC_ELLIPSE_ELLIPSE:
@@ -352,17 +352,17 @@ Inkscape::XML::Node *SPGenericEllipse::write(Inkscape::XML::Document *xml_doc, I
sp_repr_set_svg_length(repr, "cy", cy);
sp_repr_set_svg_length(repr, "rx", rx);
sp_repr_set_svg_length(repr, "ry", ry);
- repr->setAttribute("r", NULL );
- repr->setAttribute("sodipodi:cx", NULL );
- repr->setAttribute("sodipodi:cy", NULL );
- repr->setAttribute("sodipodi:rx", NULL );
- repr->setAttribute("sodipodi:ry", NULL );
- repr->setAttribute("sodipodi:end", NULL );
- repr->setAttribute("sodipodi:start", NULL );
- repr->setAttribute("sodipodi:open", NULL );
- repr->setAttribute("sodipodi:arc-type", NULL);
- repr->setAttribute("sodipodi:type", NULL );
- repr->setAttribute("d", NULL );
+ repr->setAttribute("r", nullptr );
+ repr->setAttribute("sodipodi:cx", nullptr );
+ repr->setAttribute("sodipodi:cy", nullptr );
+ repr->setAttribute("sodipodi:rx", nullptr );
+ repr->setAttribute("sodipodi:ry", nullptr );
+ repr->setAttribute("sodipodi:end", nullptr );
+ repr->setAttribute("sodipodi:start", nullptr );
+ repr->setAttribute("sodipodi:open", nullptr );
+ repr->setAttribute("sodipodi:arc-type", nullptr);
+ repr->setAttribute("sodipodi:type", nullptr );
+ repr->setAttribute("d", nullptr );
break;
default:
@@ -434,7 +434,7 @@ void SPGenericEllipse::set_shape()
this->normalize();
- SPCurve *c = NULL;
+ SPCurve *c = nullptr;
// For simplicity, we use a circle with center (0, 0) and radius 1 for our calculations.
Geom::Circle circle(0, 0, 1);
@@ -663,7 +663,7 @@ bool SPGenericEllipse::set_elliptical_path_attribute(Inkscape::XML::Node *repr)
g_free(d);
} else {
- repr->setAttribute("d", NULL);
+ repr->setAttribute("d", nullptr);
}
return true;
diff --git a/src/object/sp-factory.cpp b/src/object/sp-factory.cpp
index a540399c7..09ef89138 100644
--- a/src/object/sp-factory.cpp
+++ b/src/object/sp-factory.cpp
@@ -93,7 +93,7 @@
SPObject *SPFactory::createObject(std::string const& id)
{
- SPObject *ret = NULL;
+ SPObject *ret = nullptr;
if (id == "inkscape:box3d")
ret = new SPBox3D;
diff --git a/src/object/sp-filter.cpp b/src/object/sp-filter.cpp
index 6cb4f8e5d..a77ef9e24 100644
--- a/src/object/sp-filter.cpp
+++ b/src/object/sp-filter.cpp
@@ -46,7 +46,7 @@ SPFilter::SPFilter()
: SPObject(), filterUnits(SP_FILTER_UNITS_OBJECTBOUNDINGBOX), filterUnits_set(FALSE),
primitiveUnits(SP_FILTER_UNITS_USERSPACEONUSE), primitiveUnits_set(FALSE),
filterRes(NumberOptNumber()),
- _renderer(NULL), _image_name(new std::map<gchar *, int, ltstr>), _image_number_next(0)
+ _renderer(nullptr), _image_name(new std::map<gchar *, int, ltstr>), _image_number_next(0)
{
this->href = new SPFilterReference(this);
this->href->changedSignal().connect(sigc::bind(sigc::ptr_fun(filter_ref_changed), this));
@@ -103,7 +103,7 @@ void SPFilter::release() {
this->modified_connection.disconnect();
this->href->detach();
delete this->href;
- this->href = NULL;
+ this->href = nullptr;
}
for (map<gchar *, int, ltstr>::const_iterator i = this->_image_name->begin() ; i != this->_image_name->end() ; ++i) {
@@ -251,7 +251,7 @@ Inkscape::XML::Node* SPFilter::write(Inkscape::XML::Document *doc, Inkscape::XML
std::vector<Inkscape::XML::Node *> l;
for (auto& child: children) {
- Inkscape::XML::Node *crepr = child.updateRepr(doc, NULL, flags);
+ Inkscape::XML::Node *crepr = child.updateRepr(doc, nullptr, flags);
if (crepr) {
l.push_back(crepr);
@@ -259,7 +259,7 @@ Inkscape::XML::Node* SPFilter::write(Inkscape::XML::Document *doc, Inkscape::XML
}
for (auto i=l.rbegin();i!=l.rend();++i) {
- repr->addChild(*i, NULL);
+ repr->addChild(*i, nullptr);
Inkscape::GC::release(*i);
}
} else {
@@ -293,25 +293,25 @@ Inkscape::XML::Node* SPFilter::write(Inkscape::XML::Document *doc, Inkscape::XML
if (this->x._set) {
sp_repr_set_svg_double(repr, "x", this->x.computed);
} else {
- repr->setAttribute("x", NULL);
+ repr->setAttribute("x", nullptr);
}
if (this->y._set) {
sp_repr_set_svg_double(repr, "y", this->y.computed);
} else {
- repr->setAttribute("y", NULL);
+ repr->setAttribute("y", nullptr);
}
if (this->width._set) {
sp_repr_set_svg_double(repr, "width", this->width.computed);
} else {
- repr->setAttribute("width", NULL);
+ repr->setAttribute("width", nullptr);
}
if (this->height._set) {
sp_repr_set_svg_double(repr, "height", this->height.computed);
} else {
- repr->setAttribute("height", NULL);
+ repr->setAttribute("height", nullptr);
}
if (this->filterRes.getNumber()>=0) {
@@ -319,7 +319,7 @@ Inkscape::XML::Node* SPFilter::write(Inkscape::XML::Document *doc, Inkscape::XML
repr->setAttribute("filterRes", tmp);
g_free(tmp);
} else {
- repr->setAttribute("filterRes", NULL);
+ repr->setAttribute("filterRes", nullptr);
}
if (this->href->getURI()) {
@@ -379,8 +379,8 @@ void SPFilter::remove_child(Inkscape::XML::Node *child) {
void sp_filter_build_renderer(SPFilter *sp_filter, Inkscape::Filters::Filter *nr_filter)
{
- g_assert(sp_filter != NULL);
- g_assert(nr_filter != NULL);
+ g_assert(sp_filter != nullptr);
+ g_assert(nr_filter != nullptr);
sp_filter->_renderer = nr_filter;
@@ -404,7 +404,7 @@ void sp_filter_build_renderer(SPFilter *sp_filter, Inkscape::Filters::Filter *nr
for(auto& primitive_obj: sp_filter->children) {
if (SP_IS_FILTER_PRIMITIVE(&primitive_obj)) {
SPFilterPrimitive *primitive = SP_FILTER_PRIMITIVE(&primitive_obj);
- g_assert(primitive != NULL);
+ g_assert(primitive != nullptr);
// if (((SPFilterPrimitiveClass*) G_OBJECT_GET_CLASS(primitive))->build_renderer) {
// ((SPFilterPrimitiveClass *) G_OBJECT_GET_CLASS(primitive))->build_renderer(primitive, nr_filter);
@@ -417,7 +417,7 @@ void sp_filter_build_renderer(SPFilter *sp_filter, Inkscape::Filters::Filter *nr
}
int sp_filter_primitive_count(SPFilter *filter) {
- g_assert(filter != NULL);
+ g_assert(filter != nullptr);
int count = 0;
for(auto& primitive_obj: filter->children) {
@@ -475,7 +475,7 @@ gchar const *sp_filter_name_for_image(SPFilter const *filter, int const image) {
break;
case Inkscape::Filters::NR_FILTER_SLOT_NOT_SET:
case Inkscape::Filters::NR_FILTER_UNNAMED_SLOT:
- return 0;
+ return nullptr;
break;
default:
for (map<gchar *, int, ltstr>::const_iterator i
@@ -486,11 +486,11 @@ gchar const *sp_filter_name_for_image(SPFilter const *filter, int const image) {
}
}
}
- return 0;
+ return nullptr;
}
Glib::ustring sp_filter_get_new_result_name(SPFilter *filter) {
- g_assert(filter != NULL);
+ g_assert(filter != nullptr);
int largest = 0;
for(auto& primitive_obj: filter->children) {
diff --git a/src/object/sp-flowdiv.cpp b/src/object/sp-flowdiv.cpp
index 002fcff85..d79ff349d 100644
--- a/src/object/sp-flowdiv.cpp
+++ b/src/object/sp-flowdiv.cpp
@@ -87,19 +87,19 @@ void SPFlowdiv::set(unsigned int key, const gchar* value) {
Inkscape::XML::Node* SPFlowdiv::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) {
if ( flags & SP_OBJECT_WRITE_BUILD ) {
- if ( repr == NULL ) {
+ if ( repr == nullptr ) {
repr = xml_doc->createElement("svg:flowDiv");
}
std::vector<Inkscape::XML::Node *> l;
for (auto& child: children) {
- Inkscape::XML::Node* c_repr = NULL;
+ Inkscape::XML::Node* c_repr = nullptr;
if ( SP_IS_FLOWTSPAN (&child) ) {
- c_repr = child.updateRepr(xml_doc, NULL, flags);
+ c_repr = child.updateRepr(xml_doc, nullptr, flags);
} else if ( SP_IS_FLOWPARA(&child) ) {
- c_repr = child.updateRepr(xml_doc, NULL, flags);
+ c_repr = child.updateRepr(xml_doc, nullptr, flags);
} else if ( SP_IS_STRING(&child) ) {
c_repr = xml_doc->createTextNode(SP_STRING(&child)->string.c_str());
}
@@ -109,7 +109,7 @@ Inkscape::XML::Node* SPFlowdiv::write(Inkscape::XML::Document *xml_doc, Inkscape
}
}
for (auto i=l.rbegin();i!=l.rend();++i) {
- repr->addChild(*i, NULL);
+ repr->addChild(*i, nullptr);
Inkscape::GC::release(*i);
}
} else {
@@ -210,19 +210,19 @@ void SPFlowtspan::set(unsigned int key, const gchar* value) {
Inkscape::XML::Node *SPFlowtspan::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) {
if ( flags&SP_OBJECT_WRITE_BUILD ) {
- if ( repr == NULL ) {
+ if ( repr == nullptr ) {
repr = xml_doc->createElement("svg:flowSpan");
}
std::vector<Inkscape::XML::Node *> l;
for (auto& child: children) {
- Inkscape::XML::Node* c_repr = NULL;
+ Inkscape::XML::Node* c_repr = nullptr;
if ( SP_IS_FLOWTSPAN(&child) ) {
- c_repr = child.updateRepr(xml_doc, NULL, flags);
+ c_repr = child.updateRepr(xml_doc, nullptr, flags);
} else if ( SP_IS_FLOWPARA(&child) ) {
- c_repr = child.updateRepr(xml_doc, NULL, flags);
+ c_repr = child.updateRepr(xml_doc, nullptr, flags);
} else if ( SP_IS_STRING(&child) ) {
c_repr = xml_doc->createTextNode(SP_STRING(&child)->string.c_str());
}
@@ -232,7 +232,7 @@ Inkscape::XML::Node *SPFlowtspan::write(Inkscape::XML::Document *xml_doc, Inksca
}
}
for (auto i=l.rbegin();i!=l.rend();++i) {
- repr->addChild(*i, NULL);
+ repr->addChild(*i, nullptr);
Inkscape::GC::release(*i);
}
} else {
@@ -333,19 +333,19 @@ void SPFlowpara::set(unsigned int key, const gchar* value) {
Inkscape::XML::Node *SPFlowpara::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) {
if ( flags&SP_OBJECT_WRITE_BUILD ) {
- if ( repr == NULL ) {
+ if ( repr == nullptr ) {
repr = xml_doc->createElement("svg:flowPara");
}
std::vector<Inkscape::XML::Node *> l;
for (auto& child: children) {
- Inkscape::XML::Node* c_repr = NULL;
+ Inkscape::XML::Node* c_repr = nullptr;
if ( SP_IS_FLOWTSPAN(&child) ) {
- c_repr = child.updateRepr(xml_doc, NULL, flags);
+ c_repr = child.updateRepr(xml_doc, nullptr, flags);
} else if ( SP_IS_FLOWPARA(&child) ) {
- c_repr = child.updateRepr(xml_doc, NULL, flags);
+ c_repr = child.updateRepr(xml_doc, nullptr, flags);
} else if ( SP_IS_STRING(&child) ) {
c_repr = xml_doc->createTextNode(SP_STRING(&child)->string.c_str());
}
@@ -356,7 +356,7 @@ Inkscape::XML::Node *SPFlowpara::write(Inkscape::XML::Document *xml_doc, Inkscap
}
for (auto i=l.rbegin();i!=l.rend();++i) {
- repr->addChild(*i, NULL);
+ repr->addChild(*i, nullptr);
Inkscape::GC::release(*i);
}
} else {
@@ -403,7 +403,7 @@ void SPFlowline::modified(unsigned int flags) {
Inkscape::XML::Node *SPFlowline::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) {
if ( flags & SP_OBJECT_WRITE_BUILD ) {
- if ( repr == NULL ) {
+ if ( repr == nullptr ) {
repr = xml_doc->createElement("svg:flowLine");
}
}
@@ -440,7 +440,7 @@ void SPFlowregionbreak::modified(unsigned int flags) {
Inkscape::XML::Node *SPFlowregionbreak::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) {
if ( flags & SP_OBJECT_WRITE_BUILD ) {
- if ( repr == NULL ) {
+ if ( repr == nullptr ) {
repr = xml_doc->createElement("svg:flowLine");
}
}
diff --git a/src/object/sp-flowregion.cpp b/src/object/sp-flowregion.cpp
index 6640d93c2..3e7732e1a 100644
--- a/src/object/sp-flowregion.cpp
+++ b/src/object/sp-flowregion.cpp
@@ -67,7 +67,7 @@ void SPFlowregion::update(SPCtx *ctx, unsigned int flags) {
}
for (auto child:l) {
- g_assert(child != NULL);
+ g_assert(child != nullptr);
SPItem *item = dynamic_cast<SPItem *>(child);
if (childflags || (child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
@@ -97,7 +97,7 @@ void SPFlowregion::UpdateComputed(void)
computed.clear();
for (auto& child: children) {
- Shape *shape = 0;
+ Shape *shape = nullptr;
GetDest(&child, &shape);
computed.push_back(shape);
}
@@ -118,7 +118,7 @@ void SPFlowregion::modified(guint flags) {
}
for (auto child:l) {
- g_assert(child != NULL);
+ g_assert(child != nullptr);
if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
child->emitModified(flags);
@@ -130,14 +130,14 @@ void SPFlowregion::modified(guint flags) {
Inkscape::XML::Node *SPFlowregion::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) {
if (flags & SP_OBJECT_WRITE_BUILD) {
- if ( repr == NULL ) {
+ if ( repr == nullptr ) {
repr = xml_doc->createElement("svg:flowRegion");
}
std::vector<Inkscape::XML::Node *> l;
for (auto& child: children) {
if ( !dynamic_cast<SPTitle *>(&child) && !dynamic_cast<SPDesc *>(&child) ) {
- Inkscape::XML::Node *crepr = child.updateRepr(xml_doc, NULL, flags);
+ Inkscape::XML::Node *crepr = child.updateRepr(xml_doc, nullptr, flags);
if (crepr) {
l.push_back(crepr);
@@ -146,7 +146,7 @@ Inkscape::XML::Node *SPFlowregion::write(Inkscape::XML::Document *xml_doc, Inksc
}
for (auto i = l.rbegin(); i != l.rend(); ++i) {
- repr->addChild(*i, NULL);
+ repr->addChild(*i, nullptr);
Inkscape::GC::release(*i);
}
@@ -170,13 +170,13 @@ const char* SPFlowregion::displayName() const {
}
SPFlowregionExclude::SPFlowregionExclude() : SPItem() {
- this->computed = NULL;
+ this->computed = nullptr;
}
SPFlowregionExclude::~SPFlowregionExclude() {
if (this->computed) {
delete this->computed;
- this->computed = NULL;
+ this->computed = nullptr;
}
}
@@ -215,7 +215,7 @@ void SPFlowregionExclude::update(SPCtx *ctx, unsigned int flags) {
}
for(auto child:l) {
- g_assert(child != NULL);
+ g_assert(child != nullptr);
if (flags || (child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
SPItem *item = dynamic_cast<SPItem *>(child);
@@ -240,7 +240,7 @@ void SPFlowregionExclude::UpdateComputed(void)
{
if (computed) {
delete computed;
- computed = NULL;
+ computed = nullptr;
}
for (auto& child: children) {
@@ -263,7 +263,7 @@ void SPFlowregionExclude::modified(guint flags) {
}
for (auto child:l) {
- g_assert(child != NULL);
+ g_assert(child != nullptr);
if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
child->emitModified(flags);
@@ -275,14 +275,14 @@ void SPFlowregionExclude::modified(guint flags) {
Inkscape::XML::Node *SPFlowregionExclude::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) {
if (flags & SP_OBJECT_WRITE_BUILD) {
- if ( repr == NULL ) {
+ if ( repr == nullptr ) {
repr = xml_doc->createElement("svg:flowRegionExclude");
}
std::vector<Inkscape::XML::Node *> l;
for (auto& child: children) {
- Inkscape::XML::Node *crepr = child.updateRepr(xml_doc, NULL, flags);
+ Inkscape::XML::Node *crepr = child.updateRepr(xml_doc, nullptr, flags);
if (crepr) {
l.push_back(crepr);
@@ -290,7 +290,7 @@ Inkscape::XML::Node *SPFlowregionExclude::write(Inkscape::XML::Document *xml_doc
}
for (auto i = l.rbegin(); i != l.rend(); ++i) {
- repr->addChild(*i, NULL);
+ repr->addChild(*i, nullptr);
Inkscape::GC::release(*i);
}
@@ -315,7 +315,7 @@ const char* SPFlowregionExclude::displayName() const {
static void UnionShape(Shape **base_shape, Shape const *add_shape)
{
- if (*base_shape == NULL)
+ if (*base_shape == nullptr)
*base_shape = new Shape;
if ( (*base_shape)->hasEdges() == false ) {
(*base_shape)->Copy(const_cast<Shape*>(add_shape));
@@ -329,14 +329,14 @@ static void UnionShape(Shape **base_shape, Shape const *add_shape)
static void GetDest(SPObject* child,Shape **computed)
{
- if ( child == NULL ) return;
+ if ( child == nullptr ) return;
- SPCurve *curve=NULL;
+ SPCurve *curve=nullptr;
Geom::Affine tr_mat;
SPObject* u_child = child;
SPItem *item = dynamic_cast<SPItem *>(u_child);
- g_assert(item != NULL);
+ g_assert(item != nullptr);
SPUse *use = dynamic_cast<SPUse *>(item);
if ( use ) {
u_child = use->child;
diff --git a/src/object/sp-flowtext.cpp b/src/object/sp-flowtext.cpp
index 28b6b9575..3811f4072 100644
--- a/src/object/sp-flowtext.cpp
+++ b/src/object/sp-flowtext.cpp
@@ -74,7 +74,7 @@ void SPFlowtext::update(SPCtx* ctx, unsigned int flags) {
}
for (auto child:l) {
- g_assert(child != NULL);
+ g_assert(child != nullptr);
if (childflags || (child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
SPItem *item = dynamic_cast<SPItem *>(child);
@@ -97,7 +97,7 @@ void SPFlowtext::update(SPCtx* ctx, unsigned int flags) {
Geom::OptRect pbox = this->geometricBounds();
- for (SPItemView *v = this->display; v != NULL; v = v->next) {
+ for (SPItemView *v = this->display; v != nullptr; v = v->next) {
Inkscape::DrawingGroup *g = dynamic_cast<Inkscape::DrawingGroup *>(v->arenaitem);
this->_clearFlow(g);
g->setStyle(this->style);
@@ -107,7 +107,7 @@ void SPFlowtext::update(SPCtx* ctx, unsigned int flags) {
}
void SPFlowtext::modified(unsigned int flags) {
- SPObject *region = NULL;
+ SPObject *region = nullptr;
if (flags & SP_OBJECT_MODIFIED_FLAG) {
flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
@@ -119,7 +119,7 @@ void SPFlowtext::modified(unsigned int flags) {
if (flags & ( SP_OBJECT_STYLE_MODIFIED_FLAG )) {
Geom::OptRect pbox = geometricBounds();
- for (SPItemView* v = display; v != NULL; v = v->next) {
+ for (SPItemView* v = display; v != nullptr; v = v->next) {
Inkscape::DrawingGroup *g = dynamic_cast<Inkscape::DrawingGroup *>(v->arenaitem);
_clearFlow(g);
g->setStyle(style);
@@ -156,9 +156,9 @@ void SPFlowtext::set(unsigned int key, const gchar* value) {
//XML Tree being directly used while it shouldn't be.
SPCSSAttr *opts = sp_repr_css_attr(this->getRepr(), "inkscape:layoutOptions");
{
- gchar const *val = sp_repr_css_property(opts, "justification", NULL);
+ gchar const *val = sp_repr_css_property(opts, "justification", nullptr);
- if (val != NULL && !this->style->text_align.set) {
+ if (val != nullptr && !this->style->text_align.set) {
if ( strcmp(val, "0") == 0 || strcmp(val, "false") == 0 ) {
this->style->text_align.value = SP_CSS_TEXT_ALIGN_LEFT;
} else {
@@ -187,12 +187,12 @@ void SPFlowtext::set(unsigned int key, const gchar* value) {
}
*/
{ // This would probably translate to padding-left, if SPStyle had it.
- gchar const *val = sp_repr_css_property(opts, "par-indent", NULL);
+ gchar const *val = sp_repr_css_property(opts, "par-indent", nullptr);
- if ( val == NULL ) {
+ if ( val == nullptr ) {
this->par_indent = 0.0;
} else {
- this->par_indent = g_ascii_strtod(val, NULL);
+ this->par_indent = g_ascii_strtod(val, nullptr);
}
}
@@ -209,17 +209,17 @@ void SPFlowtext::set(unsigned int key, const gchar* value) {
Inkscape::XML::Node* SPFlowtext::write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, guint flags) {
if ( flags & SP_OBJECT_WRITE_BUILD ) {
- if ( repr == NULL ) {
+ if ( repr == nullptr ) {
repr = doc->createElement("svg:flowRoot");
}
std::vector<Inkscape::XML::Node *> l;
for (auto& child: children) {
- Inkscape::XML::Node *c_repr = NULL;
+ Inkscape::XML::Node *c_repr = nullptr;
if ( dynamic_cast<SPFlowdiv *>(&child) || dynamic_cast<SPFlowpara *>(&child) || dynamic_cast<SPFlowregion *>(&child) || dynamic_cast<SPFlowregionExclude *>(&child)) {
- c_repr = child.updateRepr(doc, NULL, flags);
+ c_repr = child.updateRepr(doc, nullptr, flags);
}
if ( c_repr ) {
@@ -228,7 +228,7 @@ Inkscape::XML::Node* SPFlowtext::write(Inkscape::XML::Document* doc, Inkscape::X
}
for (auto i=l.rbegin();i!=l.rend();++i) {
- repr->addChild(*i, NULL);
+ repr->addChild(*i, nullptr);
Inkscape::GC::release(*i);
}
} else {
@@ -291,7 +291,7 @@ void SPFlowtext::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inksca
// of this point depending on the text alignment (left vs. right)
Inkscape::Text::Layout const *layout = te_get_layout((SPItem *) this);
- if (layout != NULL && layout->outputExists()) {
+ if (layout != nullptr && layout->outputExists()) {
boost::optional<Geom::Point> pt = layout->baselineAnchorPoint();
if (pt) {
@@ -314,7 +314,7 @@ Inkscape::DrawingItem* SPFlowtext::show(Inkscape::Drawing &drawing, unsigned int
}
void SPFlowtext::hide(unsigned int key) {
- for (SPItemView* v = this->display; v != NULL; v = v->next) {
+ for (SPItemView* v = this->display; v != nullptr; v = v->next) {
if (v->key == key) {
Inkscape::DrawingGroup *g = dynamic_cast<Inkscape::DrawingGroup *>(v->arenaitem);
this->_clearFlow(g);
@@ -354,7 +354,7 @@ void SPFlowtext::_buildLayoutInput(SPObject *root, Shape const *exclusion_shape,
// emulate par-indent with the first char's kern
SPObject *t = root;
- SPFlowtext *ft = NULL;
+ SPFlowtext *ft = nullptr;
while (t && !ft) {
ft = dynamic_cast<SPFlowtext *>(t);
t = t->parent;
@@ -378,7 +378,7 @@ void SPFlowtext::_buildLayoutInput(SPObject *root, Shape const *exclusion_shape,
} else {
layout.appendControlCode(Inkscape::Text::Layout::PARAGRAPH_BREAK, *pending_line_break_object);
}
- *pending_line_break_object = NULL;
+ *pending_line_break_object = nullptr;
}
for (auto& child: root->children) {
@@ -390,7 +390,7 @@ void SPFlowtext::_buildLayoutInput(SPObject *root, Shape const *exclusion_shape,
else {
layout.appendControlCode(Inkscape::Text::Layout::PARAGRAPH_BREAK, *pending_line_break_object);
}
- *pending_line_break_object = NULL;
+ *pending_line_break_object = nullptr;
}
if (with_indent) {
layout.appendText(str->string, root->style, &child, &pi);
@@ -455,7 +455,7 @@ void SPFlowtext::rebuildLayout()
layout.clear();
Shape *exclusion_shape = _buildExclusionShape();
- SPObject *pending_line_break_object = NULL;
+ SPObject *pending_line_break_object = nullptr;
_buildLayoutInput(this, exclusion_shape, &shapes, &pending_line_break_object);
delete exclusion_shape;
layout.calculateFlow();
@@ -472,7 +472,7 @@ void SPFlowtext::_clearFlow(Inkscape::DrawingGroup *in_arena)
Inkscape::XML::Node *SPFlowtext::getAsText()
{
if (!this->layout.outputExists()) {
- return NULL;
+ return nullptr;
}
Inkscape::XML::Document *xml_doc = this->document->getReprDoc();
@@ -528,7 +528,7 @@ Inkscape::XML::Node *SPFlowtext::getAsText()
sp_repr_set_svg_double(line_tspan, "y", anchor_point[Geom::Y]);
}
- void *rawptr = 0;
+ void *rawptr = nullptr;
Glib::ustring::iterator span_text_start_iter;
this->layout.getSourceOfCharacter(it, &rawptr, &span_text_start_iter);
SPObject *source_obj = reinterpret_cast<SPObject *>(rawptr);
@@ -541,7 +541,7 @@ Inkscape::XML::Node *SPFlowtext::getAsText()
SPString *str = dynamic_cast<SPString *>(source_obj);
if (str) {
Glib::ustring *string = &(str->string); // TODO fixme: dangerous, unsafe premature-optimization
- void *rawptr = 0;
+ void *rawptr = nullptr;
Glib::ustring::iterator span_text_end_iter;
this->layout.getSourceOfCharacter(it_span_end, &rawptr, &span_text_end_iter);
SPObject *span_end_obj = reinterpret_cast<SPObject *>(rawptr);
@@ -583,9 +583,9 @@ SPItem const *SPFlowtext::get_frame(SPItem const *after) const
SPItem *SPFlowtext::get_frame(SPItem const *after)
{
- SPItem *frame = 0;
+ SPItem *frame = nullptr;
- SPObject *region = 0;
+ SPObject *region = nullptr;
for (auto& o: children) {
if (dynamic_cast<SPFlowregion *>(&o)) {
region = &o;
@@ -599,7 +599,7 @@ SPItem *SPFlowtext::get_frame(SPItem const *after)
for (auto& o: region->children) {
SPItem *item = dynamic_cast<SPItem *>(&o);
if (item) {
- if ( (after == NULL) || past ) {
+ if ( (after == nullptr) || past ) {
frame = item;
} else {
if (item == after) {
@@ -619,7 +619,7 @@ SPItem *SPFlowtext::get_frame(SPItem const *after)
bool SPFlowtext::has_internal_frame() const
{
- SPItem const *frame = get_frame(NULL);
+ SPItem const *frame = get_frame(nullptr);
return (frame && isAncestorOf(frame) && dynamic_cast<SPRect const *>(frame));
}
@@ -633,20 +633,20 @@ SPItem *create_flowtext_with_internal_frame (SPDesktop *desktop, Geom::Point p0,
Inkscape::XML::Node *root_repr = xml_doc->createElement("svg:flowRoot");
root_repr->setAttribute("xml:space", "preserve"); // we preserve spaces in the text objects we create
SPItem *ft_item = dynamic_cast<SPItem *>(desktop->currentLayer()->appendChildRepr(root_repr));
- g_assert(ft_item != NULL);
+ g_assert(ft_item != nullptr);
SPObject *root_object = doc->getObjectByRepr(root_repr);
- g_assert(dynamic_cast<SPFlowtext *>(root_object) != NULL);
+ g_assert(dynamic_cast<SPFlowtext *>(root_object) != nullptr);
Inkscape::XML::Node *region_repr = xml_doc->createElement("svg:flowRegion");
root_repr->appendChild(region_repr);
SPObject *region_object = doc->getObjectByRepr(region_repr);
- g_assert(dynamic_cast<SPFlowregion *>(region_object) != NULL);
+ g_assert(dynamic_cast<SPFlowregion *>(region_object) != nullptr);
Inkscape::XML::Node *rect_repr = xml_doc->createElement("svg:rect"); // FIXME: use path!!! after rects are converted to use path
region_repr->appendChild(rect_repr);
SPRect *rect = dynamic_cast<SPRect *>(doc->getObjectByRepr(rect_repr));
- g_assert(rect != NULL);
+ g_assert(rect != nullptr);
p0 *= desktop->dt2doc();
p1 *= desktop->dt2doc();
@@ -665,7 +665,7 @@ SPItem *create_flowtext_with_internal_frame (SPDesktop *desktop, Geom::Point p0,
Inkscape::XML::Node *para_repr = xml_doc->createElement("svg:flowPara");
root_repr->appendChild(para_repr);
SPObject *para_object = doc->getObjectByRepr(para_repr);
- g_assert(dynamic_cast<SPFlowpara *>(para_object) != NULL);
+ g_assert(dynamic_cast<SPFlowpara *>(para_object) != nullptr);
Inkscape::XML::Node *text = xml_doc->createTextNode("");
para_repr->appendChild(text);
@@ -677,7 +677,7 @@ SPItem *create_flowtext_with_internal_frame (SPDesktop *desktop, Geom::Point p0,
SPItem *item = dynamic_cast<SPItem *>(desktop->currentLayer());
- g_assert(item != NULL);
+ g_assert(item != nullptr);
ft_item->transform = item->i2doc_affine().inverse();
return ft_item;
@@ -699,7 +699,7 @@ Geom::Affine SPFlowtext::set_transform (Geom::Affine const &xform)
return xform;
}
- SPObject *region = NULL;
+ SPObject *region = nullptr;
for (auto& o: children) {
if (dynamic_cast<SPFlowregion *>(&o)) {
region = &o;
@@ -710,7 +710,7 @@ Geom::Affine SPFlowtext::set_transform (Geom::Affine const &xform)
SPRect *rect = dynamic_cast<SPRect *>(region->firstChild());
if (rect) {
rect->set_i2d_affine(xform * rect->i2dt_affine());
- rect->doWriteTransform(rect->transform, NULL, true);
+ rect->doWriteTransform(rect->transform, nullptr, true);
}
}
diff --git a/src/object/sp-font-face.cpp b/src/object/sp-font-face.cpp
index 52fc09ddd..754956058 100644
--- a/src/object/sp-font-face.cpp
+++ b/src/object/sp-font-face.cpp
@@ -275,13 +275,13 @@ SPFontFace::SPFontFace() : SPObject() {
std::vector<FontFaceStretchType> stretch;
stretch.push_back(SP_FONTFACE_STRETCH_NORMAL);
this->font_stretch = stretch;
- this->font_family = NULL;
+ this->font_family = nullptr;
//this->font_style = ;
//this->font_variant = ;
//this->font_weight = ;
//this->font_stretch = ;
- this->font_size = NULL;
+ this->font_size = nullptr;
//this->unicode_range = ;
this->units_per_em = 1000;
//this->panose_1 = ;
@@ -293,8 +293,8 @@ SPFontFace::SPFontFace() : SPObject() {
this->accent_height = 0;
this->ascent = 0;
this->descent = 0;
- this->widths = NULL;
- this->bbox = NULL;
+ this->widths = nullptr;
+ this->bbox = nullptr;
this->ideographic = 0;
this->alphabetic = 0;
this->mathematical = 0;
@@ -456,7 +456,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) {
break;
case SP_ATTR_UNITS_PER_EM:
{
- double number = value ? g_ascii_strtod(value, 0) : 0;
+ double number = value ? g_ascii_strtod(value, nullptr) : 0;
if (number != this->units_per_em){
this->units_per_em = number;
@@ -466,7 +466,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) {
}
case SP_ATTR_STEMV:
{
- double number = value ? g_ascii_strtod(value, 0) : 0;
+ double number = value ? g_ascii_strtod(value, nullptr) : 0;
if (number != this->stemv){
this->stemv = number;
@@ -476,7 +476,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) {
}
case SP_ATTR_STEMH:
{
- double number = value ? g_ascii_strtod(value, 0) : 0;
+ double number = value ? g_ascii_strtod(value, nullptr) : 0;
if (number != this->stemh){
this->stemh = number;
@@ -486,7 +486,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) {
}
case SP_ATTR_SLOPE:
{
- double number = value ? g_ascii_strtod(value, 0) : 0;
+ double number = value ? g_ascii_strtod(value, nullptr) : 0;
if (number != this->slope){
this->slope = number;
@@ -496,7 +496,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) {
}
case SP_ATTR_CAP_HEIGHT:
{
- double number = value ? g_ascii_strtod(value, 0) : 0;
+ double number = value ? g_ascii_strtod(value, nullptr) : 0;
if (number != this->cap_height){
this->cap_height = number;
@@ -506,7 +506,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) {
}
case SP_ATTR_X_HEIGHT:
{
- double number = value ? g_ascii_strtod(value, 0) : 0;
+ double number = value ? g_ascii_strtod(value, nullptr) : 0;
if (number != this->x_height){
this->x_height = number;
@@ -516,7 +516,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) {
}
case SP_ATTR_ACCENT_HEIGHT:
{
- double number = value ? g_ascii_strtod(value, 0) : 0;
+ double number = value ? g_ascii_strtod(value, nullptr) : 0;
if (number != this->accent_height){
this->accent_height = number;
@@ -526,7 +526,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) {
}
case SP_ATTR_ASCENT:
{
- double number = value ? g_ascii_strtod(value, 0) : 0;
+ double number = value ? g_ascii_strtod(value, nullptr) : 0;
if (number != this->ascent){
this->ascent = number;
@@ -536,7 +536,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) {
}
case SP_ATTR_DESCENT:
{
- double number = value ? g_ascii_strtod(value, 0) : 0;
+ double number = value ? g_ascii_strtod(value, nullptr) : 0;
if (number != this->descent){
this->descent = number;
@@ -546,7 +546,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) {
}
case SP_ATTR_IDEOGRAPHIC:
{
- double number = value ? g_ascii_strtod(value, 0) : 0;
+ double number = value ? g_ascii_strtod(value, nullptr) : 0;
if (number != this->ideographic){
this->ideographic = number;
@@ -556,7 +556,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) {
}
case SP_ATTR_ALPHABETIC:
{
- double number = value ? g_ascii_strtod(value, 0) : 0;
+ double number = value ? g_ascii_strtod(value, nullptr) : 0;
if (number != this->alphabetic){
this->alphabetic = number;
@@ -566,7 +566,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) {
}
case SP_ATTR_MATHEMATICAL:
{
- double number = value ? g_ascii_strtod(value, 0) : 0;
+ double number = value ? g_ascii_strtod(value, nullptr) : 0;
if (number != this->mathematical){
this->mathematical = number;
@@ -576,7 +576,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) {
}
case SP_ATTR_HANGING:
{
- double number = value ? g_ascii_strtod(value, 0) : 0;
+ double number = value ? g_ascii_strtod(value, nullptr) : 0;
if (number != this->hanging){
this->hanging = number;
@@ -586,7 +586,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) {
}
case SP_ATTR_V_IDEOGRAPHIC:
{
- double number = value ? g_ascii_strtod(value, 0) : 0;
+ double number = value ? g_ascii_strtod(value, nullptr) : 0;
if (number != this->v_ideographic){
this->v_ideographic = number;
@@ -596,7 +596,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) {
}
case SP_ATTR_V_ALPHABETIC:
{
- double number = value ? g_ascii_strtod(value, 0) : 0;
+ double number = value ? g_ascii_strtod(value, nullptr) : 0;
if (number != this->v_alphabetic){
this->v_alphabetic = number;
@@ -606,7 +606,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) {
}
case SP_ATTR_V_MATHEMATICAL:
{
- double number = value ? g_ascii_strtod(value, 0) : 0;
+ double number = value ? g_ascii_strtod(value, nullptr) : 0;
if (number != this->v_mathematical){
this->v_mathematical = number;
@@ -616,7 +616,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) {
}
case SP_ATTR_V_HANGING:
{
- double number = value ? g_ascii_strtod(value, 0) : 0;
+ double number = value ? g_ascii_strtod(value, nullptr) : 0;
if (number != this->v_hanging){
this->v_hanging = number;
@@ -626,7 +626,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) {
}
case SP_ATTR_UNDERLINE_POSITION:
{
- double number = value ? g_ascii_strtod(value, 0) : 0;
+ double number = value ? g_ascii_strtod(value, nullptr) : 0;
if (number != this->underline_position){
this->underline_position = number;
@@ -636,7 +636,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) {
}
case SP_ATTR_UNDERLINE_THICKNESS:
{
- double number = value ? g_ascii_strtod(value, 0) : 0;
+ double number = value ? g_ascii_strtod(value, nullptr) : 0;
if (number != this->underline_thickness){
this->underline_thickness = number;
@@ -646,7 +646,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) {
}
case SP_ATTR_STRIKETHROUGH_POSITION:
{
- double number = value ? g_ascii_strtod(value, 0) : 0;
+ double number = value ? g_ascii_strtod(value, nullptr) : 0;
if (number != this->strikethrough_position){
this->strikethrough_position = number;
@@ -656,7 +656,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) {
}
case SP_ATTR_STRIKETHROUGH_THICKNESS:
{
- double number = value ? g_ascii_strtod(value, 0) : 0;
+ double number = value ? g_ascii_strtod(value, nullptr) : 0;
if (number != this->strikethrough_thickness){
this->strikethrough_thickness = number;
@@ -666,7 +666,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) {
}
case SP_ATTR_OVERLINE_POSITION:
{
- double number = value ? g_ascii_strtod(value, 0) : 0;
+ double number = value ? g_ascii_strtod(value, nullptr) : 0;
if (number != this->overline_position){
this->overline_position = number;
@@ -676,7 +676,7 @@ void SPFontFace::set(unsigned int key, const gchar *value) {
}
case SP_ATTR_OVERLINE_THICKNESS:
{
- double number = value ? g_ascii_strtod(value, 0) : 0;
+ double number = value ? g_ascii_strtod(value, nullptr) : 0;
if (number != this->overline_thickness){
this->overline_thickness = number;
diff --git a/src/object/sp-font.cpp b/src/object/sp-font.cpp
index a0193224c..4701e8690 100644
--- a/src/object/sp-font.cpp
+++ b/src/object/sp-font.cpp
@@ -84,7 +84,7 @@ void SPFont::set(unsigned int key, const gchar *value) {
switch (key) {
case SP_ATTR_HORIZ_ORIGIN_X:
{
- double number = value ? g_ascii_strtod(value, 0) : 0;
+ double number = value ? g_ascii_strtod(value, nullptr) : 0;
if (number != this->horiz_origin_x){
this->horiz_origin_x = number;
@@ -94,7 +94,7 @@ void SPFont::set(unsigned int key, const gchar *value) {
}
case SP_ATTR_HORIZ_ORIGIN_Y:
{
- double number = value ? g_ascii_strtod(value, 0) : 0;
+ double number = value ? g_ascii_strtod(value, nullptr) : 0;
if (number != this->horiz_origin_y){
this->horiz_origin_y = number;
@@ -104,7 +104,7 @@ void SPFont::set(unsigned int key, const gchar *value) {
}
case SP_ATTR_HORIZ_ADV_X:
{
- double number = value ? g_ascii_strtod(value, 0) : FNT_DEFAULT_ADV;
+ double number = value ? g_ascii_strtod(value, nullptr) : FNT_DEFAULT_ADV;
if (number != this->horiz_adv_x){
this->horiz_adv_x = number;
@@ -114,7 +114,7 @@ void SPFont::set(unsigned int key, const gchar *value) {
}
case SP_ATTR_VERT_ORIGIN_X:
{
- double number = value ? g_ascii_strtod(value, 0) : FNT_DEFAULT_ADV / 2.0;
+ double number = value ? g_ascii_strtod(value, nullptr) : FNT_DEFAULT_ADV / 2.0;
if (number != this->vert_origin_x){
this->vert_origin_x = number;
@@ -124,7 +124,7 @@ void SPFont::set(unsigned int key, const gchar *value) {
}
case SP_ATTR_VERT_ORIGIN_Y:
{
- double number = value ? g_ascii_strtod(value, 0) : FNT_DEFAULT_ASCENT;
+ double number = value ? g_ascii_strtod(value, nullptr) : FNT_DEFAULT_ASCENT;
if (number != this->vert_origin_y){
this->vert_origin_y = number;
@@ -134,7 +134,7 @@ void SPFont::set(unsigned int key, const gchar *value) {
}
case SP_ATTR_VERT_ADV_Y:
{
- double number = value ? g_ascii_strtod(value, 0) : FNT_UNITS_PER_EM;
+ double number = value ? g_ascii_strtod(value, nullptr) : FNT_UNITS_PER_EM;
if (number != this->vert_adv_y){
this->vert_adv_y = number;
diff --git a/src/object/sp-glyph-kerning.cpp b/src/object/sp-glyph-kerning.cpp
index 66de5aed9..899bb71f6 100644
--- a/src/object/sp-glyph-kerning.cpp
+++ b/src/object/sp-glyph-kerning.cpp
@@ -22,10 +22,10 @@
SPGlyphKerning::SPGlyphKerning()
: SPObject()
//TODO: correct these values:
- , u1(NULL)
- , g1(NULL)
- , u2(NULL)
- , g2(NULL)
+ , u1(nullptr)
+ , g1(nullptr)
+ , u2(nullptr)
+ , g2(nullptr)
, k(0)
{
}
@@ -124,7 +124,7 @@ void SPGlyphKerning::set(unsigned int key, const gchar *value)
}
case SP_ATTR_K:
{
- double number = value ? g_ascii_strtod(value, 0) : 0;
+ double number = value ? g_ascii_strtod(value, nullptr) : 0;
if (number != this->k){
this->k = number;
diff --git a/src/object/sp-glyph.cpp b/src/object/sp-glyph.cpp
index 6284cbfa1..9f5f6403c 100644
--- a/src/object/sp-glyph.cpp
+++ b/src/object/sp-glyph.cpp
@@ -21,10 +21,10 @@
SPGlyph::SPGlyph()
: SPObject()
//TODO: correct these values:
- , d(NULL)
+ , d(nullptr)
, orientation(GLYPH_ORIENTATION_BOTH)
, arabic_form(GLYPH_ARABIC_FORM_INITIAL)
- , lang(NULL)
+ , lang(nullptr)
, horiz_adv_x(0)
, vert_origin_x(0)
, vert_origin_y(0)
@@ -168,7 +168,7 @@ void SPGlyph::set(unsigned int key, const gchar *value)
}
case SP_ATTR_HORIZ_ADV_X:
{
- double number = value ? g_ascii_strtod(value, 0) : 0;
+ double number = value ? g_ascii_strtod(value, nullptr) : 0;
if (number != this->horiz_adv_x){
this->horiz_adv_x = number;
@@ -178,7 +178,7 @@ void SPGlyph::set(unsigned int key, const gchar *value)
}
case SP_ATTR_VERT_ORIGIN_X:
{
- double number = value ? g_ascii_strtod(value, 0) : 0;
+ double number = value ? g_ascii_strtod(value, nullptr) : 0;
if (number != this->vert_origin_x){
this->vert_origin_x = number;
@@ -188,7 +188,7 @@ void SPGlyph::set(unsigned int key, const gchar *value)
}
case SP_ATTR_VERT_ORIGIN_Y:
{
- double number = value ? g_ascii_strtod(value, 0) : 0;
+ double number = value ? g_ascii_strtod(value, nullptr) : 0;
if (number != this->vert_origin_y){
this->vert_origin_y = number;
@@ -198,7 +198,7 @@ void SPGlyph::set(unsigned int key, const gchar *value)
}
case SP_ATTR_VERT_ADV_Y:
{
- double number = value ? g_ascii_strtod(value, 0) : 0;
+ double number = value ? g_ascii_strtod(value, nullptr) : 0;
if (number != this->vert_adv_y){
this->vert_adv_y = number;
diff --git a/src/object/sp-gradient.cpp b/src/object/sp-gradient.cpp
index feaa04e0f..0dfee1385 100644
--- a/src/object/sp-gradient.cpp
+++ b/src/object/sp-gradient.cpp
@@ -88,8 +88,8 @@ void SPGradient::setSwatch( bool swatch )
{
if ( swatch != isSwatch() ) {
this->swatch = swatch; // to make isSolid() work, this happens first
- gchar const* paintVal = swatch ? (isSolid() ? "solid" : "gradient") : 0;
- setAttribute( "osb:paint", paintVal, 0 );
+ gchar const* paintVal = swatch ? (isSolid() ? "solid" : "gradient") : nullptr;
+ setAttribute( "osb:paint", paintVal, nullptr );
requestModified( SP_OBJECT_MODIFIED_FLAG );
}
@@ -228,7 +228,7 @@ bool SPGradient::isAligned(SPGradient *that)
*/
SPGradient::SPGradient() : SPPaintServer(), units(),
spread(),
- ref(NULL),
+ ref(nullptr),
state(2),
vector() {
@@ -267,7 +267,7 @@ void SPGradient::build(SPDocument *document, Inkscape::XML::Node *repr)
{
// Work-around in case a swatch had been marked for immediate collection:
if ( repr->attribute("osb:paint") && repr->attribute("inkscape:collect") ) {
- repr->setAttribute("inkscape:collect", 0);
+ repr->setAttribute("inkscape:collect", nullptr);
}
SPPaintServer::build(document, repr);
@@ -319,7 +319,7 @@ void SPGradient::release()
this->modified_connection.disconnect();
this->ref->detach();
delete this->ref;
- this->ref = NULL;
+ this->ref = nullptr;
}
//this->modified_connection.~connection();
@@ -402,7 +402,7 @@ void SPGradient::set(unsigned key, gchar const *value)
case SP_ATTR_OSB_SWATCH:
{
- bool newVal = (value != 0);
+ bool newVal = (value != nullptr);
bool modified = false;
if (newVal != this->swatch) {
@@ -415,7 +415,7 @@ void SPGradient::set(unsigned key, gchar const *value)
Glib::ustring paintVal = ( this->hasStops() && (this->getStopCount() == 0) ) ? "solid" : "gradient";
if ( paintVal != value ) {
- this->setAttribute( "osb:paint", paintVal.c_str(), 0 );
+ this->setAttribute( "osb:paint", paintVal.c_str(), nullptr );
modified = true;
}
}
@@ -479,7 +479,7 @@ void SPGradient::child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *re
if ( this->getStopCount() > 0 ) {
gchar const * attr = this->getAttribute("osb:paint");
if ( attr && strcmp(attr, "gradient") ) {
- this->setAttribute( "osb:paint", "gradient", 0 );
+ this->setAttribute( "osb:paint", "gradient", nullptr );
}
}
}
@@ -524,7 +524,7 @@ void SPGradient::remove_child(Inkscape::XML::Node *child)
gchar const * attr = this->getAttribute("osb:paint");
if ( attr && strcmp(attr, "solid") ) {
- this->setAttribute( "osb:paint", "solid", 0 );
+ this->setAttribute( "osb:paint", "solid", nullptr );
}
}
@@ -617,7 +617,7 @@ Inkscape::XML::Node *SPGradient::write(Inkscape::XML::Document *xml_doc, Inkscap
std::vector<Inkscape::XML::Node *> l;
for (auto& child: children) {
- Inkscape::XML::Node *crepr = child.updateRepr(xml_doc, NULL, flags);
+ Inkscape::XML::Node *crepr = child.updateRepr(xml_doc, nullptr, flags);
if (crepr) {
l.push_back(crepr);
@@ -625,7 +625,7 @@ Inkscape::XML::Node *SPGradient::write(Inkscape::XML::Document *xml_doc, Inkscap
}
for (auto i=l.rbegin();i!=l.rend();++i) {
- repr->addChild(*i, NULL);
+ repr->addChild(*i, nullptr);
Inkscape::GC::release(*i);
}
}
@@ -677,7 +677,7 @@ Inkscape::XML::Node *SPGradient::write(Inkscape::XML::Document *xml_doc, Inkscap
repr->setAttribute( "osb:paint", "gradient" );
}
} else {
- repr->setAttribute( "osb:paint", 0 );
+ repr->setAttribute( "osb:paint", nullptr );
}
#ifdef OBJECT_TRACE
@@ -772,7 +772,7 @@ chase_hrefs(SPGradient *const src, bool (*match)(SPGradient const *))
if ( p2 == p1 ) {
/* We've been here before, so return NULL to indicate that no matching gradient found
* in the chain. */
- return NULL;
+ return nullptr;
}
}
}
@@ -814,7 +814,7 @@ has_units_set(SPGradient const *gr)
SPGradient *SPGradient::getVector(bool force_vector)
{
SPGradient * src = chase_hrefs(this, has_stopsFN);
- if (src == NULL) {
+ if (src == nullptr) {
src = this;
}
@@ -827,7 +827,7 @@ SPGradient *SPGradient::getVector(bool force_vector)
SPGradient *SPGradient::getArray(bool force_vector)
{
SPGradient * src = chase_hrefs(this, has_patchesFN);
- if (src == NULL) {
+ if (src == nullptr) {
src = this;
}
return src;
@@ -870,7 +870,7 @@ sp_gradient_repr_clear_vector(SPGradient *gr)
/* Collect stops from original repr */
std::vector<Inkscape::XML::Node *> l;
- 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(), "svg:stop")) {
l.push_back(child);
}
@@ -892,7 +892,7 @@ sp_gradient_repr_clear_vector(SPGradient *gr)
void
sp_gradient_repr_write_vector(SPGradient *gr)
{
- g_return_if_fail(gr != NULL);
+ g_return_if_fail(gr != nullptr);
g_return_if_fail(SP_IS_GRADIENT(gr));
Inkscape::XML::Document *xml_doc = gr->document->getReprDoc();
@@ -918,7 +918,7 @@ sp_gradient_repr_write_vector(SPGradient *gr)
/* And insert new children from list */
for (auto i=l.rbegin();i!=l.rend();++i) {
Inkscape::XML::Node *child = *i;
- repr->addChild(child, NULL);
+ repr->addChild(child, nullptr);
Inkscape::GC::release(child);
}
}
@@ -974,7 +974,7 @@ void SPGradient::rebuildVector()
vector.stops.clear();
- SPGradient *reffed = ref ? ref->getObject() : NULL;
+ SPGradient *reffed = ref ? ref->getObject() : nullptr;
if ( !hasStops() && reffed ) {
/* Copy vector from referenced gradient */
vector.built = true; // Prevent infinite recursion.
@@ -1160,7 +1160,7 @@ sp_gradient_pattern_common_setup(cairo_pattern_t *cp,
cairo_pattern_t *
sp_gradient_create_preview_pattern(SPGradient *gr, double width)
{
- cairo_pattern_t *pat = NULL;
+ cairo_pattern_t *pat = nullptr;
if (!SP_IS_MESHGRADIENT(gr)) {
gr->ensureVector();
diff --git a/src/object/sp-guide.cpp b/src/object/sp-guide.cpp
index 19aced5c0..eb0b27ab4 100644
--- a/src/object/sp-guide.cpp
+++ b/src/object/sp-guide.cpp
@@ -47,7 +47,7 @@ using std::vector;
SPGuide::SPGuide()
: SPObject()
- , label(NULL)
+ , label(nullptr)
, locked(0)
, normal_to_line(Geom::Point(0.,1.))
, point_on_line(Geom::Point(0.,0.))
@@ -106,7 +106,7 @@ void SPGuide::set(unsigned int key, const gchar *value) {
if (value) {
this->label = g_strdup(value);
} else {
- this->label = NULL;
+ this->label = nullptr;
}
this->set_label(this->label, false);
@@ -220,7 +220,7 @@ SPGuide *SPGuide::createSPGuide(SPDocument *doc, Geom::Point const &pt1, Geom::P
sp_repr_set_point(repr, "position", Geom::Point( newx, newy ));
sp_repr_set_point(repr, "orientation", n);
- SPNamedView *namedview = sp_document_namedview(doc, NULL);
+ SPNamedView *namedview = sp_document_namedview(doc, nullptr);
if (namedview) {
if (namedview->lockguides) {
repr->setAttribute("inkscape:locked", "true");
@@ -299,7 +299,7 @@ void SPGuide::showSPGuide()
void SPGuide::hideSPGuide(SPCanvas *canvas)
{
- g_assert(canvas != NULL);
+ g_assert(canvas != nullptr);
g_assert(SP_IS_CANVAS(canvas));
for(std::vector<SPGuideLine *>::iterator it = this->views.begin(); it != this->views.end(); ++it) {
if (canvas == SP_CANVAS_ITEM(*it)->canvas) {
@@ -324,7 +324,7 @@ void SPGuide::hideSPGuide()
void SPGuide::sensitize(SPCanvas *canvas, bool sensitive)
{
- g_assert(canvas != NULL);
+ g_assert(canvas != nullptr);
g_assert(SP_IS_CANVAS(canvas));
for(std::vector<SPGuideLine *>::const_iterator it = this->views.begin(); it != this->views.end(); ++it) {
@@ -479,12 +479,12 @@ char* SPGuide::description(bool const verbose) const
using Geom::X;
using Geom::Y;
- char *descr = NULL;
+ char *descr = nullptr;
if ( !this->document ) {
// Guide has probably been deleted and no longer has an attached namedview.
descr = g_strdup(_("Deleted"));
} else {
- SPNamedView *namedview = sp_document_namedview(this->document, NULL);
+ SPNamedView *namedview = sp_document_namedview(this->document, nullptr);
Inkscape::Util::Quantity x_q = Inkscape::Util::Quantity(this->point_on_line[X], "px");
Inkscape::Util::Quantity y_q = Inkscape::Util::Quantity(this->point_on_line[Y], "px");
diff --git a/src/object/sp-hatch-path.cpp b/src/object/sp-hatch-path.cpp
index 4497b6911..649fefe94 100644
--- a/src/object/sp-hatch-path.cpp
+++ b/src/object/sp-hatch-path.cpp
@@ -32,7 +32,7 @@
SPHatchPath::SPHatchPath()
: offset(),
_display(),
- _curve(NULL),
+ _curve(nullptr),
_continuous(false)
{
offset.unset();
@@ -74,7 +74,7 @@ void SPHatchPath::release()
{
for (ViewIterator iter = _display.begin(); iter != _display.end(); ++iter) {
delete iter->arenaitem;
- iter->arenaitem = NULL;
+ iter->arenaitem = nullptr;
}
SPObject::release();
@@ -94,7 +94,7 @@ void SPHatchPath::set(unsigned int key, const gchar* value)
curve->unref();
}
} else {
- setCurve(NULL, true);
+ setCurve(nullptr, true);
}
requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
@@ -216,7 +216,7 @@ SPCurve *SPHatchPath::calculateRenderCurve(unsigned key) const
}
}
g_assert_not_reached();
- return NULL;
+ return nullptr;
}
gdouble SPHatchPath::_repeatLength() const
@@ -324,7 +324,7 @@ SPHatchPath::View::View(Inkscape::DrawingShape *arenaitem, int key)
SPHatchPath::View::~View()
{
// remember, do not delete arenaitem here
- arenaitem = NULL;
+ arenaitem = nullptr;
}
diff --git a/src/object/sp-hatch.cpp b/src/object/sp-hatch.cpp
index ce6384a74..0675c66ac 100644
--- a/src/object/sp-hatch.cpp
+++ b/src/object/sp-hatch.cpp
@@ -34,7 +34,7 @@
SPHatch::SPHatch()
: SPPaintServer(),
href(),
- ref(NULL), // avoiding 'this' in initializer list
+ ref(nullptr), // avoiding 'this' in initializer list
_hatchUnits(UNITS_OBJECTBOUNDINGBOX),
_hatchUnits_set(false),
_hatchContentUnits(UNITS_USERSPACEONUSE),
@@ -93,14 +93,14 @@ void SPHatch::release()
child->hide(view_iter->key);
}
delete view_iter->arenaitem;
- view_iter->arenaitem = NULL;
+ view_iter->arenaitem = nullptr;
}
if (ref) {
_modified_connection.disconnect();
ref->detach();
delete ref;
- ref = NULL;
+ ref = nullptr;
}
SPPaintServer::release();
@@ -292,7 +292,7 @@ void SPHatch::update(SPCtx* ctx, unsigned int flags)
for (ChildIterator iter = children.begin(); iter != children.end(); ++iter) {
SPHatchPath* child = *iter;
- sp_object_ref(child, NULL);
+ sp_object_ref(child, nullptr);
for (ViewIterator view_iter = _display.begin(); view_iter != _display.end(); ++view_iter) {
Geom::OptInterval strip_extents = _calculateStripExtents(view_iter->bbox);
@@ -304,7 +304,7 @@ void SPHatch::update(SPCtx* ctx, unsigned int flags)
child->updateDisplay(ctx, flags);
}
- sp_object_unref(child, NULL);
+ sp_object_unref(child, nullptr);
}
for (ViewIterator iter = _display.begin(); iter != _display.end(); ++iter) {
@@ -325,13 +325,13 @@ void SPHatch::modified(unsigned int flags)
for (ChildIterator iter = children.begin(); iter != children.end(); ++iter) {
SPObject *child = *iter;
- 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);
}
}
@@ -349,8 +349,8 @@ void SPHatch::_onRefChanged(SPObject *old_ref, SPObject *ref)
}
if (!_hasHatchPatchChildren(this)) {
- SPHatch *old_shown = NULL;
- SPHatch *new_shown = NULL;
+ SPHatch *old_shown = nullptr;
+ SPHatch *new_shown = nullptr;
std::vector<SPHatchPath *> oldhatchPaths;
std::vector<SPHatchPath *> newhatchPaths;
@@ -407,7 +407,7 @@ SPHatch *SPHatch::rootHatch()
SPHatch::HatchUnits SPHatch::hatchUnits() const
{
HatchUnits units = _hatchUnits;
- for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : NULL) {
+ for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : nullptr) {
if (pat_i->_hatchUnits_set) {
units = pat_i->_hatchUnits;
break;
@@ -419,7 +419,7 @@ SPHatch::HatchUnits SPHatch::hatchUnits() const
SPHatch::HatchUnits SPHatch::hatchContentUnits() const
{
HatchUnits units = _hatchContentUnits;
- for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : NULL) {
+ for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : nullptr) {
if (pat_i->_hatchContentUnits_set) {
units = pat_i->_hatchContentUnits;
break;
@@ -430,7 +430,7 @@ SPHatch::HatchUnits SPHatch::hatchContentUnits() const
Geom::Affine const &SPHatch::hatchTransform() const
{
- for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : NULL) {
+ for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : nullptr) {
if (pat_i->_hatchTransform_set) {
return pat_i->_hatchTransform;
}
@@ -441,7 +441,7 @@ Geom::Affine const &SPHatch::hatchTransform() const
gdouble SPHatch::x() const
{
gdouble val = 0;
- for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : NULL) {
+ for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : nullptr) {
if (pat_i->_x._set) {
val = pat_i->_x.computed;
break;
@@ -453,7 +453,7 @@ gdouble SPHatch::x() const
gdouble SPHatch::y() const
{
gdouble val = 0;
- for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : NULL) {
+ for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : nullptr) {
if (pat_i->_y._set) {
val = pat_i->_y.computed;
break;
@@ -465,7 +465,7 @@ gdouble SPHatch::y() const
gdouble SPHatch::pitch() const
{
gdouble val = 0;
- for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : NULL) {
+ for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : nullptr) {
if (pat_i->_pitch._set) {
val = pat_i->_pitch.computed;
break;
@@ -477,7 +477,7 @@ gdouble SPHatch::pitch() const
gdouble SPHatch::rotate() const
{
gdouble val = 0;
- for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : NULL) {
+ for (SPHatch const *pat_i = this; pat_i; pat_i = (pat_i->ref) ? pat_i->ref->getObject() : nullptr) {
if (pat_i->_rotate._set) {
val = pat_i->_rotate.computed;
break;
@@ -736,7 +736,7 @@ SPHatch::View::View(Inkscape::DrawingPattern *arenaitem, int key)
SPHatch::View::~View()
{
// remember, do not delete arenaitem here
- arenaitem = NULL;
+ arenaitem = nullptr;
}
/*
diff --git a/src/object/sp-hatch.h b/src/object/sp-hatch.h
index 0b7e98577..fc978a74d 100644
--- a/src/object/sp-hatch.h
+++ b/src/object/sp-hatch.h
@@ -168,7 +168,7 @@ public:
protected:
bool _acceptObject(SPObject *obj) const override {
- return dynamic_cast<SPHatch *>(obj) != NULL && URIReference::_acceptObject(obj);
+ return dynamic_cast<SPHatch *>(obj) != nullptr && URIReference::_acceptObject(obj);
}
};
diff --git a/src/object/sp-image.cpp b/src/object/sp-image.cpp
index cc319a924..18e8b6674 100644
--- a/src/object/sp-image.cpp
+++ b/src/object/sp-image.cpp
@@ -118,13 +118,13 @@ SPImage::SPImage() : SPItem(), SPViewBox() {
this->sx = this->sy = 1.0;
this->ox = this->oy = 0.0;
- this->curve = NULL;
+ this->curve = nullptr;
- this->href = 0;
+ this->href = nullptr;
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
- this->color_profile = 0;
+ this->color_profile = nullptr;
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
- this->pixbuf = 0;
+ this->pixbuf = nullptr;
}
SPImage::~SPImage() {
@@ -153,16 +153,16 @@ void SPImage::release() {
if (this->href) {
g_free (this->href);
- this->href = NULL;
+ this->href = nullptr;
}
delete this->pixbuf;
- this->pixbuf = NULL;
+ this->pixbuf = nullptr;
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
if (this->color_profile) {
g_free (this->color_profile);
- this->color_profile = NULL;
+ this->color_profile = nullptr;
}
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
@@ -177,7 +177,7 @@ void SPImage::set(unsigned int key, const gchar* value) {
switch (key) {
case SP_ATTR_XLINK_HREF:
g_free (this->href);
- this->href = (value) ? g_strdup (value) : NULL;
+ this->href = (value) ? g_strdup (value) : nullptr;
this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_IMAGE_HREF_MODIFIED_FLAG);
break;
@@ -228,7 +228,7 @@ void SPImage::set(unsigned int key, const gchar* value) {
g_free (this->color_profile);
}
- this->color_profile = (value) ? g_strdup (value) : NULL;
+ this->color_profile = (value) ? g_strdup (value) : nullptr;
if ( value ) {
DEBUG_MESSAGE( lcmsFour, "<this> color-profile set to '%s'", value );
@@ -328,9 +328,9 @@ void SPImage::update(SPCtx *ctx, unsigned int flags) {
SPItem::update(ctx, flags);
if (flags & SP_IMAGE_HREF_MODIFIED_FLAG) {
delete this->pixbuf;
- this->pixbuf = NULL;
+ this->pixbuf = nullptr;
if (this->href) {
- Inkscape::Pixbuf *pixbuf = NULL;
+ Inkscape::Pixbuf *pixbuf = nullptr;
pixbuf = sp_image_repr_read_image (
this->getRepr()->attribute("xlink:href"),
this->getRepr()->attribute("sodipodi:absref"),
@@ -407,7 +407,7 @@ void SPImage::modified(unsigned int flags) {
// SPItem::onModified(flags);
if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) {
- for (SPItemView *v = this->display; v != NULL; v = v->next) {
+ for (SPItemView *v = this->display; v != nullptr; v = v->next) {
Inkscape::DrawingImage *img = dynamic_cast<Inkscape::DrawingImage *>(v->arenaitem);
img->setStyle(this->style);
}
@@ -501,17 +501,17 @@ gchar* SPImage::description() const {
href_desc = g_strdup("(null_pointer)"); // we call g_free() on href_desc
}
- char *ret = ( this->pixbuf == NULL
+ char *ret = ( this->pixbuf == nullptr
? g_strdup_printf(_("[bad reference]: %s"), href_desc)
: g_strdup_printf(_("%d &#215; %d: %s"),
this->pixbuf->width(),
this->pixbuf->height(),
href_desc) );
- if (this->pixbuf == NULL &&
+ if (this->pixbuf == nullptr &&
this->document)
{
- Inkscape::Pixbuf * pb = NULL;
+ Inkscape::Pixbuf * pb = nullptr;
pb = sp_image_repr_read_image (
this->getRepr()->attribute("xlink:href"),
this->getRepr()->attribute("sodipodi:absref"),
@@ -540,17 +540,17 @@ Inkscape::DrawingItem* SPImage::show(Inkscape::Drawing &drawing, unsigned int /*
Inkscape::Pixbuf *sp_image_repr_read_image(gchar const *href, gchar const *absref, gchar const *base)
{
- Inkscape::Pixbuf *inkpb = 0;
+ Inkscape::Pixbuf *inkpb = nullptr;
gchar const *filename = href;
- if (filename != NULL) {
+ if (filename != nullptr) {
if (strncmp (filename,"file:",5) == 0) {
- gchar *fullname = g_filename_from_uri(filename, NULL, NULL);
+ gchar *fullname = g_filename_from_uri(filename, nullptr, nullptr);
if (fullname) {
inkpb = Inkscape::Pixbuf::create_from_file(fullname);
g_free(fullname);
- if (inkpb != NULL) {
+ if (inkpb != nullptr) {
return inkpb;
}
}
@@ -558,7 +558,7 @@ Inkscape::Pixbuf *sp_image_repr_read_image(gchar const *href, gchar const *absre
/* data URI - embedded image */
filename += 5;
inkpb = Inkscape::Pixbuf::create_from_data_uri(filename);
- if (inkpb != NULL) {
+ if (inkpb != nullptr) {
return inkpb;
}
} else {
@@ -576,7 +576,7 @@ Inkscape::Pixbuf *sp_image_repr_read_image(gchar const *href, gchar const *absre
// and if it fails, we also try to use bare href regardless of its g_path_is_absolute
if (g_file_test (fullname, G_FILE_TEST_EXISTS) && !g_file_test (fullname, G_FILE_TEST_IS_DIR)) {
inkpb = Inkscape::Pixbuf::create_from_file(fullname);
- if (inkpb != NULL) {
+ if (inkpb != nullptr) {
g_free (fullname);
return inkpb;
}
@@ -587,7 +587,7 @@ Inkscape::Pixbuf *sp_image_repr_read_image(gchar const *href, gchar const *absre
/* try filename as absolute */
if (g_file_test (filename, G_FILE_TEST_EXISTS) && !g_file_test (filename, G_FILE_TEST_IS_DIR)) {
inkpb = Inkscape::Pixbuf::create_from_file(filename);
- if (inkpb != NULL) {
+ if (inkpb != nullptr) {
return inkpb;
}
}
@@ -596,16 +596,16 @@ Inkscape::Pixbuf *sp_image_repr_read_image(gchar const *href, gchar const *absre
/* at last try to load from sp absolute path name */
filename = absref;
- if (filename != NULL) {
+ if (filename != nullptr) {
// using absref is outside of SVG rules, so we must at least warn the user
- if ( base != NULL && href != NULL ) {
+ if ( base != nullptr && href != nullptr ) {
g_warning ("<image xlink:href=\"%s\"> did not resolve to a valid image file (base dir is %s), now trying sodipodi:absref=\"%s\"", href, base, absref);
} else {
g_warning ("xlink:href did not resolve to a valid image file, now trying sodipodi:absref=\"%s\"", absref);
}
inkpb = Inkscape::Pixbuf::create_from_file(filename);
- if (inkpb != NULL) {
+ if (inkpb != nullptr) {
return inkpb;
}
}
@@ -615,7 +615,7 @@ Inkscape::Pixbuf *sp_image_repr_read_image(gchar const *href, gchar const *absre
/* It should be included xpm, so if it still does not does load, */
/* our libraries are broken */
- g_assert (inkpb != NULL);
+ g_assert (inkpb != nullptr);
return inkpb;
}
@@ -635,7 +635,7 @@ static void sp_image_update_canvas_image(SPImage *image)
{
SPItem *item = SP_ITEM(image);
- for (SPItemView *v = item->display; v != NULL; v = v->next) {
+ for (SPItemView *v = item->display; v != nullptr; v = v->next) {
sp_image_update_arenaitem(image, dynamic_cast<Inkscape::DrawingImage *>(v->arenaitem));
}
}
@@ -738,7 +738,7 @@ static void sp_image_set_curve( SPImage *image )
*/
SPCurve *sp_image_get_curve( SPImage *image )
{
- SPCurve *result = 0;
+ SPCurve *result = nullptr;
if (image->curve) {
result = image->curve->copy();
}
@@ -750,16 +750,16 @@ void sp_embed_image(Inkscape::XML::Node *image_node, Inkscape::Pixbuf *pb)
bool free_data = false;
// check whether the pixbuf has MIME data
- guchar *data = NULL;
+ guchar *data = nullptr;
gsize len = 0;
std::string data_mimetype;
data = const_cast<guchar *>(pb->getMimeData(len, data_mimetype));
- if (data == NULL) {
+ if (data == nullptr) {
// if there is no supported MIME data, embed as PNG
data_mimetype = "image/png";
- gdk_pixbuf_save_to_buffer(pb->getPixbufRaw(), reinterpret_cast<gchar**>(&data), &len, "png", NULL, NULL);
+ gdk_pixbuf_save_to_buffer(pb->getPixbufRaw(), reinterpret_cast<gchar**>(&data), &len, "png", nullptr, NULL);
free_data = true;
}
@@ -801,13 +801,13 @@ void sp_embed_svg(Inkscape::XML::Node *image_node, std::string const &fn)
// we need to load the entire file into memory,
// since we'll store it as MIME data
- gchar *data = NULL;
+ gchar *data = nullptr;
gsize len = 0;
- GError *error = NULL;
+ GError *error = nullptr;
if (g_file_get_contents(fn.c_str(), &data, &len, &error)) {
- if (error != NULL) {
+ if (error != nullptr) {
std::cerr << "Pixbuf::create_from_file: " << error->message << std::endl;
std::cerr << " (" << fn << ")" << std::endl;
return;
diff --git a/src/object/sp-item-group.cpp b/src/object/sp-item-group.cpp
index 602c4558c..735248248 100644
--- a/src/object/sp-item-group.cpp
+++ b/src/object/sp-item-group.cpp
@@ -95,7 +95,7 @@ void SPGroup::child_added(Inkscape::XML::Node* child, Inkscape::XML::Node* ref)
/* TODO: this should be moved into SPItem somehow */
SPItemView *v;
- for (v = this->display; v != NULL; v = v->next) {
+ for (v = this->display; v != nullptr; v = v->next) {
Inkscape::DrawingItem *ac = item->invoke_show (v->arenaitem->drawing(), v->key, v->flags);
if (ac) {
@@ -110,7 +110,7 @@ void SPGroup::child_added(Inkscape::XML::Node* child, Inkscape::XML::Node* ref)
SPItemView *v;
unsigned position = item->pos_in_parent();
- for (v = this->display; v != NULL; v = v->next) {
+ for (v = this->display; v != nullptr; v = v->next) {
Inkscape::DrawingItem *ac = item->invoke_show (v->arenaitem->drawing(), v->key, v->flags);
if (ac) {
@@ -140,7 +140,7 @@ void SPGroup::order_changed (Inkscape::XML::Node *child, Inkscape::XML::Node *ol
/* TODO: this should be moved into SPItem somehow */
SPItemView *v;
unsigned position = item->pos_in_parent();
- for ( v = item->display ; v != NULL ; v = v->next ) {
+ for ( v = item->display ; v != nullptr ; v = v->next ) {
v->arenaitem->setZOrder(position);
}
}
@@ -186,7 +186,7 @@ void SPGroup::update(SPCtx *ctx, unsigned int flags) {
SPLPEItem::update(ctx, flags);
if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) {
- for (SPItemView *v = this->display; v != NULL; v = v->next) {
+ for (SPItemView *v = this->display; v != nullptr; v = v->next) {
Inkscape::DrawingGroup *group = dynamic_cast<Inkscape::DrawingGroup *>(v->arenaitem);
if( this->parent ) {
this->context_style = this->parent->context_style;
@@ -206,7 +206,7 @@ void SPGroup::modified(guint flags) {
flags &= SP_OBJECT_MODIFIED_CASCADE;
if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) {
- for (SPItemView *v = this->display; v != NULL; v = v->next) {
+ for (SPItemView *v = this->display; v != nullptr; v = v->next) {
Inkscape::DrawingGroup *group = dynamic_cast<Inkscape::DrawingGroup *>(v->arenaitem);
group->setStyle(this->style);
}
@@ -238,7 +238,7 @@ Inkscape::XML::Node* SPGroup::write(Inkscape::XML::Document *xml_doc, Inkscape::
for (auto& child: children) {
if ( !dynamic_cast<SPTitle *>(&child) && !dynamic_cast<SPDesc *>(&child) ) {
- Inkscape::XML::Node *crepr = child.updateRepr(xml_doc, NULL, flags);
+ Inkscape::XML::Node *crepr = child.updateRepr(xml_doc, nullptr, flags);
if (crepr) {
l.push_back(crepr);
@@ -246,7 +246,7 @@ Inkscape::XML::Node* SPGroup::write(Inkscape::XML::Document *xml_doc, Inkscape::
}
}
for (auto i=l.rbegin();i!=l.rend();++i) {
- repr->addChild(*i, NULL);
+ repr->addChild(*i, nullptr);
Inkscape::GC::release(*i);
}
} else {
@@ -266,7 +266,7 @@ Inkscape::XML::Node* SPGroup::write(Inkscape::XML::Document *xml_doc, Inkscape::
} else if ( flags & SP_OBJECT_WRITE_ALL ) {
value = "group";
} else {
- value = NULL;
+ value = nullptr;
}
repr->setAttribute("inkscape:groupmode", value);
@@ -400,9 +400,9 @@ sp_recursive_scale_text_size(Inkscape::XML::Node *repr, double scale){
SPCSSAttr * css = sp_repr_css_attr(repr,"style");
Glib::ustring element = g_quark_to_string(repr->code());
if ((css && element == "svg:text") || element == "svg:tspan") {
- gchar const *w = sp_repr_css_property(css, "font-size", NULL);
+ gchar const *w = sp_repr_css_property(css, "font-size", nullptr);
if (w) {
- gchar *units = NULL;
+ gchar *units = nullptr;
double wd = g_ascii_strtod(w, &units);
wd *= scale;
if (w != units) {
@@ -414,10 +414,10 @@ sp_recursive_scale_text_size(Inkscape::XML::Node *repr, double scale){
repr->setAttribute("style", css_str.c_str());
}
}
- w = NULL;
- w = sp_repr_css_property(css, "letter-spacing", NULL);
+ w = nullptr;
+ w = sp_repr_css_property(css, "letter-spacing", nullptr);
if (w) {
- gchar *units = NULL;
+ gchar *units = nullptr;
double wd = g_ascii_strtod(w, &units);
wd *= scale;
if (w != units) {
@@ -429,10 +429,10 @@ sp_recursive_scale_text_size(Inkscape::XML::Node *repr, double scale){
repr->setAttribute("style", css_str.c_str());
}
}
- w = NULL;
- w = sp_repr_css_property(css, "word-spacing", NULL);
+ w = nullptr;
+ w = sp_repr_css_property(css, "word-spacing", nullptr);
if (w) {
- gchar *units = NULL;
+ gchar *units = nullptr;
double wd = g_ascii_strtod(w, &units);
wd *= scale;
if (w != units) {
@@ -448,7 +448,7 @@ sp_recursive_scale_text_size(Inkscape::XML::Node *repr, double scale){
if (dx) {
gchar ** dxarray = g_strsplit(dx, " ", 0);
Inkscape::SVGOStringStream dx_data;
- while (*dxarray != NULL) {
+ while (*dxarray != nullptr) {
double pos;
sp_svg_number_read_d(*dxarray, &pos);
pos *= scale;
@@ -461,7 +461,7 @@ sp_recursive_scale_text_size(Inkscape::XML::Node *repr, double scale){
if (dy) {
gchar ** dyarray = g_strsplit(dy, " ", 0);
Inkscape::SVGOStringStream dy_data;
- while (*dyarray != NULL) {
+ while (*dyarray != nullptr) {
double pos;
sp_svg_number_read_d(*dyarray, &pos);
pos *= scale;
@@ -476,7 +476,7 @@ sp_recursive_scale_text_size(Inkscape::XML::Node *repr, double scale){
void
sp_item_group_ungroup (SPGroup *group, std::vector<SPItem*> &children, bool do_done)
{
- g_return_if_fail (group != NULL);
+ g_return_if_fail (group != nullptr);
SPDocument *doc = group->document;
SPRoot *root = doc->getRoot();
@@ -558,10 +558,10 @@ sp_item_group_ungroup (SPGroup *group, std::vector<SPItem*> &children, bool do_d
// When dealing with a chain of linked offsets, the transformation of an offset will be
// tied to the transformation of the top-most source, not to any of the intermediate
// offsets. So let's find the top-most source
- while (source != NULL && dynamic_cast<SPOffset *>(source)) {
+ while (source != nullptr && dynamic_cast<SPOffset *>(source)) {
source = sp_offset_get_source(dynamic_cast<SPOffset *>(source));
}
- if (source != NULL && // If true then we must be dealing with a linked offset ...
+ if (source != nullptr && // If true then we must be dealing with a linked offset ...
group->isAncestorOf(source) ) { // ... of which the source is in the same group
ctrans = citem->transform; // then we should apply the transformation of the group to the offset
}
@@ -638,7 +638,7 @@ sp_item_group_ungroup (SPGroup *group, std::vector<SPItem*> &children, bool do_d
SPItem *item = static_cast<SPItem *>(doc->getObjectByRepr(repr));
if (item) {
- item->doWriteTransform(item->transform, NULL, false);
+ item->doWriteTransform(item->transform, nullptr, false);
children.insert(children.begin(),item);
item->requestModified(SP_OBJECT_MODIFIED_FLAG);
} else {
@@ -659,7 +659,7 @@ sp_item_group_ungroup (SPGroup *group, std::vector<SPItem*> &children, bool do_d
std::vector<SPItem*> sp_item_group_item_list(SPGroup * group)
{
std::vector<SPItem*> s;
- g_return_val_if_fail(group != NULL, s);
+ g_return_val_if_fail(group != nullptr, s);
for (auto& o: group->children) {
if ( dynamic_cast<SPItem *>(&o) ) {
@@ -779,24 +779,24 @@ void SPGroup::scaleChildItemsRec(Geom::Scale const &sc, Geom::Point const &p, bo
tAff[4] = 0.0;
tAff[5] = 0.0;
}
- item->doWriteTransform(tAff, NULL, true);
+ item->doWriteTransform(tAff, nullptr, true);
} else {
// used for other import
- SPItem *sub_item = NULL;
+ SPItem *sub_item = nullptr;
if (item->clip_ref->getObject()) {
sub_item = dynamic_cast<SPItem *>(item->clip_ref->getObject()->firstChild());
}
- if (sub_item != NULL) {
- sub_item->doWriteTransform(sub_item->transform*sc, NULL, true);
+ if (sub_item != nullptr) {
+ sub_item->doWriteTransform(sub_item->transform*sc, nullptr, true);
}
- sub_item = NULL;
+ sub_item = nullptr;
if (item->mask_ref->getObject()) {
sub_item = dynamic_cast<SPItem *>(item->mask_ref->getObject()->firstChild());
}
- if (sub_item != NULL) {
- sub_item->doWriteTransform(sub_item->transform*sc, NULL, true);
+ if (sub_item != nullptr) {
+ sub_item->doWriteTransform(sub_item->transform*sc, nullptr, true);
}
- item->doWriteTransform(sc.inverse()*item->transform*sc, NULL, true);
+ item->doWriteTransform(sc.inverse()*item->transform*sc, nullptr, true);
group->scaleChildItemsRec(sc, p, false);
}
} else {
@@ -806,7 +806,7 @@ void SPGroup::scaleChildItemsRec(Geom::Scale const &sc, Geom::Point const &p, bo
Geom::Translate const s(p);
Geom::Affine final = s.inverse() * sc * s;
- gchar const *conn_type = NULL;
+ gchar const *conn_type = nullptr;
SPText *text_item = dynamic_cast<SPText *>(item);
bool is_text_path = text_item && text_item->firstChild() && dynamic_cast<SPTextPath *>(text_item->firstChild());
if (is_text_path) {
@@ -820,9 +820,9 @@ void SPGroup::scaleChildItemsRec(Geom::Scale const &sc, Geom::Point const &p, bo
if (box) {
// Force recalculation from perspective
box3d_position_set(box);
- } else if (item->getAttribute("inkscape:connector-type") != NULL
- && (item->getAttribute("inkscape:connection-start") == NULL
- || item->getAttribute("inkscape:connection-end") == NULL)) {
+ } else if (item->getAttribute("inkscape:connector-type") != nullptr
+ && (item->getAttribute("inkscape:connection-start") == nullptr
+ || item->getAttribute("inkscape:connection-end") == nullptr)) {
// Remove and store connector type for transform if disconnected
conn_type = item->getAttribute("inkscape:connector-type");
item->removeAttribute("inkscape:connector-type");
@@ -839,21 +839,21 @@ void SPGroup::scaleChildItemsRec(Geom::Scale const &sc, Geom::Point const &p, bo
item->transform = Geom::Affine();
// Apply scale
item->set_i2d_affine(item->i2dt_affine() * sc);
- item->doWriteTransform(item->transform, NULL, true);
+ item->doWriteTransform(item->transform, nullptr, true);
// Scale translation and restore original transform
tmp[4] *= sc[0];
tmp[5] *= sc[1];
- item->doWriteTransform(tmp, NULL, true);
+ item->doWriteTransform(tmp, nullptr, true);
} else if (dynamic_cast<SPUse *>(item)) {
// calculate the matrix we need to apply to the clone
// to cancel its induced transform from its original
Geom::Affine move = final.inverse() * item->transform * final;
item->doWriteTransform(move, &move, true);
} else {
- item->doWriteTransform(item->transform*sc, NULL, true);
+ item->doWriteTransform(item->transform*sc, nullptr, true);
}
- if (conn_type != NULL) {
+ if (conn_type != nullptr) {
item->setAttribute("inkscape:connector-type", conn_type);
}
@@ -880,7 +880,7 @@ gint SPGroup::getItemCount() const {
}
void SPGroup::_showChildren (Inkscape::Drawing &drawing, Inkscape::DrawingItem *ai, unsigned int key, unsigned int flags) {
- Inkscape::DrawingItem *ac = NULL;
+ Inkscape::DrawingItem *ac = nullptr;
std::vector<SPObject*> l=this->childList(false, SPObject::ActionShow);
for(std::vector<SPObject*>::const_iterator i=l.begin();i!=l.end();++i){
SPObject *o = *i;
@@ -945,7 +945,7 @@ sp_group_perform_patheffect(SPGroup *group, SPGroup *top_group, Inkscape::LivePa
top_group->applyToMask(clipmaskto, lpe);
}
if (sub_shape) {
- SPCurve * c = NULL;
+ SPCurve * c = nullptr;
// If item is a SPRect, convert it to path first:
if ( dynamic_cast<SPRect *>(sub_shape) ) {
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
diff --git a/src/object/sp-item-rm-unsatisfied-cns.cpp b/src/object/sp-item-rm-unsatisfied-cns.cpp
index 516c88672..f0b5a863e 100644
--- a/src/object/sp-item-rm-unsatisfied-cns.cpp
+++ b/src/object/sp-item-rm-unsatisfied-cns.cpp
@@ -14,7 +14,7 @@ void sp_item_rm_unsatisfied_cns(SPItem &item)
return;
}
std::vector<Inkscape::SnapCandidatePoint> snappoints;
- item.getSnappoints(snappoints, NULL);
+ item.getSnappoints(snappoints, nullptr);
for (unsigned i = item.constraints.size(); i--;) {
g_assert( i < item.constraints.size() );
SPGuideConstraint const &cn = item.constraints[i];
diff --git a/src/object/sp-item-update-cns.cpp b/src/object/sp-item-update-cns.cpp
index 077931d52..cae95badd 100644
--- a/src/object/sp-item-update-cns.cpp
+++ b/src/object/sp-item-update-cns.cpp
@@ -11,7 +11,7 @@ using std::vector;
void sp_item_update_cns(SPItem &item, SPDesktop const &desktop)
{
std::vector<Inkscape::SnapCandidatePoint> snappoints;
- item.getSnappoints(snappoints, NULL);
+ item.getSnappoints(snappoints, nullptr);
/* TODO: Implement the ordering. */
vector<SPGuideConstraint> found_cns;
satisfied_guide_cns(desktop, snappoints, found_cns);
diff --git a/src/object/sp-item.cpp b/src/object/sp-item.cpp
index 5ca22cabd..4d9b4d7bf 100644
--- a/src/object/sp-item.cpp
+++ b/src/object/sp-item.cpp
@@ -76,7 +76,7 @@ SPItem::SPItem() : SPObject() {
sensitive = TRUE;
bbox_valid = FALSE;
- _highlightColor = NULL;
+ _highlightColor = nullptr;
transform_center_x = 0;
transform_center_y = 0;
@@ -88,7 +88,7 @@ SPItem::SPItem() : SPObject() {
transform = Geom::identity();
// doc_bbox = Geom::OptRect();
- display = NULL;
+ display = nullptr;
clip_ref = new SPClipPathReference(this);
clip_ref->changedSignal().connect(sigc::bind(sigc::ptr_fun(clip_ref_changed), this));
@@ -114,7 +114,7 @@ bool SPItem::isVisibleAndUnlocked(unsigned display_key) const {
}
bool SPItem::isLocked() const {
- for (SPObject const *o = this; o != NULL; o = o->parent) {
+ for (SPObject const *o = this; o != nullptr; o = o->parent) {
SPItem const *item = dynamic_cast<SPItem const *>(o);
if (item && !(item->sensitive)) {
return true;
@@ -125,7 +125,7 @@ bool SPItem::isLocked() const {
void SPItem::setLocked(bool locked) {
setAttribute("sodipodi:insensitive",
- ( locked ? "1" : NULL ));
+ ( locked ? "1" : nullptr ));
updateRepr();
document->_emitModified();
}
@@ -149,7 +149,7 @@ bool SPItem::isHidden(unsigned display_key) const {
return true;
for ( SPItemView *view(display) ; view ; view = view->next ) {
if ( view->key == display_key ) {
- g_assert(view->arenaitem != NULL);
+ g_assert(view->arenaitem != nullptr);
for ( Inkscape::DrawingItem *arenaitem = view->arenaitem ;
arenaitem ; arenaitem = arenaitem->parent() )
{
@@ -164,7 +164,7 @@ bool SPItem::isHidden(unsigned display_key) const {
}
bool SPItem::isHighlightSet() const {
- return _highlightColor != NULL;
+ return _highlightColor != nullptr;
}
guint32 SPItem::highlight_color() const {
@@ -297,7 +297,7 @@ SPItem::scaleCenter(Geom::Scale const &sc) {
namespace {
bool is_item(SPObject const &object) {
- return dynamic_cast<SPItem const *>(&object) != NULL;
+ return dynamic_cast<SPItem const *>(&object) != nullptr;
}
}
@@ -351,7 +351,7 @@ void SPItem::lowerToBottom() {
void SPItem::moveTo(SPItem *target, bool intoafter) {
- Inkscape::XML::Node *target_ref = ( target ? target->getRepr() : NULL );
+ Inkscape::XML::Node *target_ref = ( target ? target->getRepr() : nullptr );
Inkscape::XML::Node *our_ref = getRepr();
if (!target_ref) {
@@ -372,7 +372,7 @@ void SPItem::moveTo(SPItem *target, bool intoafter) {
if (intoafter) {
// Move this inside of the target at the end
our_ref->parent()->removeChild(our_ref);
- target_ref->addChild(our_ref, NULL);
+ target_ref->addChild(our_ref, nullptr);
} else if (target_ref->parent() != our_ref->parent()) {
// Change in parent, need to remove and add
our_ref->parent()->removeChild(our_ref);
@@ -480,7 +480,7 @@ void SPItem::set(unsigned int key, gchar const* value) {
case SP_ATTR_SODIPODI_INSENSITIVE:
{
item->sensitive = !value;
- for (SPItemView *v = item->display; v != NULL; v = v->next) {
+ for (SPItemView *v = item->display; v != nullptr; v = v->next) {
v->arenaitem->setSensitive(item->sensitive);
}
break;
@@ -491,7 +491,7 @@ void SPItem::set(unsigned int key, gchar const* value) {
if (value) {
item->_highlightColor = g_strdup(value);
} else {
- item->_highlightColor = NULL;
+ item->_highlightColor = nullptr;
}
break;
}
@@ -500,7 +500,7 @@ void SPItem::set(unsigned int key, gchar const* value) {
break;
case SP_ATTR_TRANSFORM_CENTER_X:
if (value) {
- item->transform_center_x = g_strtod(value, NULL);
+ item->transform_center_x = g_strtod(value, nullptr);
} else {
item->transform_center_x = 0;
}
@@ -508,7 +508,7 @@ void SPItem::set(unsigned int key, gchar const* value) {
break;
case SP_ATTR_TRANSFORM_CENTER_Y:
if (value) {
- item->transform_center_y = g_strtod(value, NULL);
+ item->transform_center_y = g_strtod(value, nullptr);
} else {
item->transform_center_y = 0;
}
@@ -538,16 +538,16 @@ void SPItem::clip_ref_changed(SPObject *old_clip, SPObject *clip, SPItem *item)
if (old_clip) {
SPItemView *v;
/* Hide clippath */
- for (v = item->display; v != NULL; v = v->next) {
+ for (v = item->display; v != nullptr; v = v->next) {
SPClipPath *oldPath = dynamic_cast<SPClipPath *>(old_clip);
- g_assert(oldPath != NULL);
+ g_assert(oldPath != nullptr);
oldPath->hide(v->arenaitem->key());
}
}
SPClipPath *clipPath = dynamic_cast<SPClipPath *>(clip);
if (clipPath) {
Geom::OptRect bbox = item->geometricBounds();
- for (SPItemView *v = item->display; v != NULL; v = v->next) {
+ for (SPItemView *v = item->display; v != nullptr; v = v->next) {
if (!v->arenaitem->key()) {
v->arenaitem->setKey(SPItem::display_key_new(3));
}
@@ -566,16 +566,16 @@ void SPItem::mask_ref_changed(SPObject *old_mask, SPObject *mask, SPItem *item)
{
if (old_mask) {
/* Hide mask */
- for (SPItemView *v = item->display; v != NULL; v = v->next) {
+ for (SPItemView *v = item->display; v != nullptr; v = v->next) {
SPMask *maskItem = dynamic_cast<SPMask *>(old_mask);
- g_assert(maskItem != NULL);
+ g_assert(maskItem != nullptr);
maskItem->sp_mask_hide(v->arenaitem->key());
}
}
SPMask *maskItem = dynamic_cast<SPMask *>(mask);
if (maskItem) {
Geom::OptRect bbox = item->geometricBounds();
- for (SPItemView *v = item->display; v != NULL; v = v->next) {
+ for (SPItemView *v = item->display; v != nullptr; v = v->next) {
if (!v->arenaitem->key()) {
v->arenaitem->setKey(SPItem::display_key_new(3));
}
@@ -592,7 +592,7 @@ void SPItem::mask_ref_changed(SPObject *old_mask, SPObject *mask, SPItem *item)
void SPItem::fill_ps_ref_changed(SPObject *old_ps, SPObject *ps, SPItem *item) {
SPPaintServer *old_fill_ps = dynamic_cast<SPPaintServer *>(old_ps);
if (old_fill_ps) {
- for (SPItemView *v =item->display; v != NULL; v = v->next) {
+ for (SPItemView *v =item->display; v != nullptr; v = v->next) {
old_fill_ps->hide(v->arenaitem->key());
}
}
@@ -600,7 +600,7 @@ void SPItem::fill_ps_ref_changed(SPObject *old_ps, SPObject *ps, SPItem *item) {
SPPaintServer *new_fill_ps = dynamic_cast<SPPaintServer *>(ps);
if (new_fill_ps) {
Geom::OptRect bbox = item->geometricBounds();
- for (SPItemView *v = item->display; v != NULL; v = v->next) {
+ for (SPItemView *v = item->display; v != nullptr; v = v->next) {
if (!v->arenaitem->key()) {
v->arenaitem->setKey(SPItem::display_key_new(3));
}
@@ -617,7 +617,7 @@ void SPItem::fill_ps_ref_changed(SPObject *old_ps, SPObject *ps, SPItem *item) {
void SPItem::stroke_ps_ref_changed(SPObject *old_ps, SPObject *ps, SPItem *item) {
SPPaintServer *old_stroke_ps = dynamic_cast<SPPaintServer *>(old_ps);
if (old_stroke_ps) {
- for (SPItemView *v =item->display; v != NULL; v = v->next) {
+ for (SPItemView *v =item->display; v != nullptr; v = v->next) {
old_stroke_ps->hide(v->arenaitem->key());
}
}
@@ -625,7 +625,7 @@ void SPItem::stroke_ps_ref_changed(SPObject *old_ps, SPObject *ps, SPItem *item)
SPPaintServer *new_stroke_ps = dynamic_cast<SPPaintServer *>(ps);
if (new_stroke_ps) {
Geom::OptRect bbox = item->geometricBounds();
- for (SPItemView *v = item->display; v != NULL; v = v->next) {
+ for (SPItemView *v = item->display; v != nullptr; v = v->next) {
if (!v->arenaitem->key()) {
v->arenaitem->setKey(SPItem::display_key_new(3));
}
@@ -653,30 +653,30 @@ void SPItem::update(SPCtx* ctx, guint flags) {
SP_OBJECT_MODIFIED_FLAG |
SP_OBJECT_STYLE_MODIFIED_FLAG) ) {
if (flags & SP_OBJECT_MODIFIED_FLAG) {
- for (SPItemView *v = display; v != NULL; v = v->next) {
+ for (SPItemView *v = display; v != nullptr; v = v->next) {
v->arenaitem->setTransform(transform);
}
}
- SPClipPath *clip_path = clip_ref ? clip_ref->getObject() : NULL;
- SPMask *mask = mask_ref ? mask_ref->getObject() : NULL;
+ SPClipPath *clip_path = clip_ref ? clip_ref->getObject() : nullptr;
+ SPMask *mask = mask_ref ? mask_ref->getObject() : nullptr;
if ( clip_path || mask ) {
Geom::OptRect bbox = geometricBounds();
if (clip_path) {
- for (SPItemView *v = display; v != NULL; v = v->next) {
+ for (SPItemView *v = display; v != nullptr; v = v->next) {
clip_path->setBBox(v->arenaitem->key(), bbox);
}
}
if (mask) {
- for (SPItemView *v = display; v != NULL; v = v->next) {
+ for (SPItemView *v = display; v != nullptr; v = v->next) {
mask->sp_mask_set_bbox(v->arenaitem->key(), bbox);
}
}
}
if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) {
- for (SPItemView *v = display; v != NULL; v = v->next) {
+ for (SPItemView *v = display; v != nullptr; v = v->next) {
v->arenaitem->setOpacity(SP_SCALE24_TO_FLOAT(style->opacity.value));
v->arenaitem->setAntialiasing(style->shape_rendering.computed == SP_CSS_SHAPE_RENDERING_CRISPEDGES ? 0 : 2);
v->arenaitem->setIsolation( style->isolation.value );
@@ -719,14 +719,14 @@ Inkscape::XML::Node* SPItem::write(Inkscape::XML::Document *xml_doc, Inkscape::X
std::vector<Inkscape::XML::Node *>l;
for (auto& child: object->children) {
if (dynamic_cast<SPTitle *>(&child) || dynamic_cast<SPDesc *>(&child)) {
- Inkscape::XML::Node *crepr = child.updateRepr(xml_doc, NULL, flags);
+ Inkscape::XML::Node *crepr = child.updateRepr(xml_doc, nullptr, flags);
if (crepr) {
l.push_back(crepr);
}
}
}
for (auto i = l.rbegin(); i!= l.rend(); ++i) {
- repr->addChild(*i, NULL);
+ repr->addChild(*i, nullptr);
Inkscape::GC::release(*i);
}
} else {
@@ -742,15 +742,15 @@ Inkscape::XML::Node* SPItem::write(Inkscape::XML::Document *xml_doc, Inkscape::X
g_free(c);
if (flags & SP_OBJECT_WRITE_EXT) {
- repr->setAttribute("sodipodi:insensitive", ( item->sensitive ? NULL : "true" ));
+ repr->setAttribute("sodipodi:insensitive", ( item->sensitive ? nullptr : "true" ));
if (item->transform_center_x != 0)
sp_repr_set_svg_double (repr, "inkscape:transform-center-x", item->transform_center_x);
else
- repr->setAttribute ("inkscape:transform-center-x", NULL);
+ repr->setAttribute ("inkscape:transform-center-x", nullptr);
if (item->transform_center_y != 0)
sp_repr_set_svg_double (repr, "inkscape:transform-center-y", item->transform_center_y);
else
- repr->setAttribute ("inkscape:transform-center-y", NULL);
+ repr->setAttribute ("inkscape:transform-center-y", nullptr);
}
if (item->clip_ref){
@@ -774,7 +774,7 @@ Inkscape::XML::Node* SPItem::write(Inkscape::XML::Document *xml_doc, Inkscape::X
if (item->_highlightColor){
repr->setAttribute("inkscape:highlight-color", item->_highlightColor);
} else {
- repr->setAttribute("inkscape:highlight-color", NULL);
+ repr->setAttribute("inkscape:highlight-color", nullptr);
}
SPObject::write(xml_doc, repr, flags);
@@ -808,7 +808,7 @@ Geom::OptRect SPItem::visualBounds(Geom::Affine const &transform) const
Geom::OptRect bbox;
- SPFilter *filter = (style && style->filter.href) ? dynamic_cast<SPFilter *>(style->getFilter()) : NULL;
+ SPFilter *filter = (style && style->filter.href) ? dynamic_cast<SPFilter *>(style->getFilter()) : nullptr;
if ( filter ) {
// call the subclass method
// CPPIFY
@@ -862,7 +862,7 @@ Geom::OptRect SPItem::visualBounds(Geom::Affine const &transform) const
}
if (clip_ref->getObject()) {
SPItem *ownerItem = dynamic_cast<SPItem *>(clip_ref->getOwner());
- g_assert(ownerItem != NULL);
+ g_assert(ownerItem != nullptr);
ownerItem->bbox_valid = FALSE; // LP Bug 1349018
bbox.intersectWith(clip_ref->getObject()->geometricBounds(transform));
}
@@ -945,7 +945,7 @@ Geom::OptRect SPItem::desktopBounds(BBoxType type) const
}
unsigned int SPItem::pos_in_parent() const {
- g_assert(parent != NULL);
+ g_assert(parent != nullptr);
g_assert(SP_IS_OBJECT(parent));
unsigned int pos = 0;
@@ -982,7 +982,7 @@ void SPItem::getSnappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscap
const_cast<SPItem*>(this)->snappoints(p, snapprefs);
// Get the snappoints at the item's center
- if (snapprefs != NULL && snapprefs->isTargetSnappable(Inkscape::SNAPTARGET_ROTATION_CENTER)) {
+ if (snapprefs != nullptr && snapprefs->isTargetSnappable(Inkscape::SNAPTARGET_ROTATION_CENTER)) {
p.push_back(Inkscape::SnapCandidatePoint(getCenter(), Inkscape::SNAPSOURCE_ROTATION_CENTER, Inkscape::SNAPTARGET_ROTATION_CENTER));
}
@@ -1059,7 +1059,7 @@ gchar *SPItem::detailedDescription() const {
if ( style && style->filter.href && style->filter.href->getObject() ) {
const gchar *label = style->filter.href->getObject()->label();
- gchar *snew = 0;
+ gchar *snew = nullptr;
if (label) {
snew = g_strdup_printf (_("%s; <i>filtered (%s)</i>"), s, _(label));
@@ -1107,16 +1107,16 @@ unsigned SPItem::display_key_new(unsigned numkeys)
// CPPIFY: make pure virtual
Inkscape::DrawingItem* SPItem::show(Inkscape::Drawing& /*drawing*/, unsigned int /*key*/, unsigned int /*flags*/) {
//throw;
- return 0;
+ return nullptr;
}
Inkscape::DrawingItem *SPItem::invoke_show(Inkscape::Drawing &drawing, unsigned key, unsigned flags)
{
- Inkscape::DrawingItem *ai = NULL;
+ Inkscape::DrawingItem *ai = nullptr;
ai = this->show(drawing, key, flags);
- if (ai != NULL) {
+ if (ai != nullptr) {
Geom::OptRect item_bbox = geometricBounds();
display = sp_item_view_new_prepend(display, this, flags, key, ai);
@@ -1202,18 +1202,18 @@ void SPItem::invoke_hide(unsigned key)
{
this->hide(key);
- SPItemView *ref = NULL;
+ SPItemView *ref = nullptr;
SPItemView *v = display;
- while (v != NULL) {
+ while (v != nullptr) {
SPItemView *next = v->next;
if (v->key == key) {
if (clip_ref->getObject()) {
(clip_ref->getObject())->hide(v->arenaitem->key());
- v->arenaitem->setClip(NULL);
+ v->arenaitem->setClip(nullptr);
}
if (mask_ref->getObject()) {
mask_ref->getObject()->sp_mask_hide(v->arenaitem->key());
- v->arenaitem->setMask(NULL);
+ v->arenaitem->setMask(nullptr);
}
SPPaintServer *fill_ps = style->getFillPaintServer();
if (fill_ps) {
@@ -1449,7 +1449,7 @@ void SPItem::doWriteTransform(Geom::Affine const &transform, Geom::Affine const
{
// calculate the relative transform, if not given by the adv attribute
Geom::Affine advertized_transform;
- if (adv != NULL) {
+ if (adv != nullptr) {
advertized_transform = *adv;
} else {
advertized_transform = sp_item_transform_repr (this).inverse() * transform;
@@ -1578,7 +1578,7 @@ void SPItem::set_item_transform(Geom::Affine const &transform_matrix)
Geom::Affine i2anc_affine(SPObject const *object, SPObject const *const ancestor) {
Geom::Affine ret(Geom::identity());
- g_return_val_if_fail(object != NULL, ret);
+ g_return_val_if_fail(object != nullptr, ret);
/* stop at first non-renderable ancestor */
while ( object != ancestor && dynamic_cast<SPItem const *>(object) ) {
@@ -1587,7 +1587,7 @@ Geom::Affine i2anc_affine(SPObject const *object, SPObject const *const ancestor
ret *= root->c2p;
} else {
SPItem const *item = dynamic_cast<SPItem const *>(object);
- g_assert(item != NULL);
+ g_assert(item != nullptr);
ret *= item->transform;
}
object = object->parent;
@@ -1597,7 +1597,7 @@ Geom::Affine i2anc_affine(SPObject const *object, SPObject const *const ancestor
Geom::Affine
i2i_affine(SPObject const *src, SPObject const *dest) {
- g_return_val_if_fail(src != NULL && dest != NULL, Geom::identity());
+ g_return_val_if_fail(src != nullptr && dest != nullptr, Geom::identity());
SPObject const *ancestor = src->nearestCommonAncestor(dest);
return i2anc_affine(src, ancestor) * i2anc_affine(dest, ancestor).inverse();
}
@@ -1608,7 +1608,7 @@ Geom::Affine SPItem::getRelativeTransform(SPObject const *dest) const {
Geom::Affine SPItem::i2doc_affine() const
{
- return i2anc_affine(this, NULL);
+ return i2anc_affine(this, nullptr);
}
Geom::Affine SPItem::i2dt_affine() const
@@ -1651,9 +1651,9 @@ Geom::Affine SPItem::dt2i_affine() const
SPItemView *SPItem::sp_item_view_new_prepend(SPItemView *list, SPItem *item, unsigned flags, unsigned key, Inkscape::DrawingItem *drawing_item)
{
- g_assert(item != NULL);
- g_assert(dynamic_cast<SPItem *>(item) != NULL);
- g_assert(drawing_item != NULL);
+ g_assert(item != nullptr);
+ g_assert(dynamic_cast<SPItem *>(item) != nullptr);
+ g_assert(drawing_item != nullptr);
SPItemView *new_view = g_new(SPItemView, 1);
@@ -1692,7 +1692,7 @@ Inkscape::DrawingItem *SPItem::get_arenaitem(unsigned key)
}
}
- return NULL;
+ return nullptr;
}
int sp_item_repr_compare_position(SPItem const *first, SPItem const *second)
@@ -1708,7 +1708,7 @@ SPItem const *sp_item_first_item_child(SPObject const *obj)
SPItem *sp_item_first_item_child(SPObject *obj)
{
- SPItem *child = 0;
+ SPItem *child = nullptr;
for (auto& iter: obj->children) {
SPItem *tmp = dynamic_cast<SPItem *>(&iter);
if ( tmp ) {
diff --git a/src/object/sp-item.h b/src/object/sp-item.h
index 82aca1250..f6a6781e9 100644
--- a/src/object/sp-item.h
+++ b/src/object/sp-item.h
@@ -307,7 +307,7 @@ public:
Inkscape::DrawingItem *invoke_show(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags);
void invoke_hide(unsigned int key);
- void getSnappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs=0) const;
+ void getSnappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs=nullptr) const;
void adjust_pattern(/* Geom::Affine const &premul, */ Geom::Affine const &postmul, bool set = false, PatternTransform = TRANSFORM_BOTH);
void adjust_gradient(/* Geom::Affine const &premul, */ Geom::Affine const &postmul, bool set = false);
void adjust_stroke(double ex);
@@ -334,7 +334,7 @@ public:
* stored optimized. Send _transformed_signal. Invoke _write method so that
* the repr is updated with the new transform.
*/
- void doWriteTransform(Geom::Affine const &transform, Geom::Affine const *adv = NULL, bool compensate = true);
+ void doWriteTransform(Geom::Affine const &transform, Geom::Affine const *adv = nullptr, bool compensate = true);
/**
* Sets item private transform (not propagated to repr), without compensating stroke widths,
diff --git a/src/object/sp-lpe-item.cpp b/src/object/sp-lpe-item.cpp
index 8e1f425a8..9f81b0307 100644
--- a/src/object/sp-lpe-item.cpp
+++ b/src/object/sp-lpe-item.cpp
@@ -61,7 +61,7 @@ SPLPEItem::SPLPEItem()
, path_effects_enabled(1)
, path_effect_list(new PathEffectList())
, lpe_modified_connection_list(new std::list<sigc::connection>())
- , current_path_effect(NULL)
+ , current_path_effect(nullptr)
, lpe_helperpaths()
{
}
@@ -85,12 +85,12 @@ void SPLPEItem::release() {
}
delete this->lpe_modified_connection_list;
- this->lpe_modified_connection_list = NULL;
+ this->lpe_modified_connection_list = nullptr;
this->path_effect_list->clear();
// delete the list itself
delete this->path_effect_list;
- this->path_effect_list = NULL;
+ this->path_effect_list = nullptr;
SPItem::release();
}
@@ -99,7 +99,7 @@ void SPLPEItem::set(unsigned int key, gchar const* value) {
switch (key) {
case SP_ATTR_INKSCAPE_PATH_EFFECT:
{
- this->current_path_effect = NULL;
+ this->current_path_effect = nullptr;
// Disable the path effects while populating the LPE list
sp_lpe_item_enable_path_effects(this, false);
@@ -135,7 +135,7 @@ void SPLPEItem::set(unsigned int key, gchar const* value) {
g_warning("BadURIException when trying to find LPE: %s", e.what());
path_effect_ref->unlink();
delete path_effect_ref;
- path_effect_ref = NULL;
+ path_effect_ref = nullptr;
}
this->path_effect_list->push_back(path_effect_ref);
@@ -181,7 +181,7 @@ Inkscape::XML::Node* SPLPEItem::write(Inkscape::XML::Document *xml_doc, Inkscape
if ( hasPathEffect() ) {
repr->setAttribute("inkscape:path-effect", patheffectlist_svg_string(*this->path_effect_list));
} else {
- repr->setAttribute("inkscape:path-effect", NULL);
+ repr->setAttribute("inkscape:path-effect", nullptr);
}
}
@@ -288,14 +288,14 @@ sp_lpe_item_update_patheffect (SPLPEItem *lpeitem, bool wholetree, bool write)
#ifdef SHAPE_VERBOSE
g_message("sp_lpe_item_update_patheffect: %p\n", lpeitem);
#endif
- g_return_if_fail (lpeitem != NULL);
+ g_return_if_fail (lpeitem != nullptr);
g_return_if_fail (SP_IS_OBJECT (lpeitem));
g_return_if_fail (SP_IS_LPE_ITEM (lpeitem));
if (!lpeitem->pathEffectsEnabled())
return;
- SPLPEItem *top = NULL;
+ SPLPEItem *top = nullptr;
if (wholetree) {
SPLPEItem *prev_parent = lpeitem;
@@ -327,7 +327,7 @@ lpeobject_ref_modified(SPObject */*href*/, guint /*flags*/, SPLPEItem *lpeitem)
static void
sp_lpe_item_create_original_path_recursive(SPLPEItem *lpeitem)
{
- g_return_if_fail(lpeitem != NULL);
+ g_return_if_fail(lpeitem != nullptr);
SPClipPath *clip_path = SP_ITEM(lpeitem)->clip_ref->getObject();
if(clip_path) {
@@ -378,7 +378,7 @@ sp_lpe_item_create_original_path_recursive(SPLPEItem *lpeitem)
static void
sp_lpe_item_cleanup_original_path_recursive(SPLPEItem *lpeitem, bool keep_paths, bool force, bool is_clip_mask)
{
- g_return_if_fail(lpeitem != NULL);
+ g_return_if_fail(lpeitem != nullptr);
SPItem *item = dynamic_cast<SPItem *>(lpeitem);
if (!item) {
return;
@@ -426,8 +426,8 @@ sp_lpe_item_cleanup_original_path_recursive(SPLPEItem *lpeitem, bool keep_paths,
if (!keep_paths) {
repr->setAttribute("d", repr->attribute("inkscape:original-d"));
}
- repr->setAttribute("inkscape:original-d", NULL);
- path->setCurveBeforeLPE(NULL);
+ repr->setAttribute("inkscape:original-d", nullptr);
+ path->setCurveBeforeLPE(nullptr);
if (!(shape->getCurve()->get_segment_count())) {
repr->parent()->removeChild(repr);
}
@@ -447,8 +447,8 @@ sp_lpe_item_cleanup_original_path_recursive(SPLPEItem *lpeitem, bool keep_paths,
( is_clip_mask && force)))
{
if (!keep_paths) {
- repr->setAttribute("d", NULL);
- shape->setCurveBeforeLPE(NULL);
+ repr->setAttribute("d", nullptr);
+ shape->setCurveBeforeLPE(nullptr);
} else {
const char * id = repr->attribute("id");
const char * style = repr->attribute("style");
@@ -629,7 +629,7 @@ void SPLPEItem::removeAllPathEffects(bool keep_paths)
}
}
new_list.clear();
- this->getRepr()->setAttribute("inkscape:path-effect", NULL);
+ this->getRepr()->setAttribute("inkscape:path-effect", nullptr);
if (!keep_paths) {
// Make sure that ellipse is stored as <svg:circle> or <svg:ellipse> if possible.
@@ -810,8 +810,8 @@ SPLPEItem::resetClipPathAndMaskLPE(bool fromrecurse)
} else if (shape) {
shape->setCurveInsync( shape->getCurveForEdit());
if (!hasPathEffectOnClipOrMaskRecursive(shape)) {
- shape->getRepr()->setAttribute("inkscape:original-d", NULL);
- shape->setCurveBeforeLPE(NULL);
+ shape->getRepr()->setAttribute("inkscape:original-d", nullptr);
+ shape->setCurveBeforeLPE(nullptr);
} else {
// make sure there is an original-d for paths!!!
sp_lpe_item_create_original_path_recursive(shape);
@@ -836,8 +836,8 @@ SPLPEItem::resetClipPathAndMaskLPE(bool fromrecurse)
} else if (shape) {
shape->setCurveInsync( shape->getCurveForEdit());
if (!hasPathEffectOnClipOrMaskRecursive(shape)) {
- shape->getRepr()->setAttribute("inkscape:original-d", NULL);
- shape->setCurveBeforeLPE(NULL);
+ shape->getRepr()->setAttribute("inkscape:original-d", nullptr);
+ shape->setCurveBeforeLPE(nullptr);
} else {
// make sure there is an original-d for paths!!!
sp_lpe_item_create_original_path_recursive(shape);
@@ -862,8 +862,8 @@ SPLPEItem::resetClipPathAndMaskLPE(bool fromrecurse)
} else if (shape) {
shape->setCurveInsync( shape->getCurveForEdit());
if (!hasPathEffectOnClipOrMaskRecursive(shape)) {
- shape->getRepr()->setAttribute("inkscape:original-d", NULL);
- shape->setCurveBeforeLPE(NULL);
+ shape->getRepr()->setAttribute("inkscape:original-d", nullptr);
+ shape->setCurveBeforeLPE(nullptr);
} else {
// make sure there is an original-d for paths!!!
sp_lpe_item_create_original_path_recursive(shape);
@@ -918,7 +918,7 @@ SPLPEItem::applyToClipPathOrMask(SPItem *clip_mask, SPItem* to, Inkscape::LivePa
applyToClipPathOrMask(subitem, to, lpe);
}
} else if (shape) {
- SPCurve * c = NULL;
+ SPCurve * c = nullptr;
// If item is a SPRect, convert it to path first:
if ( dynamic_cast<SPRect *>(shape) ) {
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
@@ -993,7 +993,7 @@ SPLPEItem::getPathEffectOfType(int type)
}
}
}
- return NULL;
+ return nullptr;
}
Inkscape::LivePathEffect::Effect const*
@@ -1009,7 +1009,7 @@ SPLPEItem::getPathEffectOfType(int type) const
}
}
}
- return NULL;
+ return nullptr;
}
void SPLPEItem::editNextParamOncanvas(SPDesktop *dt)
@@ -1109,7 +1109,7 @@ Inkscape::LivePathEffect::Effect* SPLPEItem::getCurrentLPE()
if (lperef && lperef->lpeobject)
return lperef->lpeobject->get_lpe();
else
- return NULL;
+ return nullptr;
}
bool SPLPEItem::setCurrentPathEffect(Inkscape::LivePathEffect::LPEObjectReference* lperef)
diff --git a/src/object/sp-lpe-item.h b/src/object/sp-lpe-item.h
index 665dbcd7d..b53b440a1 100644
--- a/src/object/sp-lpe-item.h
+++ b/src/object/sp-lpe-item.h
@@ -95,9 +95,9 @@ public:
void addPathEffect(std::string value, bool reset);
void addPathEffect(LivePathEffectObject * new_lpeobj);
void resetClipPathAndMaskLPE(bool fromrecurse = false);
- void applyToMask(SPItem* to, Inkscape::LivePathEffect::Effect *lpe = NULL);
- void applyToClipPath(SPItem* to, Inkscape::LivePathEffect::Effect *lpe = NULL);
- void applyToClipPathOrMask(SPItem * clip_mask, SPItem* to, Inkscape::LivePathEffect::Effect *lpe = NULL);
+ void applyToMask(SPItem* to, Inkscape::LivePathEffect::Effect *lpe = nullptr);
+ void applyToClipPath(SPItem* to, Inkscape::LivePathEffect::Effect *lpe = nullptr);
+ void applyToClipPathOrMask(SPItem * clip_mask, SPItem* to, Inkscape::LivePathEffect::Effect *lpe = nullptr);
bool forkPathEffectsIfNecessary(unsigned int nr_of_allowed_users = 1);
void editNextParamOncanvas(SPDesktop *dt);
diff --git a/src/object/sp-marker.cpp b/src/object/sp-marker.cpp
index e5ddb91b5..851a7d54f 100644
--- a/src/object/sp-marker.cpp
+++ b/src/object/sp-marker.cpp
@@ -240,31 +240,31 @@ Inkscape::XML::Node* SPMarker::write(Inkscape::XML::Document *xml_doc, Inkscape:
repr->setAttribute("markerUnits", "userSpaceOnUse");
}
} else {
- repr->setAttribute("markerUnits", NULL);
+ repr->setAttribute("markerUnits", nullptr);
}
if (this->refX._set) {
sp_repr_set_svg_double(repr, "refX", this->refX.computed);
} else {
- repr->setAttribute("refX", NULL);
+ repr->setAttribute("refX", nullptr);
}
if (this->refY._set) {
sp_repr_set_svg_double (repr, "refY", this->refY.computed);
} else {
- repr->setAttribute("refY", NULL);
+ repr->setAttribute("refY", nullptr);
}
if (this->markerWidth._set) {
sp_repr_set_svg_double (repr, "markerWidth", this->markerWidth.computed);
} else {
- repr->setAttribute("markerWidth", NULL);
+ repr->setAttribute("markerWidth", nullptr);
}
if (this->markerHeight._set) {
sp_repr_set_svg_double (repr, "markerHeight", this->markerHeight.computed);
} else {
- repr->setAttribute("markerHeight", NULL);
+ repr->setAttribute("markerHeight", nullptr);
}
if (this->orient_set) {
@@ -276,7 +276,7 @@ Inkscape::XML::Node* SPMarker::write(Inkscape::XML::Document *xml_doc, Inkscape:
sp_repr_set_css_double(repr, "orient", this->orient.computed);
}
} else {
- repr->setAttribute("orient", NULL);
+ repr->setAttribute("orient", nullptr);
}
/* fixme: */
@@ -292,7 +292,7 @@ Inkscape::XML::Node* SPMarker::write(Inkscape::XML::Document *xml_doc, Inkscape:
Inkscape::DrawingItem* SPMarker::show(Inkscape::Drawing &/*drawing*/, unsigned int /*key*/, unsigned int /*flags*/) {
// Markers in tree are never shown directly even if outside of <defs>.
- return 0;
+ return nullptr;
}
Inkscape::DrawingItem* SPMarker::private_show(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags) {
@@ -337,13 +337,13 @@ sp_marker_show_dimension (SPMarker *marker, unsigned int key, unsigned int size)
marker->hide(key);
it->second.items.clear();
for (unsigned int i = 0; i < size; ++i) {
- it->second.items.push_back(NULL);
+ it->second.items.push_back(nullptr);
}
}
} else {
marker->views_map[key] = SPMarkerView();
for (unsigned int i = 0; i < size; ++i) {
- marker->views_map[key].items.push_back(NULL);
+ marker->views_map[key].items.push_back(nullptr);
}
}
}
@@ -361,23 +361,23 @@ sp_marker_show_instance ( SPMarker *marker, Inkscape::DrawingItem *parent,
// otherwise Cairo will fail to render anything on the tile
// that contains the "degenerate" marker.
if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH && linewidth == 0) {
- return NULL;
+ return nullptr;
}
std::map<unsigned int, SPMarkerView>::iterator it = marker->views_map.find(key);
if (it == marker->views_map.end()) {
// Key not found
- return NULL;
+ return nullptr;
}
SPMarkerView *view = &(it->second);
if (pos >= view->items.size() ) {
// Position index too large, doesn't exist.
- return NULL;
+ return nullptr;
}
// If not already created
- if (view->items[pos] == NULL) {
+ if (view->items[pos] == nullptr) {
/* Parent class ::show method */
view->items[pos] = marker->private_show(parent->drawing(), key, SP_ITEM_REFERENCE_FLAGS);
@@ -483,9 +483,9 @@ SPObject *sp_marker_fork_if_necessary(SPObject *marker)
SPDocument *doc = marker->document;
Inkscape::XML::Document *xml_doc = doc->getReprDoc();
// Turn off garbage-collectable or it might be collected before we can use it
- marker->getRepr()->setAttribute("inkscape:collect", NULL);
+ marker->getRepr()->setAttribute("inkscape:collect", nullptr);
Inkscape::XML::Node *mark_repr = marker->getRepr()->duplicate(xml_doc);
- doc->getDefs()->getRepr()->addChild(mark_repr, NULL);
+ doc->getDefs()->getRepr()->addChild(mark_repr, nullptr);
if (!mark_repr->attribute("inkscape:stockid")) {
mark_repr->setAttribute("inkscape:stockid", mark_repr->attribute("id"));
}
diff --git a/src/object/sp-mask.cpp b/src/object/sp-mask.cpp
index 2e764131c..5e6ed29f0 100644
--- a/src/object/sp-mask.cpp
+++ b/src/object/sp-mask.cpp
@@ -47,7 +47,7 @@ SPMask::SPMask() : SPObjectGroup() {
this->maskContentUnits_set = FALSE;
this->maskContentUnits = SP_CONTENT_UNITS_USERSPACEONUSE;
- this->display = NULL;
+ this->display = nullptr;
}
SPMask::~SPMask() {
@@ -150,7 +150,7 @@ void SPMask::child_added(Inkscape::XML::Node* child, Inkscape::XML::Node* ref) {
SPObject *ochild = this->document->getObjectByRepr(child);
if (SP_IS_ITEM (ochild)) {
- for (SPMaskView *v = this->display; v != NULL; v = v->next) {
+ for (SPMaskView *v = this->display; v != nullptr; v = v->next) {
Inkscape::DrawingItem *ac = SP_ITEM (ochild)->invoke_show(v->arenaitem->drawing(), v->key, SP_ITEM_REFERENCE_FLAGS);
if (ac) {
@@ -178,7 +178,7 @@ void SPMask::update(SPCtx* ctx, unsigned int flags) {
sp_object_unref(*child);
}
- for (SPMaskView *v = this->display; v != NULL; v = v->next) {
+ for (SPMaskView *v = this->display; v != nullptr; v = v->next) {
Inkscape::DrawingGroup *g = dynamic_cast<Inkscape::DrawingGroup *>(v->arenaitem);
if (this->maskContentUnits == SP_CONTENT_UNITS_OBJECTBOUNDINGBOX && v->bbox) {
@@ -246,7 +246,7 @@ sp_mask_create (std::vector<Inkscape::XML::Node*> &reprs, SPDocument *document)
}
Inkscape::DrawingItem *SPMask::sp_mask_show(Inkscape::Drawing &drawing, unsigned int key) {
- g_return_val_if_fail (this != NULL, NULL);
+ g_return_val_if_fail (this != nullptr, NULL);
g_return_val_if_fail (SP_IS_MASK (this), NULL);
Inkscape::DrawingGroup *ai = new Inkscape::DrawingGroup(drawing);
@@ -272,7 +272,7 @@ Inkscape::DrawingItem *SPMask::sp_mask_show(Inkscape::Drawing &drawing, unsigned
}
void SPMask::sp_mask_hide(unsigned int key) {
- g_return_if_fail (this != NULL);
+ g_return_if_fail (this != nullptr);
g_return_if_fail (SP_IS_MASK (this));
for (auto& child: children) {
@@ -281,7 +281,7 @@ void SPMask::sp_mask_hide(unsigned int key) {
}
}
- for (SPMaskView *v = this->display; v != NULL; v = v->next) {
+ for (SPMaskView *v = this->display; v != nullptr; v = v->next) {
if (v->key == key) {
/* We simply unref and let item to manage this in handler */
this->display = sp_mask_view_list_remove (this->display, v);
@@ -293,7 +293,7 @@ void SPMask::sp_mask_hide(unsigned int key) {
}
void SPMask::sp_mask_set_bbox(unsigned int key, Geom::OptRect const &bbox) {
- for (SPMaskView *v = this->display; v != NULL; v = v->next) {
+ for (SPMaskView *v = this->display; v != nullptr; v = v->next) {
if (v->key == key) {
v->bbox = bbox;
break;
diff --git a/src/object/sp-mask.h b/src/object/sp-mask.h
index f02a486b3..5707e27d3 100644
--- a/src/object/sp-mask.h
+++ b/src/object/sp-mask.h
@@ -94,11 +94,11 @@ protected:
char const * owner_mask = "";
char const * obj_name = "";
char const * obj_id = "";
- if (owner_repr != NULL) {
+ if (owner_repr != nullptr) {
owner_name = owner_repr->name();
owner_mask = owner_repr->attribute("mask");
}
- if (obj_repr != NULL) {
+ if (obj_repr != nullptr) {
obj_name = obj_repr->name();
obj_id = obj_repr->attribute("id");
}
diff --git a/src/object/sp-mesh-array.cpp b/src/object/sp-mesh-array.cpp
index d958427f2..14ec3866b 100644
--- a/src/object/sp-mesh-array.cpp
+++ b/src/object/sp-mesh-array.cpp
@@ -640,7 +640,7 @@ SPMeshNodeArray::SPMeshNodeArray( SPMeshGradient *mg ) {
SPMeshNodeArray::SPMeshNodeArray( const SPMeshNodeArray& rhs ) {
built = false;
- mg = NULL;
+ mg = nullptr;
draggers_valid = false;
nodes = rhs.nodes; // This only copies the pointers but it does size the vector of vectors.
@@ -661,7 +661,7 @@ SPMeshNodeArray& SPMeshNodeArray::operator=( const SPMeshNodeArray& rhs ) {
clear(); // Clear any existing array.
built = false;
- mg = NULL;
+ mg = nullptr;
draggers_valid = false;
nodes = rhs.nodes; // This only copies the pointers but it does size the vector of vectors.
diff --git a/src/object/sp-mesh-array.h b/src/object/sp-mesh-array.h
index df43638db..e334de90b 100644
--- a/src/object/sp-mesh-array.h
+++ b/src/object/sp-mesh-array.h
@@ -163,7 +163,7 @@ public:
friend class SPMeshPatchI;
- SPMeshNodeArray() { built = false; mg = NULL; draggers_valid = false; };
+ SPMeshNodeArray() { built = false; mg = nullptr; draggers_valid = false; };
SPMeshNodeArray( SPMeshGradient *mg );
SPMeshNodeArray( const SPMeshNodeArray& rhs );
SPMeshNodeArray& operator=(const SPMeshNodeArray& rhs);
diff --git a/src/object/sp-mesh-gradient.cpp b/src/object/sp-mesh-gradient.cpp
index 572131c60..d36a7fb73 100644
--- a/src/object/sp-mesh-gradient.cpp
+++ b/src/object/sp-mesh-gradient.cpp
@@ -163,7 +163,7 @@ cairo_pattern_t* SPMeshGradient::pattern_new(cairo_t * /*ct*/,
this->ensureArray();
- cairo_pattern_t *cp = NULL;
+ cairo_pattern_t *cp = nullptr;
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 4)
SPMeshNodeArray* my_array = &array;
diff --git a/src/object/sp-mesh-patch.cpp b/src/object/sp-mesh-patch.cpp
index 04a121c7a..1110e15ca 100644
--- a/src/object/sp-mesh-patch.cpp
+++ b/src/object/sp-mesh-patch.cpp
@@ -21,7 +21,7 @@
SPMeshpatch* SPMeshpatch::getNextMeshpatch()
{
- SPMeshpatch *result = 0;
+ SPMeshpatch *result = nullptr;
for (SPObject* obj = getNext(); obj && !result; obj = obj->getNext()) {
if (SP_IS_MESHPATCH(obj)) {
@@ -34,7 +34,7 @@ SPMeshpatch* SPMeshpatch::getNextMeshpatch()
SPMeshpatch* SPMeshpatch::getPrevMeshpatch()
{
- SPMeshpatch *result = 0;
+ SPMeshpatch *result = nullptr;
for (SPObject* obj = getPrev(); obj; obj = obj->getPrev()) {
// The closest previous SPObject that is an SPMeshpatch *should* be ourself.
@@ -58,7 +58,7 @@ SPMeshpatch* SPMeshpatch::getPrevMeshpatch()
* Mesh Patch
*/
SPMeshpatch::SPMeshpatch() : SPObject() {
- this->tensor_string = NULL;
+ this->tensor_string = nullptr;
}
SPMeshpatch::~SPMeshpatch() {
diff --git a/src/object/sp-mesh-row.cpp b/src/object/sp-mesh-row.cpp
index 8204aff65..03d71c6f5 100644
--- a/src/object/sp-mesh-row.cpp
+++ b/src/object/sp-mesh-row.cpp
@@ -19,7 +19,7 @@
SPMeshrow* SPMeshrow::getNextMeshrow()
{
- SPMeshrow *result = 0;
+ SPMeshrow *result = nullptr;
for (SPObject* obj = getNext(); obj && !result; obj = obj->getNext()) {
if (SP_IS_MESHROW(obj)) {
@@ -32,7 +32,7 @@ SPMeshrow* SPMeshrow::getNextMeshrow()
SPMeshrow* SPMeshrow::getPrevMeshrow()
{
- SPMeshrow *result = 0;
+ SPMeshrow *result = nullptr;
for (SPObject* obj = getPrev(); obj; obj = obj->getPrev()) {
// The closest previous SPObject that is an SPMeshrow *should* be ourself.
diff --git a/src/object/sp-metadata.cpp b/src/object/sp-metadata.cpp
index e7907e4f0..04cddbb8b 100644
--- a/src/object/sp-metadata.cpp
+++ b/src/object/sp-metadata.cpp
@@ -44,7 +44,7 @@ namespace {
void strip_ids_recursively(Inkscape::XML::Node *node) {
using Inkscape::XML::NodeSiblingIterator;
if ( node->type() == Inkscape::XML::ELEMENT_NODE ) {
- node->setAttribute("id", NULL);
+ node->setAttribute("id", nullptr);
}
for ( NodeSiblingIterator iter=node->firstChild() ; iter ; ++iter ) {
strip_ids_recursively(iter);
@@ -125,11 +125,11 @@ SPMetadata *sp_document_metadata(SPDocument *document)
{
SPObject *nv;
- g_return_val_if_fail (document != NULL, NULL);
+ g_return_val_if_fail (document != nullptr, NULL);
- nv = sp_item_group_get_child_by_name( document->getRoot(), NULL,
+ nv = sp_item_group_get_child_by_name( document->getRoot(), nullptr,
"metadata");
- g_assert (nv != NULL);
+ g_assert (nv != nullptr);
return (SPMetadata *)nv;
}
diff --git a/src/object/sp-missing-glyph.cpp b/src/object/sp-missing-glyph.cpp
index f441b66d2..7b10b4e9a 100644
--- a/src/object/sp-missing-glyph.cpp
+++ b/src/object/sp-missing-glyph.cpp
@@ -21,7 +21,7 @@
SPMissingGlyph::SPMissingGlyph() : SPObject() {
//TODO: correct these values:
- this->d = NULL;
+ this->d = nullptr;
this->horiz_adv_x = 0;
this->vert_origin_x = 0;
this->vert_origin_y = 0;
@@ -59,7 +59,7 @@ void SPMissingGlyph::set(unsigned int key, const gchar* value) {
}
case SP_ATTR_HORIZ_ADV_X:
{
- double number = value ? g_ascii_strtod(value, 0) : 0;
+ double number = value ? g_ascii_strtod(value, nullptr) : 0;
if (number != this->horiz_adv_x){
this->horiz_adv_x = number;
this->requestModified(SP_OBJECT_MODIFIED_FLAG);
@@ -68,7 +68,7 @@ void SPMissingGlyph::set(unsigned int key, const gchar* value) {
}
case SP_ATTR_VERT_ORIGIN_X:
{
- double number = value ? g_ascii_strtod(value, 0) : 0;
+ double number = value ? g_ascii_strtod(value, nullptr) : 0;
if (number != this->vert_origin_x){
this->vert_origin_x = number;
this->requestModified(SP_OBJECT_MODIFIED_FLAG);
@@ -77,7 +77,7 @@ void SPMissingGlyph::set(unsigned int key, const gchar* value) {
}
case SP_ATTR_VERT_ORIGIN_Y:
{
- double number = value ? g_ascii_strtod(value, 0) : 0;
+ double number = value ? g_ascii_strtod(value, nullptr) : 0;
if (number != this->vert_origin_y){
this->vert_origin_y = number;
this->requestModified(SP_OBJECT_MODIFIED_FLAG);
@@ -86,7 +86,7 @@ void SPMissingGlyph::set(unsigned int key, const gchar* value) {
}
case SP_ATTR_VERT_ADV_Y:
{
- double number = value ? g_ascii_strtod(value, 0) : 0;
+ double number = value ? g_ascii_strtod(value, nullptr) : 0;
if (number != this->vert_adv_y){
this->vert_adv_y = number;
this->requestModified(SP_OBJECT_MODIFIED_FLAG);
diff --git a/src/object/sp-namedview.cpp b/src/object/sp-namedview.cpp
index 7cea56119..a384c23c9 100644
--- a/src/object/sp-namedview.cpp
+++ b/src/object/sp-namedview.cpp
@@ -65,12 +65,12 @@ SPNamedView::SPNamedView() : SPObjectGroup(), snap_manager(this) {
this->guidehicolor = 0;
this->views.clear();
this->borderlayer = 0;
- this->page_size_units = NULL;
+ this->page_size_units = nullptr;
this->window_x = 0;
this->cy = 0;
this->window_y = 0;
- this->display_units = NULL;
- this->page_size_units = NULL;
+ this->display_units = nullptr;
+ this->page_size_units = nullptr;
this->pagecolor = 0;
this->cx = 0;
this->pageshadow = 0;
@@ -113,7 +113,7 @@ static void sp_namedview_generate_old_grid(SPNamedView * /*nv*/, SPDocument *doc
const char* gridopacity = "0.15";
const char* gridempopacity = "0.38";
- const char* value = NULL;
+ const char* value = nullptr;
if ((value = repr->attribute("gridoriginx"))) {
gridoriginx = value;
old_grid_settings_present = true;
@@ -173,15 +173,15 @@ static void sp_namedview_generate_old_grid(SPNamedView * /*nv*/, SPDocument *doc
Inkscape::GC::release(newnode);
// remove all old settings
- repr->setAttribute("gridoriginx", NULL);
- repr->setAttribute("gridoriginy", NULL);
- repr->setAttribute("gridspacingx", NULL);
- repr->setAttribute("gridspacingy", NULL);
- repr->setAttribute("gridcolor", NULL);
- repr->setAttribute("gridempcolor", NULL);
- repr->setAttribute("gridopacity", NULL);
- repr->setAttribute("gridempopacity", NULL);
- repr->setAttribute("gridempspacing", NULL);
+ repr->setAttribute("gridoriginx", nullptr);
+ repr->setAttribute("gridoriginy", nullptr);
+ repr->setAttribute("gridspacingx", nullptr);
+ repr->setAttribute("gridspacingy", nullptr);
+ repr->setAttribute("gridcolor", nullptr);
+ repr->setAttribute("gridempcolor", nullptr);
+ repr->setAttribute("gridopacity", nullptr);
+ repr->setAttribute("gridempopacity", nullptr);
+ repr->setAttribute("gridempspacing", nullptr);
// SPDocumentUndo::done(doc, SP_VERB_DIALOG_NAMEDVIEW, _("Create new grid from pre0.46 grid settings"));
}
@@ -297,15 +297,15 @@ void SPNamedView::set(unsigned int key, const gchar* value) {
this->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_GRIDTOLERANCE:
- this->snap_manager.snapprefs.setGridTolerance(value ? g_ascii_strtod(value, NULL) : 10000);
+ this->snap_manager.snapprefs.setGridTolerance(value ? g_ascii_strtod(value, nullptr) : 10000);
this->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_GUIDETOLERANCE:
- this->snap_manager.snapprefs.setGuideTolerance(value ? g_ascii_strtod(value, NULL) : 20);
+ this->snap_manager.snapprefs.setGuideTolerance(value ? g_ascii_strtod(value, nullptr) : 20);
this->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_OBJECTTOLERANCE:
- this->snap_manager.snapprefs.setObjectTolerance(value ? g_ascii_strtod(value, NULL) : 20);
+ this->snap_manager.snapprefs.setObjectTolerance(value ? g_ascii_strtod(value, nullptr) : 20);
this->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_GUIDECOLOR:
@@ -400,15 +400,15 @@ void SPNamedView::set(unsigned int key, const gchar* value) {
this->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_INKSCAPE_ZOOM:
- this->zoom = value ? g_ascii_strtod(value, NULL) : 0; // zero means not set
+ this->zoom = value ? g_ascii_strtod(value, nullptr) : 0; // zero means not set
this->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_INKSCAPE_CX:
- this->cx = value ? g_ascii_strtod(value, NULL) : HUGE_VAL; // HUGE_VAL means not set
+ this->cx = value ? g_ascii_strtod(value, nullptr) : HUGE_VAL; // HUGE_VAL means not set
this->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_INKSCAPE_CY:
- this->cy = value ? g_ascii_strtod(value, NULL) : HUGE_VAL; // HUGE_VAL means not set
+ this->cy = value ? g_ascii_strtod(value, nullptr) : HUGE_VAL; // HUGE_VAL means not set
this->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_INKSCAPE_WINDOW_WIDTH:
@@ -528,7 +528,7 @@ void SPNamedView::set(unsigned int key, const gchar* value) {
this->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_INKSCAPE_CONNECTOR_SPACING:
- this->connector_spacing = value ? g_ascii_strtod(value, NULL) :
+ this->connector_spacing = value ? g_ascii_strtod(value, nullptr) :
defaultConnSpacing;
this->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
@@ -566,7 +566,7 @@ void SPNamedView::set(unsigned int key, const gchar* value) {
}
case SP_ATTR_UNITS: {
// Only used in "Custom size" section of Document Properties dialog
- Inkscape::Util::Unit const *new_unit = NULL;
+ Inkscape::Util::Unit const *new_unit = nullptr;
if (value) {
Inkscape::Util::Unit const *const req_unit = unit_table.getUnit(value);
@@ -605,7 +605,7 @@ void SPNamedView::set(unsigned int key, const gchar* value) {
*/
static Inkscape::CanvasGrid*
sp_namedview_add_grid(SPNamedView *nv, Inkscape::XML::Node *repr, SPDesktop *desktop) {
- Inkscape::CanvasGrid* grid = NULL;
+ Inkscape::CanvasGrid* grid = nullptr;
//check if namedview already has an object for this grid
for(std::vector<Inkscape::CanvasGrid *>::const_iterator it=nv->grids.begin();it!=nv->grids.end();++it ) {
if (repr == (*it)->repr) {
@@ -619,7 +619,7 @@ sp_namedview_add_grid(SPNamedView *nv, Inkscape::XML::Node *repr, SPDesktop *des
Inkscape::GridType gridtype = Inkscape::CanvasGrid::getGridTypeFromSVGName(repr->attribute("type"));
if (!nv->document) {
g_warning("sp_namedview_add_grid - how come doc is null here?!");
- return NULL;
+ return nullptr;
}
grid = Inkscape::CanvasGrid::NewGrid(nv, repr, nv->document, gridtype);
nv->grids.push_back(grid);
@@ -642,7 +642,7 @@ void SPNamedView::child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *r
SPObjectGroup::child_added(child, ref);
if (!strcmp(child->name(), "inkscape:grid")) {
- sp_namedview_add_grid(this, child, NULL);
+ sp_namedview_add_grid(this, child, nullptr);
} else {
SPObject *no = this->document->getObjectByRepr(child);
if ( !SP_IS_OBJECT(no) ) {
@@ -723,7 +723,7 @@ void SPNamedView::show(SPDesktop *desktop)
// generate grids specified in SVG:
Inkscape::XML::Node *repr = this->getRepr();
if (repr) {
- 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:grid")) {
sp_namedview_add_grid(this, child, desktop);
}
@@ -824,7 +824,7 @@ void sp_namedview_window_from_document(SPDesktop *desktop)
void SPNamedView::writeNewGrid(SPDocument *document,int gridtype)
{
- g_assert(this->getRepr() != NULL);
+ g_assert(this->getRepr() != nullptr);
Inkscape::CanvasGrid::writeNewGridToRepr(this->getRepr(),document,static_cast<Inkscape::GridType>(gridtype));
}
@@ -835,13 +835,13 @@ bool SPNamedView::getSnapGlobal() const
void SPNamedView::setSnapGlobal(bool v)
{
- g_assert(this->getRepr() != NULL);
+ g_assert(this->getRepr() != nullptr);
sp_repr_set_boolean(this->getRepr(), "inkscape:snap-global", v);
}
void sp_namedview_update_layers_from_document (SPDesktop *desktop)
{
- SPObject *layer = NULL;
+ SPObject *layer = nullptr;
SPDocument *document = desktop->doc();
SPNamedView *nv = desktop->namedview;
if ( nv->default_layer_id != 0 ) {
@@ -849,7 +849,7 @@ void sp_namedview_update_layers_from_document (SPDesktop *desktop)
}
// don't use that object if it's not at least group
if ( !layer || !SP_IS_GROUP(layer) ) {
- layer = NULL;
+ layer = nullptr;
}
// if that didn't work out, look for the topmost layer
if (!layer) {
@@ -904,7 +904,7 @@ void sp_namedview_document_from_window(SPDesktop *desktop)
void SPNamedView::hide(SPDesktop const *desktop)
{
- g_assert(desktop != NULL);
+ g_assert(desktop != nullptr);
g_assert(std::find(views.begin(),views.end(),desktop)!=views.end());
for(std::vector<SPGuide *>::iterator it=this->guides.begin();it!=this->guides.end();++it ) {
(*it)->hideSPGuide(desktop->getCanvas());
@@ -914,7 +914,7 @@ void SPNamedView::hide(SPDesktop const *desktop)
void SPNamedView::activateGuides(void* desktop, bool active)
{
- g_assert(desktop != NULL);
+ g_assert(desktop != nullptr);
g_assert(std::find(views.begin(),views.end(),desktop)!=views.end());
SPDesktop *dt = static_cast<SPDesktop*>(desktop);
@@ -1060,12 +1060,12 @@ static gboolean sp_nv_read_opacity(const gchar *str, guint32 *color)
SPNamedView *sp_document_namedview(SPDocument *document, const gchar *id)
{
- g_return_val_if_fail(document != NULL, NULL);
+ g_return_val_if_fail(document != nullptr, NULL);
- SPObject *nv = sp_item_group_get_child_by_name(document->getRoot(), NULL, "sodipodi:namedview");
- g_assert(nv != NULL);
+ SPObject *nv = sp_item_group_get_child_by_name(document->getRoot(), nullptr, "sodipodi:namedview");
+ g_assert(nv != nullptr);
- if (id == NULL) {
+ if (id == nullptr) {
return (SPNamedView *) nv;
}
@@ -1083,14 +1083,14 @@ SPNamedView const *sp_document_namedview(SPDocument const *document, const gchar
void SPNamedView::setGuides(bool v)
{
- g_assert(this->getRepr() != NULL);
+ g_assert(this->getRepr() != nullptr);
sp_repr_set_boolean(this->getRepr(), "showguides", v);
sp_repr_set_boolean(this->getRepr(), "inkscape:guide-bbox", v);
}
bool SPNamedView::getGuides()
{
- g_assert(this->getRepr() != NULL);
+ g_assert(this->getRepr() != nullptr);
unsigned int v;
unsigned int set = sp_repr_get_boolean(this->getRepr(), "showguides", &v);
if (!set) { // hide guides if not specified, for backwards compatibility
@@ -1158,7 +1158,7 @@ Inkscape::CanvasGrid * sp_namedview_get_first_enabled_grid(SPNamedView *namedvie
return (*it);
}
- return NULL;
+ return nullptr;
}
void SPNamedView::translateGuides(Geom::Translate const &tr) {
diff --git a/src/object/sp-object-group.cpp b/src/object/sp-object-group.cpp
index f8ef855e3..102eafa83 100644
--- a/src/object/sp-object-group.cpp
+++ b/src/object/sp-object-group.cpp
@@ -51,14 +51,14 @@ Inkscape::XML::Node *SPObjectGroup::write(Inkscape::XML::Document *xml_doc, Inks
std::vector<Inkscape::XML::Node *> l;
for (auto& child: children) {
- Inkscape::XML::Node *crepr = child.updateRepr(xml_doc, NULL, flags);
+ Inkscape::XML::Node *crepr = child.updateRepr(xml_doc, nullptr, flags);
if (crepr) {
l.push_back(crepr);
}
}
for (auto i=l.rbegin();i!=l.rend();++i) {
- repr->addChild(*i, NULL);
+ repr->addChild(*i, nullptr);
Inkscape::GC::release(*i);
}
} else {
diff --git a/src/object/sp-object.cpp b/src/object/sp-object.cpp
index 112a08fb9..d9a003074 100644
--- a/src/object/sp-object.cpp
+++ b/src/object/sp-object.cpp
@@ -91,7 +91,7 @@ public:
*/
static void setIdNull( SPObject* obj ) {
if (obj) {
- obj->id = 0;
+ obj->id = nullptr;
}
}
@@ -105,7 +105,7 @@ public:
if (obj && (id != obj->id) ) {
if (obj->id) {
g_free(obj->id);
- obj->id = 0;
+ obj->id = nullptr;
}
if (id) {
obj->id = g_strdup(id);
@@ -118,10 +118,10 @@ public:
* Constructor, sets all attributes to default values.
*/
SPObject::SPObject()
- : cloned(0), clone_original(NULL), uflags(0), mflags(0), hrefcount(0), _total_hrefcount(0),
- document(NULL), parent(NULL), id(NULL), repr(NULL), refCount(1), hrefList(std::list<SPObject*>()),
- _successor(NULL), _collection_policy(SPObject::COLLECT_WITH_PARENT),
- _label(NULL), _default_label(NULL)
+ : cloned(0), clone_original(nullptr), uflags(0), mflags(0), hrefcount(0), _total_hrefcount(0),
+ document(nullptr), parent(nullptr), id(nullptr), repr(nullptr), refCount(1), hrefList(std::list<SPObject*>()),
+ _successor(nullptr), _collection_policy(SPObject::COLLECT_WITH_PARENT),
+ _label(nullptr), _default_label(nullptr)
{
debug("id=%p, typename=%s",this, g_type_name_from_instance((GTypeInstance*)this));
@@ -134,8 +134,8 @@ SPObject::SPObject()
// vg, g, defs, desc, title, symbol, use, image, switch, path, rect, circle, ellipse, line, polyline,
// polygon, text, tspan, tref, textPath, altGlyph, glyphRef, marker, linearGradient, radialGradient,
// stop, pattern, clipPath, mask, filter, feImage, a, font, glyph, missing-glyph, foreignObject
- this->style = new SPStyle( NULL, this ); // Is it necessary to call with "this"?
- this->context_style = NULL;
+ this->style = new SPStyle( nullptr, this ); // Is it necessary to call with "this"?
+ this->context_style = nullptr;
}
/**
@@ -145,18 +145,18 @@ SPObject::~SPObject() {
g_free(this->_label);
g_free(this->_default_label);
- this->_label = NULL;
- this->_default_label = NULL;
+ this->_label = nullptr;
+ this->_default_label = nullptr;
if (this->_successor) {
- sp_object_unref(this->_successor, NULL);
- this->_successor = NULL;
+ sp_object_unref(this->_successor, nullptr);
+ this->_successor = nullptr;
}
if (parent) {
parent->children.erase(parent->children.iterator_to(*this));
}
- if( style == NULL ) {
+ if( style == nullptr ) {
// style pointer could be NULL if unreffed too many times.
// Conjecture: style pointer is never NULL.
std::cerr << "SPObject::~SPObject(): style pointer is NULL" << std::endl;
@@ -241,7 +241,7 @@ Inkscape::XML::Node const* SPObject::getRepr() const{
SPObject *sp_object_ref(SPObject *object, SPObject *owner)
{
- g_return_val_if_fail(object != NULL, NULL);
+ g_return_val_if_fail(object != nullptr, NULL);
g_return_val_if_fail(SP_IS_OBJECT(object), NULL);
g_return_val_if_fail(!owner || SP_IS_OBJECT(owner), NULL);
@@ -253,7 +253,7 @@ SPObject *sp_object_ref(SPObject *object, SPObject *owner)
SPObject *sp_object_unref(SPObject *object, SPObject *owner)
{
- g_return_val_if_fail(object != NULL, NULL);
+ g_return_val_if_fail(object != nullptr, NULL);
g_return_val_if_fail(SP_IS_OBJECT(object), NULL);
g_return_val_if_fail(!owner || SP_IS_OBJECT(owner), NULL);
@@ -265,12 +265,12 @@ SPObject *sp_object_unref(SPObject *object, SPObject *owner)
delete object;
}
- return NULL;
+ return nullptr;
}
SPObject *sp_object_href(SPObject *object, SPObject* owner)
{
- g_return_val_if_fail(object != NULL, NULL);
+ g_return_val_if_fail(object != nullptr, NULL);
g_return_val_if_fail(SP_IS_OBJECT(object), NULL);
object->hrefcount++;
@@ -284,7 +284,7 @@ SPObject *sp_object_href(SPObject *object, SPObject* owner)
SPObject *sp_object_hunref(SPObject *object, SPObject* owner)
{
- g_return_val_if_fail(object != NULL, NULL);
+ g_return_val_if_fail(object != nullptr, NULL);
g_return_val_if_fail(SP_IS_OBJECT(object), NULL);
g_return_val_if_fail(object->hrefcount > 0, NULL);
@@ -294,11 +294,11 @@ SPObject *sp_object_hunref(SPObject *object, SPObject* owner)
if(owner)
object->hrefList.remove(owner);
- return NULL;
+ return nullptr;
}
void SPObject::_updateTotalHRefCount(int increment) {
- SPObject *topmost_collectable = NULL;
+ SPObject *topmost_collectable = nullptr;
for ( SPObject *iter = this ; iter ; iter = iter->parent ) {
iter->_total_hrefcount += increment;
if ( iter->_total_hrefcount < iter->hrefcount ) {
@@ -316,7 +316,7 @@ void SPObject::_updateTotalHRefCount(int increment) {
}
bool SPObject::isAncestorOf(SPObject const *object) const {
- g_return_val_if_fail(object != NULL, false);
+ g_return_val_if_fail(object != nullptr, false);
object = object->parent;
while (object) {
if ( object == this ) {
@@ -336,14 +336,14 @@ bool same_objects(SPObject const &a, SPObject const &b) {
}
SPObject const *SPObject::nearestCommonAncestor(SPObject const *object) const {
- g_return_val_if_fail(object != NULL, NULL);
+ g_return_val_if_fail(object != nullptr, NULL);
using Inkscape::Algorithms::longest_common_suffix;
- return longest_common_suffix<SPObject::ConstParentIterator>(this, object, NULL, &same_objects);
+ return longest_common_suffix<SPObject::ConstParentIterator>(this, object, nullptr, &same_objects);
}
static SPObject const *AncestorSon(SPObject const *obj, SPObject const *ancestor) {
- SPObject const *result = 0;
+ SPObject const *result = nullptr;
if ( obj && ancestor ) {
if (obj->parent == ancestor) {
result = obj;
@@ -390,19 +390,19 @@ SPObject *SPObject::appendChildRepr(Inkscape::XML::Node *repr) {
return document->getObjectByRepr(repr);
} else {
g_critical("Attempt to append repr as child of cloned object");
- return NULL;
+ return nullptr;
}
}
void SPObject::setCSS(SPCSSAttr *css, gchar const *attr)
{
- g_assert(this->getRepr() != NULL);
+ g_assert(this->getRepr() != nullptr);
sp_repr_css_set(this->getRepr(), css, attr);
}
void SPObject::changeCSS(SPCSSAttr *css, gchar const *attr)
{
- g_assert(this->getRepr() != NULL);
+ g_assert(this->getRepr() != nullptr);
sp_repr_css_change(this->getRepr(), css, attr);
}
@@ -443,7 +443,7 @@ void SPObject::setLabel(gchar const *label)
void SPObject::requestOrphanCollection() {
- g_return_if_fail(document != NULL);
+ g_return_if_fail(document != nullptr);
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
// do not remove style or script elements (Bug #276244)
@@ -484,7 +484,7 @@ void SPObject::_sendDeleteSignalRecursive() {
void SPObject::deleteObject(bool propagate, bool propagate_descendants)
{
- sp_object_ref(this, NULL);
+ sp_object_ref(this, nullptr);
if ( SP_IS_LPE_ITEM(this) && SP_LPE_ITEM(this)->hasPathEffect()) {
SP_LPE_ITEM(this)->removeAllPathEffects(false);
}
@@ -503,7 +503,7 @@ void SPObject::deleteObject(bool propagate, bool propagate_descendants)
if (_successor) {
_successor->deleteObject(propagate, propagate_descendants);
}
- sp_object_unref(this, NULL);
+ sp_object_unref(this, nullptr);
}
void SPObject::cropToObject(SPObject *except)
@@ -527,7 +527,7 @@ void SPObject::attach(SPObject *object, SPObject *prev)
{
//g_return_if_fail(parent != NULL);
//g_return_if_fail(SP_IS_OBJECT(parent));
- g_return_if_fail(object != NULL);
+ g_return_if_fail(object != nullptr);
g_return_if_fail(SP_IS_OBJECT(object));
g_return_if_fail(!prev || SP_IS_OBJECT(prev));
g_return_if_fail(!prev || prev->parent == this);
@@ -566,14 +566,14 @@ void SPObject::detach(SPObject *object)
{
//g_return_if_fail(parent != NULL);
//g_return_if_fail(SP_IS_OBJECT(parent));
- g_return_if_fail(object != NULL);
+ g_return_if_fail(object != nullptr);
g_return_if_fail(SP_IS_OBJECT(object));
g_return_if_fail(object->parent == this);
children.erase(children.iterator_to(*object));
object->releaseReferences();
- object->parent = NULL;
+ object->parent = nullptr;
this->_updateTotalHRefCount(-object->_total_hrefcount);
sp_object_unref(object, this);
@@ -581,7 +581,7 @@ void SPObject::detach(SPObject *object)
SPObject *SPObject::get_child_by_repr(Inkscape::XML::Node *repr)
{
- g_return_val_if_fail(repr != NULL, NULL);
+ g_return_val_if_fail(repr != nullptr, NULL);
SPObject *result = nullptr;
if (children.size() > 0 && children.back().getRepr() == repr) {
@@ -603,7 +603,7 @@ void SPObject::child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
const std::string type_string = NodeTraits::get_type_string(*child);
SPObject* ochild = SPFactory::createObject(type_string);
- if (ochild == NULL) {
+ if (ochild == nullptr) {
// Currenty, there are many node types that do not have
// corresponding classes in the SPObject tree.
// (rdf:RDF, inkscape:clipboard, ...)
@@ -611,9 +611,9 @@ void SPObject::child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
return;
}
- SPObject *prev = ref ? object->get_child_by_repr(ref) : NULL;
+ SPObject *prev = ref ? object->get_child_by_repr(ref) : nullptr;
object->attach(ochild, prev);
- sp_object_unref(ochild, NULL);
+ sp_object_unref(ochild, nullptr);
ochild->invoke_build(object->document, child, object->cloned);
}
@@ -644,8 +644,8 @@ void SPObject::order_changed(Inkscape::XML::Node *child, Inkscape::XML::Node * /
SPObject* object = this;
SPObject *ochild = object->get_child_by_repr(child);
- g_return_if_fail(ochild != NULL);
- SPObject *prev = new_ref ? object->get_child_by_repr(new_ref) : NULL;
+ g_return_if_fail(ochild != nullptr);
+ SPObject *prev = new_ref ? object->get_child_by_repr(new_ref) : nullptr;
object->reorder(ochild, prev);
ochild->_position_changed_signal.emit(ochild);
}
@@ -668,11 +668,11 @@ void SPObject::build(SPDocument *document, Inkscape::XML::Node *repr) {
// stuff externally modified to have no id.
object->clone_original = document->getObjectById(repr->attribute("id"));
- for (Inkscape::XML::Node *rchild = repr->firstChild() ; rchild != NULL; rchild = rchild->next()) {
+ for (Inkscape::XML::Node *rchild = repr->firstChild() ; rchild != nullptr; rchild = rchild->next()) {
const std::string typeString = NodeTraits::get_type_string(*rchild);
SPObject* child = SPFactory::createObject(typeString);
- if (child == NULL) {
+ if (child == nullptr) {
// Currenty, there are many node types that do not have
// corresponding classes in the SPObject tree.
// (rdf:RDF, inkscape:clipboard, ...)
@@ -681,7 +681,7 @@ void SPObject::build(SPDocument *document, Inkscape::XML::Node *repr) {
}
object->attach(child, object->lastChild());
- sp_object_unref(child, NULL);
+ sp_object_unref(child, nullptr);
child->invoke_build(document, rchild, object->cloned);
}
@@ -699,12 +699,12 @@ void SPObject::invoke_build(SPDocument *document, Inkscape::XML::Node *repr, uns
//g_assert(object != NULL);
//g_assert(SP_IS_OBJECT(object));
- g_assert(document != NULL);
- g_assert(repr != NULL);
+ g_assert(document != nullptr);
+ g_assert(repr != nullptr);
- g_assert(this->document == NULL);
- g_assert(this->repr == NULL);
- g_assert(this->getId() == NULL);
+ g_assert(this->document == nullptr);
+ g_assert(this->repr == nullptr);
+ g_assert(this->getId() == nullptr);
/* Bookkeeping */
@@ -727,7 +727,7 @@ void SPObject::invoke_build(SPDocument *document, Inkscape::XML::Node *repr, uns
if (!document->isSeeking()) {
{
gchar *realid = sp_object_get_unique_id(this, id);
- g_assert(realid != NULL);
+ g_assert(realid != nullptr);
this->document->bindObjectToId(realid, this);
SPObjectImpl::setId(this, realid);
@@ -735,7 +735,7 @@ void SPObject::invoke_build(SPDocument *document, Inkscape::XML::Node *repr, uns
}
/* Redefine ID, if required */
- if ((id == NULL) || (strcmp(id, this->getId()) != 0)) {
+ if ((id == nullptr) || (strcmp(id, this->getId()) != 0)) {
this->repr->setAttribute("id", this->getId());
}
} else if (id) {
@@ -748,7 +748,7 @@ void SPObject::invoke_build(SPDocument *document, Inkscape::XML::Node *repr, uns
}
}
} else {
- g_assert(this->getId() == NULL);
+ g_assert(this->getId() == nullptr);
}
@@ -790,7 +790,7 @@ SPObject* SPObject::nthChild(unsigned index) {
counter++;
}
}
- return NULL;
+ return nullptr;
}
void SPObject::addChild(Inkscape::XML::Node *child, Inkscape::XML::Node * prev)
@@ -815,15 +815,15 @@ void SPObject::releaseReferences() {
if (!cloned) {
if (this->id) {
- this->document->bindObjectToId(this->id, NULL);
+ this->document->bindObjectToId(this->id, nullptr);
}
g_free(this->id);
- this->id = NULL;
+ this->id = nullptr;
g_free(this->_default_label);
- this->_default_label = NULL;
+ this->_default_label = nullptr;
- this->document->bindObjectToRepr(this->repr, NULL);
+ this->document->bindObjectToRepr(this->repr, nullptr);
Inkscape::GC::release(this->repr);
} else {
@@ -835,8 +835,8 @@ void SPObject::releaseReferences() {
// this->style = sp_style_unref(this->style);
// }
- this->document = NULL;
- this->repr = NULL;
+ this->document = nullptr;
+ this->repr = nullptr;
}
@@ -897,7 +897,7 @@ void SPObject::set(unsigned int key, gchar const* value) {
//XML Tree being used here.
if ( !object->cloned && object->getRepr()->type() == Inkscape::XML::ELEMENT_NODE ) {
SPDocument *document=object->document;
- SPObject *conflict=NULL;
+ SPObject *conflict=nullptr;
gchar const *new_id = value;
@@ -907,20 +907,20 @@ void SPObject::set(unsigned int key, gchar const* value) {
if ( conflict && conflict != object ) {
if (!document->isSeeking()) {
- sp_object_ref(conflict, NULL);
+ sp_object_ref(conflict, nullptr);
// give the conflicting object a new ID
- gchar *new_conflict_id = sp_object_get_unique_id(conflict, NULL);
+ gchar *new_conflict_id = sp_object_get_unique_id(conflict, nullptr);
conflict->getRepr()->setAttribute("id", new_conflict_id);
g_free(new_conflict_id);
- sp_object_unref(conflict, NULL);
+ sp_object_unref(conflict, nullptr);
} else {
- new_id = NULL;
+ new_id = nullptr;
}
}
if (object->getId()) {
- document->bindObjectToId(object->getId(), NULL);
- SPObjectImpl::setId(object, 0);
+ document->bindObjectToId(object->getId(), nullptr);
+ SPObjectImpl::setId(object, nullptr);
}
if (new_id) {
@@ -929,7 +929,7 @@ void SPObject::set(unsigned int key, gchar const* value) {
}
g_free(object->_default_label);
- object->_default_label = NULL;
+ object->_default_label = nullptr;
}
break;
case SP_ATTR_INKSCAPE_LABEL:
@@ -937,10 +937,10 @@ void SPObject::set(unsigned int key, gchar const* value) {
if (value) {
object->_label = g_strdup(value);
} else {
- object->_label = NULL;
+ object->_label = nullptr;
}
g_free(object->_default_label);
- object->_default_label = NULL;
+ object->_default_label = nullptr;
break;
case SP_ATTR_INKSCAPE_COLLECT:
if ( value && !strcmp(value, "always") ) {
@@ -987,10 +987,10 @@ void SPObject::readAttr(gchar const *key)
{
//g_assert(object != NULL);
//g_assert(SP_IS_OBJECT(object));
- g_assert(key != NULL);
+ g_assert(key != nullptr);
//XML Tree being used here.
- g_assert(this->getRepr() != NULL);
+ g_assert(this->getRepr() != nullptr);
unsigned int keyid = sp_attribute_lookup(key);
if (keyid != SP_ATTR_INVALID) {
@@ -1032,7 +1032,7 @@ static gchar const *sp_xml_get_space_string(unsigned int space)
case SP_XML_SPACE_PRESERVE:
return "preserve";
default:
- return NULL;
+ return nullptr;
}
}
@@ -1044,7 +1044,7 @@ Inkscape::XML::Node* SPObject::write(Inkscape::XML::Document *doc, Inkscape::XML
if (!repr && (flags & SP_OBJECT_WRITE_BUILD)) {
repr = this->getRepr()->duplicate(doc);
if (!( flags & SP_OBJECT_WRITE_EXT )) {
- repr->setAttribute("inkscape:collect", NULL);
+ repr->setAttribute("inkscape:collect", nullptr);
}
} else if (repr) {
repr->setAttribute("id", this->getId());
@@ -1060,7 +1060,7 @@ Inkscape::XML::Node* SPObject::write(Inkscape::XML::Document *doc, Inkscape::XML
{
repr->setAttribute("inkscape:collect", "always");
} else {
- repr->setAttribute("inkscape:collect", NULL);
+ repr->setAttribute("inkscape:collect", nullptr);
}
if (style) {
@@ -1078,7 +1078,7 @@ Inkscape::XML::Node* SPObject::write(Inkscape::XML::Document *doc, Inkscape::XML
}
if( s.empty() ) {
- repr->setAttribute("style", NULL);
+ repr->setAttribute("style", nullptr);
} else {
repr->setAttribute("style", s.c_str());
}
@@ -1138,14 +1138,14 @@ Inkscape::XML::Node * SPObject::updateRepr(unsigned int flags)
#ifdef OBJECT_TRACE
objectTrace( "SPObject::updateRepr 1", false );
#endif
- return NULL;
+ return nullptr;
}
} else {
/* cloned objects have no repr */
#ifdef OBJECT_TRACE
objectTrace( "SPObject::updateRepr 1", false );
#endif
- return NULL;
+ return nullptr;
}
}
@@ -1155,14 +1155,14 @@ Inkscape::XML::Node * SPObject::updateRepr(Inkscape::XML::Document *doc, Inkscap
objectTrace( "SPObject::updateRepr 2" );
#endif
- g_assert(doc != NULL);
+ g_assert(doc != nullptr);
if (cloned) {
/* cloned objects have no repr */
#ifdef OBJECT_TRACE
objectTrace( "SPObject::updateRepr 2", false );
#endif
- return NULL;
+ return nullptr;
}
if (!(flags & SP_OBJECT_WRITE_BUILD) && !repr) {
@@ -1183,7 +1183,7 @@ Inkscape::XML::Node * SPObject::updateRepr(Inkscape::XML::Document *doc, Inkscap
void SPObject::requestDisplayUpdate(unsigned int flags)
{
- g_return_if_fail( this->document != NULL );
+ g_return_if_fail( this->document != nullptr );
if (update_in_progress) {
g_print("WARNING: Requested update while update in progress, counter = %d\n", update_in_progress);
@@ -1276,7 +1276,7 @@ void SPObject::updateDisplay(SPCtx *ctx, unsigned int flags)
void SPObject::requestModified(unsigned int flags)
{
- g_return_if_fail( this->document != NULL );
+ g_return_if_fail( this->document != nullptr );
/* requestModified must be used only to set one of SP_OBJECT_MODIFIED_FLAG or
* SP_OBJECT_CHILD_MODIFIED_FLAG */
@@ -1340,10 +1340,10 @@ void SPObject::emitModified(unsigned int flags)
gchar const *SPObject::getTagName(SPException *ex) const
{
- g_assert(repr != NULL);
+ g_assert(repr != nullptr);
/* If exception is not clear, return */
if (!SP_EXCEPTION_IS_OK(ex)) {
- return NULL;
+ return nullptr;
}
/// \todo fixme: Exception if object is NULL? */
@@ -1353,10 +1353,10 @@ gchar const *SPObject::getTagName(SPException *ex) const
gchar const *SPObject::getAttribute(gchar const *key, SPException *ex) const
{
- g_assert(this->repr != NULL);
+ g_assert(this->repr != nullptr);
/* If exception is not clear, return */
if (!SP_EXCEPTION_IS_OK(ex)) {
- return NULL;
+ return nullptr;
}
/// \todo fixme: Exception if object is NULL? */
@@ -1366,7 +1366,7 @@ gchar const *SPObject::getAttribute(gchar const *key, SPException *ex) const
void SPObject::setAttribute(gchar const *key, gchar const *value, SPException *ex)
{
- g_assert(this->repr != NULL);
+ g_assert(this->repr != nullptr);
/* If exception is not clear, return */
g_return_if_fail(SP_EXCEPTION_IS_OK(ex));
@@ -1377,13 +1377,13 @@ void SPObject::setAttribute(gchar const *key, gchar const *value, SPException *e
void SPObject::setAttribute(char const *key, Glib::ustring const &value, SPException *ex)
{
- setAttribute(key, value.empty() ? NULL : value.c_str(), ex);
+ setAttribute(key, value.empty() ? nullptr : value.c_str(), ex);
}
void SPObject::setAttribute(Glib::ustring const &key, Glib::ustring const &value, SPException *ex)
{
- setAttribute( key.empty() ? NULL : key.c_str(),
- value.empty() ? NULL : value.c_str(), ex);
+ setAttribute( key.empty() ? nullptr : key.c_str(),
+ value.empty() ? nullptr : value.c_str(), ex);
}
@@ -1394,12 +1394,12 @@ void SPObject::removeAttribute(gchar const *key, SPException *ex)
/// \todo fixme: Exception if object is NULL? */
//XML Tree being used here.
- getRepr()->setAttribute(key, NULL, false);
+ getRepr()->setAttribute(key, nullptr, false);
}
bool SPObject::storeAsDouble( gchar const *key, double *val ) const
{
- g_assert(this->getRepr()!= NULL);
+ g_assert(this->getRepr()!= nullptr);
return sp_repr_get_double(((Inkscape::XML::Node *)(this->getRepr())),key,val);
}
@@ -1416,15 +1416,15 @@ sp_object_get_unique_id(SPObject *object,
//XML Tree being used here.
gchar const *name = object->getRepr()->name();
- g_assert(name != NULL);
+ g_assert(name != nullptr);
gchar const *local = strchr(name, ':');
if (local) {
name = local + 1;
}
- if (id != NULL) {
- if (object->document->getObjectById(id) == NULL) {
+ if (id != nullptr) {
+ if (object->document->getObjectById(id) == nullptr) {
return g_strdup(id);
}
}
@@ -1438,7 +1438,7 @@ sp_object_get_unique_id(SPObject *object,
do {
++count;
g_snprintf(count_buf, count_buflen, "%lu", count);
- } while ( object->document->getObjectById(buf) != NULL );
+ } while ( object->document->getObjectById(buf) != nullptr );
return buf;
}
@@ -1448,7 +1448,7 @@ gchar const * SPObject::getStyleProperty(gchar const *key, gchar const *def) con
{
//g_return_val_if_fail(object != NULL, NULL);
//g_return_val_if_fail(SP_IS_OBJECT(object), NULL);
- g_return_val_if_fail(key != NULL, NULL);
+ g_return_val_if_fail(key != nullptr, NULL);
//XML Tree being used here.
gchar const *style = getRepr()->attribute("style");
@@ -1456,7 +1456,7 @@ gchar const * SPObject::getStyleProperty(gchar const *key, gchar const *def) con
size_t const len = strlen(key);
char const *p;
while ( (p = strstr(style, key))
- != NULL )
+ != nullptr )
{
p += len;
while ((*p <= ' ') && *p) {
@@ -1540,7 +1540,7 @@ bool SPObject::setDesc(gchar const *desc, bool verbatim)
char * SPObject::getTitleOrDesc(gchar const *svg_tagname) const
{
- char *result = NULL;
+ char *result = nullptr;
SPObject *elem = findFirstChild(svg_tagname);
if ( elem ) {
//This string copy could be avoided by changing
@@ -1565,7 +1565,7 @@ bool SPObject::setTitleOrDesc(gchar const *value, gchar const *svg_tagname, bool
}
}
if (just_whitespace) {
- value = NULL;
+ value = nullptr;
}
}
// Don't stomp on mark-up if there is no real change.
@@ -1583,8 +1583,8 @@ bool SPObject::setTitleOrDesc(gchar const *value, gchar const *svg_tagname, bool
SPObject *elem = findFirstChild(svg_tagname);
- if (value == NULL) {
- if (elem == NULL) {
+ if (value == nullptr) {
+ if (elem == nullptr) {
return false;
}
// delete the title/description(s)
@@ -1597,11 +1597,11 @@ bool SPObject::setTitleOrDesc(gchar const *value, gchar const *svg_tagname, bool
Inkscape::XML::Document *xml_doc = document->getReprDoc();
- if (elem == NULL) {
+ if (elem == nullptr) {
// create a new 'title' or 'desc' element, putting it at the
// beginning (in accordance with the spec's recommendations)
Inkscape::XML::Node *xml_elem = xml_doc->createElement(svg_tagname);
- repr->addChild(xml_elem, NULL);
+ repr->addChild(xml_elem, nullptr);
elem = document->getObjectByRepr(xml_elem);
Inkscape::GC::release(xml_elem);
}
diff --git a/src/object/sp-object.h b/src/object/sp-object.h
index f969e0c0a..3b083761e 100644
--- a/src/object/sp-object.h
+++ b/src/object/sp-object.h
@@ -137,7 +137,7 @@ public:
* \pre object points to real object
* @todo need to move this to be a member of SPObject.
*/
-SPObject *sp_object_ref(SPObject *object, SPObject *owner=NULL);
+SPObject *sp_object_ref(SPObject *object, SPObject *owner=nullptr);
/**
* Decrease reference count of object, with possible debugging and
@@ -148,7 +148,7 @@ SPObject *sp_object_ref(SPObject *object, SPObject *owner=NULL);
* \pre object points to real object
* @todo need to move this to be a member of SPObject.
*/
-SPObject *sp_object_unref(SPObject *object, SPObject *owner=NULL);
+SPObject *sp_object_unref(SPObject *object, SPObject *owner=nullptr);
/**
* Increase weak refcount.
@@ -287,7 +287,7 @@ public:
typedef Inkscape::Util::ForwardPointerIterator<SPObject const, ParentIteratorStrategy> ConstParentIterator;
bool isSiblingOf(SPObject const *object) const {
- if (object == NULL) return false;
+ if (object == nullptr) return false;
return this->parent && this->parent == object->parent;
}
@@ -510,7 +510,7 @@ public:
assert(successor != NULL);
assert(_successor == NULL);
assert(successor->_successor == NULL);
- sp_object_ref(successor, NULL);
+ sp_object_ref(successor, nullptr);
_successor = successor;
}
@@ -696,20 +696,20 @@ public:
unsigned getPosition();
- char const * getAttribute(char const *name,SPException *ex=NULL) const;
+ char const * getAttribute(char const *name,SPException *ex=nullptr) const;
void appendChild(Inkscape::XML::Node *child);
- void addChild(Inkscape::XML::Node *child,Inkscape::XML::Node *prev=NULL);
+ void addChild(Inkscape::XML::Node *child,Inkscape::XML::Node *prev=nullptr);
/**
* Call virtual set() function of object.
*/
void setKeyValue(unsigned int key, char const *value);
- void setAttribute( char const *key, char const *value, SPException *ex=NULL);
- void setAttribute( char const *key, Glib::ustring const &value, SPException *ex=NULL);
- void setAttribute(Glib::ustring const &key, Glib::ustring const &value, SPException *ex=NULL);
+ void setAttribute( char const *key, char const *value, SPException *ex=nullptr);
+ void setAttribute( char const *key, Glib::ustring const &value, SPException *ex=nullptr);
+ void setAttribute(Glib::ustring const &key, Glib::ustring const &value, SPException *ex=nullptr);
/**
* Read value of key attribute from XML node into object.
@@ -718,7 +718,7 @@ public:
char const *getTagName(SPException *ex) const;
- void removeAttribute(char const *key, SPException *ex=NULL);
+ void removeAttribute(char const *key, SPException *ex=nullptr);
/**
* Returns an object style property.
diff --git a/src/object/sp-offset.cpp b/src/object/sp-offset.cpp
index dbb5d15e4..9f9297077 100644
--- a/src/object/sp-offset.cpp
+++ b/src/object/sp-offset.cpp
@@ -87,15 +87,15 @@ static bool use_slow_but_correct_offset_method = false;
SPOffset::SPOffset() : SPShape() {
this->rad = 1.0;
- this->original = NULL;
- this->originalPath = NULL;
+ this->original = nullptr;
+ this->originalPath = nullptr;
this->knotSet = false;
this->sourceDirty=false;
this->isUpdating=false;
// init various connections
- this->sourceHref = NULL;
- this->sourceRepr = NULL;
- this->sourceObject = NULL;
+ this->sourceHref = nullptr;
+ this->sourceRepr = nullptr;
+ this->sourceObject = nullptr;
// set up the uri reference
this->sourceRef = new SPUseReference(this);
@@ -122,7 +122,7 @@ void SPOffset::build(SPDocument *document, Inkscape::XML::Node *repr) {
//in all the below lines in the block while it shouldn't be.
gchar const *oldA = this->getRepr()->attribute("sodipodi:radius");
this->getRepr()->setAttribute("inkscape:radius",oldA);
- this->getRepr()->setAttribute("sodipodi:radius",NULL);
+ this->getRepr()->setAttribute("sodipodi:radius",nullptr);
this->readAttr( "inkscape:radius" );
}
@@ -132,7 +132,7 @@ void SPOffset::build(SPDocument *document, Inkscape::XML::Node *repr) {
} else {
gchar const *oldA = this->getRepr()->attribute("sodipodi:original");
this->getRepr()->setAttribute("inkscape:original",oldA);
- this->getRepr()->setAttribute("sodipodi:original",NULL);
+ this->getRepr()->setAttribute("sodipodi:original",nullptr);
this->readAttr( "inkscape:original" );
}
@@ -155,7 +155,7 @@ void SPOffset::build(SPDocument *document, Inkscape::XML::Node *repr) {
free(nA);
- this->getRepr()->setAttribute("inkscape:href",NULL);
+ this->getRepr()->setAttribute("inkscape:href",nullptr);
}
this->readAttr( "xlink:href" );
@@ -182,7 +182,7 @@ Inkscape::XML::Node* SPOffset::write(Inkscape::XML::Document *xml_doc, Inkscape:
// Make sure the offset has curve
SPCurve *curve = SP_SHAPE (this)->getCurve();
- if (curve == NULL) {
+ if (curve == nullptr) {
this->set_shape();
}
@@ -205,8 +205,8 @@ void SPOffset::release() {
delete ((Path *) this->originalPath);
}
- this->original = NULL;
- this->originalPath = NULL;
+ this->original = nullptr;
+ this->originalPath = nullptr;
sp_offset_quit_listening(this);
@@ -214,7 +214,7 @@ void SPOffset::release() {
g_free(this->sourceHref);
- this->sourceHref = NULL;
+ this->sourceHref = nullptr;
this->sourceRef->detach();
SPShape::release();
@@ -230,14 +230,14 @@ void SPOffset::set(unsigned int key, const gchar* value) {
{
case SP_ATTR_INKSCAPE_ORIGINAL:
case SP_ATTR_SODIPODI_ORIGINAL:
- if (value == NULL) {
+ if (value == nullptr) {
} else {
if (this->original) {
free (this->original);
delete ((Path *) this->originalPath);
- this->original = NULL;
- this->originalPath = NULL;
+ this->original = nullptr;
+ this->originalPath = nullptr;
}
this->original = strdup (value);
@@ -272,13 +272,13 @@ void SPOffset::set(unsigned int key, const gchar* value) {
case SP_ATTR_INKSCAPE_HREF:
case SP_ATTR_XLINK_HREF:
- if ( value == NULL ) {
+ if ( value == nullptr ) {
sp_offset_quit_listening(this);
if ( this->sourceHref ) {
g_free(this->sourceHref);
}
- this->sourceHref = NULL;
+ this->sourceHref = nullptr;
this->sourceRef->detach();
} else {
if ( this->sourceHref && ( strcmp(value, this->sourceHref) == 0 ) ) {
@@ -339,7 +339,7 @@ gchar* SPOffset::description() const {
}
void SPOffset::set_shape() {
- if ( this->originalPath == NULL ) {
+ if ( this->originalPath == nullptr ) {
// oops : no path?! (the offset object should do harakiri)
return;
}
@@ -359,7 +359,7 @@ void SPOffset::set_shape() {
if ( res_d ) {
Geom::PathVector pv = sp_svg_read_pathv(res_d);
SPCurve *c = new SPCurve(pv);
- g_assert(c != NULL);
+ g_assert(c != nullptr);
this->setCurveInsync (c);
this->setCurveBeforeLPE(c);
@@ -539,7 +539,7 @@ void SPOffset::set_shape() {
if ( nPartSurf >= 0 ) {
// inversion de la surface -> disparait
delete parts[i];
- parts[i]=NULL;
+ parts[i]=nullptr;
} else {
}
@@ -576,7 +576,7 @@ void SPOffset::set_shape() {
if ( nPartSurf >= 0 ) {
// inversion de la surface -> disparait
delete parts[i];
- parts[i]=NULL;
+ parts[i]=nullptr;
} else {
}
@@ -649,7 +649,7 @@ void SPOffset::set_shape() {
delete theRes;
}
{
- char *res_d = NULL;
+ char *res_d = nullptr;
if (orig->descr_cmd.size() <= 1)
{
@@ -667,7 +667,7 @@ void SPOffset::set_shape() {
Geom::PathVector pv = sp_svg_read_pathv(res_d);
SPCurve *c = new SPCurve(pv);
- g_assert(c != NULL);
+ g_assert(c != nullptr);
this->setCurveInsync (c);
this->setCurveBeforeLPE(c);
@@ -774,7 +774,7 @@ vectors_are_clockwise (Geom::Point A, Geom::Point B, Geom::Point C)
double
sp_offset_distance_to_original (SPOffset * offset, Geom::Point px)
{
- if (offset == NULL || offset->originalPath == NULL || ((Path *) offset->originalPath)->descr_cmd.size() <= 1) {
+ if (offset == nullptr || offset->originalPath == nullptr || ((Path *) offset->originalPath)->descr_cmd.size() <= 1) {
return 1.0;
}
@@ -936,7 +936,7 @@ sp_offset_top_point (SPOffset const * offset, Geom::Point *px)
{
(*px) = Geom::Point(0, 0);
- if (offset == NULL) {
+ if (offset == nullptr) {
return;
}
@@ -948,7 +948,7 @@ sp_offset_top_point (SPOffset const * offset, Geom::Point *px)
SPCurve *curve = SP_SHAPE (offset)->getCurve();
- if (curve == NULL)
+ if (curve == nullptr)
{
// CPPIFY
//offset->set_shape();
@@ -956,7 +956,7 @@ sp_offset_top_point (SPOffset const * offset, Geom::Point *px)
curve = SP_SHAPE (offset)->getCurve();
- if (curve == NULL)
+ if (curve == nullptr)
return;
}
@@ -988,7 +988,7 @@ sp_offset_top_point (SPOffset const * offset, Geom::Point *px)
// the listening functions
static void sp_offset_start_listening(SPOffset *offset,SPObject* to)
{
- if ( to == NULL ) {
+ if ( to == nullptr ) {
return;
}
@@ -1002,7 +1002,7 @@ static void sp_offset_start_listening(SPOffset *offset,SPObject* to)
static void sp_offset_quit_listening(SPOffset *offset)
{
- if ( offset->sourceObject == NULL ) {
+ if ( offset->sourceObject == nullptr ) {
return;
}
@@ -1010,8 +1010,8 @@ static void sp_offset_quit_listening(SPOffset *offset)
offset->_delete_connection.disconnect();
offset->_transformed_connection.disconnect();
- offset->sourceRepr = NULL;
- offset->sourceObject = NULL;
+ offset->sourceRepr = nullptr;
+ offset->sourceObject = nullptr;
}
static void
@@ -1083,7 +1083,7 @@ sp_offset_delete_self(SPObject */*deleted*/, SPOffset *offset)
g_free(offset->sourceHref);
}
- offset->sourceHref = NULL;
+ offset->sourceHref = nullptr;
offset->sourceRef->detach();
} else if (mode == SP_CLONE_ORPHANS_DELETE) {
offset->deleteObject();
@@ -1104,7 +1104,7 @@ sp_offset_source_modified (SPObject */*iSource*/, guint flags, SPItem *item)
static void
refresh_offset_source(SPOffset* offset)
{
- if ( offset == NULL ) {
+ if ( offset == nullptr ) {
return;
}
@@ -1114,12 +1114,12 @@ refresh_offset_source(SPOffset* offset)
// The bad case: no d attribute. Must check that it's an SPShape and then take the outline.
SPObject *refobj=offset->sourceObject;
- if ( refobj == NULL ) {
+ if ( refobj == nullptr ) {
return;
}
SPItem *item = SP_ITEM (refobj);
- SPCurve *curve = NULL;
+ SPCurve *curve = nullptr;
if (SP_IS_SHAPE (item)) {
curve = SP_SHAPE (item)->getCurve ();
@@ -1131,7 +1131,7 @@ refresh_offset_source(SPOffset* offset)
return;
}
- if (curve == NULL) {
+ if (curve == nullptr) {
return;
}
@@ -1162,7 +1162,7 @@ refresh_offset_source(SPOffset* offset)
orig->Fill (theShape, 0);
css = sp_repr_css_attr (offset->sourceRepr , "style");
- val = sp_repr_css_property (css, "fill-rule", NULL);
+ val = sp_repr_css_property (css, "fill-rule", nullptr);
if (val && strcmp (val, "nonzero") == 0)
{
@@ -1208,7 +1208,7 @@ sp_offset_get_source (SPOffset *offset)
}
}
- return NULL;
+ return nullptr;
}
diff --git a/src/object/sp-paint-server.cpp b/src/object/sp-paint-server.cpp
index 958078012..3e685ad24 100644
--- a/src/object/sp-paint-server.cpp
+++ b/src/object/sp-paint-server.cpp
@@ -66,7 +66,7 @@ bool SPPaintServer::isValid() const
Inkscape::DrawingPattern *SPPaintServer::show(Inkscape::Drawing &/*drawing*/, unsigned int /*key*/, Geom::OptRect /*bbox*/)
{
- return NULL;
+ return nullptr;
}
void SPPaintServer::hide(unsigned int /*key*/)
@@ -79,7 +79,7 @@ void SPPaintServer::setBBox(unsigned int /*key*/, Geom::OptRect const &/*bbox*/)
cairo_pattern_t* SPPaintServer::pattern_new(cairo_t * /*ct*/, Geom::OptRect const &/*bbox*/, double /*opacity*/)
{
- return NULL;
+ return nullptr;
}
/*
diff --git a/src/object/sp-paint-server.h b/src/object/sp-paint-server.h
index 23d0399af..4cd61bcda 100644
--- a/src/object/sp-paint-server.h
+++ b/src/object/sp-paint-server.h
@@ -87,7 +87,7 @@ PaintServer *chase_hrefs(PaintServer *src, sigc::slot<bool, PaintServer const *>
if ( p2 == p1 ) {
/* We've been here before, so return NULL to indicate that no matching gradient found
* in the chain. */
- return NULL;
+ return nullptr;
}
}
}
diff --git a/src/object/sp-path.cpp b/src/object/sp-path.cpp
index de31b45e2..51fa549e7 100644
--- a/src/object/sp-path.cpp
+++ b/src/object/sp-path.cpp
@@ -196,15 +196,15 @@ void SPPath::build(SPDocument *document, Inkscape::XML::Node *repr) {
this->readAttr( "d" );
/* d is a required attribute */
- char const *d = this->getAttribute("d", NULL);
+ char const *d = this->getAttribute("d", nullptr);
- if (d == NULL) {
+ if (d == nullptr) {
// First see if calculating the path effect will generate "d":
this->update_patheffect(true);
- d = this->getAttribute("d", NULL);
+ d = this->getAttribute("d", nullptr);
// I guess that didn't work, now we have nothing useful to write ("")
- if (d == NULL) {
+ if (d == nullptr) {
this->setKeyValue( sp_attribute_lookup("d"), "");
}
}
@@ -228,7 +228,7 @@ void SPPath::set(unsigned int key, const gchar* value) {
curve->unref();
}
} else {
- this->setCurveBeforeLPE(NULL);
+ this->setCurveBeforeLPE(nullptr);
}
sp_lpe_item_update_patheffect(this, true, true);
@@ -244,7 +244,7 @@ void SPPath::set(unsigned int key, const gchar* value) {
curve->unref();
}
} else {
- this->setCurve(NULL);
+ this->setCurve(nullptr);
}
break;
@@ -285,16 +285,16 @@ g_message("sp_path_write writes 'd' attribute");
repr->setAttribute("d", str);
g_free(str);
} else {
- repr->setAttribute("d", NULL);
+ repr->setAttribute("d", nullptr);
}
if (flags & SP_OBJECT_WRITE_EXT) {
- if ( this->_curve_before_lpe != NULL ) {
+ if ( this->_curve_before_lpe != nullptr ) {
gchar *str = sp_svg_write_path(this->_curve_before_lpe->get_pathvector());
repr->setAttribute("inkscape:original-d", str);
g_free(str);
} else {
- repr->setAttribute("inkscape:original-d", NULL);
+ repr->setAttribute("inkscape:original-d", nullptr);
}
}
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<SPObject *> &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<Inkscape::XML::Node *> &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<Inkscape::XML::Node *> &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;
diff --git a/src/object/sp-polygon.cpp b/src/object/sp-polygon.cpp
index b2a0c1480..90bc0c731 100644
--- a/src/object/sp-polygon.cpp
+++ b/src/object/sp-polygon.cpp
@@ -69,7 +69,7 @@ Inkscape::XML::Node* SPPolygon::write(Inkscape::XML::Document *xml_doc, Inkscape
/* We can safely write points here, because all subclasses require it too (Lauris) */
/* While saving polygon element without points attribute _curve is NULL (see bug 1202753) */
- if (this->_curve != NULL) {
+ if (this->_curve != nullptr) {
gchar *str = sp_svg_write_polygon(this->_curve->get_pathvector());
repr->setAttribute("points", str);
g_free(str);
@@ -91,7 +91,7 @@ static gboolean polygon_get_value(gchar const **p, gdouble *v)
return false;
}
- gchar *e = NULL;
+ gchar *e = nullptr;
*v = g_ascii_strtod(*p, &e);
if (e == *p) {
diff --git a/src/object/sp-polyline.cpp b/src/object/sp-polyline.cpp
index 3be4700eb..aa8dab7e2 100644
--- a/src/object/sp-polyline.cpp
+++ b/src/object/sp-polyline.cpp
@@ -46,7 +46,7 @@ void SPPolyLine::set(unsigned int key, const gchar* value) {
hascpt = FALSE;
cptr = value;
- eptr = NULL;
+ eptr = nullptr;
while (TRUE) {
gdouble x, y;
diff --git a/src/object/sp-rect.cpp b/src/object/sp-rect.cpp
index 08c3df4fd..783ad309a 100644
--- a/src/object/sp-rect.cpp
+++ b/src/object/sp-rect.cpp
@@ -198,8 +198,8 @@ const char* SPRect::displayName() const {
void SPRect::set_shape() {
if ((this->height.computed < 1e-18) || (this->width.computed < 1e-18)) {
- this->setCurveInsync(NULL);
- this->setCurveBeforeLPE(NULL);
+ this->setCurveInsync(nullptr);
+ this->setCurveBeforeLPE(nullptr);
return;
}
diff --git a/src/object/sp-root.cpp b/src/object/sp-root.cpp
index 3f31588cc..d1c4b4d35 100644
--- a/src/object/sp-root.cpp
+++ b/src/object/sp-root.cpp
@@ -30,7 +30,7 @@
SPRoot::SPRoot() : SPGroup(), SPViewBox()
{
- this->onload = NULL;
+ this->onload = nullptr;
static Inkscape::Version const zero_version(0, 0);
@@ -44,7 +44,7 @@ SPRoot::SPRoot() : SPGroup(), SPViewBox()
this->width.unset(SVGLength::PERCENT, 1.0, 1.0);
this->height.unset(SVGLength::PERCENT, 1.0, 1.0);
- this->defs = NULL;
+ this->defs = nullptr;
}
SPRoot::~SPRoot()
@@ -91,7 +91,7 @@ void SPRoot::build(SPDocument *document, Inkscape::XML::Node *repr)
void SPRoot::release()
{
- this->defs = NULL;
+ this->defs = nullptr;
SPGroup::release();
}
@@ -191,7 +191,7 @@ void SPRoot::child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
void SPRoot::remove_child(Inkscape::XML::Node *child)
{
if (this->defs && (this->defs->getRepr() == child)) {
- SPObject *iter = 0;
+ SPObject *iter = nullptr;
// We search for first remaining <defs> node - it is not beautiful, but works
for (auto& child: children) {
@@ -204,7 +204,7 @@ void SPRoot::remove_child(Inkscape::XML::Node *child)
if (!iter) {
/* we should probably create a new <defs> here? */
- this->defs = NULL;
+ this->defs = nullptr;
}
}
@@ -285,7 +285,7 @@ void SPRoot::update(SPCtx *ctx, guint flags)
SPGroup::update((SPCtx *) &rctx, flags);
/* As last step set additional transform of drawing group */
- for (SPItemView *v = this->display; v != NULL; v = v->next) {
+ for (SPItemView *v = this->display; v != nullptr; v = v->next) {
Inkscape::DrawingGroup *g = dynamic_cast<Inkscape::DrawingGroup *>(v->arenaitem);
g->setChildTransform(this->c2p);
}
diff --git a/src/object/sp-script.cpp b/src/object/sp-script.cpp
index 144c8d76a..45cf25bbf 100644
--- a/src/object/sp-script.cpp
+++ b/src/object/sp-script.cpp
@@ -15,7 +15,7 @@
#include "attributes.h"
SPScript::SPScript() : SPObject() {
- this->xlinkhref = NULL;
+ this->xlinkhref = nullptr;
}
SPScript::~SPScript() {
diff --git a/src/object/sp-shape.cpp b/src/object/sp-shape.cpp
index 1708ecfb3..cb636c100 100644
--- a/src/object/sp-shape.cpp
+++ b/src/object/sp-shape.cpp
@@ -51,11 +51,11 @@ static void sp_shape_update_marker_view (SPShape *shape, Inkscape::DrawingItem *
SPShape::SPShape() : SPLPEItem() {
for ( int i = 0 ; i < SP_MARKER_LOC_QTY ; i++ ) {
- this->_marker[i] = NULL;
+ this->_marker[i] = nullptr;
}
- this->_curve = NULL;
- this->_curve_before_lpe = NULL;
+ this->_curve = nullptr;
+ this->_curve_before_lpe = nullptr;
}
SPShape::~SPShape() {
@@ -88,7 +88,7 @@ void SPShape::release() {
for (int i = 0; i < SP_MARKER_LOC_QTY; i++) {
if (this->_marker[i]) {
- for (SPItemView *v = this->display; v != NULL; v = v->next) {
+ for (SPItemView *v = this->display; v != nullptr; v = v->next) {
sp_marker_hide(_marker[i], v->arenaitem->key() + i);
}
@@ -138,7 +138,7 @@ void SPShape::update(SPCtx* ctx, guint flags) {
double const aw = 1.0 / ictx->i2vp.descrim();
this->style->stroke_width.computed = this->style->stroke_width.value * aw;
- for (SPItemView *v = ((SPItem *) (this))->display; v != NULL; v = v->next) {
+ for (SPItemView *v = ((SPItem *) (this))->display; v != nullptr; v = v->next) {
Inkscape::DrawingShape *sh = dynamic_cast<Inkscape::DrawingShape *>(v->arenaitem);
if (hasMarkers()) {
this->context_style = this->style;
@@ -156,7 +156,7 @@ void SPShape::update(SPCtx* ctx, guint flags) {
if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_PARENT_MODIFIED_FLAG)) {
/* This is suboptimal, because changing parent style schedules recalculation */
/* But on the other hand - how can we know that parent does not tie style and transform */
- for (SPItemView *v = this->display; v != NULL; v = v->next) {
+ for (SPItemView *v = this->display; v != nullptr; v = v->next) {
Inkscape::DrawingShape *sh = dynamic_cast<Inkscape::DrawingShape *>(v->arenaitem);
if (flags & SP_OBJECT_MODIFIED_FLAG) {
@@ -168,7 +168,7 @@ void SPShape::update(SPCtx* ctx, guint flags) {
if (this->hasMarkers ()) {
/* Dimension marker views */
- for (SPItemView *v = this->display; v != NULL; v = v->next) {
+ for (SPItemView *v = this->display; v != nullptr; v = v->next) {
if (!v->arenaitem->key()) {
v->arenaitem->setKey(SPItem::display_key_new (SP_MARKER_LOC_QTY));
}
@@ -183,12 +183,12 @@ void SPShape::update(SPCtx* ctx, guint flags) {
}
/* Update marker views */
- for (SPItemView *v = this->display; v != NULL; v = v->next) {
+ for (SPItemView *v = this->display; v != nullptr; v = v->next) {
sp_shape_update_marker_view (this, v->arenaitem);
}
// Marker selector needs this here or marker previews are not rendered.
- for (SPItemView *v = this->display; v != NULL; v = v->next) {
+ for (SPItemView *v = this->display; v != nullptr; v = v->next) {
Inkscape::DrawingShape *sh = dynamic_cast<Inkscape::DrawingShape *>(v->arenaitem);
sh->setChildrenStyle(this->context_style); // Resolve 'context-xxx' in children.
@@ -397,7 +397,7 @@ void SPShape::modified(unsigned int flags) {
SPLPEItem::modified(flags);
if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) {
- for (SPItemView *v = this->display; v != NULL; v = v->next) {
+ for (SPItemView *v = this->display; v != nullptr; v = v->next) {
Inkscape::DrawingShape *sh = dynamic_cast<Inkscape::DrawingShape *>(v->arenaitem);
if (hasMarkers()) {
this->context_style = this->style;
@@ -760,12 +760,12 @@ void SPShape::update_patheffect(bool write)
}
if (write && success) {
Inkscape::XML::Node *repr = this->getRepr();
- if (c_lpe != NULL) {
+ if (c_lpe != nullptr) {
gchar *str = sp_svg_write_path(c_lpe->get_pathvector());
repr->setAttribute("d", str);
g_free(str);
} else {
- repr->setAttribute("d", NULL);
+ repr->setAttribute("d", nullptr);
}
}
c_lpe->unref();
@@ -823,7 +823,7 @@ Inkscape::DrawingItem* SPShape::show(Inkscape::Drawing &drawing, unsigned int /*
void SPShape::hide(unsigned int key) {
for (int i = 0; i < SP_MARKER_LOC_QTY; ++i) {
if (_marker[i]) {
- for (SPItemView* v = display; v != NULL; v = v->next) {
+ for (SPItemView* v = display; v != nullptr; v = v->next) {
if (key == v->key) {
sp_marker_hide(_marker[i], v->arenaitem->key() + i);
}
@@ -845,7 +845,7 @@ int SPShape::hasMarkers() const
specified, then all three should appear. */
// Ignore markers for objects which are inside markers themselves.
- for (SPObject *parent = this->parent; parent != NULL; parent = parent->parent) {
+ for (SPObject *parent = this->parent; parent != nullptr; parent = parent->parent) {
if (dynamic_cast<SPMarker *>(parent)) {
return 0;
}
@@ -925,13 +925,13 @@ static void
sp_shape_marker_release (SPObject *marker, SPShape *shape)
{
SPItem *item = dynamic_cast<SPItem *>(shape);
- g_return_if_fail(item != NULL);
+ g_return_if_fail(item != nullptr);
for (int i = 0; i < SP_MARKER_LOC_QTY; i++) {
if (marker == shape->_marker[i]) {
SPItemView *v;
/* Hide marker */
- for (v = item->display; v != NULL; v = v->next) {
+ for (v = item->display; v != nullptr; v = v->next) {
sp_marker_hide(shape->_marker[i], v->arenaitem->key() + i);
}
/* Detach marker */
@@ -963,7 +963,7 @@ void
sp_shape_set_marker (SPObject *object, unsigned int key, const gchar *value)
{
SPShape *shape = dynamic_cast<SPShape *>(object);
- g_return_if_fail(shape != NULL);
+ g_return_if_fail(shape != nullptr);
if (key > SP_MARKER_LOC_END) {
return;
@@ -980,7 +980,7 @@ sp_shape_set_marker (SPObject *object, unsigned int key, const gchar *value)
shape->_modified_connect[key].disconnect();
/* Hide marker */
- for (v = shape->display; v != NULL; v = v->next) {
+ for (v = shape->display; v != nullptr; v = v->next) {
sp_marker_hide(shape->_marker[key],
v->arenaitem->key() + key);
}
@@ -1082,7 +1082,7 @@ SPCurve * SPShape::getCurve(unsigned int owner) const
return _curve->copy();
}
- return NULL;
+ return nullptr;
}
/**
@@ -1097,7 +1097,7 @@ SPCurve * SPShape::getCurveBeforeLPE(unsigned int owner) const
}
return _curve_before_lpe->copy();
}
- return NULL;
+ return nullptr;
}
/**
@@ -1116,7 +1116,7 @@ SPCurve * SPShape::getCurveForEdit(unsigned int owner) const
}
void SPShape::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const {
- if (this->_curve == NULL) {
+ if (this->_curve == nullptr) {
return;
}
diff --git a/src/object/sp-spiral.cpp b/src/object/sp-spiral.cpp
index e17ddb10d..37e68d7c2 100644
--- a/src/object/sp-spiral.cpp
+++ b/src/object/sp-spiral.cpp
@@ -78,7 +78,7 @@ Inkscape::XML::Node* SPSpiral::write(Inkscape::XML::Document *xml_doc, Inkscape:
// Nulls might be possible if this called iteratively
if (!this->_curve) {
//g_warning("sp_spiral_write(): No path to copy\n");
- return NULL;
+ return nullptr;
}
char *d = sp_svg_write_path(this->_curve->get_pathvector());
@@ -118,7 +118,7 @@ void SPSpiral::set(unsigned int key, gchar const* value) {
* N.B. atof/sscanf/strtod consider "nan" and "inf"
* to be valid numbers.
*/
- this->exp = g_ascii_strtod (value, NULL);
+ this->exp = g_ascii_strtod (value, nullptr);
this->exp = CLAMP (this->exp, 0.0, 1000.0);
} else {
this->exp = 1.0;
@@ -129,7 +129,7 @@ void SPSpiral::set(unsigned int key, gchar const* value) {
case SP_ATTR_SODIPODI_REVOLUTION:
if (value) {
- this->revo = g_ascii_strtod (value, NULL);
+ this->revo = g_ascii_strtod (value, nullptr);
this->revo = CLAMP (this->revo, 0.05, 1024.0);
} else {
this->revo = 3.0;
@@ -148,7 +148,7 @@ void SPSpiral::set(unsigned int key, gchar const* value) {
case SP_ATTR_SODIPODI_ARGUMENT:
if (value) {
- this->arg = g_ascii_strtod (value, NULL);
+ this->arg = g_ascii_strtod (value, nullptr);
/** \todo
* FIXME: We still need some bounds on arg, for
* numerical reasons. E.g., we don't want inf or NaN,
@@ -166,7 +166,7 @@ void SPSpiral::set(unsigned int key, gchar const* value) {
case SP_ATTR_SODIPODI_T0:
if (value) {
- this->t0 = g_ascii_strtod (value, NULL);
+ this->t0 = g_ascii_strtod (value, nullptr);
this->t0 = CLAMP (this->t0, 0.0, 0.999);
/** \todo
* Have shared constants for the allowable bounds for
@@ -260,7 +260,7 @@ void SPSpiral::fitAndDraw(SPCurve* c, double dstep, Geom::Point darray[], Geom::
/** \todo
* We should use better algorithm to specify maximum error.
*/
- depth = Geom::bezier_fit_cubic_full (bezier, NULL, darray, SAMPLE_SIZE,
+ depth = Geom::bezier_fit_cubic_full (bezier, nullptr, darray, SAMPLE_SIZE,
hat1, hat2,
SPIRAL_TOLERANCE*SPIRAL_TOLERANCE,
FITTING_MAX_BEZIERS);
@@ -576,14 +576,14 @@ void SPSpiral::getPolar(gdouble t, gdouble* rad, gdouble* arg) const {
bool SPSpiral::isInvalid() const {
gdouble rad;
- this->getPolar(0.0, &rad, NULL);
+ this->getPolar(0.0, &rad, nullptr);
if (rad < 0.0 || rad > SP_HUGE) {
g_print("rad(t=0)=%g\n", rad);
return true;
}
- this->getPolar(1.0, &rad, NULL);
+ this->getPolar(1.0, &rad, nullptr);
if (rad < 0.0 || rad > SP_HUGE) {
g_print("rad(t=1)=%g\n", rad);
diff --git a/src/object/sp-star.cpp b/src/object/sp-star.cpp
index da00080a3..fdb85e392 100644
--- a/src/object/sp-star.cpp
+++ b/src/object/sp-star.cpp
@@ -87,7 +87,7 @@ Inkscape::XML::Node* SPStar::write(Inkscape::XML::Document *xml_doc, Inkscape::X
repr->setAttribute("d", d);
g_free(d);
} else {
- repr->setAttribute("d", NULL);
+ repr->setAttribute("d", nullptr);
}
// CPPIFY: see header file
SPShape::write(xml_doc, repr, flags);
@@ -112,7 +112,7 @@ void SPStar::set(unsigned int key, const gchar* value) {
break;
case SP_ATTR_SODIPODI_CX:
- if (!sp_svg_length_read_ldd (value, &unit, NULL, &this->center[Geom::X]) ||
+ if (!sp_svg_length_read_ldd (value, &unit, nullptr, &this->center[Geom::X]) ||
(unit == SVGLength::EM) ||
(unit == SVGLength::EX) ||
(unit == SVGLength::PERCENT)) {
@@ -123,7 +123,7 @@ void SPStar::set(unsigned int key, const gchar* value) {
break;
case SP_ATTR_SODIPODI_CY:
- if (!sp_svg_length_read_ldd (value, &unit, NULL, &this->center[Geom::Y]) ||
+ if (!sp_svg_length_read_ldd (value, &unit, nullptr, &this->center[Geom::Y]) ||
(unit == SVGLength::EM) ||
(unit == SVGLength::EX) ||
(unit == SVGLength::PERCENT)) {
@@ -134,7 +134,7 @@ void SPStar::set(unsigned int key, const gchar* value) {
break;
case SP_ATTR_SODIPODI_R1:
- if (!sp_svg_length_read_ldd (value, &unit, NULL, &this->r[0]) ||
+ if (!sp_svg_length_read_ldd (value, &unit, nullptr, &this->r[0]) ||
(unit == SVGLength::EM) ||
(unit == SVGLength::EX) ||
(unit == SVGLength::PERCENT)) {
@@ -146,7 +146,7 @@ void SPStar::set(unsigned int key, const gchar* value) {
break;
case SP_ATTR_SODIPODI_R2:
- if (!sp_svg_length_read_ldd (value, &unit, NULL, &this->r[1]) ||
+ if (!sp_svg_length_read_ldd (value, &unit, nullptr, &this->r[1]) ||
(unit == SVGLength::EM) ||
(unit == SVGLength::EX) ||
(unit == SVGLength::PERCENT)) {
@@ -158,7 +158,7 @@ void SPStar::set(unsigned int key, const gchar* value) {
case SP_ATTR_SODIPODI_ARG1:
if (value) {
- this->arg[0] = g_ascii_strtod (value, NULL);
+ this->arg[0] = g_ascii_strtod (value, nullptr);
} else {
this->arg[0] = 0.0;
}
@@ -168,7 +168,7 @@ void SPStar::set(unsigned int key, const gchar* value) {
case SP_ATTR_SODIPODI_ARG2:
if (value) {
- this->arg[1] = g_ascii_strtod (value, NULL);
+ this->arg[1] = g_ascii_strtod (value, nullptr);
} else {
this->arg[1] = 0.0;
}
@@ -188,7 +188,7 @@ void SPStar::set(unsigned int key, const gchar* value) {
case SP_ATTR_INKSCAPE_ROUNDED:
if (value) {
- this->rounded = g_ascii_strtod (value, NULL);
+ this->rounded = g_ascii_strtod (value, nullptr);
} else {
this->rounded = 0.0;
}
@@ -198,7 +198,7 @@ void SPStar::set(unsigned int key, const gchar* value) {
case SP_ATTR_INKSCAPE_RANDOMIZED:
if (value) {
- this->randomized = g_ascii_strtod (value, NULL);
+ this->randomized = g_ascii_strtod (value, nullptr);
} else {
this->randomized = 0.0;
}
@@ -452,7 +452,7 @@ void SPStar::set_shape() {
void
sp_star_position_set (SPStar *star, gint sides, Geom::Point center, gdouble r1, gdouble r2, gdouble arg1, gdouble arg2, bool isflat, double rounded, double randomized)
{
- g_return_if_fail (star != NULL);
+ g_return_if_fail (star != nullptr);
g_return_if_fail (SP_IS_STAR (star));
star->sides = CLAMP(sides, 3, 1024);
diff --git a/src/object/sp-stop.cpp b/src/object/sp-stop.cpp
index 58746c951..d016e6366 100644
--- a/src/object/sp-stop.cpp
+++ b/src/object/sp-stop.cpp
@@ -24,7 +24,7 @@
#include "svg/css-ostringstream.h"
SPStop::SPStop() : SPObject() {
- this->path_string = NULL;
+ this->path_string = nullptr;
this->offset = 0.0;
this->currentColor = false;
@@ -152,8 +152,8 @@ Inkscape::XML::Node* SPStop::write(Inkscape::XML::Document* xml_doc, Inkscape::X
}
os << ";stop-opacity:" << opacity;
repr->setAttribute("style", os.str().c_str());
- repr->setAttribute("stop-color", NULL);
- repr->setAttribute("stop-opacity", NULL);
+ repr->setAttribute("stop-color", nullptr);
+ repr->setAttribute("stop-opacity", nullptr);
sp_repr_set_css_double(repr, "offset", this->offset);
/* strictly speaking, offset an SVG <number> rather than a CSS one, but exponents make no sense
* for offset proportions. */
@@ -167,7 +167,7 @@ Inkscape::XML::Node* SPStop::write(Inkscape::XML::Document* xml_doc, Inkscape::X
// A stop might have some non-stop siblings
SPStop* SPStop::getNextStop() {
- SPStop *result = 0;
+ SPStop *result = nullptr;
for (SPObject* obj = getNext(); obj && !result; obj = obj->getNext()) {
if (SP_IS_STOP(obj)) {
@@ -179,7 +179,7 @@ SPStop* SPStop::getNextStop() {
}
SPStop* SPStop::getPrevStop() {
- SPStop *result = 0;
+ SPStop *result = nullptr;
for (SPObject* obj = getPrev(); obj; obj = obj->getPrev()) {
// The closest previous SPObject that is an SPStop *should* be ourself.
@@ -215,7 +215,7 @@ SPColor SPStop::getEffectiveColor() const {
SPColor ret;
if (currentColor) {
- char const *str = getStyleProperty("color", NULL);
+ char const *str = getStyleProperty("color", nullptr);
/* Default value: arbitrarily black. (SVG1.1 and CSS2 both say that the initial
* value depends on user agent, and don't give any further restrictions that I can
* see.) */
@@ -237,7 +237,7 @@ guint32 SPStop::get_rgba32() const {
* value depends on user agent, and don't give any further restrictions that I can
* see.) */
if (this->currentColor) {
- char const *str = this->getStyleProperty("color", NULL);
+ char const *str = this->getStyleProperty("color", nullptr);
if (str) {
rgb0 = sp_svg_read_color(str, rgb0);
diff --git a/src/object/sp-string.cpp b/src/object/sp-string.cpp
index df57a5a80..a01b05e8f 100644
--- a/src/object/sp-string.cpp
+++ b/src/object/sp-string.cpp
@@ -139,7 +139,7 @@ void SPString::read_content() {
}
break;
default:
- if( white_space && (!string.empty() || (getPrev() != NULL))) {
+ if( white_space && (!string.empty() || (getPrev() != nullptr))) {
string += ' ';
}
string += c;
@@ -149,7 +149,7 @@ void SPString::read_content() {
} // End loop
// Insert white space at end if more text follows
- if (white_space && getRepr()->next() != NULL) { // can't use SPObject::getNext() when the SPObject tree is still being built
+ if (white_space && getRepr()->next() != nullptr) { // can't use SPObject::getNext() when the SPObject tree is still being built
string += ' ';
}
diff --git a/src/object/sp-style-elem.cpp b/src/object/sp-style-elem.cpp
index f1e66ae45..c273c844f 100644
--- a/src/object/sp-style-elem.cpp
+++ b/src/object/sp-style-elem.cpp
@@ -63,7 +63,7 @@ child_add_rm_cb(Inkscape::XML::Node *, Inkscape::XML::Node *, Inkscape::XML::Nod
void *const data)
{
SPObject *obj = reinterpret_cast<SPObject *>(data);
- g_assert(data != NULL);
+ g_assert(data != nullptr);
obj->read_content();
}
@@ -72,7 +72,7 @@ content_changed_cb(Inkscape::XML::Node *, gchar const *, gchar const *,
void *const data)
{
SPObject *obj = reinterpret_cast<SPObject *>(data);
- g_assert(data != NULL);
+ g_assert(data != nullptr);
obj->read_content();
obj->document->getRoot()->emitModified( SP_OBJECT_MODIFIED_CASCADE );
}
@@ -83,7 +83,7 @@ child_order_changed_cb(Inkscape::XML::Node *, Inkscape::XML::Node *,
void *const data)
{
SPObject *obj = reinterpret_cast<SPObject *>(data);
- g_assert(data != NULL);
+ g_assert(data != nullptr);
obj->read_content();
}
@@ -114,7 +114,7 @@ concat_children(Inkscape::XML::Node const &repr)
{
Glib::ustring ret;
// effic: Initialising ret to a reasonable starting size could speed things up.
- for (Inkscape::XML::Node const *rch = repr.firstChild(); rch != NULL; rch = rch->next()) {
+ for (Inkscape::XML::Node const *rch = repr.firstChild(); rch != nullptr; rch = rch->next()) {
if ( rch->type() == TEXT_NODE ) {
ret += rch->content();
}
@@ -140,7 +140,7 @@ struct ParseTmp
ParseTmp(CRStyleSheet *const stylesheet, SPDocument *const document) :
stylesheet(stylesheet),
stmtType(NO_STMT),
- currStmt(NULL),
+ currStmt(nullptr),
document(document),
magic(ParseTmp_magic)
{ }
@@ -170,7 +170,7 @@ import_style_cb (CRDocHandler *a_handler,
// Get document
g_return_if_fail(a_handler && a_uri);
- g_return_if_fail(a_handler->app_data != NULL);
+ g_return_if_fail(a_handler->app_data != nullptr);
ParseTmp &parse_tmp = *static_cast<ParseTmp *>(a_handler->app_data);
g_return_if_fail(parse_tmp.hasMagic());
@@ -193,7 +193,7 @@ import_style_cb (CRDocHandler *a_handler,
Inkscape::IO::Resource::get_filename (document->getURI(), a_uri->stryng->str);
// Parse file
- CRStyleSheet *stylesheet = cr_stylesheet_new (NULL);
+ CRStyleSheet *stylesheet = cr_stylesheet_new (nullptr);
CRParser *parser = parser_init(stylesheet, document);
CRStatus const parse_status =
cr_parser_parse_file (parser, reinterpret_cast<const guchar *>(import_file.c_str()), CR_UTF_8);
@@ -205,7 +205,7 @@ import_style_cb (CRDocHandler *a_handler,
}
// Need to delete ParseTmp created by parser_init()
- CRDocHandler *sac_handler = NULL;
+ CRDocHandler *sac_handler = nullptr;
cr_parser_get_sac_handler (parser, &sac_handler);
ParseTmp *parse_new = reinterpret_cast<ParseTmp *>(sac_handler->app_data);
cr_parser_destroy(parser);
@@ -231,16 +231,16 @@ start_selector_cb(CRDocHandler *a_handler,
CRSelector *a_sel_list)
{
g_return_if_fail(a_handler && a_sel_list);
- g_return_if_fail(a_handler->app_data != NULL);
+ g_return_if_fail(a_handler->app_data != nullptr);
ParseTmp &parse_tmp = *static_cast<ParseTmp *>(a_handler->app_data);
g_return_if_fail(parse_tmp.hasMagic());
- if ( (parse_tmp.currStmt != NULL)
+ if ( (parse_tmp.currStmt != nullptr)
|| (parse_tmp.stmtType != NO_STMT) ) {
g_warning("Expecting currStmt==NULL and stmtType==0 (NO_STMT) at start of ruleset, but found currStmt=%p, stmtType=%u",
static_cast<void *>(parse_tmp.currStmt), unsigned(parse_tmp.stmtType));
// fixme: Check whether we need to unref currStmt if non-NULL.
}
- CRStatement *ruleset = cr_statement_new_ruleset(parse_tmp.stylesheet, a_sel_list, NULL, NULL);
+ CRStatement *ruleset = cr_statement_new_ruleset(parse_tmp.stylesheet, a_sel_list, nullptr, nullptr);
g_return_if_fail(ruleset && ruleset->type == RULESET_STMT);
parse_tmp.stmtType = NORMAL_RULESET_STMT;
parse_tmp.currStmt = ruleset;
@@ -251,7 +251,7 @@ end_selector_cb(CRDocHandler *a_handler,
CRSelector *a_sel_list)
{
g_return_if_fail(a_handler && a_sel_list);
- g_return_if_fail(a_handler->app_data != NULL);
+ g_return_if_fail(a_handler->app_data != nullptr);
ParseTmp &parse_tmp = *static_cast<ParseTmp *>(a_handler->app_data);
g_return_if_fail(parse_tmp.hasMagic());
CRStatement *const ruleset = parse_tmp.currStmt;
@@ -270,7 +270,7 @@ end_selector_cb(CRDocHandler *a_handler,
ruleset->kind.ruleset->sel_list,
a_sel_list);
}
- parse_tmp.currStmt = NULL;
+ parse_tmp.currStmt = nullptr;
parse_tmp.stmtType = NO_STMT;
}
@@ -278,15 +278,15 @@ static void
start_font_face_cb(CRDocHandler *a_handler,
CRParsingLocation *)
{
- g_return_if_fail(a_handler->app_data != NULL);
+ g_return_if_fail(a_handler->app_data != nullptr);
ParseTmp &parse_tmp = *static_cast<ParseTmp *>(a_handler->app_data);
g_return_if_fail(parse_tmp.hasMagic());
- if (parse_tmp.stmtType != NO_STMT || parse_tmp.currStmt != NULL) {
+ if (parse_tmp.stmtType != NO_STMT || parse_tmp.currStmt != nullptr) {
g_warning("Expecting currStmt==NULL and stmtType==0 (NO_STMT) at start of @font-face, but found currStmt=%p, stmtType=%u",
static_cast<void *>(parse_tmp.currStmt), unsigned(parse_tmp.stmtType));
// fixme: Check whether we need to unref currStmt if non-NULL.
}
- CRStatement *font_face_rule = cr_statement_new_at_font_face_rule (parse_tmp.stylesheet, NULL);
+ CRStatement *font_face_rule = cr_statement_new_at_font_face_rule (parse_tmp.stylesheet, nullptr);
g_return_if_fail(font_face_rule && font_face_rule->type == AT_FONT_FACE_RULE_STMT);
parse_tmp.stmtType = FONT_FACE_STMT;
parse_tmp.currStmt = font_face_rule;
@@ -295,7 +295,7 @@ start_font_face_cb(CRDocHandler *a_handler,
static void
end_font_face_cb(CRDocHandler *a_handler)
{
- g_return_if_fail(a_handler->app_data != NULL);
+ g_return_if_fail(a_handler->app_data != nullptr);
ParseTmp &parse_tmp = *static_cast<ParseTmp *>(a_handler->app_data);
g_return_if_fail(parse_tmp.hasMagic());
@@ -329,7 +329,7 @@ end_font_face_cb(CRDocHandler *a_handler)
}
// Add ttf or otf fonts.
- CRDeclaration const *cur = NULL;
+ CRDeclaration const *cur = nullptr;
for (cur = font_face_rule->kind.font_face_rule->decl_list; cur; cur = cur->next) {
if (cur->property &&
cur->property->stryng &&
@@ -364,7 +364,7 @@ end_font_face_cb(CRDocHandler *a_handler)
}
}
- parse_tmp.currStmt = NULL;
+ parse_tmp.currStmt = nullptr;
parse_tmp.stmtType = NO_STMT;
}
@@ -376,7 +376,7 @@ property_cb(CRDocHandler *const a_handler,
{
// std::cout << "property_cb: Entrance: " << a_name->stryng->str << ": " << cr_term_to_string(a_value) << std::endl;
g_return_if_fail(a_handler && a_name);
- g_return_if_fail(a_handler->app_data != NULL);
+ g_return_if_fail(a_handler->app_data != nullptr);
ParseTmp &parse_tmp = *static_cast<ParseTmp *>(a_handler->app_data);
g_return_if_fail(parse_tmp.hasMagic());
@@ -422,7 +422,7 @@ parser_init(CRStyleSheet *const stylesheet, SPDocument *const document) {
sac_handler->end_font_face = end_font_face_cb;
sac_handler->property = property_cb;
- CRParser *parser = cr_parser_new (NULL);
+ CRParser *parser = cr_parser_new (nullptr);
cr_parser_set_sac_handler(parser, sac_handler);
return parser;
@@ -449,10 +449,10 @@ void SPStyleElem::read_content() {
// style element would correspond to document->style_sheet, while
// laters ones are chained on using style_sheet->next).
- document->style_sheet = cr_stylesheet_new (NULL);
+ document->style_sheet = cr_stylesheet_new (nullptr);
CRParser *parser = parser_init(document->style_sheet, document);
- CRDocHandler *sac_handler = NULL;
+ CRDocHandler *sac_handler = nullptr;
cr_parser_get_sac_handler (parser, &sac_handler);
ParseTmp *parse_tmp = reinterpret_cast<ParseTmp *>(sac_handler->app_data);
@@ -470,7 +470,7 @@ void SPStyleElem::read_content() {
cr_cascade_set_sheet (document->style_cascade, document->style_sheet, ORIGIN_AUTHOR);
} else {
cr_stylesheet_destroy (document->style_sheet);
- document->style_sheet = NULL;
+ document->style_sheet = nullptr;
if (parse_status != CR_PARSING_ERROR) {
g_printerr("parsing error code=%u\n", unsigned(parse_status));
/* Better than nothing. TODO: Improve libcroco's error handling. At a minimum, add a
@@ -497,7 +497,7 @@ rec_add_listener(Inkscape::XML::Node &repr,
Inkscape::XML::NodeEventVector const *const fns, void *const data)
{
repr.addListener(fns, data);
- for (Inkscape::XML::Node *child = repr.firstChild(); child != NULL; child = child->next()) {
+ for (Inkscape::XML::Node *child = repr.firstChild(); child != nullptr; child = child->next()) {
rec_add_listener(*child, fns, data);
}
}
@@ -511,7 +511,7 @@ void SPStyleElem::build(SPDocument *document, Inkscape::XML::Node *repr) {
static Inkscape::XML::NodeEventVector const nodeEventVector = {
child_add_rm_cb, // child_added
child_add_rm_cb, // child_removed
- NULL, // attr_changed
+ nullptr, // attr_changed
content_changed_cb, // content_changed
child_order_changed_cb, // order_changed
};
diff --git a/src/object/sp-switch.cpp b/src/object/sp-switch.cpp
index d6ab1e904..88f3c46c7 100644
--- a/src/object/sp-switch.cpp
+++ b/src/object/sp-switch.cpp
@@ -21,7 +21,7 @@
#include <sigc++/adaptors/bind.h>
SPSwitch::SPSwitch() : SPGroup() {
- this->_cached_item = 0;
+ this->_cached_item = nullptr;
}
SPSwitch::~SPSwitch() {
@@ -29,7 +29,7 @@ SPSwitch::~SPSwitch() {
}
SPObject *SPSwitch::_evaluateFirst() {
- SPObject *first = 0;
+ SPObject *first = nullptr;
for (auto& child: children) {
if (SP_IS_ITEM(&child) && sp_item_evaluate(SP_ITEM(&child))) {
@@ -48,7 +48,7 @@ std::vector<SPObject*> SPSwitch::_childList(bool add_ref, SPObject::Action actio
SPObject *child = _evaluateFirst();
std::vector<SPObject*> x;
- if (NULL == child)
+ if (nullptr == child)
return x;
if (add_ref) {
@@ -120,11 +120,11 @@ void SPSwitch::_releaseItem(SPObject *obj, SPSwitch *selection)
void SPSwitch::_releaseLastItem(SPObject *obj)
{
- if (NULL == this->_cached_item || this->_cached_item != obj)
+ if (nullptr == this->_cached_item || this->_cached_item != obj)
return;
this->_release_connection.disconnect();
- this->_cached_item = NULL;
+ this->_cached_item = nullptr;
}
void SPSwitch::_showChildren (Inkscape::Drawing &drawing, Inkscape::DrawingItem *ai, unsigned int key, unsigned int flags) {
diff --git a/src/object/sp-symbol.cpp b/src/object/sp-symbol.cpp
index 55b5101af..07e6f660e 100644
--- a/src/object/sp-symbol.cpp
+++ b/src/object/sp-symbol.cpp
@@ -77,7 +77,7 @@ void SPSymbol::update(SPCtx *ctx, guint flags) {
SPGroup::update((SPCtx *) &rctx, flags);
// As last step set additional transform of drawing group
- for (SPItemView *v = this->display; v != NULL; v = v->next) {
+ for (SPItemView *v = this->display; v != nullptr; v = v->next) {
Inkscape::DrawingGroup *g = dynamic_cast<Inkscape::DrawingGroup *>(v->arenaitem);
g->setChildTransform(this->c2p);
}
@@ -109,7 +109,7 @@ Inkscape::XML::Node* SPSymbol::write(Inkscape::XML::Document *xml_doc, Inkscape:
}
Inkscape::DrawingItem* SPSymbol::show(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags) {
- Inkscape::DrawingItem *ai = 0;
+ Inkscape::DrawingItem *ai = nullptr;
if (this->cloned) {
// Cloned <symbol> is actually renderable
diff --git a/src/object/sp-tag-use-reference.cpp b/src/object/sp-tag-use-reference.cpp
index bb03c120a..c4de4a068 100644
--- a/src/object/sp-tag-use-reference.cpp
+++ b/src/object/sp-tag-use-reference.cpp
@@ -35,20 +35,20 @@ static void sp_usepath_delete_self(SPObject *deleted, SPTagUsePath *offset);
SPTagUsePath::SPTagUsePath(SPObject* i_owner):SPTagUseReference(i_owner)
{
owner=i_owner;
- originalPath = NULL;
+ originalPath = nullptr;
sourceDirty=false;
- sourceHref = NULL;
- sourceRepr = NULL;
- sourceObject = NULL;
+ sourceHref = nullptr;
+ sourceRepr = nullptr;
+ sourceObject = nullptr;
_changed_connection = changedSignal().connect(sigc::bind(sigc::ptr_fun(sp_usepath_href_changed), this)); // listening to myself, this should be virtual instead
- user_unlink = NULL;
+ user_unlink = nullptr;
}
SPTagUsePath::~SPTagUsePath(void)
{
delete originalPath;
- originalPath = NULL;
+ originalPath = nullptr;
_changed_connection.disconnect(); // to do before unlinking
@@ -59,7 +59,7 @@ SPTagUsePath::~SPTagUsePath(void)
void
SPTagUsePath::link(char *to)
{
- if ( to == NULL ) {
+ if ( to == nullptr ) {
quit_listening();
unlink();
} else {
@@ -83,14 +83,14 @@ void
SPTagUsePath::unlink(void)
{
g_free(sourceHref);
- sourceHref = NULL;
+ sourceHref = nullptr;
detach();
}
void
SPTagUsePath::start_listening(SPObject* to)
{
- if ( to == NULL ) {
+ if ( to == nullptr ) {
return;
}
sourceObject = to;
@@ -101,12 +101,12 @@ SPTagUsePath::start_listening(SPObject* to)
void
SPTagUsePath::quit_listening(void)
{
- if ( sourceObject == NULL ) {
+ if ( sourceObject == nullptr ) {
return;
}
_delete_connection.disconnect();
- sourceRepr = NULL;
- sourceObject = NULL;
+ sourceRepr = nullptr;
+ sourceObject = nullptr;
}
static void
diff --git a/src/object/sp-tag-use.cpp b/src/object/sp-tag-use.cpp
index 1312b923f..c3fbfee7e 100644
--- a/src/object/sp-tag-use.cpp
+++ b/src/object/sp-tag-use.cpp
@@ -31,7 +31,7 @@
SPTagUse::SPTagUse()
{
- href = NULL;
+ href = nullptr;
//new (_changed_connection) sigc::connection;
ref = new SPTagUseReference(this);
@@ -43,12 +43,12 @@ SPTagUse::~SPTagUse()
if (child) {
detach(child);
- child = NULL;
+ child = nullptr;
}
ref->detach();
delete ref;
- ref = 0;
+ ref = nullptr;
_changed_connection.~connection(); //FIXME why?
}
@@ -70,13 +70,13 @@ SPTagUse::release()
if (child) {
detach(child);
- child = NULL;
+ child = nullptr;
}
_changed_connection.disconnect();
g_free(href);
- href = NULL;
+ href = nullptr;
ref->detach();
@@ -93,7 +93,7 @@ SPTagUse::set(unsigned key, gchar const *value)
/* No change, do nothing. */
} else {
g_free(href);
- href = NULL;
+ href = nullptr;
if (value) {
// First, set the href field, because sp_tag_use_href_changed will need it.
href = g_strdup(value);
@@ -152,7 +152,7 @@ SPItem * SPTagUse::root()
orig = SP_TAG_USE(orig)->child;
}
if (!orig || !SP_IS_ITEM(orig))
- return NULL;
+ return nullptr;
return SP_ITEM(orig);
}
@@ -169,7 +169,7 @@ SPTagUse::href_changed(SPObject */*old_ref*/, SPObject */*ref*/)
if (child_) {
child = child_;
attach(child_, lastChild());
- sp_object_unref(child_, 0);
+ sp_object_unref(child_, nullptr);
child_->invoke_build(this->document, childrepr, TRUE);
}
@@ -179,7 +179,7 @@ SPTagUse::href_changed(SPObject */*old_ref*/, SPObject */*ref*/)
SPItem * SPTagUse::get_original()
{
- SPItem *ref_ = NULL;
+ SPItem *ref_ = nullptr;
if (ref) {
ref_ = ref->getObject();
}
diff --git a/src/object/sp-tag.cpp b/src/object/sp-tag.cpp
index d331e6b18..b06a02fd1 100644
--- a/src/object/sp-tag.cpp
+++ b/src/object/sp-tag.cpp
@@ -22,7 +22,7 @@
*/
void SPTag::moveTo(SPObject *target, gboolean intoafter) {
- Inkscape::XML::Node *target_ref = ( target ? target->getRepr() : NULL );
+ Inkscape::XML::Node *target_ref = ( target ? target->getRepr() : nullptr );
Inkscape::XML::Node *our_ref = getRepr();
gboolean first = FALSE;
@@ -43,7 +43,7 @@ void SPTag::moveTo(SPObject *target, gboolean intoafter) {
if (intoafter) {
// Move this inside of the target at the end
our_ref->parent()->removeChild(our_ref);
- target_ref->addChild(our_ref, NULL);
+ target_ref->addChild(our_ref, nullptr);
} else if (target_ref->parent() != our_ref->parent()) {
// Change in parent, need to remove and add
our_ref->parent()->removeChild(our_ref);
@@ -122,7 +122,7 @@ SPTag::write(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flag
if (_expanded) {
repr->setAttribute("inkscape:expanded", "true");
} else {
- repr->setAttribute("inkscape:expanded", NULL);
+ repr->setAttribute("inkscape:expanded", nullptr);
}
}
SPObject::write(doc, repr, flags);
diff --git a/src/object/sp-text.cpp b/src/object/sp-text.cpp
index 93694e844..bd0df6381 100644
--- a/src/object/sp-text.cpp
+++ b/src/object/sp-text.cpp
@@ -101,7 +101,7 @@ void SPText::set(unsigned int key, const gchar* value) {
this->style->line_height.value = this->style->line_height.computed = sp_svg_read_percentage (value, 1.0);
}
// Remove deprecated attribute
- this->getRepr()->setAttribute("sodipodi:linespacing", NULL);
+ this->getRepr()->setAttribute("sodipodi:linespacing", nullptr);
this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_TEXT_LAYOUT_MODIFIED_FLAG);
break;
@@ -184,7 +184,7 @@ void SPText::update(SPCtx *ctx, guint flags) {
Geom::OptRect paintbox = this->geometricBounds();
- for (SPItemView* v = this->display; v != NULL; v = v->next) {
+ for (SPItemView* v = this->display; v != nullptr; v = v->next) {
Inkscape::DrawingGroup *g = dynamic_cast<Inkscape::DrawingGroup *>(v->arenaitem);
this->_clearFlow(g);
g->setStyle(this->style, this->parent->style);
@@ -210,7 +210,7 @@ void SPText::modified(guint flags) {
if (flags & ( SP_OBJECT_STYLE_MODIFIED_FLAG )) {
Geom::OptRect paintbox = this->geometricBounds();
- for (SPItemView* v = this->display; v != NULL; v = v->next) {
+ for (SPItemView* v = this->display; v != nullptr; v = v->next) {
Inkscape::DrawingGroup *g = dynamic_cast<Inkscape::DrawingGroup *>(v->arenaitem);
this->_clearFlow(g);
g->setStyle(this->style, this->parent->style);
@@ -246,12 +246,12 @@ Inkscape::XML::Node *SPText::write(Inkscape::XML::Document *xml_doc, Inkscape::X
continue;
}
- Inkscape::XML::Node *crepr = NULL;
+ Inkscape::XML::Node *crepr = nullptr;
if (SP_IS_STRING(&child)) {
crepr = xml_doc->createTextNode(SP_STRING(&child)->string.c_str());
} else {
- crepr = child.updateRepr(xml_doc, NULL, flags);
+ crepr = child.updateRepr(xml_doc, nullptr, flags);
}
if (crepr) {
@@ -260,7 +260,7 @@ Inkscape::XML::Node *SPText::write(Inkscape::XML::Document *xml_doc, Inkscape::X
}
for (auto i=l.rbegin();i!=l.rend();++i) {
- repr->addChild(*i, NULL);
+ repr->addChild(*i, nullptr);
Inkscape::GC::release(*i);
}
} else {
@@ -310,7 +310,7 @@ Inkscape::DrawingItem* SPText::show(Inkscape::Drawing &drawing, unsigned /*key*/
void SPText::hide(unsigned int key) {
- for (SPItemView* v = this->display; v != NULL; v = v->next) {
+ for (SPItemView* v = this->display; v != nullptr; v = v->next) {
if (v->key == key) {
Inkscape::DrawingGroup *g = dynamic_cast<Inkscape::DrawingGroup *>(v->arenaitem);
this->_clearFlow(g);
@@ -353,7 +353,7 @@ void SPText::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::
// of this point depending on the text alignment (left vs. right)
Inkscape::Text::Layout const *layout = te_get_layout(this);
- if (layout != NULL && layout->outputExists()) {
+ if (layout != nullptr && layout->outputExists()) {
boost::optional<Geom::Point> pt = layout->baselineAnchorPoint();
if (pt) {
@@ -440,7 +440,7 @@ unsigned SPText::_buildLayoutInput(SPObject *root, Inkscape::Text::Layout::Optio
if (style->shape_inside.set ) {
// Find union of all exclusion shapes
- Shape *exclusion_shape = NULL;
+ Shape *exclusion_shape = nullptr;
if(style->shape_subtract.set) {
exclusion_shape = _buildExclusionShape();
}
@@ -748,7 +748,7 @@ void SPText::rebuildLayout()
for (auto& child: children) {
if (SP_IS_TEXTPATH(&child)) {
SPTextPath const *textpath = SP_TEXTPATH(&child);
- if (textpath->originalPath != NULL) {
+ if (textpath->originalPath != nullptr) {
#if DEBUG_TEXTLAYOUT_DUMPASTEXT
g_print("%s", layout.dumpAsText().c_str());
#endif
@@ -874,7 +874,7 @@ bool TextTagAttributes::readSingleAttribute(unsigned key, gchar const *value, SP
// FIXME: sp_svg_length_list_read() amalgamates repeated separators. This prevents unset values.
*attr_vector = sp_svg_length_list_read(value);
- if( (update_x || update_y) && style != NULL && viewport != NULL ) {
+ if( (update_x || update_y) && style != nullptr && viewport != nullptr ) {
double const w = viewport->width();
double const h = viewport->height();
double const em = style->font_size.computed;
@@ -929,13 +929,13 @@ void TextTagAttributes::writeSingleAttributeLength(Inkscape::XML::Node *node, gc
if (length._set) {
node->setAttribute(key, length.write().c_str());
} else
- node->setAttribute(key, NULL);
+ node->setAttribute(key, nullptr);
}
void TextTagAttributes::writeSingleAttributeVector(Inkscape::XML::Node *node, gchar const *key, std::vector<SVGLength> const &attr_vector)
{
if (attr_vector.empty())
- node->setAttribute(key, NULL);
+ node->setAttribute(key, nullptr);
else {
Glib::ustring string;
@@ -983,11 +983,11 @@ void TextTagAttributes::setFirstXY(Geom::Point &point)
void TextTagAttributes::mergeInto(Inkscape::Text::Layout::OptionalTextTagAttrs *output, Inkscape::Text::Layout::OptionalTextTagAttrs const &parent_attrs, unsigned parent_attrs_offset, bool copy_xy, bool copy_dxdyrotate) const
{
- mergeSingleAttribute(&output->x, parent_attrs.x, parent_attrs_offset, copy_xy ? &attributes.x : NULL);
- mergeSingleAttribute(&output->y, parent_attrs.y, parent_attrs_offset, copy_xy ? &attributes.y : NULL);
- mergeSingleAttribute(&output->dx, parent_attrs.dx, parent_attrs_offset, copy_dxdyrotate ? &attributes.dx : NULL);
- mergeSingleAttribute(&output->dy, parent_attrs.dy, parent_attrs_offset, copy_dxdyrotate ? &attributes.dy : NULL);
- mergeSingleAttribute(&output->rotate, parent_attrs.rotate, parent_attrs_offset, copy_dxdyrotate ? &attributes.rotate : NULL);
+ mergeSingleAttribute(&output->x, parent_attrs.x, parent_attrs_offset, copy_xy ? &attributes.x : nullptr);
+ mergeSingleAttribute(&output->y, parent_attrs.y, parent_attrs_offset, copy_xy ? &attributes.y : nullptr);
+ mergeSingleAttribute(&output->dx, parent_attrs.dx, parent_attrs_offset, copy_dxdyrotate ? &attributes.dx : nullptr);
+ mergeSingleAttribute(&output->dy, parent_attrs.dy, parent_attrs_offset, copy_dxdyrotate ? &attributes.dy : nullptr);
+ mergeSingleAttribute(&output->rotate, parent_attrs.rotate, parent_attrs_offset, copy_dxdyrotate ? &attributes.rotate : nullptr);
if (attributes.textLength._set) { // only from current node, this is not inherited from parent
output->textLength.value = attributes.textLength.value;
output->textLength.computed = attributes.textLength.computed;
@@ -1000,7 +1000,7 @@ void TextTagAttributes::mergeInto(Inkscape::Text::Layout::OptionalTextTagAttrs *
void TextTagAttributes::mergeSingleAttribute(std::vector<SVGLength> *output_list, std::vector<SVGLength> const &parent_list, unsigned parent_offset, std::vector<SVGLength> const *overlay_list)
{
output_list->clear();
- if (overlay_list == NULL) {
+ if (overlay_list == nullptr) {
if (parent_list.size() > parent_offset)
{
output_list->reserve(parent_list.size() - parent_offset);
diff --git a/src/object/sp-tref-reference.h b/src/object/sp-tref-reference.h
index 0cad4e912..bff49e3d5 100644
--- a/src/object/sp-tref-reference.h
+++ b/src/object/sp-tref-reference.h
@@ -27,7 +27,7 @@ typedef unsigned int GQuark;
class SPTRefReference : public Inkscape::URIReference,
public Inkscape::XML::NodeObserver {
public:
- SPTRefReference(SPObject *owner) : URIReference(owner), subtreeObserved(NULL) {
+ SPTRefReference(SPObject *owner) : URIReference(owner), subtreeObserved(nullptr) {
updateObserver();
}
diff --git a/src/object/sp-tref.cpp b/src/object/sp-tref.cpp
index eae852a89..ef81a1128 100644
--- a/src/object/sp-tref.cpp
+++ b/src/object/sp-tref.cpp
@@ -47,9 +47,9 @@ static void sp_tref_href_changed(SPObject *old_ref, SPObject *ref, SPTRef *tref)
static void sp_tref_delete_self(SPObject *deleted, SPTRef *self);
SPTRef::SPTRef() : SPItem() {
- this->stringChild = NULL;
+ this->stringChild = nullptr;
- this->href = NULL;
+ this->href = nullptr;
this->uriOriginalRef = new SPTRefReference(this);
this->_changed_connection =
@@ -78,7 +78,7 @@ void SPTRef::release() {
this->_changed_connection.disconnect();
g_free(this->href);
- this->href = NULL;
+ this->href = nullptr;
this->uriOriginalRef->detach();
@@ -95,14 +95,14 @@ void SPTRef::set(unsigned int key, const gchar* value) {
if ( !value ) {
// No value
g_free(this->href);
- this->href = NULL;
+ this->href = nullptr;
this->uriOriginalRef->detach();
} else if ((this->href && strcmp(value, this->href) != 0) || (!this->href)) {
// Value has changed
if ( this->href ) {
g_free(this->href);
- this->href = NULL;
+ this->href = nullptr;
}
this->href = g_strdup(value);
@@ -193,13 +193,13 @@ Geom::OptRect SPTRef::bbox(Geom::Affine const &transform, SPItem::BBoxType type)
parent_text = parent_text->parent;
}
- if (parent_text == NULL) {
+ if (parent_text == nullptr) {
return bbox;
}
// get the bbox of our portion of the layout
bbox = SP_TEXT(parent_text)->layout.bounds(transform,
- sp_text_get_length_upto(parent_text, this), sp_text_get_length_upto(this, NULL) - 1);
+ sp_text_get_length_upto(parent_text, this), sp_text_get_length_upto(this, nullptr) - 1);
// Add stroke width
// FIXME this code is incorrect
@@ -251,7 +251,7 @@ sp_tref_href_changed(SPObject */*old_ref*/, SPObject */*ref*/, SPTRef *tref)
if (tref->stringChild) {
tref->detach(tref->stringChild);
- tref->stringChild = NULL;
+ tref->stringChild = nullptr;
}
// Ensure that we are referring to a legitimate object
@@ -282,7 +282,7 @@ sp_tref_delete_self(SPObject */*deleted*/, SPTRef *self)
*/
SPObject * SPTRef::getObjectReferredTo(void)
{
- SPObject *referredObject = NULL;
+ SPObject *referredObject = nullptr;
if (uriOriginalRef) {
referredObject = uriOriginalRef->getObject();
@@ -295,7 +295,7 @@ SPObject * SPTRef::getObjectReferredTo(void)
* Return the object referred to via the URI reference
*/
SPObject const *SPTRef::getObjectReferredTo() const {
- SPObject *referredObject = NULL;
+ SPObject *referredObject = nullptr;
if (uriOriginalRef) {
referredObject = uriOriginalRef->getObject();
@@ -391,7 +391,7 @@ void sp_tref_update_text(SPTRef *tref)
if (tref->stringChild) {
tref->detach(tref->stringChild);
- tref->stringChild = NULL;
+ tref->stringChild = nullptr;
}
// Create the node and SPString to be the tref's child
@@ -402,7 +402,7 @@ void sp_tref_update_text(SPTRef *tref)
// Add this SPString as a child of the tref
tref->attach(tref->stringChild, tref->lastChild());
- sp_object_unref(tref->stringChild, NULL);
+ sp_object_unref(tref->stringChild, nullptr);
(tref->stringChild)->invoke_build(tref->document, newStringRepr, TRUE);
Inkscape::GC::release(newStringRepr);
@@ -446,7 +446,7 @@ build_string_from_root(Inkscape::XML::Node *root, Glib::ustring *retString)
SPObject *
sp_tref_convert_to_tspan(SPObject *obj)
{
- SPObject * new_tspan = NULL;
+ SPObject * new_tspan = nullptr;
////////////////////
// BASE CASE
@@ -472,7 +472,7 @@ sp_tref_convert_to_tspan(SPObject *obj)
// Create a new string child for the tspan
Inkscape::XML::Node *new_string_repr = tref->stringChild->getRepr()->duplicate(xml_doc);
- new_tspan_repr->addChild(new_string_repr, NULL);
+ new_tspan_repr->addChild(new_string_repr, nullptr);
//SPObject * new_string_child = document->getObjectByRepr(new_string_repr);
diff --git a/src/object/sp-tspan.cpp b/src/object/sp-tspan.cpp
index 175e5da3f..4df068c98 100644
--- a/src/object/sp-tspan.cpp
+++ b/src/object/sp-tspan.cpp
@@ -148,12 +148,12 @@ Geom::OptRect SPTSpan::bbox(Geom::Affine const &transform, SPItem::BBoxType type
parent_text = parent_text->parent;
}
- if (parent_text == NULL) {
+ if (parent_text == nullptr) {
return bbox;
}
// get the bbox of our portion of the layout
- bbox = SP_TEXT(parent_text)->layout.bounds(transform, sp_text_get_length_upto(parent_text, this), sp_text_get_length_upto(this, NULL) - 1);
+ bbox = SP_TEXT(parent_text)->layout.bounds(transform, sp_text_get_length_upto(parent_text, this), sp_text_get_length_upto(this, nullptr) - 1);
if (!bbox) {
return bbox;
@@ -180,10 +180,10 @@ Inkscape::XML::Node* SPTSpan::write(Inkscape::XML::Document *xml_doc, Inkscape::
std::vector<Inkscape::XML::Node *> l;
for (auto& child: children) {
- Inkscape::XML::Node* c_repr=NULL;
+ Inkscape::XML::Node* c_repr=nullptr;
if ( SP_IS_TSPAN(&child) || SP_IS_TREF(&child) ) {
- c_repr = child.updateRepr(xml_doc, NULL, flags);
+ c_repr = child.updateRepr(xml_doc, nullptr, flags);
} else if ( SP_IS_TEXTPATH(&child) ) {
//c_repr = child.updateRepr(xml_doc, NULL, flags); // shouldn't happen
} else if ( SP_IS_STRING(&child) ) {
@@ -196,7 +196,7 @@ Inkscape::XML::Node* SPTSpan::write(Inkscape::XML::Document *xml_doc, Inkscape::
}
for (auto i = l.rbegin(); i!= l.rend(); ++i) {
- repr->addChild((*i), NULL);
+ repr->addChild((*i), nullptr);
Inkscape::GC::release(*i);
}
} else {
@@ -229,7 +229,7 @@ void refresh_textpath_source(SPTextPath* offset);
SPTextPath::SPTextPath() : SPItem() {
this->startOffset._set = false;
this->side = SP_TEXT_PATH_SIDE_LEFT;
- this->originalPath = NULL;
+ this->originalPath = nullptr;
this->isUpdating=false;
// set up the uri reference
@@ -253,7 +253,7 @@ void SPTextPath::build(SPDocument *doc, Inkscape::XML::Node *repr) {
bool no_content = true;
- for (Inkscape::XML::Node* rch = repr->firstChild() ; rch != NULL; rch = rch->next()) {
+ for (Inkscape::XML::Node* rch = repr->firstChild() ; rch != nullptr; rch = rch->next()) {
if ( rch->type() == Inkscape::XML::TEXT_NODE )
{
no_content = false;
@@ -264,7 +264,7 @@ void SPTextPath::build(SPDocument *doc, Inkscape::XML::Node *repr) {
if ( no_content ) {
Inkscape::XML::Document *xml_doc = doc->getReprDoc();
Inkscape::XML::Node* rch = xml_doc->createTextNode("");
- repr->addChild(rch, NULL);
+ repr->addChild(rch, nullptr);
}
SPItem::build(doc, repr);
@@ -277,7 +277,7 @@ void SPTextPath::release() {
delete this->originalPath;
}
- this->originalPath = NULL;
+ this->originalPath = nullptr;
SPItem::release();
}
@@ -357,7 +357,7 @@ void SPTextPath::update(SPCtx *ctx, guint flags) {
void refresh_textpath_source(SPTextPath* tp)
{
- if ( tp == NULL ) {
+ if ( tp == nullptr ) {
return;
}
@@ -432,10 +432,10 @@ Inkscape::XML::Node* SPTextPath::write(Inkscape::XML::Document *xml_doc, Inkscap
std::vector<Inkscape::XML::Node *> l;
for (auto& child: children) {
- Inkscape::XML::Node* c_repr=NULL;
+ Inkscape::XML::Node* c_repr=nullptr;
if ( SP_IS_TSPAN(&child) || SP_IS_TREF(&child) ) {
- c_repr = child.updateRepr(xml_doc, NULL, flags);
+ c_repr = child.updateRepr(xml_doc, nullptr, flags);
} else if ( SP_IS_TEXTPATH(&child) ) {
//c_repr = child->updateRepr(xml_doc, NULL, flags); // shouldn't happen
} else if ( SP_IS_STRING(&child) ) {
@@ -448,7 +448,7 @@ Inkscape::XML::Node* SPTextPath::write(Inkscape::XML::Document *xml_doc, Inkscap
}
for( auto i = l.rbegin(); i != l.rend(); ++i ) {
- repr->addChild(*i, NULL);
+ repr->addChild(*i, nullptr);
Inkscape::GC::release(*i);
}
} else {
@@ -478,7 +478,7 @@ SPItem *sp_textpath_get_path_item(SPTextPath *tp)
return refobj;
}
}
- return NULL;
+ return nullptr;
}
void sp_textpath_to_text(SPObject *tp)
@@ -507,7 +507,7 @@ void sp_textpath_to_text(SPObject *tp)
// remove the old repr from under textpath
tp->getRepr()->removeChild(*i);
// put its copy under text
- text->getRepr()->addChild(copy, NULL); // fixme: copy id
+ text->getRepr()->addChild(copy, nullptr); // fixme: copy id
}
//remove textpath
diff --git a/src/object/sp-use-reference.cpp b/src/object/sp-use-reference.cpp
index d35bdf579..d5fdfc01a 100644
--- a/src/object/sp-use-reference.cpp
+++ b/src/object/sp-use-reference.cpp
@@ -38,12 +38,12 @@ SPUsePath::SPUsePath(SPObject* i_owner):SPUseReference(i_owner)
owner=i_owner;
originalPath = nullptr;
sourceDirty=false;
- sourceHref = NULL;
- sourceRepr = NULL;
- sourceObject = NULL;
+ sourceHref = nullptr;
+ sourceRepr = nullptr;
+ sourceObject = nullptr;
_changed_connection = changedSignal().connect(sigc::bind(sigc::ptr_fun(sp_usepath_href_changed), this)); // listening to myself, this should be virtual instead
- user_unlink = NULL;
+ user_unlink = nullptr;
}
SPUsePath::~SPUsePath(void)
@@ -61,7 +61,7 @@ SPUsePath::~SPUsePath(void)
void
SPUsePath::link(char *to)
{
- if ( to == NULL ) {
+ if ( to == nullptr ) {
quit_listening();
unlink();
} else {
@@ -85,14 +85,14 @@ void
SPUsePath::unlink(void)
{
g_free(sourceHref);
- sourceHref = NULL;
+ sourceHref = nullptr;
detach();
}
void
SPUsePath::start_listening(SPObject* to)
{
- if ( to == NULL ) {
+ if ( to == nullptr ) {
return;
}
sourceObject = to;
@@ -105,14 +105,14 @@ SPUsePath::start_listening(SPObject* to)
void
SPUsePath::quit_listening(void)
{
- if ( sourceObject == NULL ) {
+ if ( sourceObject == nullptr ) {
return;
}
_modified_connection.disconnect();
_delete_connection.disconnect();
_transformed_connection.disconnect();
- sourceRepr = NULL;
- sourceObject = NULL;
+ sourceRepr = nullptr;
+ sourceObject = nullptr;
}
static void
@@ -203,7 +203,7 @@ void SPUsePath::refresh_source()
}
SPObject *refobj = sourceObject;
- if ( refobj == NULL ) return;
+ if ( refobj == nullptr ) return;
SPItem *item = SP_ITEM(refobj);
diff --git a/src/object/sp-use.cpp b/src/object/sp-use.cpp
index af61e392b..6ee4be4b2 100644
--- a/src/object/sp-use.cpp
+++ b/src/object/sp-use.cpp
@@ -46,8 +46,8 @@
SPUse::SPUse()
: SPItem(),
SPDimensions(),
- child(NULL),
- href(NULL),
+ child(nullptr),
+ href(nullptr),
ref(new SPUseReference(this)),
_delete_connection(),
_changed_connection(),
@@ -66,12 +66,12 @@ SPUse::SPUse()
SPUse::~SPUse() {
if (this->child) {
this->detach(this->child);
- this->child = NULL;
+ this->child = nullptr;
}
this->ref->detach();
delete this->ref;
- this->ref = 0;
+ this->ref = nullptr;
}
void SPUse::build(SPDocument *document, Inkscape::XML::Node *repr) {
@@ -91,7 +91,7 @@ void SPUse::build(SPDocument *document, Inkscape::XML::Node *repr) {
void SPUse::release() {
if (this->child) {
this->detach(this->child);
- this->child = NULL;
+ this->child = nullptr;
}
this->_delete_connection.disconnect();
@@ -99,7 +99,7 @@ void SPUse::release() {
this->_transformed_connection.disconnect();
g_free(this->href);
- this->href = NULL;
+ this->href = nullptr;
this->ref->detach();
@@ -133,7 +133,7 @@ void SPUse::set(unsigned int key, const gchar* value) {
/* No change, do nothing. */
} else {
g_free(this->href);
- this->href = NULL;
+ this->href = nullptr;
if (value) {
// First, set the href field, because SPUse::href_changed will need it.
@@ -241,9 +241,9 @@ gchar* SPUse::description() const {
if (child) {
if ( dynamic_cast<SPSymbol *>(child) ) {
if (child->title()) {
- return g_strdup_printf(_("called %s"), Glib::Markup::escape_text(Glib::ustring( g_dpgettext2(NULL, "Symbol", child->title()))).c_str());
+ return g_strdup_printf(_("called %s"), Glib::Markup::escape_text(Glib::ustring( g_dpgettext2(nullptr, "Symbol", child->title()))).c_str());
} else if (child->getAttribute("id")) {
- return g_strdup_printf(_("called %s"), Glib::Markup::escape_text(Glib::ustring( g_dpgettext2(NULL, "Symbol", child->getAttribute("id")))).c_str());
+ return g_strdup_printf(_("called %s"), Glib::Markup::escape_text(Glib::ustring( g_dpgettext2(nullptr, "Symbol", child->getAttribute("id")))).c_str());
} else {
return g_strdup_printf(_("called %s"), _("Unnamed Symbol"));
}
@@ -506,7 +506,7 @@ void SPUse::href_changed() {
if (this->child) {
this->detach(this->child);
- this->child = NULL;
+ this->child = nullptr;
}
if (this->href) {
@@ -526,7 +526,7 @@ void SPUse::href_changed() {
this->child->invoke_build(this->document, childrepr, TRUE);
- for (SPItemView *v = this->display; v != NULL; v = v->next) {
+ for (SPItemView *v = this->display; v != nullptr; v = v->next) {
Inkscape::DrawingItem *ai = this->child->invoke_show(v->arenaitem->drawing(), v->key, v->flags);
if (ai) {
@@ -595,7 +595,7 @@ void SPUse::update(SPCtx *ctx, unsigned flags) {
if (childflags || (this->child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
SPItem const *chi = dynamic_cast<SPItem const *>(child);
- g_assert(chi != NULL);
+ g_assert(chi != nullptr);
cctx.i2doc = chi->transform * ictx->i2doc;
cctx.i2vp = chi->transform * ictx->i2vp;
this->child->updateDisplay((SPCtx *)&cctx, childflags);
@@ -607,7 +607,7 @@ void SPUse::update(SPCtx *ctx, unsigned flags) {
SPItem::update(ctx, flags);
if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) {
- for (SPItemView *v = this->display; v != NULL; v = v->next) {
+ for (SPItemView *v = this->display; v != nullptr; v = v->next) {
Inkscape::DrawingGroup *g = dynamic_cast<Inkscape::DrawingGroup *>(v->arenaitem);
this->context_style = this->style;
g->setStyle(this->style, this->context_style);
@@ -615,7 +615,7 @@ void SPUse::update(SPCtx *ctx, unsigned flags) {
}
/* As last step set additional transform of arena group */
- for (SPItemView *v = this->display; v != NULL; v = v->next) {
+ for (SPItemView *v = this->display; v != nullptr; v = v->next) {
Inkscape::DrawingGroup *g = dynamic_cast<Inkscape::DrawingGroup *>(v->arenaitem);
Geom::Affine t(Geom::Translate(this->x.computed, this->y.computed));
g->setChildTransform(t);
@@ -631,7 +631,7 @@ void SPUse::modified(unsigned int flags) {
flags &= SP_OBJECT_MODIFIED_CASCADE;
if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) {
- for (SPItemView *v = this->display; v != NULL; v = v->next) {
+ for (SPItemView *v = this->display; v != nullptr; v = v->next) {
Inkscape::DrawingGroup *g = dynamic_cast<Inkscape::DrawingGroup *>(v->arenaitem);
this->context_style = this->style;
g->setStyle(this->style, this->context_style);
@@ -653,7 +653,7 @@ SPItem *SPUse::unlink() {
Inkscape::XML::Node *repr = this->getRepr();
if (!repr) {
- return NULL;
+ return nullptr;
}
Inkscape::XML::Node *parent = repr->parent();
@@ -664,18 +664,18 @@ SPItem *SPUse::unlink() {
SPItem *orig = this->root();
if (!orig) {
- return NULL;
+ return nullptr;
}
// Calculate the accumulated transform, starting from the original.
Geom::Affine t = this->get_root_transform();
- Inkscape::XML::Node *copy = NULL;
+ Inkscape::XML::Node *copy = nullptr;
if (dynamic_cast<SPSymbol *>(orig)) { // make a group, copy children
copy = xml_doc->createElement("svg:g");
- for (Inkscape::XML::Node *child = orig->getRepr()->firstChild() ; child != NULL; child = child->next()) {
+ for (Inkscape::XML::Node *child = orig->getRepr()->firstChild() ; child != nullptr; child = child->next()) {
Inkscape::XML::Node *newchild = child->duplicate(xml_doc);
copy->appendChild(newchild);
}
@@ -706,17 +706,17 @@ SPItem *SPUse::unlink() {
Inkscape::GC::release(repr);
// Remove tiled clone attrs.
- copy->setAttribute("inkscape:tiled-clone-of", NULL);
- copy->setAttribute("inkscape:tile-w", NULL);
- copy->setAttribute("inkscape:tile-h", NULL);
- copy->setAttribute("inkscape:tile-cx", NULL);
- copy->setAttribute("inkscape:tile-cy", NULL);
+ copy->setAttribute("inkscape:tiled-clone-of", nullptr);
+ copy->setAttribute("inkscape:tile-w", nullptr);
+ copy->setAttribute("inkscape:tile-h", nullptr);
+ copy->setAttribute("inkscape:tile-cx", nullptr);
+ copy->setAttribute("inkscape:tile-cy", nullptr);
// Establish the succession and let go of our object.
this->setSuccessor(unlinked);
SPItem *item = dynamic_cast<SPItem *>(unlinked);
- g_assert(item != NULL);
+ g_assert(item != nullptr);
// Set the accummulated transform.
{
@@ -729,7 +729,7 @@ SPItem *SPUse::unlink() {
}
SPItem *SPUse::get_original() {
- SPItem *ref = NULL;
+ SPItem *ref = nullptr;
if (this->ref){
ref = this->ref->getObject();
diff --git a/src/object/uri-references.cpp b/src/object/uri-references.cpp
index 43dc996df..b4af31278 100644
--- a/src/object/uri-references.cpp
+++ b/src/object/uri-references.cpp
@@ -29,21 +29,21 @@ namespace Inkscape {
URIReference::URIReference(SPObject *owner)
: _owner(owner)
- , _owner_document(NULL)
- , _obj(NULL)
- , _uri(NULL)
+ , _owner_document(nullptr)
+ , _obj(nullptr)
+ , _uri(nullptr)
{
- g_assert(_owner != NULL);
+ g_assert(_owner != nullptr);
/* FIXME !!! attach to owner's destroy signal to clean up in case */
}
URIReference::URIReference(SPDocument *owner_document)
- : _owner(NULL)
+ : _owner(nullptr)
, _owner_document(owner_document)
- , _obj(NULL)
- , _uri(NULL)
+ , _obj(nullptr)
+ , _uri(nullptr)
{
- g_assert(_owner_document != NULL);
+ g_assert(_owner_document != nullptr);
}
URIReference::~URIReference() { detach(); }
@@ -109,7 +109,7 @@ bool URIReference::_acceptObject(SPObject *obj) const
void URIReference::attach(const URI &uri)
{
- SPDocument *document = NULL;
+ SPDocument *document = nullptr;
// Attempt to get the document that contains the URI
if (_owner) {
@@ -134,7 +134,7 @@ void URIReference::attach(const URI &uri)
if (!path.empty()) {
document = document->createChildDoc(path);
} else {
- document = NULL;
+ document = nullptr;
}
}
if (!document) {
@@ -153,7 +153,7 @@ void URIReference::attach(const URI &uri)
/* for now this handles the minimal xpointer form that SVG 1.0
* requires of us
*/
- gchar *id = NULL;
+ gchar *id = nullptr;
if (!strncmp(fragment, "xpointer(", 9)) {
/* FIXME !!! this is wasteful */
/* FIXME: It looks as though this is including "))" in the id. I suggest moving
@@ -189,14 +189,14 @@ void URIReference::detach()
{
_connection.disconnect();
delete _uri;
- _uri = NULL;
- _setObject(NULL);
+ _uri = nullptr;
+ _setObject(nullptr);
}
void URIReference::_setObject(SPObject *obj)
{
if (obj && !_acceptObject(obj)) {
- obj = NULL;
+ obj = nullptr;
}
if (obj == _obj)
@@ -224,7 +224,7 @@ void URIReference::_setObject(SPObject *obj)
void URIReference::_release(SPObject *obj)
{
g_assert(_obj == obj);
- _setObject(NULL);
+ _setObject(nullptr);
}
} /* namespace Inkscape */
@@ -233,7 +233,7 @@ void URIReference::_release(SPObject *obj)
SPObject *sp_css_uri_reference_resolve(SPDocument *document, const gchar *uri)
{
- SPObject *ref = NULL;
+ SPObject *ref = nullptr;
if (document && uri && (strncmp(uri, "url(", 4) == 0)) {
gchar *trimmed = extract_uri(uri);
@@ -248,7 +248,7 @@ SPObject *sp_css_uri_reference_resolve(SPDocument *document, const gchar *uri)
SPObject *sp_uri_reference_resolve(SPDocument *document, const gchar *uri)
{
- SPObject *ref = NULL;
+ SPObject *ref = nullptr;
if (uri && (*uri == '#')) {
ref = document->getObjectById(uri + 1);
diff --git a/src/object/uri.cpp b/src/object/uri.cpp
index 881b322b4..91878512a 100644
--- a/src/object/uri.cpp
+++ b/src/object/uri.cpp
@@ -61,7 +61,7 @@ URI::Impl::Impl(xmlURIPtr uri)
URI::Impl::~Impl() {
if (_uri) {
xmlFreeURI(_uri);
- _uri = NULL;
+ _uri = nullptr;
}
}
@@ -76,7 +76,7 @@ void URI::Impl::unreference() {
}
bool URI::Impl::isOpaque() const {
- bool opq = !isRelative() && (getOpaque() != NULL);
+ bool opq = !isRelative() && (getOpaque() != nullptr);
return opq;
}
@@ -136,7 +136,7 @@ const gchar *URI::Impl::getOpaque() const {
gchar *URI::to_native_filename(gchar const* uri)
{
- gchar *filename = NULL;
+ gchar *filename = nullptr;
URI tmp(uri);
filename = tmp.toNativeFilename();
return filename;
@@ -173,7 +173,7 @@ gchar *URI::toNativeFilename() const {
if (isRelativePath()) {
return uriString;
} else {
- gchar *filename = g_filename_from_uri(uriString, NULL, NULL);
+ gchar *filename = g_filename_from_uri(uriString, nullptr, nullptr);
g_free(uriString);
if (filename) {
return filename;
@@ -216,7 +216,7 @@ URI URI::fromUtf8( gchar const* path ) {
/* TODO !!! proper error handling */
URI URI::from_native_filename(gchar const *path) {
- gchar *uri = g_filename_to_uri(path, NULL, NULL);
+ gchar *uri = g_filename_to_uri(path, nullptr, nullptr);
URI result(uri);
g_free( uri );
return result;
@@ -230,7 +230,7 @@ gchar *URI::Impl::toString() const {
xmlFree(string);
return glib_string;
} else {
- return NULL;
+ return nullptr;
}
}