From b03240add0ffbe9166649fe225eae6205bfcb7e1 Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Thu, 7 Nov 2024 21:14:27 +0100 Subject: [PATCH 1/2] STYLE: Remove `m_Stream = nullptr` from destructor of `FileOutputWindow` `m_Stream` is a non-static member of `itk::FileOutputWindow`, so it cannot be accessed anymore when the FileOutputWindow object is destructed. --- Modules/Core/Common/src/itkFileOutputWindow.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/Modules/Core/Common/src/itkFileOutputWindow.cxx b/Modules/Core/Common/src/itkFileOutputWindow.cxx index 8254bf78965..44984d849c0 100644 --- a/Modules/Core/Common/src/itkFileOutputWindow.cxx +++ b/Modules/Core/Common/src/itkFileOutputWindow.cxx @@ -33,7 +33,6 @@ FileOutputWindow::FileOutputWindow() FileOutputWindow::~FileOutputWindow() { delete m_Stream; - m_Stream = nullptr; } void From aa38494b56914fa4de2cf32533b9130579417c94 Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Wed, 6 Nov 2024 23:26:19 +0100 Subject: [PATCH 2/2] STYLE: Remove C-style cast from `nullptr` default arguments QuadEdgeMesh Found by the regular expression `(\w+ \*)([ ]+\w+ = )\(\1\)nullptr`. Following C++ Core Guidelines, Oct 3, 2024, "Avoid casts", http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#es48-avoid-casts --- .../include/itkQuadEdgeMeshBaseIterator.h | 4 +--- .../include/itkQuadEdgeMeshFrontIterator.h | 11 +++-------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshBaseIterator.h b/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshBaseIterator.h index 0e32f3862ee..64631eaa881 100644 --- a/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshBaseIterator.h +++ b/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshBaseIterator.h @@ -275,9 +275,7 @@ class ITK_TEMPLATE_EXPORT QuadEdgeMeshIteratorGeom : public QuadEdgeMeshIterator using OriginRefType = typename QuadEdgeType::OriginRefType; public: - QuadEdgeMeshIteratorGeom(QuadEdgeType * e = (QuadEdgeType *)nullptr, - int op = Superclass::OperatorOnext, - bool start = true) + QuadEdgeMeshIteratorGeom(QuadEdgeType * e = nullptr, int op = Superclass::OperatorOnext, bool start = true) : Superclass(e, op, start) {} diff --git a/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshFrontIterator.h b/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshFrontIterator.h index 9072eda96f1..7ddc9d96581 100644 --- a/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshFrontIterator.h +++ b/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshFrontIterator.h @@ -32,10 +32,7 @@ using FrontIterator = QuadEdgeMeshFrontIterator; \ using ConstFrontIterator = QuadEdgeMeshConstFrontIterator; \ \ - virtual FrontIterator BeginFront(QEPrimalType * seed = (QEPrimalType *)nullptr) \ - { \ - return (FrontIterator(this, true, seed)); \ - } \ + virtual FrontIterator BeginFront(QEPrimalType * seed = nullptr) { return (FrontIterator(this, true, seed)); } \ \ virtual ConstFrontIterator BeginFront(QEPrimalType * seed) const { return (ConstFrontIterator(this, true, seed)); } \ \ @@ -149,9 +146,7 @@ class ITK_TEMPLATE_EXPORT QuadEdgeMeshFrontBaseIterator public: /** Object creation methods. */ - QuadEdgeMeshFrontBaseIterator(MeshType * mesh = (MeshType *)nullptr, - bool start = true, - QEType * seed = (QEType *)nullptr); + QuadEdgeMeshFrontBaseIterator(MeshType * mesh = nullptr, bool start = true, QEType * seed = nullptr); virtual ~QuadEdgeMeshFrontBaseIterator(); Self & @@ -242,7 +237,7 @@ class ITK_TEMPLATE_EXPORT QuadEdgeMeshFrontIterator : public QuadEdgeMeshFrontBa public: /** Object creation methods. */ - QuadEdgeMeshFrontIterator(MeshType * mesh = (MeshType *)0, bool start = true, QEType * seed = (QEType *)nullptr) + QuadEdgeMeshFrontIterator(MeshType * mesh = (MeshType *)0, bool start = true, QEType * seed = nullptr) : Superclass(mesh, start, seed) {} ~QuadEdgeMeshFrontIterator() override = default;