Skip to content

Commit 5266433

Browse files
hjmjohnsonjcfr
authored andcommitted
COMP: Use nullptr instead of 0 or NULL
The check converts the usage of null pointer constants (eg. NULL, 0) to use the new C++11 nullptr keyword. cd ${BLDDIR} run-clang-tidy.py -extra-arg=-D__clang__ -checks=-*,modernize-use-nullptr -header-filter=.* -fix
1 parent 4552731 commit 5266433

13 files changed

+21
-21
lines changed

Libs/MRML/Core/Testing/vtkMRMLDisplayableHierarchyNodeDisplayPropertiesTest.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ bool TestColors(vtkMRMLScene* scene,
376376
return false;
377377
}
378378
vtkMRMLDisplayableHierarchyNode* hierarchyNode = GetHierarchyNode(scene, level);
379-
assert(hierarchyNode != 0);
379+
assert(hierarchyNode != nullptr);
380380
vtkMRMLDisplayNode* hierarchyDisplayNode = hierarchyNode->GetDisplayNode();
381381
if (hierarchyDisplayNode->GetColor()[0] != hierarchyColors[level][0] ||
382382
hierarchyDisplayNode->GetColor()[1] != hierarchyColors[level][1] ||
@@ -411,7 +411,7 @@ bool TestVisibility(vtkMRMLScene* scene,
411411
return false;
412412
}
413413
vtkMRMLDisplayableHierarchyNode* hierarchyNode = GetHierarchyNode(scene, level);
414-
assert(hierarchyNode != 0);
414+
assert(hierarchyNode != nullptr);
415415
vtkMRMLDisplayNode* hierarchyDisplayNode = hierarchyNode->GetDisplayNode();
416416
if (hierarchyDisplayNode->GetVisibility() != hierarchyVisibility[level])
417417
{

Libs/MRML/Core/vtkMRMLScene.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,7 +1304,7 @@ vtkMRMLNode* vtkMRMLScene::AddNewNodeByClassWithID(std::string className, std::s
13041304
if (className.empty())
13051305
{
13061306
vtkErrorMacro("AddNewNodeByClassWithID: className is an emptry string");
1307-
return NULL;
1307+
return nullptr;
13081308
}
13091309

13101310
if (nodeID.empty())
@@ -1325,7 +1325,7 @@ vtkMRMLNode* vtkMRMLScene::AddNewNodeByClassWithID(std::string className, std::s
13251325
if (this->NodeIDs.find(nodeID) != this->NodeIDs.end())
13261326
{
13271327
vtkErrorMacro("AddNewNodeByClassWithID: node already exists with ID - " << nodeID);
1328-
return NULL;
1328+
return nullptr;
13291329
}
13301330

13311331
vtkSmartPointer<vtkMRMLNode> nodeToAdd =
@@ -1910,7 +1910,7 @@ vtkMRMLNode* vtkMRMLScene::GetNodeByID(const char* id)
19101910
{
19111911
// Ensure the node can't be found, and there is no error with the cache
19121912
// mechanism.
1913-
vtkMRMLNode* foundNode = 0;
1913+
vtkMRMLNode* foundNode = nullptr;
19141914
vtkCollectionSimpleIterator it;
19151915
for (this->Nodes->InitTraversal(it);
19161916
(node = (vtkMRMLNode*)this->Nodes->GetNextItemAsObject(it)) ;)

Libs/MRML/Core/vtkMRMLTextStorageNode.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ int vtkMRMLTextStorageNode::ReadDataInternal(vtkMRMLNode * refNode)
108108
bool vtkMRMLTextStorageNode::CanWriteFromReferenceNode(vtkMRMLNode * refNode)
109109
{
110110
vtkMRMLTextNode* textNode = vtkMRMLTextNode::SafeDownCast(refNode);
111-
if (textNode == NULL)
111+
if (textNode == nullptr)
112112
{
113113
vtkErrorMacro("vtkMRMLTextStorageNode::CanWriteFromReferenceNode: input is not a text node");
114114
return false;
@@ -120,7 +120,7 @@ bool vtkMRMLTextStorageNode::CanWriteFromReferenceNode(vtkMRMLNode * refNode)
120120
int vtkMRMLTextStorageNode::WriteDataInternal(vtkMRMLNode * refNode)
121121
{
122122
vtkMRMLTextNode* textNode = vtkMRMLTextNode::SafeDownCast(refNode);
123-
if (textNode == NULL)
123+
if (textNode == nullptr)
124124
{
125125
vtkErrorMacro(<< "vtkMRMLTextStorageNode::WriteDataInternal: Do not recognize node type " << refNode->GetClassName());
126126
return 0;

Libs/MRML/DisplayableManager/vtkMRMLCrosshairDisplayableManager.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ vtkMRMLCrosshairDisplayableManager::vtkInternal::~vtkInternal()
142142
}
143143

144144
// everything should be empty
145-
assert(this->CrosshairNode == 0);
145+
assert(this->CrosshairNode == nullptr);
146146
}
147147

148148
//---------------------------------------------------------------------------

Libs/MRML/DisplayableManager/vtkMRMLVolumeGlyphSliceDisplayableManager.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ vtkMRMLVolumeGlyphSliceDisplayableManager::vtkInternal::~vtkInternal()
123123
{
124124
this->SetSliceCompositeNode(nullptr);
125125
// everything should be empty
126-
assert(this->SliceCompositeNode == 0);
126+
assert(this->SliceCompositeNode == nullptr);
127127
assert(this->VolumeNodes.size() == 0);
128128
assert(this->DisplayNodes.size() == 0);
129129
assert(this->Actors.size() == 0);

Libs/MRML/Logic/vtkMRMLSliceLayerLogic.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,15 +391,15 @@ void vtkMRMLSliceLayerLogic::UpdateNodeReferences ()
391391
if ( displayNode != this->VolumeDisplayNodeObserved &&
392392
this->VolumeDisplayNode != nullptr)
393393
{
394-
vtkDebugMacro("vtkMRMLSliceLayerLogic::UpdateNodeReferences: new display node = " << (displayNode == 0 ? "null" : "valid") << endl);
394+
vtkDebugMacro("vtkMRMLSliceLayerLogic::UpdateNodeReferences: new display node = " << (displayNode == nullptr ? "null" : "valid") << endl);
395395
this->VolumeDisplayNode->Delete();
396396
this->VolumeDisplayNode = nullptr;
397397
}
398398

399399
if ( displayNode != this->VolumeDisplayNodeObserved &&
400400
this->VolumeDisplayNodeUVW != nullptr)
401401
{
402-
vtkDebugMacro("vtkMRMLSliceLayerLogic::UpdateNodeReferences: new display node = " << (displayNode == 0 ? "null" : "valid") << endl);
402+
vtkDebugMacro("vtkMRMLSliceLayerLogic::UpdateNodeReferences: new display node = " << (displayNode == nullptr ? "null" : "valid") << endl);
403403
this->VolumeDisplayNodeUVW->Delete();
404404
this->VolumeDisplayNodeUVW = nullptr;
405405
}

Libs/MRML/Widgets/qMRMLSceneModel.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1176,7 +1176,7 @@ void qMRMLSceneModel::onMRMLSceneNodeAboutToBeAdded(vtkMRMLScene* scene, vtkMRML
11761176
Q_UNUSED(node);
11771177
#ifndef QT_NO_DEBUG
11781178
Q_D(qMRMLSceneModel);
1179-
Q_ASSERT(scene != 0);
1179+
Q_ASSERT(scene != nullptr);
11801180
Q_ASSERT(scene == d->MRMLScene);
11811181
#endif
11821182
}

Modules/Loadable/Data/Logic/vtkSlicerDataModuleLogic.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ void vtkSlicerDataModuleLogic::SetMRMLSceneInternal(vtkMRMLScene * newScene)
7474
//-----------------------------------------------------------------------------
7575
void vtkSlicerDataModuleLogic::RegisterNodes()
7676
{
77-
assert(this->GetMRMLScene() != 0);
77+
assert(this->GetMRMLScene() != nullptr);
7878
}
7979

8080
//---------------------------------------------------------------------------

Modules/Loadable/SubjectHierarchy/Widgets/qSlicerSubjectHierarchyVisibilityPlugin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Q_SLICER_MODULE_SUBJECTHIERARCHY_WIDGETS_EXPORT qSlicerSubjectHierarchyVis
3838

3939
public:
4040
typedef qSlicerSubjectHierarchyAbstractPlugin Superclass;
41-
qSlicerSubjectHierarchyVisibilityPlugin(QObject* parent = NULL);
41+
qSlicerSubjectHierarchyVisibilityPlugin(QObject* parent = nullptr);
4242
~qSlicerSubjectHierarchyVisibilityPlugin() override;
4343

4444
public:

Modules/Loadable/Texts/qSlicerTextsReader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class qSlicerTextsReader : public qSlicerFileReader
3131
Q_OBJECT
3232
public:
3333
typedef qSlicerFileReader Superclass;
34-
qSlicerTextsReader(QObject* parent = 0);
34+
qSlicerTextsReader(QObject* parent = nullptr);
3535
~qSlicerTextsReader() override;
3636

3737
QString description() const override;

0 commit comments

Comments
 (0)