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

This commit is contained in:
DarthArgus
2016-02-15 00:07:31 -06:00
parent 6bb5137dc4
commit 03dc62efba
937 changed files with 14983 additions and 14983 deletions
@@ -97,7 +97,7 @@ void Os::installCommon(void)
mainThreadId = pthread_self();
// get the name of the executable
//Can't find UNIX call for this: DWORD result = GetModuleFileName(NULL, programName, sizeof(programName));
//Can't find UNIX call for this: DWORD result = GetModuleFileName(nullptr, programName, sizeof(programName));
strcpy(programName, "TempName");
DWORD result = 1;
@@ -119,7 +119,7 @@ void Os::installCommon(void)
char buffer[512];
while (!feof(f))
{
if (fgets(buffer, 512, f) != NULL) {
if (fgets(buffer, 512, f) != nullptr) {
if (strncmp(buffer, "processor\t: ", 12)==0)
{
processorCount = atoi(buffer+12)+1;
@@ -165,13 +165,13 @@ void Os::abort(void)
if (!isMainThread())
{
threadDied = true;
pthread_exit(NULL);
pthread_exit(nullptr);
}
if (!shouldReturnFromAbort)
{
// let the C runtime deal with the abnormal termination
int * dummy = NULL;
int * dummy = nullptr;
int forceCrash = *dummy;
UNREF(forceCrash);
for (;;)
@@ -256,14 +256,14 @@ bool Os::writeFile(const char *fileName, const void *data, int length) // Le
DWORD written;
// open the file for writing
handle = CreateFile(fileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
handle = CreateFile(fileName, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
// check if it was opened
if (handle == INVALID_HANDLE_VALUE)
return false;
// attempt to write the data
result = WriteFile(handle, data, static_cast<DWORD>(length), &written, NULL);
result = WriteFile(handle, data, static_cast<DWORD>(length), &written, nullptr);
// make sure the data was written okay
if (!result || written != static_cast<DWORD>(length))
@@ -81,7 +81,7 @@ PerThreadData::Data *PerThreadData::getData(bool allowReturnNull)
if (!slotCreated)
{
DEBUG_FATAL(true && !allowReturnNull, ("not installed"));
return NULL;
return nullptr;
}
Data * const data = reinterpret_cast<Data *>(pthread_getspecific(slot));
@@ -97,7 +97,7 @@ PerThreadData::Data *PerThreadData::getData(bool allowReturnNull)
*
* If the client is calling this function on a thread that existed before the engine was
* installed, the client should set isNewThread to false. Setting isNewThread to false
* prevents the function from validating that the thread's TLS is NULL. For threads existing
* prevents the function from validating that the thread's TLS is nullptr. For threads existing
* before the engine is installed, the TLS data for the thread is undefined.
*
* @param isNewThread [IN] true if the thread was created after the engine was installed, false otherwise
@@ -147,10 +147,10 @@ void PerThreadData::threadRemove(void)
//close the event used for file streaming reads
delete data->readGate;
data->readGate = NULL;
data->readGate = nullptr;
// wipe the data in the thread slot
const BOOL result2 = pthread_setspecific(slot, NULL);
const BOOL result2 = pthread_setspecific(slot, nullptr);
UNREF(result2);
DEBUG_FATAL(result2, ("TlsSetValue failed")); //NB: unlike Windows, returns 0 on success.
@@ -93,7 +93,7 @@ public:
* threads existing at the time of slot creation. Thus, if you build a
* plugin that only initializes the engine the first time it is
* used, and other threads already exist in the app, those threads
* will contain bogus non-null data in the TLS slot. If the plugin really
* will contain bogus non-nullptr data in the TLS slot. If the plugin really
* wants to do lazy initialization of the engine, it will need
* to handle calling PerThreadData::threadInstall() for all existing threads
* (except the thread that initialized the engine, which already
@@ -102,7 +102,7 @@ public:
inline bool PerThreadData::isThreadInstalled(void)
{
return (getData(true) != NULL);
return (getData(true) != nullptr);
}
// ----------------------------------------------------------------------
@@ -168,7 +168,7 @@ inline void PerThreadData::setExitChainFataling(bool newValue)
* Get the first entry for the exit chain.
*
* This routine is not intended for general use; it should only be used by the ExitChain class.
* This routine may return NULL.
* This routine may return nullptr.
*
* @return Pointer to the first entry on the exit chain
* @see ExitChain::isFataling()
@@ -184,7 +184,7 @@ inline ExitChain::Entry *PerThreadData::getExitChainFirstEntry(void)
* Set the exit chain fataling flag value.
*
* This routine is not intended for general use; it should only be used by the ExitChain class.
* The parameter to this routine may be NULL.
* The parameter to this routine may be nullptr.
*
* @param newValue New value for the exit chain first entry
*/
@@ -33,7 +33,7 @@ char* _itoa(int value, char* stringOut, int radix)
bool QueryPerformanceCounter(__int64* time)
{
struct timeval tv;
gettimeofday(&tv, NULL);
gettimeofday(&tv, nullptr);
*time = static_cast<LARGE_INTEGER>(tv.tv_sec);
*time = (*time * 1000000) + static_cast<LARGE_INTEGER>(tv.tv_usec);
@@ -107,7 +107,7 @@ FILE* CreateFile(const char* fileName, DWORD access, DWORD shareMode, void* unsu
FILE* retval = 0;
DEBUG_FATAL(flagsAndAttributes != FILE_ATTRIBUTE_NORMAL, ("Unsupported File mode call to CreateFile()"));
DEBUG_FATAL(unsupB != NULL, ("Unsupported File mode call to CreateFile()"));
DEBUG_FATAL(unsupB != nullptr, ("Unsupported File mode call to CreateFile()"));
//DEBUG_FATAL(shareMode != 0, ("Unsupported File mode call to CreateFile()"));
DEBUG_FATAL(unsupA != 0, ("Unsupported File mode call to CreateFile()"));
@@ -118,7 +118,7 @@ FILE* CreateFile(const char* fileName, DWORD access, DWORD shareMode, void* unsu
if (retval)
{
fclose(retval);
retval = NULL;
retval = nullptr;
}
else
{
@@ -46,7 +46,7 @@ void OutputDebugString(const char* stringOut);
typedef FILE* HANDLE;
#define INVALID_HANDLE_VALUE NULL //Have to use a #define because this may be a FILE*
#define INVALID_HANDLE_VALUE nullptr //Have to use a #define because this may be a FILE*
const int GENERIC_READ = 1 << 0;
@@ -66,8 +66,8 @@ const int FILE_END = SEEK_END;
const int FILE_SHARE_READ = 1;
BOOL WriteFile(FILE* hFile, const void* lpBuffer, DWORD numBytesToWrite, DWORD* numBytesWritten, void* unsup=NULL);
BOOL ReadFile(FILE* hFile, void* lpBuffer, DWORD numBytesToWrite, DWORD* numBytesRead, void* unsup=NULL);
BOOL WriteFile(FILE* hFile, const void* lpBuffer, DWORD numBytesToWrite, DWORD* numBytesWritten, void* unsup=nullptr);
BOOL ReadFile(FILE* hFile, void* lpBuffer, DWORD numBytesToWrite, DWORD* numBytesRead, void* unsup=nullptr);
DWORD SetFilePointer(FILE* hFile, long lDistanceToMove, long* lpDistanceToMoveHigh, DWORD dwMoveMethod);
FILE* CreateFile(const char* fileName, DWORD access, DWORD shareMode, void* unsupA, DWORD creationDisposition, DWORD flagsAndAttributes, FILE* unsup2);
BOOL CloseHandle(FILE* hFile);
@@ -150,11 +150,11 @@ SetupSharedFoundation::Data::Data(Defaults defaults)
case D_game:
runInBackground = true;
lpCmdLine = NULL;
lpCmdLine = nullptr;
argc = 0;
argv = NULL;
argv = nullptr;
configFile = NULL;
configFile = nullptr;
frameRateLimit = CONST_REAL(0);
break;
@@ -162,11 +162,11 @@ SetupSharedFoundation::Data::Data(Defaults defaults)
case D_console:
runInBackground = true;
lpCmdLine = NULL;
lpCmdLine = nullptr;
argc = 0;
argv = NULL;
argv = nullptr;
configFile = NULL;
configFile = nullptr;
frameRateLimit = CONST_REAL(0);
break;
@@ -21,7 +21,7 @@
//
// Remarks:
//
// If the buffer would overflow, the null terminating character is not written and -1
// If the buffer would overflow, the nullptr terminating character is not written and -1
// will be returned.
#ifdef _MSC_VER