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
|
|
@ -136,7 +136,7 @@ void wxListItemData::Init()
|
|||
m_image = -1;
|
||||
m_data = 0;
|
||||
|
||||
m_attr = NULL;
|
||||
m_attr = nullptr;
|
||||
}
|
||||
|
||||
wxListItemData::wxListItemData(wxListMainWindow *owner)
|
||||
|
|
@ -146,7 +146,7 @@ wxListItemData::wxListItemData(wxListMainWindow *owner)
|
|||
m_owner = owner;
|
||||
|
||||
if ( owner->InReportView() )
|
||||
m_rect = NULL;
|
||||
m_rect = nullptr;
|
||||
else
|
||||
m_rect = new wxRect;
|
||||
}
|
||||
|
|
@ -426,7 +426,7 @@ wxListLineData::wxListLineData( wxListMainWindow *owner )
|
|||
m_owner = owner;
|
||||
|
||||
if ( InReportView() )
|
||||
m_gi = NULL;
|
||||
m_gi = nullptr;
|
||||
else // !report
|
||||
m_gi = new GeometryInfo;
|
||||
|
||||
|
|
@ -675,7 +675,7 @@ int wxListLineData::GetImage( int index ) const
|
|||
wxItemAttr *wxListLineData::GetAttr() const
|
||||
{
|
||||
wxListItemDataList::compatibility_iterator node = m_items.GetFirst();
|
||||
wxCHECK_MSG( node, NULL, wxT("invalid column index in GetAttr()") );
|
||||
wxCHECK_MSG( node, nullptr, wxT("invalid column index in GetAttr()") );
|
||||
|
||||
wxListItemData *item = node->GetData();
|
||||
return item->GetAttr();
|
||||
|
|
@ -969,7 +969,7 @@ wxEND_EVENT_TABLE()
|
|||
|
||||
void wxListHeaderWindow::Init()
|
||||
{
|
||||
m_currentCursor = NULL;
|
||||
m_currentCursor = nullptr;
|
||||
m_isDragging = false;
|
||||
m_dirty = false;
|
||||
m_sendSetColumnWidth = false;
|
||||
|
|
@ -979,8 +979,8 @@ wxListHeaderWindow::wxListHeaderWindow()
|
|||
{
|
||||
Init();
|
||||
|
||||
m_owner = NULL;
|
||||
m_resizeCursor = NULL;
|
||||
m_owner = nullptr;
|
||||
m_resizeCursor = nullptr;
|
||||
|
||||
m_sortAsc = true;
|
||||
m_sortCol = -1;
|
||||
|
|
@ -1035,10 +1035,10 @@ void wxListHeaderWindow::AdjustDC(wxDC& dc)
|
|||
wxGenericListCtrl *parent = m_owner->GetListCtrl();
|
||||
|
||||
int xpix;
|
||||
parent->GetScrollPixelsPerUnit( &xpix, NULL );
|
||||
parent->GetScrollPixelsPerUnit( &xpix, nullptr );
|
||||
|
||||
int view_start;
|
||||
parent->GetViewStart( &view_start, NULL );
|
||||
parent->GetViewStart( &view_start, nullptr );
|
||||
|
||||
|
||||
int org_x = 0;
|
||||
|
|
@ -1072,7 +1072,7 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||
// width and height of the entire header window
|
||||
int w, h;
|
||||
GetClientSize( &w, &h );
|
||||
parent->CalcUnscrolledPosition(w, 0, &w, NULL);
|
||||
parent->CalcUnscrolledPosition(w, 0, &w, nullptr);
|
||||
|
||||
dc.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT);
|
||||
dc.SetTextForeground(GetForegroundColour());
|
||||
|
|
@ -1146,7 +1146,7 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||
}
|
||||
else
|
||||
{
|
||||
imageList = NULL;
|
||||
imageList = nullptr;
|
||||
}
|
||||
|
||||
// ignore alignment if there is not enough space anyhow
|
||||
|
|
@ -1231,7 +1231,7 @@ void wxListHeaderWindow::OnMouse( wxMouseEvent &event )
|
|||
|
||||
// we want to work with logical coords
|
||||
int x;
|
||||
parent->CalcUnscrolledPosition(event.GetX(), 0, &x, NULL);
|
||||
parent->CalcUnscrolledPosition(event.GetX(), 0, &x, nullptr);
|
||||
|
||||
if (m_isDragging)
|
||||
{
|
||||
|
|
@ -1240,8 +1240,8 @@ void wxListHeaderWindow::OnMouse( wxMouseEvent &event )
|
|||
// we don't draw the line beyond our window, but we allow dragging it
|
||||
// there
|
||||
int w = 0;
|
||||
GetClientSize( &w, NULL );
|
||||
parent->CalcUnscrolledPosition(w, 0, &w, NULL);
|
||||
GetClientSize( &w, nullptr );
|
||||
parent->CalcUnscrolledPosition(w, 0, &w, nullptr);
|
||||
w -= 6;
|
||||
|
||||
// erase the line if it was drawn
|
||||
|
|
@ -1592,8 +1592,8 @@ void wxListMainWindow::Init()
|
|||
m_headerWidth =
|
||||
m_lineHeight = 0;
|
||||
|
||||
m_small_image_list = NULL;
|
||||
m_normal_image_list = NULL;
|
||||
m_small_image_list = nullptr;
|
||||
m_normal_image_list = nullptr;
|
||||
|
||||
m_small_spacing = 30;
|
||||
m_normal_spacing = 40;
|
||||
|
|
@ -1604,9 +1604,9 @@ void wxListMainWindow::Init()
|
|||
|
||||
m_lastOnSame = false;
|
||||
m_renameTimer = new wxListRenameTimer( this );
|
||||
m_findTimer = NULL;
|
||||
m_findTimer = nullptr;
|
||||
m_findBell = 0; // default is to not ring bell at all
|
||||
m_textctrlWrapper = NULL;
|
||||
m_textctrlWrapper = nullptr;
|
||||
|
||||
m_current =
|
||||
m_lineLastClicked =
|
||||
|
|
@ -1623,7 +1623,7 @@ wxListMainWindow::wxListMainWindow()
|
|||
Init();
|
||||
|
||||
m_highlightBrush =
|
||||
m_highlightUnfocusedBrush = NULL;
|
||||
m_highlightUnfocusedBrush = nullptr;
|
||||
}
|
||||
|
||||
wxListMainWindow::wxListMainWindow( wxWindow *parent,
|
||||
|
|
@ -1749,7 +1749,7 @@ wxCoord wxListMainWindow::GetLineHeight() const
|
|||
dc.SetFont( GetFont() );
|
||||
|
||||
wxCoord y;
|
||||
dc.GetTextExtent(wxT("H"), NULL, &y);
|
||||
dc.GetTextExtent(wxT("H"), nullptr, &y);
|
||||
|
||||
if ( m_small_image_list && m_small_image_list->GetImageCount() )
|
||||
{
|
||||
|
|
@ -2079,7 +2079,7 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||
RecalculatePositions();
|
||||
|
||||
// ... but schedule it for later.
|
||||
CallAfter(&wxWindow::Refresh, true, (const wxRect*)NULL);
|
||||
CallAfter(&wxWindow::Refresh, true, (const wxRect*)nullptr);
|
||||
|
||||
// Don't bother redoing the relayout again the next time nor redrawing
|
||||
// now, as we'll be refresh soon anyhow.
|
||||
|
|
@ -2384,7 +2384,7 @@ void wxListMainWindow::ChangeCurrent(size_t current)
|
|||
|
||||
wxTextCtrl *wxListMainWindow::EditLabel(long item, wxClassInfo* textControlClass)
|
||||
{
|
||||
wxCHECK_MSG( (item >= 0) && ((size_t)item < GetItemCount()), NULL,
|
||||
wxCHECK_MSG( (item >= 0) && ((size_t)item < GetItemCount()), nullptr,
|
||||
wxT("wrong index in wxGenericListCtrl::EditLabel()") );
|
||||
|
||||
wxASSERT_MSG( textControlClass->IsKindOf(wxCLASSINFO(wxTextCtrl)),
|
||||
|
|
@ -2397,13 +2397,13 @@ wxTextCtrl *wxListMainWindow::EditLabel(long item, wxClassInfo* textControlClass
|
|||
le.m_item.m_itemId =
|
||||
le.m_itemIndex = item;
|
||||
wxListLineData *data = GetLine(itemEdit);
|
||||
wxCHECK_MSG( data, NULL, wxT("invalid index in EditLabel()") );
|
||||
wxCHECK_MSG( data, nullptr, wxT("invalid index in EditLabel()") );
|
||||
data->GetItem( 0, le.m_item );
|
||||
|
||||
if ( GetParent()->GetEventHandler()->ProcessEvent( le ) && !le.IsAllowed() )
|
||||
{
|
||||
// vetoed by user code
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if ( m_dirty )
|
||||
|
|
@ -4538,7 +4538,7 @@ long wxListMainWindow::FindItem(long start, wxUIntPtr data)
|
|||
long wxListMainWindow::FindItem( const wxPoint& pt )
|
||||
{
|
||||
size_t topItem;
|
||||
GetVisibleLinesRange( &topItem, NULL );
|
||||
GetVisibleLinesRange( &topItem, nullptr );
|
||||
|
||||
wxPoint p;
|
||||
GetItemPosition( GetItemCount() - 1, p );
|
||||
|
|
@ -4717,7 +4717,7 @@ int wxListMainWindow::GetItemWidthWithImage(wxListItem * item)
|
|||
if (!item->GetText().empty())
|
||||
{
|
||||
wxCoord w;
|
||||
dc.GetTextExtent( item->GetText(), &w, NULL );
|
||||
dc.GetTextExtent( item->GetText(), &w, nullptr );
|
||||
width += w;
|
||||
}
|
||||
|
||||
|
|
@ -4778,7 +4778,7 @@ void wxListMainWindow::OnScroll(wxScrollWinEvent& event)
|
|||
wxGenericListCtrl* lc = GetListCtrl();
|
||||
wxCHECK_RET( lc, wxT("no listctrl window?") );
|
||||
|
||||
if (lc->m_headerWin) // when we use wxLC_NO_HEADER, m_headerWin==NULL
|
||||
if (lc->m_headerWin) // when we use wxLC_NO_HEADER, m_headerWin==nullptr
|
||||
{
|
||||
lc->m_headerWin->Refresh();
|
||||
lc->m_headerWin->Update();
|
||||
|
|
@ -4903,8 +4903,8 @@ wxEND_EVENT_TABLE()
|
|||
|
||||
void wxGenericListCtrl::Init()
|
||||
{
|
||||
m_mainWin = NULL;
|
||||
m_headerWin = NULL;
|
||||
m_mainWin = nullptr;
|
||||
m_headerWin = nullptr;
|
||||
}
|
||||
|
||||
wxGenericListCtrl::~wxGenericListCtrl()
|
||||
|
|
@ -4918,7 +4918,7 @@ wxGenericListCtrl::~wxGenericListCtrl()
|
|||
void wxGenericListCtrl::CreateOrDestroyHeaderWindowAsNeeded()
|
||||
{
|
||||
bool needs_header = HasHeader();
|
||||
bool has_header = (m_headerWin != NULL);
|
||||
bool has_header = (m_headerWin != nullptr);
|
||||
|
||||
if (needs_header == has_header)
|
||||
return;
|
||||
|
|
@ -5445,7 +5445,7 @@ void wxGenericListCtrl::SetTextColour(const wxColour& col)
|
|||
long wxGenericListCtrl::GetTopItem() const
|
||||
{
|
||||
size_t top;
|
||||
m_mainWin->GetVisibleLinesRange(&top, NULL);
|
||||
m_mainWin->GetVisibleLinesRange(&top, nullptr);
|
||||
return (long)top;
|
||||
}
|
||||
|
||||
|
|
@ -5593,7 +5593,7 @@ long wxGenericListCtrl::DoInsertColumn( long col, const wxListItem &item )
|
|||
long idx = m_mainWin->InsertColumn( col, item );
|
||||
|
||||
// NOTE: if wxLC_NO_HEADER was given, then we are in report view mode but
|
||||
// still have m_headerWin==NULL
|
||||
// still have m_headerWin==nullptr
|
||||
if (m_headerWin)
|
||||
m_headerWin->Refresh();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue