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

@ -63,13 +63,13 @@
// global variables
// ----------------------------------------------------------------------------
static wxBitmap *gs_bmpNoMask = NULL,
*gs_bmpWithColMask = NULL,
*gs_bmpMask = NULL,
*gs_bmpWithMask = NULL,
*gs_bmp4 = NULL,
*gs_bmp4_mono = NULL,
*gs_bmp36 = NULL;
static wxBitmap *gs_bmpNoMask = nullptr,
*gs_bmpWithColMask = nullptr,
*gs_bmpMask = nullptr,
*gs_bmpWithMask = nullptr,
*gs_bmp4 = nullptr,
*gs_bmp4_mono = nullptr,
*gs_bmp36 = nullptr;
// ----------------------------------------------------------------------------
// private classes
@ -114,7 +114,7 @@ public:
// set or remove the clipping region
void Clip(bool clip) { m_clip = clip; Refresh(); }
#if wxUSE_GRAPHICS_CONTEXT
bool HasRenderer() const { return m_renderer != NULL; }
bool HasRenderer() const { return m_renderer != nullptr; }
void UseGraphicRenderer(wxGraphicsRenderer* renderer);
bool IsDefaultRenderer() const
{ if ( !m_renderer ) return false;
@ -198,7 +198,7 @@ public:
#if wxUSE_GRAPHICS_CONTEXT
void OnGraphicContextNone(wxCommandEvent& WXUNUSED(event))
{
m_canvas->UseGraphicRenderer(NULL);
m_canvas->UseGraphicRenderer(nullptr);
}
void OnGraphicContextDefault(wxCommandEvent& WXUNUSED(event))
@ -233,7 +233,7 @@ public:
void OnAntiAliasingUpdateUI(wxUpdateUIEvent& event)
{
event.Enable(m_canvas->GetRenderer() != NULL);
event.Enable(m_canvas->GetRenderer() != nullptr);
}
#endif // wxUSE_GRAPHICS_CONTEXT
@ -518,7 +518,7 @@ MyCanvas::MyCanvas(MyFrame *parent)
m_clip = false;
m_rubberBand = false;
#if wxUSE_GRAPHICS_CONTEXT
m_renderer = NULL;
m_renderer = nullptr;
m_useAntiAliasing = true;
#endif
m_useBuffer = false;
@ -1155,7 +1155,7 @@ void MyCanvas::DrawGraphics(wxGraphicsContext* gc)
break;
}
wxDouble w, h;
gc->GetTextExtent(label, &w, &h, NULL, NULL);
gc->GetTextExtent(label, &w, &h, nullptr, nullptr);
gc->DrawText(label, -w/2, -BASE2 - h - gc->FromDIP(4));
switch( i )
{
@ -1225,7 +1225,7 @@ void MyCanvas::DrawGraphics(wxGraphicsContext* gc)
gc->DrawText(labelText, 0, 0);
// Center a bitmap horizontally
wxDouble textWidth;
gc->GetTextExtent(labelText, &textWidth, NULL);
gc->GetTextExtent(labelText, &textWidth, nullptr);
const wxDouble rectSize = gc->FromDIP(100);
wxDouble x0 = (textWidth - rectSize) / 2;
gc->DrawRectangle(x0, BASE2, rectSize, rectSize);
@ -2260,7 +2260,7 @@ wxEND_EVENT_TABLE()
// frame constructor
MyFrame::MyFrame(const wxString& title)
: wxFrame(NULL, wxID_ANY, title)
: wxFrame(nullptr, wxID_ANY, title)
{
// set the frame icon
SetIcon(wxICON(sample));
@ -2513,7 +2513,7 @@ void MyFrame::OnSave(wxCommandEvent& WXUNUSED(event))
return;
}
wxGraphicsRenderer* tempRenderer = m_canvas->GetRenderer();
m_canvas->UseGraphicRenderer(NULL);
m_canvas->UseGraphicRenderer(nullptr);
#endif
wxSVGFileDC svgdc(dlg.GetPath(),
canvasSize.GetWidth(),
@ -2539,7 +2539,7 @@ void MyFrame::OnSave(wxCommandEvent& WXUNUSED(event))
return;
}
wxGraphicsRenderer* curRenderer = m_canvas->GetRenderer();
m_canvas->UseGraphicRenderer(NULL);
m_canvas->UseGraphicRenderer(nullptr);
#endif // wxUSE_GRAPHICS_CONTEXT
wxPrintData printData;
printData.SetPrintMode(wxPRINT_MODE_FILE);