Replace zero with nullptr

This commit is contained in:
Paul Cornett
2025-03-28 16:06:22 -07:00
parent cbb1bfe589
commit bfb6c452bd
13 changed files with 30 additions and 30 deletions
+1 -1
View File
@@ -82,7 +82,7 @@ const ArchiveApp::ArchiveCommandDesc ArchiveApp::s_cmdDesc[] =
{CMD_LIST, "l", "list"},
{CMD_EXTRACT, "x", "extract"},
{CMD_NONE, 0, 0}
{CMD_NONE, nullptr, nullptr}
};
// Helper function iterating over all factories of the given type (assumed to
+1 -1
View File
@@ -1017,7 +1017,7 @@ void MyFrame::BuildDataViewCtrl(wxPanel* parent, unsigned int nPanel,
tc->SetImages(images);
const wxDataViewItem root =
tc->AppendContainer( wxDataViewItem(0), "The Root", 0 );
tc->AppendContainer( wxDataViewItem(nullptr), "The Root", 0 );
tc->AppendItem( root, "Child 1", 0 );
tc->AppendItem( root, "Child 2", 0 );
tc->AppendItem( root, "Child 3, very long, long, long, long", 0 );
+2 -2
View File
@@ -269,13 +269,13 @@ wxDataViewItem MyMusicTreeModel::GetParent( const wxDataViewItem &item ) const
{
// the invisible root node has no parent
if (!item.IsOk())
return wxDataViewItem(0);
return wxDataViewItem(nullptr);
MyMusicTreeModelNode *node = (MyMusicTreeModelNode*) item.GetID();
// "MyMusic" also has no parent
if (node == m_root)
return wxDataViewItem(0);
return wxDataViewItem(nullptr);
return wxDataViewItem( (void*) node->GetParent() );
}
+2 -2
View File
@@ -118,7 +118,7 @@ public:
// just some functions to get a slightly deeper stack trace
static void bar(const char *p)
{
char *pc = 0;
char *pc = nullptr;
*pc = *p;
printf("bar: %s\n", p);
@@ -317,7 +317,7 @@ void MyFrame::OnListLoadedDLLs(wxCommandEvent& WXUNUSED(event))
return;
const wxDynamicLibraryDetails& det = loaded[sel];
void *addr = 0;
void *addr = nullptr;
size_t len = 0;
det.GetAddress(&addr, &len);
wxLogMessage("Full path is \"%s\", memory range %p:%p, version \"%s\"",
+2 -2
View File
@@ -62,7 +62,7 @@ static void DoCrash()
{
wxGCC_WARNING_SUPPRESS(nonnull)
char *p = 0;
char *p = nullptr;
strcpy(p, "Let's crash");
wxGCC_WARNING_RESTORE(nonnull)
@@ -587,7 +587,7 @@ void MyFrame::OnShowAssertInThread(wxCommandEvent& WXUNUSED(event))
{
wxFAIL_MSG("Test assert in another thread.");
return 0;
return nullptr;
}
};
+1 -1
View File
@@ -430,7 +430,7 @@ void TestGLCanvas::OnSpinTimer(wxTimerEvent& WXUNUSED(event))
wxString glGetwxString(GLenum name)
{
const GLubyte *v = glGetString(name);
if ( v == 0 )
if ( v == nullptr )
{
// The error is not important. It is GL_INVALID_ENUM.
// We just want to clear the error stack.
+2 -2
View File
@@ -52,7 +52,7 @@ void* MyGetGLFuncAddress(const char* fname)
// Some drivers return -apart from 0-, -1, 1, 2 or 3
if ( pret == (void*)-1 || pret == (void*)1 || pret == (void*)2 || pret == (void*)3 )
pret = (void*)0;
pret = nullptr;
return pret;
}
@@ -97,7 +97,7 @@ PFNGLVERTEXATTRIBPOINTERPROC my_glVertexAttribPointer = nullptr;
// Retrieve the pointers
#define GETANDTEST(type, name) \
my_ ## name = (type) MyGetGLFuncAddress(#name); \
if (name == 0) \
if (name == nullptr) \
return false;
bool MyInitGLPointers()
+4 -4
View File
@@ -644,12 +644,12 @@ void myOGLTriangles::SetBuffers(myOGLShaders* theShader,
glBindBuffer(GL_ARRAY_BUFFER, m_bufVertId);
GLuint loc = m_triangShaders->GetAttribLoc("in_Position");
glEnableVertexAttribArray(loc);
glVertexAttribPointer(loc, 3, GL_FLOAT, GL_FALSE, 0, (GLvoid *)0);
glVertexAttribPointer(loc, 3, GL_FLOAT, GL_FALSE, 0, nullptr);
// Colours
glBindBuffer(GL_ARRAY_BUFFER, m_bufColNorId);
loc = m_triangShaders->GetAttribLoc("in_Colour");
glEnableVertexAttribArray(loc);
glVertexAttribPointer(loc, 4, GL_FLOAT, GL_FALSE, 0, (GLvoid *)0);
glVertexAttribPointer(loc, 4, GL_FLOAT, GL_FALSE, 0, nullptr);
// Normals. Their position in buffer starts at bufoffset
loc = m_triangShaders->GetAttribLoc("in_Normal");
glEnableVertexAttribArray(loc);
@@ -691,7 +691,7 @@ void myOGLTriangles::Draw(const GLfloat* unifMvp, const GLfloat* unifToVw,
glProvokingVertex(GL_FIRST_VERTEX_CONVENTION);
// Indexed drawing the triangles in strip mode, using 6 indices
glDrawElements(GL_TRIANGLE_STRIP, 6, GL_UNSIGNED_SHORT, (GLvoid *)0);
glDrawElements(GL_TRIANGLE_STRIP, 6, GL_UNSIGNED_SHORT, nullptr);
MyOnGLError(myoglERR_DRAWING_TRI);
@@ -803,7 +803,7 @@ void myOGLString::SetStringWithVerts(myOGLShaders* theShader,
// Vertices positions
GLuint loc = m_stringShaders->GetAttribLoc("in_sPosition");
glEnableVertexAttribArray(loc);
glVertexAttribPointer(loc, 3, GL_FLOAT, GL_FALSE, 0, (GLvoid *)0);
glVertexAttribPointer(loc, 3, GL_FLOAT, GL_FALSE, 0, nullptr);
// Normals. Their position in buffer starts at bufoffset
bufoffset = 12 * sizeof(GLfloat);
if ( norm )
+4 -4
View File
@@ -207,8 +207,8 @@ private:
int xScrollUnits, xOrigin;
m_owner->GetViewStart( &xOrigin, 0 );
m_owner->GetScrollPixelsPerUnit( &xScrollUnits, 0 );
m_owner->GetViewStart( &xOrigin, nullptr );
m_owner->GetScrollPixelsPerUnit( &xScrollUnits, nullptr );
dc.SetDeviceOrigin( -xOrigin * xScrollUnits, 0 );
dc.DrawText("Column 1", 5, 5);
@@ -242,8 +242,8 @@ private:
int yScrollUnits, yOrigin;
m_owner->GetViewStart( 0, &yOrigin );
m_owner->GetScrollPixelsPerUnit( 0, &yScrollUnits );
m_owner->GetViewStart( nullptr, &yOrigin );
m_owner->GetScrollPixelsPerUnit( nullptr, &yScrollUnits );
dc.SetDeviceOrigin( 0, -yOrigin * yScrollUnits );
dc.DrawText("Row 1", 5, 5);
+1 -1
View File
@@ -729,6 +729,6 @@ wxThread::ExitCode ThreadWorker::Entry()
WorkerEvent e(this,etype);
if (failed) e.setFailed();
wxGetApp().AddPendingEvent(e);
return 0;
return nullptr;
}
+6 -6
View File
@@ -495,7 +495,7 @@ wxThread::ExitCode ThreadWorker::Entry()
if (!m_socket->IsConnected())
{
LogWorker("ThreadWorker: not connected",wxLOG_Error);
return 0;
return nullptr;
}
int to_process = -1;
if (m_socket->IsConnected())
@@ -510,7 +510,7 @@ wxThread::ExitCode ThreadWorker::Entry()
{
LogWorker("ThreadWorker: Read error",wxLOG_Error);
wxGetApp().AddPendingEvent(e);
return 0;
return nullptr;
}
to_process -= m_socket->LastCount();
LogWorker(wxString::Format("to_process: %d",to_process));
@@ -521,7 +521,7 @@ wxThread::ExitCode ThreadWorker::Entry()
if (signature[0] == 0)
{
e.m_exit = true;
return 0;
return nullptr;
}
if (signature[0] == 0xCE)
@@ -529,7 +529,7 @@ wxThread::ExitCode ThreadWorker::Entry()
LogWorker("This server does not support test2 from GUI client",wxLOG_Error);
e.m_workerFailed = true;
e.m_exit = true;
return 0;
return nullptr;
}
int size = signature[1] * (signature[0] == 0xBE ? 1 : 1024);
char* buf = new char[size];
@@ -545,7 +545,7 @@ wxThread::ExitCode ThreadWorker::Entry()
{
LogWorker("ThreadWorker: Read error",wxLOG_Error);
wxGetApp().AddPendingEvent(e);
return 0;
return nullptr;
}
to_process -= m_socket->LastCount();
LogWorker(wxString::Format("ThreadWorker: %d bytes readed, %d todo",m_socket->LastCount(),to_process));
@@ -573,7 +573,7 @@ wxThread::ExitCode ThreadWorker::Entry()
e.m_workerFailed = to_process != 0;
m_socket->Destroy();
wxGetApp().AddPendingEvent(e);
return 0;
return nullptr;
}
EventWorker::EventWorker(wxSocketBase* pSock)
+2 -2
View File
@@ -1318,7 +1318,7 @@ void MyTreeCtrl::DoResetBrokenStateImages(const wxTreeItemId& idParent,
SetItemState(id, state);
if (ItemHasChildren(id))
DoResetBrokenStateImages(id, 0, state);
DoResetBrokenStateImages(id, nullptr, state);
DoResetBrokenStateImages(idParent, cookie, state);
}
@@ -1531,7 +1531,7 @@ void MyTreeCtrl::OnEndDrag(wxTreeEvent& event)
{
wxTreeItemId itemSrc = m_draggedItem,
itemDst = event.GetItem();
m_draggedItem = (wxTreeItemId)0l;
m_draggedItem = nullptr;
// where to copy the item?
if ( itemDst.IsOk() && !ItemHasChildren(itemDst) )
+2 -2
View File
@@ -104,7 +104,7 @@ public:
wxTreeItemId GetLastTreeITem() const;
void GetItemsRecursively(const wxTreeItemId& idParent,
wxTreeItemIdValue cookie = 0);
wxTreeItemIdValue cookie = nullptr);
// This function behaves differently depending on the value of size:
// - If it's -1, it turns off the use of images entirely.
@@ -137,7 +137,7 @@ public:
{
const size_t count = GetStateImageList()->GetImageCount();
int state = count > 0 ? count - 1 : wxTREE_ITEMSTATE_NONE;
DoResetBrokenStateImages(GetRootItem(), 0, state);
DoResetBrokenStateImages(GetRootItem(), nullptr, state);
}
protected: