diff --git a/samples/archive/archive.cpp b/samples/archive/archive.cpp index 1d61b59da2..da7b8cedae 100644 --- a/samples/archive/archive.cpp +++ b/samples/archive/archive.cpp @@ -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 diff --git a/samples/dataview/dataview.cpp b/samples/dataview/dataview.cpp index c15f2b3ad4..b80c9270a1 100644 --- a/samples/dataview/dataview.cpp +++ b/samples/dataview/dataview.cpp @@ -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 ); diff --git a/samples/dataview/mymodels.cpp b/samples/dataview/mymodels.cpp index bbc498a43a..1bb8a0ad57 100644 --- a/samples/dataview/mymodels.cpp +++ b/samples/dataview/mymodels.cpp @@ -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() ); } diff --git a/samples/debugrpt/debugrpt.cpp b/samples/debugrpt/debugrpt.cpp index 9dcced128f..4073f007a9 100644 --- a/samples/debugrpt/debugrpt.cpp +++ b/samples/debugrpt/debugrpt.cpp @@ -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\"", diff --git a/samples/except/except.cpp b/samples/except/except.cpp index ff87ab3159..1fc887640a 100644 --- a/samples/except/except.cpp +++ b/samples/except/except.cpp @@ -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; } }; diff --git a/samples/opengl/cube/cube.cpp b/samples/opengl/cube/cube.cpp index d0368156e4..f2b628ac9d 100644 --- a/samples/opengl/cube/cube.cpp +++ b/samples/opengl/cube/cube.cpp @@ -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. diff --git a/samples/opengl/pyramid/oglpfuncs.cpp b/samples/opengl/pyramid/oglpfuncs.cpp index d33c54cbe2..07bc0cb4ec 100644 --- a/samples/opengl/pyramid/oglpfuncs.cpp +++ b/samples/opengl/pyramid/oglpfuncs.cpp @@ -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() diff --git a/samples/opengl/pyramid/oglstuff.cpp b/samples/opengl/pyramid/oglstuff.cpp index 7deb30da28..5650b1fa1d 100644 --- a/samples/opengl/pyramid/oglstuff.cpp +++ b/samples/opengl/pyramid/oglstuff.cpp @@ -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 ) diff --git a/samples/scroll/scroll.cpp b/samples/scroll/scroll.cpp index debecd6cae..c709332286 100644 --- a/samples/scroll/scroll.cpp +++ b/samples/scroll/scroll.cpp @@ -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); diff --git a/samples/sockets/baseclient.cpp b/samples/sockets/baseclient.cpp index 25a8bd9926..58fa77327b 100644 --- a/samples/sockets/baseclient.cpp +++ b/samples/sockets/baseclient.cpp @@ -729,6 +729,6 @@ wxThread::ExitCode ThreadWorker::Entry() WorkerEvent e(this,etype); if (failed) e.setFailed(); wxGetApp().AddPendingEvent(e); - return 0; + return nullptr; } diff --git a/samples/sockets/baseserver.cpp b/samples/sockets/baseserver.cpp index b842c46aca..85386e5fe2 100644 --- a/samples/sockets/baseserver.cpp +++ b/samples/sockets/baseserver.cpp @@ -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) diff --git a/samples/treectrl/treetest.cpp b/samples/treectrl/treetest.cpp index 85439caf2c..a446b9f9f2 100644 --- a/samples/treectrl/treetest.cpp +++ b/samples/treectrl/treetest.cpp @@ -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) ) diff --git a/samples/treectrl/treetest.h b/samples/treectrl/treetest.h index 01bcb292f7..af695b5eb7 100644 --- a/samples/treectrl/treetest.h +++ b/samples/treectrl/treetest.h @@ -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: