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
|
|
@ -50,8 +50,8 @@ public:
|
|||
m_bSimpleTellOTest(false),
|
||||
m_bSeekInvalidBeyondEnd(true),
|
||||
m_bEofAtLastRead(true),
|
||||
m_pCurrentIn(NULL),
|
||||
m_pCurrentOut(NULL)
|
||||
m_pCurrentIn(nullptr),
|
||||
m_pCurrentOut(nullptr)
|
||||
{ /* Nothing extra */ }
|
||||
virtual ~BaseStreamTestCase()
|
||||
{
|
||||
|
|
@ -411,7 +411,7 @@ protected:
|
|||
}
|
||||
|
||||
m_pCurrentIn = DoCreateInStream();
|
||||
wxASSERT(m_pCurrentIn != NULL);
|
||||
wxASSERT(m_pCurrentIn != nullptr);
|
||||
return *m_pCurrentIn;
|
||||
}
|
||||
TStreamOut &CreateOutStream()
|
||||
|
|
@ -422,28 +422,28 @@ protected:
|
|||
}
|
||||
|
||||
m_pCurrentOut = DoCreateOutStream();
|
||||
wxASSERT(m_pCurrentOut != NULL);
|
||||
wxASSERT(m_pCurrentOut != nullptr);
|
||||
return *m_pCurrentOut;
|
||||
}
|
||||
|
||||
void DeleteInStream()
|
||||
{
|
||||
if (m_pCurrentIn == NULL)
|
||||
if (m_pCurrentIn == nullptr)
|
||||
return;
|
||||
delete m_pCurrentIn;
|
||||
m_pCurrentIn = NULL;
|
||||
m_pCurrentIn = nullptr;
|
||||
// In case something extra needs to be done.
|
||||
DoDeleteInStream();
|
||||
}
|
||||
void DeleteOutStream()
|
||||
{
|
||||
if (m_pCurrentOut == NULL)
|
||||
if (m_pCurrentOut == nullptr)
|
||||
return;
|
||||
|
||||
CPPUNIT_ASSERT(m_pCurrentOut->Close());
|
||||
|
||||
delete m_pCurrentOut;
|
||||
m_pCurrentOut = NULL;
|
||||
m_pCurrentOut = nullptr;
|
||||
// In case something extra needs to be done.
|
||||
DoDeleteOutStream();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -339,11 +339,11 @@ void GetVolumeInfo(const wxString& path)
|
|||
}
|
||||
}
|
||||
|
||||
// NULL means the current volume
|
||||
const wxChar *pVol = vol.empty() ? (const wxChar *)NULL
|
||||
// nullptr means the current volume
|
||||
const wxChar *pVol = vol.empty() ? (const wxChar *)nullptr
|
||||
: vol.c_str();
|
||||
|
||||
if (!::GetVolumeInformation(pVol, NULL, 0, NULL, NULL,
|
||||
if (!::GetVolumeInformation(pVol, nullptr, 0, nullptr, nullptr,
|
||||
&volumeFlags,
|
||||
volumeType,
|
||||
WXSIZEOF(volumeType)))
|
||||
|
|
@ -371,11 +371,11 @@ void MakeSparse(const wxString& path, int fd)
|
|||
if ((volumeFlags & FILE_SUPPORTS_SPARSE_FILES) != 0)
|
||||
if (!::DeviceIoControl((HANDLE)_get_osfhandle(fd),
|
||||
FSCTL_SET_SPARSE,
|
||||
NULL, 0, NULL, 0, &cb, NULL))
|
||||
nullptr, 0, nullptr, 0, &cb, nullptr))
|
||||
volumeFlags &= ~FILE_SUPPORTS_SPARSE_FILES;
|
||||
}
|
||||
|
||||
// return the suite if sparse files are supported, otherwise return NULL
|
||||
// return the suite if sparse files are supported, otherwise return nullptr
|
||||
//
|
||||
CppUnit::Test* GetlargeFileSuite()
|
||||
{
|
||||
|
|
@ -392,7 +392,7 @@ CppUnit::Test* GetlargeFileSuite()
|
|||
if ((volumeFlags & FILE_SUPPORTS_SPARSE_FILES) != 0)
|
||||
return largeFile::suite();
|
||||
else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#else // __WINDOWS__
|
||||
|
|
@ -400,7 +400,7 @@ CppUnit::Test* GetlargeFileSuite()
|
|||
bool IsFAT(const wxString& WXUNUSED(path)) { return false; }
|
||||
void MakeSparse(const wxString& WXUNUSED(path), int WXUNUSED(fd)) { }
|
||||
|
||||
// return the suite if sparse files are supported, otherwise return NULL
|
||||
// return the suite if sparse files are supported, otherwise return nullptr
|
||||
//
|
||||
CppUnit::Test* GetlargeFileSuite()
|
||||
{
|
||||
|
|
@ -428,7 +428,7 @@ CppUnit::Test* GetlargeFileSuite()
|
|||
if (st1.st_blocks != st2.st_blocks)
|
||||
return largeFile::suite();
|
||||
else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#endif // __WINDOWS__
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ protected:
|
|||
delete socket;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int m_port;
|
||||
|
|
@ -167,10 +167,10 @@ wxSocketFlags socketStream::ms_flags = wxSOCKET_NONE;
|
|||
socketStream::socketStream()
|
||||
{
|
||||
m_readSocket =
|
||||
m_writeSocket = NULL;
|
||||
m_writeSocket = nullptr;
|
||||
|
||||
m_writeThread =
|
||||
m_readThread = NULL;
|
||||
m_readThread = nullptr;
|
||||
|
||||
wxSocketBase::Initialize();
|
||||
}
|
||||
|
|
@ -233,7 +233,7 @@ void socketStream::DoCheckInputStream(wxSocketInputStream& stream_in)
|
|||
{
|
||||
// This check sometimes fails in the AppVeyor CI environment for unknown
|
||||
// reason, so just log it there but don't fail the entire test suite run.
|
||||
if ( wxGetEnv("APPVEYOR", NULL) )
|
||||
if ( wxGetEnv("APPVEYOR", nullptr) )
|
||||
{
|
||||
if ( !stream_in.IsOk() )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ TEST_CASE("wxStringOutputStream::Tell", "[stream]")
|
|||
|
||||
#if wxUSE_UNICODE
|
||||
wxMBConvUTF16 convUTF16;
|
||||
wxStringOutputStream ss16(NULL, convUTF16);
|
||||
wxStringOutputStream ss16(nullptr, convUTF16);
|
||||
CHECK( ss16.TellO() == 0 );
|
||||
|
||||
const wxCharBuffer s16 = convUTF16.cWC2MB(wxWCharBuffer(str.wc_str()));
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ void StdStreamTestCase::InputBuffer_pubsetbuf()
|
|||
wxStdInputStreamBuffer buffer(stream);
|
||||
char testBuffer[TEST_SIZE];
|
||||
|
||||
CPPUNIT_ASSERT(buffer.pubsetbuf(testBuffer, TEST_SIZE) == NULL);
|
||||
CPPUNIT_ASSERT(buffer.pubsetbuf(testBuffer, TEST_SIZE) == nullptr);
|
||||
}
|
||||
|
||||
void StdStreamTestCase::InputBuffer_pubseekoff()
|
||||
|
|
@ -328,7 +328,7 @@ void StdStreamTestCase::OutputBuffer_pubsetbuf()
|
|||
wxStdOutputStreamBuffer buffer(stream);
|
||||
char testBuffer[TEST_SIZE];
|
||||
|
||||
CPPUNIT_ASSERT(buffer.pubsetbuf(testBuffer, TEST_SIZE) == NULL);
|
||||
CPPUNIT_ASSERT(buffer.pubsetbuf(testBuffer, TEST_SIZE) == nullptr);
|
||||
}
|
||||
|
||||
void StdStreamTestCase::OutputBuffer_pubseekoff()
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ protected:
|
|||
private:
|
||||
const char *GetDataBuffer();
|
||||
const unsigned char *GetCompressedData();
|
||||
void doTestStreamData(int input_flag, int output_flag, int compress_level, const wxMemoryBuffer *buf = NULL);
|
||||
void doTestStreamData(int input_flag, int output_flag, int compress_level, const wxMemoryBuffer *buf = nullptr);
|
||||
void doDecompress_ExternalData(const unsigned char *data, const char *value, size_t data_size, size_t value_size, int flag = wxZLIB_AUTO);
|
||||
|
||||
private:
|
||||
|
|
@ -138,9 +138,9 @@ private:
|
|||
|
||||
zlibStream::zlibStream()
|
||||
:m_SizeCompressedData(0),
|
||||
m_pCompressedData(NULL),
|
||||
m_pTmpMemInStream(NULL),
|
||||
m_pTmpMemOutStream(NULL)
|
||||
m_pCompressedData(nullptr),
|
||||
m_pTmpMemInStream(nullptr),
|
||||
m_pTmpMemOutStream(nullptr)
|
||||
{
|
||||
// Init the data buffer.
|
||||
for (size_t i = 0; i < DATABUFFER_SIZE; i++)
|
||||
|
|
@ -311,7 +311,7 @@ const unsigned char *zlibStream::GetCompressedData()
|
|||
memstream_out.CopyTo(m_pCompressedData, m_SizeCompressedData);
|
||||
}
|
||||
|
||||
CPPUNIT_ASSERT(m_pCompressedData != NULL);
|
||||
CPPUNIT_ASSERT(m_pCompressedData != nullptr);
|
||||
return m_pCompressedData;
|
||||
}
|
||||
|
||||
|
|
@ -381,8 +381,8 @@ void zlibStream::doTestStreamData(int input_flag, int output_flag, int compress_
|
|||
void zlibStream::doDecompress_ExternalData(const unsigned char *data, const char *value, size_t data_size, size_t value_size, int flag)
|
||||
{
|
||||
// See that the input is ok.
|
||||
wxASSERT(data != NULL);
|
||||
wxASSERT(value != NULL);
|
||||
wxASSERT(data != nullptr);
|
||||
wxASSERT(value != nullptr);
|
||||
wxASSERT(data_size > 0);
|
||||
wxASSERT(value_size > 0);
|
||||
|
||||
|
|
@ -494,12 +494,12 @@ wxZlibOutputStream *zlibStream::DoCreateOutStream()
|
|||
void zlibStream::DoDeleteInStream()
|
||||
{
|
||||
delete m_pTmpMemInStream;
|
||||
m_pTmpMemInStream = NULL;
|
||||
m_pTmpMemInStream = nullptr;
|
||||
}
|
||||
void zlibStream::DoDeleteOutStream()
|
||||
{
|
||||
delete m_pTmpMemOutStream;
|
||||
m_pTmpMemOutStream = NULL;
|
||||
m_pTmpMemOutStream = nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue