newer standards prefer nullptr over NULL - this is most of them but there are others too

This commit is contained in:
DarthArgus
2016-02-11 15:16:14 -06:00
parent a7f2d0ea6a
commit 3e4cc36e7e
937 changed files with 14983 additions and 14983 deletions
@@ -48,8 +48,8 @@ BitBuffer::BitBuffer(void *buffer, int size, bool inputStream)
current(base),
bufSize(size)
{
DEBUG_FATAL(!buffer, ("buffer null"));
DEBUG_FATAL(!current, ("buffer null"));
DEBUG_FATAL(!buffer, ("buffer nullptr"));
DEBUG_FATAL(!current, ("buffer nullptr"));
}
// ----------------------------------------------------------------------
@@ -59,8 +59,8 @@ BitBuffer::BitBuffer(void *buffer, int size, bool inputStream)
BitBuffer::~BitBuffer(void)
{
base = NULL;
current = NULL;
base = nullptr;
current = nullptr;
}
// ----------------------------------------------------------------------
@@ -181,17 +181,17 @@ BitFile::BitFile(const char *fileName, bool inputStream)
{
if (isInput)
{
hFile = CreateFile(fileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
hFile = CreateFile(fileName, GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
}
else
{
// try to truncate it first
hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, nullptr, TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile == INVALID_HANDLE_VALUE)
{
//if that fails, create it
hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
}
}
@@ -215,7 +215,7 @@ BitFile::~BitFile(void)
}
}
hFile = NULL;
hFile = nullptr;
delete [] name;
}
@@ -224,7 +224,7 @@ BitFile::~BitFile(void)
int BitFile::getOffset(void) const
{
return static_cast<int>(SetFilePointer(hFile, 0, NULL, FILE_CURRENT));
return static_cast<int>(SetFilePointer(hFile, 0, nullptr, FILE_CURRENT));
}
// ----------------------------------------------------------------------
@@ -254,7 +254,7 @@ void BitFile::outputBits(uint32 code, uint32 count)
if (!mask)
{
uint32 bytesWritten;
if (!WriteFile(hFile, &rack, sizeof(rack), &bytesWritten, NULL))
if (!WriteFile(hFile, &rack, sizeof(rack), &bytesWritten, nullptr))
{
DEBUG_FATAL(true,("BitFile::outputBits error %d.", GetLastError()));
}
@@ -280,7 +280,7 @@ void BitFile::outputRack(void)
if (mask != INITIAL_MASK_VALUE)
{
if (!WriteFile(hFile, &rack, sizeof(rack), &bytesWritten, NULL))
if (!WriteFile(hFile, &rack, sizeof(rack), &bytesWritten, nullptr))
{
DEBUG_FATAL(true,("BitFile::outputRack writing error %d.", GetLastError()));
}
@@ -312,7 +312,7 @@ uint32 BitFile::inputBits(uint32 count)
{
uint32 bytesRead;
const BOOL result = ReadFile(hFile, &rack, sizeof(rack), &bytesRead, NULL);
const BOOL result = ReadFile(hFile, &rack, sizeof(rack), &bytesRead, nullptr);
UNREF(result);
DEBUG_FATAL(result && !bytesRead,("BitFile::inputBits hit EOF"));
@@ -383,8 +383,8 @@ ByteBuffer::ByteBuffer(void *buffer, int size, bool inputStream)
ByteBuffer::~ByteBuffer(void)
{
base = NULL;
current = NULL;
base = nullptr;
current = nullptr;
}
// ----------------------------------------------------------------------
@@ -422,7 +422,7 @@ void ByteBuffer::output(byte b)
bool ByteBuffer::input(byte *b)
{
DEBUG_FATAL(!b, ("null pointer"));
DEBUG_FATAL(!b, ("nullptr pointer"));
DEBUG_FATAL(!isInput,("ByteBuffer::input called on output stream"));
if ((current - base) >= bufSize)
@@ -446,15 +446,15 @@ ByteFile::ByteFile(const char *fileName, bool inputStream)
{
if (isInput)
{
hFile = CreateFile(fileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
hFile = CreateFile(fileName, GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
}
else
{
hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, nullptr, TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile == INVALID_HANDLE_VALUE)
{
hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
}
}
@@ -473,7 +473,7 @@ ByteFile::~ByteFile(void)
if (hFile != INVALID_HANDLE_VALUE && !CloseHandle(hFile))
DEBUG_FATAL(true,("ByteFile::~ByteFile - Unable to close HANDLE for file %s - Error %d", name, GetLastError()));
hFile = NULL;
hFile = nullptr;
delete [] name;
}
@@ -482,7 +482,7 @@ ByteFile::~ByteFile(void)
int ByteFile::getOffset(void) const
{
return static_cast<int>(SetFilePointer(hFile, 0, NULL, FILE_CURRENT));
return static_cast<int>(SetFilePointer(hFile, 0, nullptr, FILE_CURRENT));
}
// ----------------------------------------------------------------------
@@ -497,7 +497,7 @@ void ByteFile::output(byte b)
byte out = b;
uint32 bytesWritten;
if (!WriteFile(hFile, &out, sizeof(byte), &bytesWritten, NULL))
if (!WriteFile(hFile, &out, sizeof(byte), &bytesWritten, nullptr))
{
DEBUG_FATAL(true,("ByteFile::output error %d.", GetLastError()));
}
@@ -518,7 +518,7 @@ bool ByteFile::input(byte *b)
DEBUG_FATAL(!isInput,("ByteFile::input called on output stream."));
uint32 bytesRead;
BOOL result = ReadFile(hFile, b, sizeof(byte), &bytesRead, NULL);
BOOL result = ReadFile(hFile, b, sizeof(byte), &bytesRead, nullptr);
// check for EOS
return (result && !bytesRead);
@@ -47,7 +47,7 @@ Lz77::Lz77(uint32 _indexBitCount, uint32 _lengthBitCount)
lookAheadSize(rawLookAheadSize + breakEven),
treeRoot(windowSize),
window(new byte[windowSize]),
tree(NULL)
tree(nullptr)
{
}
@@ -232,10 +232,10 @@ uint32 Lz77::findNextNode(uint32 node)
* Delete a string from the tree.
*
* This routine performs the classic binary tree deletion algorithm.
* If the node to be deleted has a null link in either direction, we
* just pull the non-null link up one to replace the existing link.
* If the node to be deleted has a nullptr link in either direction, we
* just pull the non-nullptr link up one to replace the existing link.
* If both links exist, we instead delete the next link in order, which
* is guaranteed to have a null link, then replace the node to be deleted
* is guaranteed to have a nullptr link, then replace the node to be deleted
* with the next link.
*/
@@ -286,7 +286,7 @@ uint32 Lz77::addString(uint32 newNode, uint32 *matchPosition)
uint32 *child;
int delta = 0;
DEBUG_FATAL(!matchPosition, ("matchPosition is NULL"));
DEBUG_FATAL(!matchPosition, ("matchPosition is nullptr"));
if (newNode == endOfStream)
return 0;
@@ -121,8 +121,8 @@ void ZlibCompressorNamespace::remove()
DEBUG_FATAL(static_cast<int>(ms_memoryPool.size()) != ms_poolElementCount, ("ZLibCompressor memory pool entries not all released"));
operator delete(ms_memoryBottom);
ms_memoryBottom = NULL;
ms_memoryTop = NULL;
ms_memoryBottom = nullptr;
ms_memoryTop = nullptr;
ms_memoryPool.clear();
ms_mutex.leave();
@@ -155,12 +155,12 @@ int ZlibCompressor::compress(const void *inputBuffer, int inputSize, void *outpu
z.avail_out = outputSize;
z.total_out = 0;
z.msg = NULL;
z.state = NULL;
z.msg = nullptr;
z.state = nullptr;
z.zalloc = allocateWrapper;
z.zfree = freeWrapper;
z.opaque = NULL;
z.opaque = nullptr;
z.data_type = Z_BINARY;
z.adler = 0;
@@ -196,12 +196,12 @@ int ZlibCompressor::expand(const void *inputBuffer, int inputSize, void *outputB
z.avail_out = outputSize;
z.total_out = 0;
z.msg = NULL;
z.state = NULL;
z.msg = nullptr;
z.state = nullptr;
z.zalloc = allocateWrapper;
z.zfree = freeWrapper;
z.opaque = NULL;
z.opaque = nullptr;
z.data_type = Z_BINARY;
z.adler = 0;