mirror of
https://bitbucket.org/theswgsource/src-1.2.git
synced 2026-07-31 01:15:48 -04:00
newer standards prefer nullptr over NULL - this is most of them but there are others too
This commit is contained in:
@@ -169,9 +169,9 @@ void AsynchronousLoader::install(const char *fileName)
|
||||
const int numberOfExtensions = iff.getChunkLengthTotal(sizeof(int32));
|
||||
ms_extensionFunctionsList.reserve(numberOfExtensions);
|
||||
ExtensionFunctions extensionFunctions;
|
||||
extensionFunctions.extension = NULL;
|
||||
extensionFunctions.fetchFunction = NULL;
|
||||
extensionFunctions.releaseFunction = NULL;
|
||||
extensionFunctions.extension = nullptr;
|
||||
extensionFunctions.fetchFunction = nullptr;
|
||||
extensionFunctions.releaseFunction = nullptr;
|
||||
for (int i = 0; i < numberOfExtensions; ++i)
|
||||
{
|
||||
extensionFunctions.extension = ms_fileData + iff.read_int32();
|
||||
@@ -235,10 +235,10 @@ void AsynchronousLoaderNamespace::remove()
|
||||
{
|
||||
DEBUG_FATAL(!ms_installed, ("not installed"));
|
||||
Request *request = reinterpret_cast<Request*>(ms_requestMemoryBlockManager->allocate());
|
||||
request->fileRecordList = NULL;
|
||||
request->callback = NULL;
|
||||
request->data = NULL;
|
||||
request->cachedFiles = NULL;
|
||||
request->fileRecordList = nullptr;
|
||||
request->callback = nullptr;
|
||||
request->data = nullptr;
|
||||
request->cachedFiles = nullptr;
|
||||
|
||||
submitRequest(request);
|
||||
|
||||
@@ -270,7 +270,7 @@ void AsynchronousLoaderNamespace::remove()
|
||||
ms_cachedFilesPool.clear();
|
||||
|
||||
delete ms_requestMemoryBlockManager;
|
||||
ms_requestMemoryBlockManager = NULL;
|
||||
ms_requestMemoryBlockManager = nullptr;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -369,7 +369,7 @@ void AsynchronousLoader::add(const char *fileName, Callback callback, void *data
|
||||
request->fileRecordList = i->second;
|
||||
request->callback = callback;
|
||||
request->data = data;
|
||||
request->cachedFiles = NULL;
|
||||
request->cachedFiles = nullptr;
|
||||
submitRequest(request);
|
||||
}
|
||||
else
|
||||
@@ -390,8 +390,8 @@ void AsynchronousLoader::remove(Callback callback, void *data)
|
||||
for (Requests::iterator i = ms_pendingRequests.begin(); i != iEnd; ++i)
|
||||
if ((*i)->callback == callback && (*i)->data == data)
|
||||
{
|
||||
(*i)->callback = NULL;
|
||||
(*i)->data = NULL;
|
||||
(*i)->callback = nullptr;
|
||||
(*i)->data = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -400,8 +400,8 @@ void AsynchronousLoader::remove(Callback callback, void *data)
|
||||
for (Requests::iterator i = ms_completedRequests.begin(); i != iEnd; ++i)
|
||||
if ((*i)->callback == callback && (*i)->data == data)
|
||||
{
|
||||
(*i)->callback = NULL;
|
||||
(*i)->data = NULL;
|
||||
(*i)->callback = nullptr;
|
||||
(*i)->data = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -466,8 +466,8 @@ void AsynchronousLoaderNamespace::threadRoutine()
|
||||
|
||||
CachedFile cachedFile;
|
||||
cachedFile.fileRecord = fileRecord;
|
||||
cachedFile.file = NULL;
|
||||
cachedFile.resource = NULL;
|
||||
cachedFile.file = nullptr;
|
||||
cachedFile.resource = nullptr;
|
||||
|
||||
// check if the resource is already loaded
|
||||
if (!fileRecord->alreadyCached)
|
||||
@@ -622,7 +622,7 @@ void AsynchronousLoader::processCallbacks()
|
||||
else
|
||||
bytes += cachedFile.file->length();
|
||||
TreeFile::addCachedFile(cachedFile.fileRecord->fileName, cachedFile.file);
|
||||
cachedFile.file = NULL;
|
||||
cachedFile.file = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -653,13 +653,13 @@ void AsynchronousLoader::processCallbacks()
|
||||
else
|
||||
bytes += cachedFile.file->length();
|
||||
delete cachedFile.file;
|
||||
cachedFile.file = NULL;
|
||||
cachedFile.file = nullptr;
|
||||
}
|
||||
|
||||
if (cachedFile.resource)
|
||||
{
|
||||
ms_extensionFunctionsList[cachedFile.fileRecord->extensionFunctionsIndex].releaseFunction(cachedFile.resource);
|
||||
cachedFile.resource = NULL;
|
||||
cachedFile.resource = nullptr;
|
||||
}
|
||||
}
|
||||
request->cachedFiles->clear();
|
||||
@@ -667,7 +667,7 @@ void AsynchronousLoader::processCallbacks()
|
||||
ms_mutex.enter();
|
||||
|
||||
ms_cachedFilesPool.push_back(request->cachedFiles);
|
||||
request->cachedFiles = NULL;
|
||||
request->cachedFiles = nullptr;
|
||||
|
||||
ms_mutex.leave();
|
||||
}
|
||||
|
||||
@@ -73,8 +73,8 @@ void FileManifest::install()
|
||||
s_accessThreshold = ConfigFile::getKeyInt("SharedFile", "fileManifestAccessThreshold", -1, s_accessThreshold);
|
||||
|
||||
// if we are developing, and want to update the manifest, read in the tab file as well
|
||||
const char * manifestFile = ConfigFile::getKeyString("SharedFile", "updateFileManifest", 0, NULL);
|
||||
if (manifestFile != NULL)
|
||||
const char * manifestFile = ConfigFile::getKeyString("SharedFile", "updateFileManifest", 0, nullptr);
|
||||
if (manifestFile != nullptr)
|
||||
{
|
||||
s_updateManifest = true;
|
||||
|
||||
@@ -183,8 +183,8 @@ void FileManifest::remove()
|
||||
|
||||
#if PRODUCTION == 0
|
||||
// dump out the new manifest if requested
|
||||
const char * manifestFile = ConfigFile::getKeyString("SharedFile", "updateFileManifest", 0, NULL);
|
||||
if (manifestFile != NULL)
|
||||
const char * manifestFile = ConfigFile::getKeyString("SharedFile", "updateFileManifest", 0, nullptr);
|
||||
if (manifestFile != nullptr)
|
||||
{
|
||||
StdioFile outputFile(manifestFile,"w");
|
||||
DEBUG_FATAL(!outputFile.isOpen(), ("FileManifest::remove(): Could not open %s for writing.", manifestFile));
|
||||
@@ -201,7 +201,7 @@ void FileManifest::remove()
|
||||
{
|
||||
if (!i->second)
|
||||
{
|
||||
DEBUG_WARNING(true, ("FileManifest::remove(): Found a null pointer in the fileManifest map!\n"));
|
||||
DEBUG_WARNING(true, ("FileManifest::remove(): Found a nullptr pointer in the fileManifest map!\n"));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,9 +59,9 @@ bool FileNameUtils::isReadable(std::string const &path)
|
||||
{
|
||||
FILE *fp = fopen(path.c_str(), "r");
|
||||
|
||||
result = (fp != NULL);
|
||||
result = (fp != nullptr);
|
||||
|
||||
if (fp != NULL)
|
||||
if (fp != nullptr)
|
||||
{
|
||||
fclose(fp);
|
||||
}
|
||||
@@ -79,9 +79,9 @@ bool FileNameUtils::isWritable(std::string const &path)
|
||||
{
|
||||
FILE *fp = fopen(path.c_str(), "w");
|
||||
|
||||
result = (fp != NULL);
|
||||
result = (fp != nullptr);
|
||||
|
||||
if (fp != NULL)
|
||||
if (fp != nullptr)
|
||||
{
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
@@ -109,11 +109,11 @@ int FileStreamer::getFileSize(const char *fileName)
|
||||
FileStreamer::File *FileStreamer::open(const char *fileName, bool randomAccess)
|
||||
{
|
||||
DEBUG_FATAL(!ms_installed, ("not installed"));
|
||||
DEBUG_FATAL(!fileName, ("file name null"));
|
||||
DEBUG_FATAL(!fileName, ("file name nullptr"));
|
||||
|
||||
OsFile *osFile = OsFile::open(fileName, randomAccess);
|
||||
if (!osFile)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
#if PRODUCTION
|
||||
// Stop checking the fileName if one of these returns true
|
||||
@@ -150,7 +150,7 @@ void FileStreamer::File::install(bool useThread)
|
||||
void FileStreamer::File::remove()
|
||||
{
|
||||
delete ms_memoryBlockManager;
|
||||
ms_memoryBlockManager = NULL;
|
||||
ms_memoryBlockManager = nullptr;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -192,7 +192,7 @@ FileStreamer::File::~File()
|
||||
|
||||
bool FileStreamer::File::isOpen() const
|
||||
{
|
||||
return m_osFile != NULL;
|
||||
return m_osFile != nullptr;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -249,7 +249,7 @@ void FileStreamer::File::close()
|
||||
if (isOpen())
|
||||
{
|
||||
delete m_osFile;
|
||||
m_osFile = NULL;
|
||||
m_osFile = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ FileStreamerFile::~FileStreamerFile()
|
||||
|
||||
bool FileStreamerFile::isOpen() const
|
||||
{
|
||||
return m_file != NULL;
|
||||
return m_file != nullptr;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -174,7 +174,7 @@ void FileStreamerFile::close()
|
||||
{
|
||||
if (m_owner)
|
||||
delete m_file;
|
||||
m_file = NULL;
|
||||
m_file = nullptr;
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
|
||||
@@ -294,34 +294,34 @@ void FileStreamerThread::threadRoutine()
|
||||
|
||||
//get the request to service
|
||||
ms_queueCriticalSection.enter();
|
||||
request = NULL;
|
||||
request = nullptr;
|
||||
|
||||
//if there is an AudioVideo request, service it first (interrupting any current data request)
|
||||
if (ms_firstAudioVideoRequest)
|
||||
{
|
||||
request = ms_firstAudioVideoRequest;
|
||||
ms_firstAudioVideoRequest = ms_firstAudioVideoRequest->next;
|
||||
if (ms_firstAudioVideoRequest == NULL)
|
||||
ms_lastAudioVideoRequest = NULL;
|
||||
request->next = NULL;
|
||||
if (ms_firstAudioVideoRequest == nullptr)
|
||||
ms_lastAudioVideoRequest = nullptr;
|
||||
request->next = nullptr;
|
||||
}
|
||||
else
|
||||
if (ms_firstDataRequest)
|
||||
{
|
||||
request = ms_firstDataRequest;
|
||||
ms_firstDataRequest = ms_firstDataRequest->next;
|
||||
if (ms_firstDataRequest == NULL)
|
||||
ms_lastDataRequest = NULL;
|
||||
request->next = NULL;
|
||||
if (ms_firstDataRequest == nullptr)
|
||||
ms_lastDataRequest = nullptr;
|
||||
request->next = nullptr;
|
||||
}
|
||||
else
|
||||
if (ms_firstLowRequest)
|
||||
{
|
||||
request = ms_firstLowRequest;
|
||||
ms_firstLowRequest = ms_firstLowRequest->next;
|
||||
if (ms_firstLowRequest == NULL)
|
||||
ms_lastLowRequest = NULL;
|
||||
request->next = NULL;
|
||||
if (ms_firstLowRequest == nullptr)
|
||||
ms_lastLowRequest = nullptr;
|
||||
request->next = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -369,7 +369,7 @@ void FileStreamerThread::Request::install()
|
||||
void FileStreamerThread::Request::remove()
|
||||
{
|
||||
delete ms_memoryBlockManager;
|
||||
ms_memoryBlockManager = NULL;
|
||||
ms_memoryBlockManager = nullptr;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -395,15 +395,15 @@ void FileStreamerThread::Request::operator delete(void *pointer)
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
FileStreamerThread::Request::Request()
|
||||
: next(NULL),
|
||||
: next(nullptr),
|
||||
type(Request::Unknown),
|
||||
osFile(NULL),
|
||||
osFile(nullptr),
|
||||
buffer(0),
|
||||
bytesToBeRead(0),
|
||||
bytesRead(0),
|
||||
gate(NULL),
|
||||
gate(nullptr),
|
||||
priority(AbstractFile::PriorityData),
|
||||
returnValue(NULL)
|
||||
returnValue(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -412,10 +412,10 @@ FileStreamerThread::Request::Request()
|
||||
FileStreamerThread::Request::~Request()
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
next = NULL;
|
||||
buffer = NULL;
|
||||
gate = NULL;
|
||||
returnValue = NULL;
|
||||
next = nullptr;
|
||||
buffer = nullptr;
|
||||
gate = nullptr;
|
||||
returnValue = nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -146,11 +146,11 @@ bool Iff::isValid(char const * fileName)
|
||||
int const fileLength = file->length();
|
||||
byte *data = file->readEntireFileAndClose();
|
||||
delete file;
|
||||
file = NULL;
|
||||
file = nullptr;
|
||||
|
||||
bool const result = IffNamespace::isValid(data, fileLength);
|
||||
delete [] data;
|
||||
data = NULL;
|
||||
data = nullptr;
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -167,12 +167,12 @@ bool Iff::isValid(char const * fileName)
|
||||
// Iff::open()
|
||||
|
||||
Iff::Iff(void)
|
||||
: fileName(NULL),
|
||||
: fileName(nullptr),
|
||||
maxStackDepth(DEFAULT_STACK_DEPTH),
|
||||
stackDepth(0),
|
||||
stack(new Stack[DEFAULT_STACK_DEPTH]),
|
||||
length(0),
|
||||
data(NULL),
|
||||
data(nullptr),
|
||||
inChunk(false),
|
||||
growable(false),
|
||||
nonlinear(false),
|
||||
@@ -207,7 +207,7 @@ Iff::Iff(void)
|
||||
*/
|
||||
|
||||
Iff::Iff(int newDataSize, const byte *newData, bool iffOwnsData) :
|
||||
fileName(NULL),
|
||||
fileName(nullptr),
|
||||
maxStackDepth(DEFAULT_STACK_DEPTH),
|
||||
stackDepth(0),
|
||||
stack(new Stack[DEFAULT_STACK_DEPTH]),
|
||||
@@ -242,12 +242,12 @@ Iff::Iff(int newDataSize, const byte *newData, bool iffOwnsData) :
|
||||
*/
|
||||
|
||||
Iff::Iff(const char *newFileName, bool optional)
|
||||
: fileName(NULL),
|
||||
: fileName(nullptr),
|
||||
maxStackDepth(DEFAULT_STACK_DEPTH),
|
||||
stackDepth(0),
|
||||
stack(new Stack[DEFAULT_STACK_DEPTH]),
|
||||
length(0),
|
||||
data(NULL),
|
||||
data(nullptr),
|
||||
inChunk(false),
|
||||
growable(false),
|
||||
nonlinear(false),
|
||||
@@ -270,7 +270,7 @@ Iff::Iff(const char *newFileName, bool optional)
|
||||
*/
|
||||
|
||||
Iff::Iff(int initialSize, bool isGrowable, bool clearDataBuffer)
|
||||
: fileName(NULL),
|
||||
: fileName(nullptr),
|
||||
maxStackDepth(DEFAULT_STACK_DEPTH),
|
||||
stackDepth(0),
|
||||
stack(new Stack[DEFAULT_STACK_DEPTH]),
|
||||
@@ -384,7 +384,7 @@ void Iff::open(AbstractFile & file, char const * const newFileName)
|
||||
DEBUG_FATAL(data, ("causing memory leak"));
|
||||
data = file.readEntireFileAndClose();
|
||||
|
||||
FATAL(ConfigSharedFile::getValidateIff() && !IffNamespace::isValid(data, length), ("File corruption detected! Iff::isValid failed for %s (size=%d, crc=%08X). Please try a \"Full Scan\" from the LaunchPad.", newFileName ? newFileName : "null", length, Crc::calculate(data, length)));
|
||||
FATAL(ConfigSharedFile::getValidateIff() && !IffNamespace::isValid(data, length), ("File corruption detected! Iff::isValid failed for %s (size=%d, crc=%08X). Please try a \"Full Scan\" from the LaunchPad.", newFileName ? newFileName : "nullptr", length, Crc::calculate(data, length)));
|
||||
|
||||
// setup the stack data to know about the data
|
||||
stack[0].start = 0;
|
||||
@@ -406,11 +406,11 @@ void Iff::open(AbstractFile & file, char const * const newFileName)
|
||||
void Iff::close(void)
|
||||
{
|
||||
delete [] fileName;
|
||||
fileName = NULL;
|
||||
fileName = nullptr;
|
||||
|
||||
if (ownsData)
|
||||
delete [] data;
|
||||
data = NULL; //lint !e672 // possible memory leak in assignment to Iff::data // no, we only delete when we own it
|
||||
data = nullptr; //lint !e672 // possible memory leak in assignment to Iff::data // no, we only delete when we own it
|
||||
stackDepth = 0;
|
||||
}
|
||||
|
||||
@@ -886,7 +886,7 @@ void Iff::insertChunkFloatQuaternion(const Quaternion &quaternion)
|
||||
* Insert a string into the current chunk at the current location.
|
||||
*
|
||||
* This routine will call insertChunkData(const void *, int length)
|
||||
* with the string using its string length (plus one for the null
|
||||
* with the string using its string length (plus one for the nullptr
|
||||
* terminator).
|
||||
*/
|
||||
|
||||
@@ -1555,10 +1555,10 @@ void Iff::read_string(char *string, int maxLength)
|
||||
*string = *source;
|
||||
}
|
||||
|
||||
// step over the null terminator on the input
|
||||
// step over the nullptr terminator on the input
|
||||
++s.used;
|
||||
|
||||
// null terminate the output string
|
||||
// nullptr terminate the output string
|
||||
DEBUG_FATAL(maxLength <= 0, ("destination string too short"));
|
||||
*string = '\0';
|
||||
}
|
||||
@@ -1594,7 +1594,7 @@ char *Iff::read_string(void)
|
||||
for ( ; sourceLength < maxLength && source[sourceLength]; ++sourceLength)
|
||||
;
|
||||
|
||||
// verify that we found the null terminator
|
||||
// verify that we found the nullptr terminator
|
||||
DEBUG_FATAL(sourceLength >= maxLength, ("hit end of chunk before string terminator"));
|
||||
|
||||
// create and copy the string
|
||||
@@ -1634,10 +1634,10 @@ void Iff::read_string(std::string &string)
|
||||
for ( ; sourceLength < maxLength && source[sourceLength]; ++sourceLength)
|
||||
;
|
||||
|
||||
// verify that we found the null terminator
|
||||
// verify that we found the nullptr terminator
|
||||
DEBUG_FATAL(sourceLength >= maxLength, ("hit end of chunk before string terminator"));
|
||||
|
||||
// account for the null terminator
|
||||
// account for the nullptr terminator
|
||||
++sourceLength;
|
||||
|
||||
s.used += sourceLength;
|
||||
|
||||
@@ -250,7 +250,7 @@ public:
|
||||
Unicode::String read_unicodeString();
|
||||
|
||||
#if 0
|
||||
real *read_float (int count, real *array=NULL);
|
||||
real *read_float (int count, real *array=nullptr);
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -294,7 +294,7 @@ inline int Iff::getRawDataSize(void) const
|
||||
* to store raw iff data via a mechanism other than Iff::write().
|
||||
*
|
||||
* @return A read-only pointer to the data buffer containing the raw Iff data
|
||||
* managed by this Iff object. It may be NULL if no data is currently
|
||||
* managed by this Iff object. It may be nullptr if no data is currently
|
||||
* managed by the Iff.
|
||||
* @see Iff::getRawDataSize(), Iff::write()
|
||||
*/
|
||||
|
||||
@@ -23,7 +23,7 @@ IndentedFileWriter *IndentedFileWriter::createWriter(char const *filename)
|
||||
{
|
||||
// Kill the new writer since we weren't able to open the file for writing.
|
||||
delete newWriter;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ IndentedFileWriter::~IndentedFileWriter()
|
||||
if (m_file)
|
||||
{
|
||||
fclose(m_file);
|
||||
m_file = NULL;
|
||||
m_file = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,8 +63,8 @@ void IndentedFileWriter::unindent()
|
||||
|
||||
void IndentedFileWriter::writeLine(char const *line) const
|
||||
{
|
||||
FATAL(!m_file, ("writeLine(): m_file is NULL, programmer error."));
|
||||
FATAL(!line, ("writeLine(): line argument is NULL."));
|
||||
FATAL(!m_file, ("writeLine(): m_file is nullptr, programmer error."));
|
||||
FATAL(!line, ("writeLine(): line argument is nullptr."));
|
||||
|
||||
//-- Write one tab for each indentation level.
|
||||
for (int i = 0; i < m_indentCount; ++i)
|
||||
@@ -92,7 +92,7 @@ void IndentedFileWriter::writeLineFormat(char const *format, ...) const
|
||||
int const formatCount = vsnprintf(buffer, sizeof(buffer), format, varArgList);
|
||||
UNREF(formatCount);
|
||||
|
||||
//-- Ensure it's null terminated.
|
||||
//-- Ensure it's nullptr terminated.
|
||||
buffer[sizeof(buffer) - 1] = '\0';
|
||||
|
||||
//-- Do the real print.
|
||||
@@ -108,7 +108,7 @@ void IndentedFileWriter::writeLineFormat(char const *format, ...) const
|
||||
|
||||
IndentedFileWriter::IndentedFileWriter() :
|
||||
m_indentCount(0),
|
||||
m_file(NULL)
|
||||
m_file(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ bool IndentedFileWriter::createFile(char const *filename)
|
||||
}
|
||||
|
||||
m_file = fopen(filename, "w");
|
||||
return (m_file != NULL);
|
||||
return (m_file != nullptr);
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
|
||||
@@ -70,7 +70,7 @@ MemoryFile::MemoryFile(byte *buffer, int length)
|
||||
|
||||
MemoryFile::MemoryFile(AbstractFile *file)
|
||||
: AbstractFile(PriorityData),
|
||||
m_buffer(NULL),
|
||||
m_buffer(nullptr),
|
||||
m_length(file->length()),
|
||||
m_offset(0)
|
||||
{
|
||||
@@ -88,7 +88,7 @@ MemoryFile::~MemoryFile()
|
||||
|
||||
bool MemoryFile::isOpen() const
|
||||
{
|
||||
return m_buffer != NULL;
|
||||
return m_buffer != nullptr;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -162,7 +162,7 @@ int MemoryFile::write(int, const void *)
|
||||
void MemoryFile::close()
|
||||
{
|
||||
delete [] m_buffer;
|
||||
m_buffer = NULL;
|
||||
m_buffer = nullptr;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -170,7 +170,7 @@ void MemoryFile::close()
|
||||
byte *MemoryFile::readEntireFileAndClose()
|
||||
{
|
||||
byte *result = m_buffer;
|
||||
m_buffer = NULL;
|
||||
m_buffer = nullptr;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ void TreeFile::install(uint32 skuBits)
|
||||
sprintf(buffer, "searchPath%s%d", skuText, priority);
|
||||
|
||||
char const * result;
|
||||
for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", buffer, index, NULL)) != NULL; ++index)
|
||||
for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", buffer, index, nullptr)) != nullptr; ++index)
|
||||
TreeFile::addSearchPath(result, priority);
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ void TreeFile::install(uint32 skuBits)
|
||||
sprintf(buffer, "searchTree%s%d", skuText, priority);
|
||||
|
||||
char const * result;
|
||||
for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", buffer, index, NULL)) != NULL; ++index)
|
||||
for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", buffer, index, nullptr)) != nullptr; ++index)
|
||||
TreeFile::addSearchTree(result, priority);
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ void TreeFile::install(uint32 skuBits)
|
||||
sprintf(buffer, "searchTOC%s%d", skuText, priority);
|
||||
|
||||
char const * result;
|
||||
for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", buffer, index, NULL)) != NULL; ++index)
|
||||
for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", buffer, index, nullptr)) != nullptr; ++index)
|
||||
TreeFile::addSearchTOC(result, priority);
|
||||
}
|
||||
}
|
||||
@@ -430,7 +430,7 @@ void TreeFile::removeAllSearches(void)
|
||||
* Find the node (if any) the requested file is in.
|
||||
*
|
||||
* @return Pointer to the highest priority node containing the file. If the
|
||||
* file is not found, NULL is returned. If checking for filename collisions is
|
||||
* file is not found, nullptr is returned. If checking for filename collisions is
|
||||
* set on, then this function DEBUG_FATALS if multiple files match
|
||||
*/
|
||||
|
||||
@@ -440,14 +440,14 @@ TreeFile::SearchNode *TreeFile::find(const char *fileName)
|
||||
|
||||
if (!fileName)
|
||||
{
|
||||
DEBUG_WARNING(true, ("TreeFile::find() Cannot find a null filename"));
|
||||
return NULL;
|
||||
DEBUG_WARNING(true, ("TreeFile::find() Cannot find a nullptr filename"));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (fileName[0] == '\0')
|
||||
{
|
||||
DEBUG_WARNING(true, ("TreeFile::find() Cannot find an empty filename"));
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// search the list of nodes looking to see if the specified file exists
|
||||
@@ -457,7 +457,7 @@ TreeFile::SearchNode *TreeFile::find(const char *fileName)
|
||||
if ((*i)->exists(fileName, deleted))
|
||||
return *i;
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -479,7 +479,7 @@ bool TreeFile::exists(const char *fileName)
|
||||
FileManifest::addNewManifestEntry(fixedFileName, 0);
|
||||
#endif
|
||||
|
||||
return (find(fixedFileName) != NULL);
|
||||
return (find(fixedFileName) != nullptr);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -621,7 +621,7 @@ void TreeFile::fixUpFileName(const char *fileName, char *outName)
|
||||
* Find the node (if any) the requested file is in.
|
||||
*
|
||||
* @return Pointer to the highest priority node containing the file. If the
|
||||
* file is not found, NULL is returned.
|
||||
* file is not found, nullptr is returned.
|
||||
*/
|
||||
|
||||
bool TreeFile::getPathName(const char *fileName, char *pathName, int pathNameLength)
|
||||
@@ -655,12 +655,12 @@ bool TreeFile::getPathName(const char *fileName, char *pathName, int pathNameLen
|
||||
*
|
||||
* @param fileName File name to open
|
||||
* @param allowFail True to return false on failure, otherwise Fatal
|
||||
* @return pointer to a newly allocated AbstractFile-derived class (caller must delete), NULL if failure.
|
||||
* @return pointer to a newly allocated AbstractFile-derived class (caller must delete), nullptr if failure.
|
||||
*/
|
||||
|
||||
AbstractFile* TreeFile::open(const char *fileName, AbstractFile::PriorityType priority, bool allowFail)
|
||||
{
|
||||
AbstractFile *file = NULL;
|
||||
AbstractFile *file = nullptr;
|
||||
|
||||
char fixedFileName[Os::MAX_PATH_LENGTH];
|
||||
fixUpFileName(fixedFileName, fileName, true);
|
||||
@@ -678,7 +678,7 @@ AbstractFile* TreeFile::open(const char *fileName, AbstractFile::PriorityType pr
|
||||
if (cachedIterator != cachedFilesMap.end())
|
||||
{
|
||||
file = cachedIterator->second;
|
||||
cachedIterator->second = NULL;
|
||||
cachedIterator->second = nullptr;
|
||||
}
|
||||
|
||||
ms_criticalSection.leave();
|
||||
@@ -747,7 +747,7 @@ AbstractFile* TreeFile::open(const char *fileName, AbstractFile::PriorityType pr
|
||||
FileManifest::addNewManifestEntry(fixedFileName, 0);
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const int length = file->length();
|
||||
@@ -787,7 +787,7 @@ const char *TreeFile::getSearchPath(int index)
|
||||
for (SearchNodes::iterator i = ms_searchNodes.begin(); i != iEnd; ++i)
|
||||
{
|
||||
const SearchPath *searchPath = dynamic_cast<const SearchPath*>(*i);
|
||||
if (searchPath != NULL)
|
||||
if (searchPath != nullptr)
|
||||
{
|
||||
if (count == index)
|
||||
return searchPath->getPathName();
|
||||
@@ -795,14 +795,14 @@ const char *TreeFile::getSearchPath(int index)
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
/**
|
||||
* This function will return the shortest trailing path of its input that
|
||||
* can be loaded by the TreeFile. If no files can be loaded, this routine
|
||||
* will return NULL.
|
||||
* will return nullptr.
|
||||
*/
|
||||
|
||||
const char *TreeFile::getShortestExistingPath(const char *path)
|
||||
@@ -810,9 +810,9 @@ const char *TreeFile::getShortestExistingPath(const char *path)
|
||||
NOT_NULL(path);
|
||||
|
||||
if (!*path)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
const char *result = NULL;
|
||||
const char *result = nullptr;
|
||||
do
|
||||
{
|
||||
// check if this one exists
|
||||
@@ -866,7 +866,7 @@ bool TreeFile::stripTreeFileSearchPathFromFile(const char *inputPath, char *outp
|
||||
{
|
||||
// make sure it's a relative search path
|
||||
const SearchPath *searchPath = dynamic_cast<const SearchPath*>(*i);
|
||||
if (searchPath != NULL)
|
||||
if (searchPath != nullptr)
|
||||
{
|
||||
// check to see if the the search path is a prefix for the requested path
|
||||
const char *path = searchPath->getPathName();
|
||||
|
||||
@@ -53,7 +53,7 @@ TreeFile::SearchNode::~SearchNode(void)
|
||||
|
||||
TreeFile::SearchPath::SearchPath(int priority, const char *path)
|
||||
: SearchNode(priority),
|
||||
m_pathName(NULL),
|
||||
m_pathName(nullptr),
|
||||
m_pathNameLength(0)
|
||||
{
|
||||
NOT_NULL(path);
|
||||
@@ -145,7 +145,7 @@ AbstractFile *TreeFile::SearchPath::open(const char *fileName, AbstractFile::Pri
|
||||
makeAbsolutePath(fileName, buffer);
|
||||
FileStreamer::File *file = FileStreamer::open(buffer);
|
||||
if (!file)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
return new FileStreamerFile(priority, *file);
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ AbstractFile *TreeFile::SearchAbsolute::open(const char *fileName, AbstractFile:
|
||||
|
||||
FileStreamer::File *file = FileStreamer::open(fileName);
|
||||
if (!file)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
return new FileStreamerFile(priority, *file);
|
||||
}
|
||||
|
||||
@@ -248,12 +248,12 @@ bool TreeFile::SearchTree::validate(const char *fileName)
|
||||
|
||||
TreeFile::SearchTree::SearchTree(int priority, const char *fileName)
|
||||
: SearchNode(priority),
|
||||
m_treeFileName(NULL),
|
||||
m_treeFile(NULL),
|
||||
m_treeFileName(nullptr),
|
||||
m_treeFile(nullptr),
|
||||
m_version(0),
|
||||
m_numberOfFiles(0),
|
||||
m_fileNames(NULL),
|
||||
m_tableOfContents(NULL)
|
||||
m_fileNames(nullptr),
|
||||
m_tableOfContents(nullptr)
|
||||
{
|
||||
NOT_NULL(fileName);
|
||||
|
||||
@@ -435,7 +435,7 @@ void TreeFile::SearchTree::debugPrint(void)
|
||||
bool TreeFile::SearchTree::exists(const char *fileName, bool &deleted) const
|
||||
{
|
||||
NOT_NULL(fileName);
|
||||
return localExists(fileName, NULL, deleted);
|
||||
return localExists(fileName, nullptr, deleted);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -497,7 +497,7 @@ AbstractFile *TreeFile::SearchTree::open(const char *fileName, AbstractFile::Pri
|
||||
return new ZlibFile(entry.length, compressedBuffer, entry.compressedLength, true);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
@@ -535,14 +535,14 @@ bool TreeFile::SearchTOC::validate(const char *fileName)
|
||||
|
||||
TreeFile::SearchTOC::SearchTOC(int priority, const char *fileName)
|
||||
: SearchNode(priority),
|
||||
m_TOCFileName(NULL),
|
||||
m_TOCFile(NULL),
|
||||
m_treeFiles(NULL),
|
||||
m_TOCFileName(nullptr),
|
||||
m_TOCFile(nullptr),
|
||||
m_treeFiles(nullptr),
|
||||
m_numberOfFiles(0),
|
||||
m_treeFileNames(NULL),
|
||||
m_treeFileNamePointers(NULL),
|
||||
m_tableOfContents(NULL),
|
||||
m_fileNames(NULL)
|
||||
m_treeFileNames(nullptr),
|
||||
m_treeFileNamePointers(nullptr),
|
||||
m_tableOfContents(nullptr),
|
||||
m_fileNames(nullptr)
|
||||
{
|
||||
NOT_NULL(fileName);
|
||||
|
||||
@@ -587,7 +587,7 @@ TreeFile::SearchTOC::SearchTOC(int priority, const char *fileName)
|
||||
|
||||
// add on all paths in config file
|
||||
const char * result;
|
||||
for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", "TOCTreePath", index, NULL)) != NULL; ++index)
|
||||
for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", "TOCTreePath", index, nullptr)) != nullptr; ++index)
|
||||
treePaths.push_back(result);
|
||||
|
||||
// read in the tree file names and open the files
|
||||
@@ -598,7 +598,7 @@ TreeFile::SearchTOC::SearchTOC(int priority, const char *fileName)
|
||||
for (int treeFileNameIndex = 0, treeFileNameReadPosition = 0; treeFileNameIndex < static_cast<int>(header.numberOfTreeFiles); treeFileNameIndex++)
|
||||
{
|
||||
m_treeFileNamePointers[treeFileNameIndex] = (m_treeFileNames + treeFileNameReadPosition);
|
||||
m_treeFiles[treeFileNameIndex] = NULL;
|
||||
m_treeFiles[treeFileNameIndex] = nullptr;
|
||||
|
||||
// try to open the tree file in each of the relative paths
|
||||
for (std::vector<const char *>::const_iterator pathIter = treePaths.begin(); pathIter != treePaths.end(); ++pathIter)
|
||||
@@ -656,7 +656,7 @@ TreeFile::SearchTOC::SearchTOC(int priority, const char *fileName)
|
||||
{
|
||||
currentFileNameLength = m_tableOfContents[i].fileNameOffset;
|
||||
m_tableOfContents[i].fileNameOffset = currentFileNameOffset;
|
||||
// + 1 for the null termination
|
||||
// + 1 for the nullptr termination
|
||||
currentFileNameOffset += (currentFileNameLength + 1);
|
||||
}
|
||||
}
|
||||
@@ -792,7 +792,7 @@ bool TreeFile::SearchTOC::exists(const char *fileName, bool &deleted) const
|
||||
{
|
||||
NOT_NULL(fileName);
|
||||
deleted = false;
|
||||
return localExists(fileName, NULL);
|
||||
return localExists(fileName, nullptr);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -862,7 +862,7 @@ AbstractFile *TreeFile::SearchTOC::open(const char *fileName, AbstractFile::Prio
|
||||
return new ZlibFile(entry.length, compressedBuffer, entry.compressedLength, true);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
|
||||
@@ -66,7 +66,7 @@ ZlibFile::ZlibFile(int uncompressedLength, byte *compressedBuffer, int compresse
|
||||
m_compressedBuffer(compressedBuffer),
|
||||
m_compressedBufferLength(compressedBufferLength),
|
||||
m_ownsCompressedBuffer(ownsCompressedBuffer),
|
||||
m_decompressedMemoryFile(NULL)
|
||||
m_decompressedMemoryFile(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -137,10 +137,10 @@ void ZlibFile::close()
|
||||
{
|
||||
if (m_ownsCompressedBuffer)
|
||||
delete [] m_compressedBuffer;
|
||||
m_compressedBuffer = NULL;
|
||||
m_compressedBuffer = nullptr;
|
||||
|
||||
delete m_decompressedMemoryFile;
|
||||
m_decompressedMemoryFile = NULL;
|
||||
m_decompressedMemoryFile = nullptr;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -197,7 +197,7 @@ void ZlibFile::getZlibCompressedDataAndClose(byte *& compressedBuffer, int & com
|
||||
if (m_ownsCompressedBuffer)
|
||||
{
|
||||
compressedBuffer = m_compressedBuffer;
|
||||
m_compressedBuffer = NULL;
|
||||
m_compressedBuffer = nullptr;
|
||||
compressedBufferLength = m_compressedBufferLength;
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user