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:
Vadim Zeitlin 2022-10-16 01:24:34 +02:00
parent 39ea524943
commit 4f4c5fcfdf
1844 changed files with 13721 additions and 13734 deletions

View file

@ -50,7 +50,7 @@ public:
\param exclusion_column_caption The label of header of listctrl's exclusion
column.
*/
MyResizableListCtrl( wxWindow *parent = NULL,
MyResizableListCtrl( wxWindow *parent = nullptr,
wxWindowID id = wxID_ANY,
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,

View file

@ -104,10 +104,10 @@ wxEND_EVENT_TABLE()
MyFrame::MyFrame(wxWindow* parent)
{
// Load up this frame from XRC. [Note, instead of making a class's
// constructor take a wxWindow* parent with a default value of NULL,
// constructor take a wxWindow* parent with a default value of nullptr,
// we could have just had designed MyFrame class with an empty
// constructor and then written here:
// wxXmlResource::Get()->LoadFrame(this, (wxWindow* )NULL, "main_frame");
// wxXmlResource::Get()->LoadFrame(this, nullptr, "main_frame");
// since this frame will always be the top window, and thus parentless.
// However, the current approach has source code that can be recycled
// for other frames that aren't the top level window.]
@ -320,7 +320,7 @@ void MyFrame::OnAuiDemoToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnObjRefToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
{
// The dialog redirects log messages, so save the old log target first
wxLog* oldlogtarget = wxLog::SetActiveTarget(NULL);
wxLog* oldlogtarget = wxLog::SetActiveTarget(nullptr);
// Make an instance of the dialog
ObjrefDialog* objrefDialog = new ObjrefDialog(this);
@ -392,7 +392,7 @@ void MyFrame::OnRecursiveLoad(wxCommandEvent& WXUNUSED(event))
// this is a slightly contrived example, please keep in mind that it's done
// only to demonstrate LoadObjectRecursively() in action and is not the
// recommended to do this
wxDialog dlg(NULL, wxID_ANY, "Recursive Load Example",
wxDialog dlg(nullptr, wxID_ANY, "Recursive Load Example",
wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
wxSizer * const sizer = new wxBoxSizer(wxVERTICAL);

View file

@ -30,7 +30,7 @@ class MyFrame : public wxFrame
public:
// Constructor.
MyFrame( wxWindow* parent=(wxWindow *)NULL);
MyFrame( wxWindow* parent=nullptr);
private:

View file

@ -111,8 +111,8 @@ bool MyApp::OnInit()
wxHelpProvider::Set( new wxSimpleHelpProvider );
#endif // wxUSE_HELP
// Make an instance of your derived frame. Passing NULL (the default value
// of MyFrame's constructor is NULL) as the frame doesn't have a parent
// Make an instance of your derived frame. Passing nullptr (the default value
// of MyFrame's constructor is null) as the frame doesn't have a parent
// since it is the main application window.
MyFrame *frame = new MyFrame();