Use nullptr instead of NULL in the code and documentation
This is a combination of running clang-tidy with modernize-use-nullptr check for some ports (GTK, X11, OSX) and manual changes to the ports for which it couldn't be used easily (MSW, DFB) and also manually updating the docs. Also replace NULL with null or nullptr in the comments as this is more consistent with the use of nullptr in the code and makes it simpler to grep for the remaining occurrences of NULL itself. And also use null in the assert messages. Only a few occurrences of "NULL" are still left in non-C files, mostly corresponding to unclear comments or string output which it might not be safe to change.
This commit is contained in:
parent
39ea524943
commit
4f4c5fcfdf
1844 changed files with 13721 additions and 13734 deletions
|
|
@ -40,12 +40,12 @@ void CheckXml(const wxXmlNode *n, ...)
|
|||
for (;;)
|
||||
{
|
||||
const char *childName = va_arg(args, char*);
|
||||
if ( childName == NULL )
|
||||
if ( childName == nullptr )
|
||||
break;
|
||||
|
||||
CPPUNIT_ASSERT( child );
|
||||
CPPUNIT_ASSERT_EQUAL( childName, child->GetName() );
|
||||
CPPUNIT_ASSERT( child->GetChildren() == NULL );
|
||||
CPPUNIT_ASSERT( child->GetChildren() == nullptr );
|
||||
CPPUNIT_ASSERT( child->GetParent() == n );
|
||||
|
||||
child = child->GetNext();
|
||||
|
|
@ -53,7 +53,7 @@ void CheckXml(const wxXmlNode *n, ...)
|
|||
|
||||
va_end(args);
|
||||
|
||||
CPPUNIT_ASSERT( child == NULL ); // no more children
|
||||
CPPUNIT_ASSERT( child == nullptr ); // no more children
|
||||
}
|
||||
|
||||
} // anon namespace
|
||||
|
|
@ -112,41 +112,41 @@ void XmlTestCase::InsertChild()
|
|||
wxXmlNode *two = new wxXmlNode(wxXML_ELEMENT_NODE, "2");
|
||||
root->AddChild(two);
|
||||
root->AddChild(new wxXmlNode(wxXML_ELEMENT_NODE, "3"));
|
||||
CheckXml(root.get(), "1", "2", "3", NULL);
|
||||
CheckXml(root.get(), "1", "2", "3", nullptr);
|
||||
|
||||
// check inserting in front:
|
||||
root->InsertChild(new wxXmlNode(wxXML_ELEMENT_NODE, "A"), NULL);
|
||||
CheckXml(root.get(), "A", "1", "2", "3", NULL);
|
||||
root->InsertChild(new wxXmlNode(wxXML_ELEMENT_NODE, "A"), nullptr);
|
||||
CheckXml(root.get(), "A", "1", "2", "3", nullptr);
|
||||
root->InsertChild(new wxXmlNode(wxXML_ELEMENT_NODE, "B"), root->GetChildren());
|
||||
CheckXml(root.get(), "B", "A", "1", "2", "3", NULL);
|
||||
CheckXml(root.get(), "B", "A", "1", "2", "3", nullptr);
|
||||
|
||||
// and in the middle:
|
||||
root->InsertChild(new wxXmlNode(wxXML_ELEMENT_NODE, "C"), two);
|
||||
CheckXml(root.get(), "B", "A", "1", "C", "2", "3", NULL);
|
||||
CheckXml(root.get(), "B", "A", "1", "C", "2", "3", nullptr);
|
||||
}
|
||||
|
||||
void XmlTestCase::InsertChildAfter()
|
||||
{
|
||||
wxScopedPtr<wxXmlNode> root(new wxXmlNode(wxXML_ELEMENT_NODE, "root"));
|
||||
|
||||
root->InsertChildAfter(new wxXmlNode(wxXML_ELEMENT_NODE, "1"), NULL);
|
||||
CheckXml(root.get(), "1", NULL);
|
||||
root->InsertChildAfter(new wxXmlNode(wxXML_ELEMENT_NODE, "1"), nullptr);
|
||||
CheckXml(root.get(), "1", nullptr);
|
||||
|
||||
wxXmlNode *two = new wxXmlNode(wxXML_ELEMENT_NODE, "2");
|
||||
root->AddChild(two);
|
||||
wxXmlNode *three = new wxXmlNode(wxXML_ELEMENT_NODE, "3");
|
||||
root->AddChild(three);
|
||||
CheckXml(root.get(), "1", "2", "3", NULL);
|
||||
CheckXml(root.get(), "1", "2", "3", nullptr);
|
||||
|
||||
// check inserting in the middle:
|
||||
root->InsertChildAfter(new wxXmlNode(wxXML_ELEMENT_NODE, "A"), root->GetChildren());
|
||||
CheckXml(root.get(), "1", "A", "2", "3", NULL);
|
||||
CheckXml(root.get(), "1", "A", "2", "3", nullptr);
|
||||
root->InsertChildAfter(new wxXmlNode(wxXML_ELEMENT_NODE, "B"), two);
|
||||
CheckXml(root.get(), "1", "A", "2", "B", "3", NULL);
|
||||
CheckXml(root.get(), "1", "A", "2", "B", "3", nullptr);
|
||||
|
||||
// and at the end:
|
||||
root->InsertChildAfter(new wxXmlNode(wxXML_ELEMENT_NODE, "C"), three);
|
||||
CheckXml(root.get(), "1", "A", "2", "B", "3", "C", NULL);
|
||||
CheckXml(root.get(), "1", "A", "2", "B", "3", "C", nullptr);
|
||||
}
|
||||
|
||||
void XmlTestCase::LoadSave()
|
||||
|
|
@ -445,7 +445,7 @@ void XmlTestCase::SetRoot()
|
|||
|
||||
// Other tests.
|
||||
CPPUNIT_ASSERT( docNode == root->GetParent() );
|
||||
doc.SetRoot(NULL); // Removes from doc but dosn't free mem, doc node left.
|
||||
doc.SetRoot(nullptr); // Removes from doc but dosn't free mem, doc node left.
|
||||
CPPUNIT_ASSERT( !doc.IsOk() );
|
||||
|
||||
wxXmlNode *comment = new wxXmlNode(wxXML_COMMENT_NODE, "comment", "Prolog Comment");
|
||||
|
|
@ -468,7 +468,7 @@ void XmlTestCase::SetRoot()
|
|||
CPPUNIT_ASSERT( node->GetParent() == docNode );
|
||||
node = node->GetNext();
|
||||
CPPUNIT_ASSERT( !node );
|
||||
doc.SetRoot(NULL);
|
||||
doc.SetRoot(nullptr);
|
||||
CPPUNIT_ASSERT( !doc.IsOk() );
|
||||
doc.SetRoot(root);
|
||||
CPPUNIT_ASSERT( doc.IsOk() );
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ TEST_CASE_METHOD(XrcTestCase, "XRC::ObjectReferences", "[xrc]")
|
|||
// In xrc there's now a dialog containing two panels, one an object
|
||||
// reference of the other
|
||||
wxDialog dlg;
|
||||
REQUIRE( wxXmlResource::Get()->LoadDialog(&dlg, NULL, "dialog") );
|
||||
REQUIRE( wxXmlResource::Get()->LoadDialog(&dlg, nullptr, "dialog") );
|
||||
// Might as well test XRCCTRL too
|
||||
wxPanel* panel1 = XRCCTRL(dlg,"panel1",wxPanel);
|
||||
wxPanel* panel2 = XRCCTRL(dlg,"ref_of_panel1",wxPanel);
|
||||
|
|
@ -286,7 +286,7 @@ TEST_CASE("XRC::EnvVarInPath", "[xrc]")
|
|||
wxUnsetEnv("WX_TEST_ENV_IN_PATH");
|
||||
wxXmlResource::Get()->SetFlags(wxXRC_USE_LOCALE);
|
||||
}
|
||||
virtual wxObject* DoCreateResource() override { return NULL; }
|
||||
virtual wxObject* DoCreateResource() override { return nullptr; }
|
||||
virtual bool CanHandle(wxXmlNode*) override { return false; }
|
||||
bool varIsSet;
|
||||
} handler(xmlDoc.GetRoot());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue