mirror of
https://github.com/SWG-Source/src.git
synced 2026-08-02 02:15:58 -04:00
newer standards prefer nullptr over NULL - this is most of them but there are others too
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -35,7 +35,7 @@ m_numInUseBits(0)
|
||||
{
|
||||
if (numBits > (m_numAllocatedBytes << 3))
|
||||
{
|
||||
m_arrayData = NULL;
|
||||
m_arrayData = nullptr;
|
||||
m_numAllocatedBytes = 0;
|
||||
reserve(numBits);
|
||||
m_numInUseBytes = 0;
|
||||
@@ -294,7 +294,7 @@ void BitArray::reserve(int const numBits)
|
||||
{
|
||||
signed char * tmp = new signed char[static_cast<size_t>(m_numInUseBytes)];
|
||||
memset(&(tmp[oldNumInUseBytes]), 0, static_cast<size_t>(m_numInUseBytes - oldNumInUseBytes));
|
||||
if ((oldNumInUseBytes > 0) && (m_arrayData != NULL))
|
||||
if ((oldNumInUseBytes > 0) && (m_arrayData != nullptr))
|
||||
memcpy(tmp, m_arrayData, static_cast<size_t>(oldNumInUseBytes)); //lint !e671 !e670 logically, you can't enter this code block unless oldNumInUseBytes is smaller.
|
||||
|
||||
m_numAllocatedBytes = m_numInUseBytes;
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
|
||||
// for DB persistence purpose, returns the BitArray as a
|
||||
// std::string where each 4 bits are printed as a hex nibble;
|
||||
// and the converse that takes the null-terminated string
|
||||
// and the converse that takes the nullptr-terminated string
|
||||
// and converts it back into the BitArray
|
||||
void getAsDbTextString(std::string &result, int maxNibbleCount = 32767) const;
|
||||
void setFromDbTextString(const char * text);
|
||||
|
||||
@@ -17,11 +17,11 @@ std::string CalendarTime::convertEpochToTimeStringGMT(time_t epoch)
|
||||
std::string result;
|
||||
|
||||
struct tm * timeinfo = ::gmtime(&epoch);
|
||||
if (timeinfo == NULL)
|
||||
if (timeinfo == nullptr)
|
||||
return result;
|
||||
|
||||
char * asciiTime = ::asctime(timeinfo);
|
||||
if (asciiTime == NULL)
|
||||
if (asciiTime == nullptr)
|
||||
return result;
|
||||
|
||||
static char resultBuffer[512];
|
||||
@@ -48,7 +48,7 @@ std::string CalendarTime::convertEpochToTimeStringGMT_YYYYMMDDHHMMSS(time_t epoc
|
||||
std::string result;
|
||||
|
||||
struct tm * timeinfo = ::gmtime(&epoch);
|
||||
if (timeinfo == NULL)
|
||||
if (timeinfo == nullptr)
|
||||
return result;
|
||||
|
||||
static char resultBuffer[512];
|
||||
@@ -64,11 +64,11 @@ std::string CalendarTime::convertEpochToTimeStringLocal(time_t epoch)
|
||||
std::string result;
|
||||
|
||||
struct tm * timeinfo = ::localtime(&epoch);
|
||||
if (timeinfo == NULL)
|
||||
if (timeinfo == nullptr)
|
||||
return result;
|
||||
|
||||
char * asciiTime = ::asctime(timeinfo);
|
||||
if (asciiTime == NULL)
|
||||
if (asciiTime == nullptr)
|
||||
return result;
|
||||
|
||||
static char resultBuffer[512];
|
||||
@@ -105,7 +105,7 @@ std::string CalendarTime::convertEpochToTimeStringLocal_YYYYMMDDHHMMSS(time_t ep
|
||||
std::string result;
|
||||
|
||||
struct tm * timeinfo = ::localtime(&epoch);
|
||||
if (timeinfo == NULL)
|
||||
if (timeinfo == nullptr)
|
||||
return result;
|
||||
|
||||
static char resultBuffer[512];
|
||||
@@ -218,7 +218,7 @@ time_t CalendarTime::getNextGMTTimeOcurrence(time_t const startTime, int const d
|
||||
// the year, month, day, day of week, hour, minute, second
|
||||
// in GMT time
|
||||
struct tm * timeinfo = ::gmtime(&startTime);
|
||||
if (timeinfo == NULL)
|
||||
if (timeinfo == nullptr)
|
||||
return -1;
|
||||
|
||||
// get number of days until the specified day of week to search for
|
||||
@@ -333,7 +333,7 @@ time_t CalendarTime::getNextGMTTimeOcurrence(time_t const startTime, int const m
|
||||
// the year, month, day, day of week, hour, minute, second
|
||||
// in GMT time
|
||||
struct tm * timeinfo = ::gmtime(&startTime);
|
||||
if (timeinfo == NULL)
|
||||
if (timeinfo == nullptr)
|
||||
return -1;
|
||||
|
||||
// calculate the Epoch GMT time for the specified start time
|
||||
@@ -358,7 +358,7 @@ time_t CalendarTime::getNextGMTTimeOcurrence(time_t const startTime, int const m
|
||||
startTimeAtSpecifiedHourMinuteSecond += (60 * 60 * 24);
|
||||
|
||||
timeinfo = ::gmtime(&startTimeAtSpecifiedHourMinuteSecond);
|
||||
if (timeinfo == NULL)
|
||||
if (timeinfo == nullptr)
|
||||
return -1;
|
||||
|
||||
if (++sentinel > maxIterations)
|
||||
|
||||
@@ -63,7 +63,7 @@ bool CommandLine::Option::isOptionNext(
|
||||
int optionSpecCount
|
||||
)
|
||||
{
|
||||
DEBUG_FATAL(!optionSpec, ("null optionSpec arg"));
|
||||
DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg"));
|
||||
if (!optionSpecCount)
|
||||
return false;
|
||||
else
|
||||
@@ -77,8 +77,8 @@ CommandLine::Option *CommandLine::Option::createOption(
|
||||
int *optionCount
|
||||
)
|
||||
{
|
||||
DEBUG_FATAL(!optionSpec, ("null optionSpec arg"));
|
||||
DEBUG_FATAL(!optionCount, ("null optionCount arg"));
|
||||
DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg"));
|
||||
DEBUG_FATAL(!optionCount, ("nullptr optionCount arg"));
|
||||
DEBUG_FATAL(!isOptionNext(*optionSpec, *optionCount), ("attempted to create option with non-option data"));
|
||||
|
||||
const char newShortName = (*optionSpec)->char1;
|
||||
@@ -129,7 +129,7 @@ CommandLine::MatchCode CommandLine::Option::match(void)
|
||||
// matching this short or long name. If the arg specs don't match, we've
|
||||
// got an argument matching error.
|
||||
|
||||
DEBUG_FATAL(!optionTable, ("internal error: null option table"));
|
||||
DEBUG_FATAL(!optionTable, ("internal error: nullptr option table"));
|
||||
|
||||
OptionTable::Record *record = 0;
|
||||
|
||||
@@ -145,7 +145,7 @@ CommandLine::MatchCode CommandLine::Option::match(void)
|
||||
DEBUG_FATAL(!record, ("failed to find option info record for option --%s", longName));
|
||||
}
|
||||
else
|
||||
DEBUG_FATAL(true, ("corrupted option? both short and long name are null"));
|
||||
DEBUG_FATAL(true, ("corrupted option? both short and long name are nullptr"));
|
||||
|
||||
|
||||
// attempt to match against this option against commandline-specified options
|
||||
@@ -200,7 +200,7 @@ bool CommandLine::Collection::isCollectionNext(
|
||||
int optionSpecCount
|
||||
)
|
||||
{
|
||||
DEBUG_FATAL(!optionSpec, ("null optionSpec arg"));
|
||||
DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg"));
|
||||
if (!optionSpecCount)
|
||||
return false;
|
||||
else
|
||||
@@ -214,8 +214,8 @@ CommandLine::Collection *CommandLine::Collection::createCollection(
|
||||
int *optionSpecCount
|
||||
)
|
||||
{
|
||||
DEBUG_FATAL(!optionSpec, ("null optionSpec arg"));
|
||||
DEBUG_FATAL(!optionSpecCount, ("null optionSpecCount arg"));
|
||||
DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg"));
|
||||
DEBUG_FATAL(!optionSpecCount, ("nullptr optionSpecCount arg"));
|
||||
|
||||
DEBUG_FATAL(!isCollectionNext(*optionSpec, *optionSpecCount), ("tried to create collection from non-collection optionSpec"));
|
||||
if ((*optionSpec)->optionType == OST_BeginList)
|
||||
@@ -289,7 +289,7 @@ bool CommandLine::List::Node::isNode(
|
||||
int optionCount
|
||||
)
|
||||
{
|
||||
DEBUG_FATAL(!optionSpec, ("null optionSpec arg"));
|
||||
DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg"));
|
||||
if (!optionCount)
|
||||
return false;
|
||||
else
|
||||
@@ -303,8 +303,8 @@ CommandLine::List::Node *CommandLine::List::Node::createNode(
|
||||
int *optionCount
|
||||
)
|
||||
{
|
||||
DEBUG_FATAL(!optionSpec, ("null optionSpec arg"));
|
||||
DEBUG_FATAL(!optionCount, ("null optionCount arg"));
|
||||
DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg"));
|
||||
DEBUG_FATAL(!optionCount, ("nullptr optionCount arg"));
|
||||
DEBUG_FATAL(!isNode(*optionSpec, *optionCount), ("attempted to create list node with non-list-node data"));
|
||||
|
||||
Option *newOption = 0;
|
||||
@@ -350,7 +350,7 @@ CommandLine::List::List(
|
||||
listType(newListType),
|
||||
minimumNodeCount(0)
|
||||
{
|
||||
DEBUG_FATAL(!newFirstNode, ("null newFirstNode arg"));
|
||||
DEBUG_FATAL(!newFirstNode, ("nullptr newFirstNode arg"));
|
||||
DEBUG_FATAL(newListType != OPLT_Normal, ("constructor only good for OPLT_Normal lists, caller passed %d", newListType));
|
||||
}
|
||||
|
||||
@@ -366,7 +366,7 @@ CommandLine::List::List(
|
||||
listType(newListType),
|
||||
minimumNodeCount(newMinimumNodeCount)
|
||||
{
|
||||
DEBUG_FATAL(!newFirstNode, ("null newFirstNode arg"));
|
||||
DEBUG_FATAL(!newFirstNode, ("nullptr newFirstNode arg"));
|
||||
DEBUG_FATAL(newListType != OPLT_MinimumMatch, ("constructor only good for OPLT_MinimumMatch lists, caller passed %d", newListType));
|
||||
}
|
||||
|
||||
@@ -391,7 +391,7 @@ bool CommandLine::List::isListNext(
|
||||
int optionCount
|
||||
)
|
||||
{
|
||||
DEBUG_FATAL(!optionSpec, ("null optionSpec arg"));
|
||||
DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg"));
|
||||
if (!optionCount)
|
||||
return false;
|
||||
else
|
||||
@@ -405,8 +405,8 @@ CommandLine::List *CommandLine::List::createList(
|
||||
int *optionCount
|
||||
)
|
||||
{
|
||||
DEBUG_FATAL(!optionSpec, ("null optionSpec arg"));
|
||||
DEBUG_FATAL(!optionCount, ("null optionCount arg"));
|
||||
DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg"));
|
||||
DEBUG_FATAL(!optionCount, ("nullptr optionCount arg"));
|
||||
DEBUG_FATAL(!isListNext(*optionSpec, *optionCount), ("tried to create list from non-list optionSpec"));
|
||||
|
||||
Node *newFirstNode = 0;
|
||||
@@ -582,7 +582,7 @@ bool CommandLine::Switch::Node::isNode(
|
||||
const OptionSpec *optionSpec,
|
||||
int optionCount)
|
||||
{
|
||||
DEBUG_FATAL(!optionSpec, ("null optionSpec arg"));
|
||||
DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg"));
|
||||
if (!optionCount)
|
||||
return false;
|
||||
else
|
||||
@@ -596,8 +596,8 @@ CommandLine::Switch::Node *CommandLine::Switch::Node::createNode(
|
||||
int *optionCount
|
||||
)
|
||||
{
|
||||
DEBUG_FATAL(!optionSpec, ("null optionSpec arg"));
|
||||
DEBUG_FATAL(!optionCount, ("null optionCount arg"));
|
||||
DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg"));
|
||||
DEBUG_FATAL(!optionCount, ("nullptr optionCount arg"));
|
||||
DEBUG_FATAL(!isNode(*optionSpec, *optionCount), ("attempted to create list node with non-list-node data"));
|
||||
|
||||
Option *newOption = 0;
|
||||
@@ -664,7 +664,7 @@ bool CommandLine::Switch::isSwitchNext(
|
||||
int optionCount
|
||||
)
|
||||
{
|
||||
DEBUG_FATAL(!optionSpec, ("null optionSpec arg"));
|
||||
DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg"));
|
||||
if (!optionCount)
|
||||
return false;
|
||||
else
|
||||
@@ -678,8 +678,8 @@ CommandLine::Switch *CommandLine::Switch::createSwitch(
|
||||
int *optionCount
|
||||
)
|
||||
{
|
||||
DEBUG_FATAL(!optionSpec, ("null optionSpec arg"));
|
||||
DEBUG_FATAL(!optionCount, ("null optionCount arg"));
|
||||
DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg"));
|
||||
DEBUG_FATAL(!optionCount, ("nullptr optionCount arg"));
|
||||
DEBUG_FATAL(!isSwitchNext(*optionSpec, *optionCount), ("tried to create switch from non-switch option spec"));
|
||||
|
||||
const bool newOneNodeIsRequired = ((*optionSpec)->int1 != 0);
|
||||
@@ -886,7 +886,7 @@ CommandLine::OptionTable::Record *CommandLine::OptionTable::findOptionRecord(
|
||||
char shortName
|
||||
) const
|
||||
{
|
||||
DEBUG_FATAL(!shortName, ("null shortName arg"));
|
||||
DEBUG_FATAL(!shortName, ("nullptr shortName arg"));
|
||||
|
||||
// walk the list
|
||||
for (Record *record = firstRecord; record; record = record->getNext())
|
||||
@@ -960,7 +960,7 @@ CommandLine::Lexer::Lexer(
|
||||
) :
|
||||
nextCharacter(newBuffer)
|
||||
{
|
||||
DEBUG_FATAL(!newBuffer, ("null newBuffer arg"));
|
||||
DEBUG_FATAL(!newBuffer, ("nullptr newBuffer arg"));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -994,10 +994,10 @@ CommandLine::Lexer::~Lexer(void)
|
||||
|
||||
bool CommandLine::Lexer::gobbleString(bool isRequired, char *stringBuffer, int stringSize)
|
||||
{
|
||||
DEBUG_FATAL(!stringBuffer, ("null stringStart arg"));
|
||||
DEBUG_FATAL(!stringBuffer, ("nullptr stringStart arg"));
|
||||
DEBUG_FATAL(!stringSize, ("stringSize is zero"));
|
||||
|
||||
DEBUG_FATAL(!nextCharacter, ("null nextChar"));
|
||||
DEBUG_FATAL(!nextCharacter, ("nullptr nextChar"));
|
||||
|
||||
|
||||
int stringLength = 0;
|
||||
@@ -1069,7 +1069,7 @@ bool CommandLine::Lexer::gobbleString(bool isRequired, char *stringBuffer, int s
|
||||
if (isRequired && (stringLength == 0))
|
||||
return false;
|
||||
|
||||
// null-terminate the string
|
||||
// nullptr-terminate the string
|
||||
*stringBuffer = 0;
|
||||
return true;
|
||||
}
|
||||
@@ -1078,8 +1078,8 @@ bool CommandLine::Lexer::gobbleString(bool isRequired, char *stringBuffer, int s
|
||||
|
||||
bool CommandLine::Lexer::getNextToken(Token *token)
|
||||
{
|
||||
DEBUG_FATAL(!token, ("null token arg"));
|
||||
DEBUG_FATAL(!nextCharacter, ("null nextCharacter"));
|
||||
DEBUG_FATAL(!token, ("nullptr token arg"));
|
||||
DEBUG_FATAL(!nextCharacter, ("nullptr nextCharacter"));
|
||||
|
||||
// clear out the token
|
||||
memset(token, 0, sizeof(*token));
|
||||
@@ -1204,7 +1204,7 @@ void CommandLine::remove(void)
|
||||
|
||||
void CommandLine::buildOptionTree(const OptionSpec *specList, int specCount)
|
||||
{
|
||||
DEBUG_FATAL(!specList, ("null specList arg"));
|
||||
DEBUG_FATAL(!specList, ("nullptr specList arg"));
|
||||
|
||||
if (!specCount)
|
||||
{
|
||||
@@ -1247,7 +1247,7 @@ CommandLine::MatchCode CommandLine::parseCommandLineBuffer(void)
|
||||
case Lexer::TT_ShortOption:
|
||||
// we've found a short option, make sure specified short option exists
|
||||
{
|
||||
DEBUG_FATAL(!optionTable, ("internal error: null optionTable"));
|
||||
DEBUG_FATAL(!optionTable, ("internal error: nullptr optionTable"));
|
||||
OptionTable::Record *record = optionTable->findOptionRecord(token.getShortName());
|
||||
if (!record)
|
||||
{
|
||||
@@ -1279,7 +1279,7 @@ CommandLine::MatchCode CommandLine::parseCommandLineBuffer(void)
|
||||
case Lexer::TT_LongOption:
|
||||
// we've found a long option, make sure specified long option exists
|
||||
{
|
||||
DEBUG_FATAL(!optionTable, ("internal error: null optionTable"));
|
||||
DEBUG_FATAL(!optionTable, ("internal error: nullptr optionTable"));
|
||||
OptionTable::Record *record = optionTable->findOptionRecord(token.getLongName());
|
||||
if (!record)
|
||||
{
|
||||
@@ -1322,7 +1322,7 @@ CommandLine::MatchCode CommandLine::parseCommandLineBuffer(void)
|
||||
|
||||
case Lexer::TT_Argument:
|
||||
{
|
||||
DEBUG_FATAL(!optionTable, ("internal error: null optionTable"));
|
||||
DEBUG_FATAL(!optionTable, ("internal error: nullptr optionTable"));
|
||||
OptionTable::Record *record = optionTable->findOptionRecord(OP_SNAME_UNTAGGED);
|
||||
if (!record)
|
||||
{
|
||||
@@ -1382,7 +1382,7 @@ CommandLine::MatchCode CommandLine::parseCommandLineBuffer(void)
|
||||
void CommandLine::absorbString(const char *newString)
|
||||
{
|
||||
DEBUG_FATAL(!installed, ("CommandLine not installed"));
|
||||
DEBUG_FATAL(!newString, ("null newString arg"));
|
||||
DEBUG_FATAL(!newString, ("nullptr newString arg"));
|
||||
|
||||
const int stringLength = static_cast<int>(strlen(newString));
|
||||
int requiredBufferSpace;
|
||||
@@ -1398,7 +1398,7 @@ void CommandLine::absorbString(const char *newString)
|
||||
buffer[bufferSize++] = ' ';
|
||||
}
|
||||
|
||||
// copy contents of buffer, including null
|
||||
// copy contents of buffer, including nullptr
|
||||
memcpy(buffer + bufferSize, newString, stringLength + 1);
|
||||
bufferSize += stringLength;
|
||||
|
||||
@@ -1437,7 +1437,7 @@ void CommandLine::absorbString(const char *newString)
|
||||
void CommandLine::absorbStrings(const char **stringArray, int stringCount)
|
||||
{
|
||||
DEBUG_FATAL(!installed, ("CommandLine not installed"));
|
||||
DEBUG_FATAL(!stringArray, ("null string array"));
|
||||
DEBUG_FATAL(!stringArray, ("nullptr string array"));
|
||||
|
||||
for (int i = 0; i < stringCount; ++i)
|
||||
absorbString(stringArray[i]);
|
||||
@@ -1452,7 +1452,7 @@ void CommandLine::absorbStrings(const char **stringArray, int stringCount)
|
||||
* (i.e. "-- ") will be considered part of the post command line string.
|
||||
*
|
||||
* @return A read-only pointer to the portion of the command line not meant
|
||||
* for CommandLine parsing. May be NULL if the entire command line
|
||||
* for CommandLine parsing. May be nullptr if the entire command line
|
||||
* was meant for CommandLine or if no command line was specified.
|
||||
*/
|
||||
|
||||
@@ -1704,7 +1704,7 @@ int CommandLine::getOccurrenceCount(const char *longName)
|
||||
* @param shortName [IN] short name of the option
|
||||
* @param occurrenceIndex [IN] zero-based occurrence number
|
||||
* @return The read-only argument string associated with the specified option occurrence.
|
||||
* May be NULL if no argument was associated with the specified option.
|
||||
* May be nullptr if no argument was associated with the specified option.
|
||||
*/
|
||||
|
||||
const char *CommandLine::getOptionString(char shortName, int occurrenceIndex)
|
||||
@@ -1730,7 +1730,7 @@ const char *CommandLine::getOptionString(char shortName, int occurrenceIndex)
|
||||
* @param longName [IN] long name of the option
|
||||
* @param occurrenceIndex [IN] zero-based occurrence number
|
||||
* @return The read-only argument string associated with the specified option occurrence.
|
||||
* May be NULL if no argument was associated with the specified option.
|
||||
* May be nullptr if no argument was associated with the specified option.
|
||||
*/
|
||||
|
||||
const char *CommandLine::getOptionString(const char *longName, int occurrenceIndex)
|
||||
|
||||
@@ -755,7 +755,7 @@ inline const char *CommandLine::Lexer::getNextCharacter(void)
|
||||
|
||||
inline void CommandLine::Lexer::gobbleWhitespace(void)
|
||||
{
|
||||
DEBUG_FATAL(!nextCharacter, ("null nextCharacter"));
|
||||
DEBUG_FATAL(!nextCharacter, ("nullptr nextCharacter"));
|
||||
while (isspace(*nextCharacter))
|
||||
++nextCharacter;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ static char tagBuffer[6];
|
||||
#define CONFIG_FILE_TEMPLATE_CREATE_INT(section, key, def) DEBUG_REPORT_LOG(true, ("cfg: [%s] %s=%d\n", section, key, def))
|
||||
#define CONFIG_FILE_TEMPLATE_CREATE_BOOL(section, key, def) DEBUG_REPORT_LOG(true, ("cfg: [%s] %s=%s\n", section, key, def ? "true" : "false"))
|
||||
#define CONFIG_FILE_TEMPLATE_CREATE_FLOAT(section, key, def) DEBUG_REPORT_LOG(true, ("cfg: [%s] %s=%3.1f\n", section, key, def))
|
||||
#define CONFIG_FILE_TEMPLATE_CREATE_STRING(section, key, def) DEBUG_REPORT_LOG(true, ("cfg: [%s] %s=%s\n", section, key, def ? def : "NULL"))
|
||||
#define CONFIG_FILE_TEMPLATE_CREATE_STRING(section, key, def) DEBUG_REPORT_LOG(true, ("cfg: [%s] %s=%s\n", section, key, def ? def : "nullptr"))
|
||||
#define CONFIG_FILE_TEMPLATE_CREATE_TAG(section, key, def) ConvertTagToString(def, tagBuffer), DEBUG_REPORT_LOG(true, ("cfg: [%s] %s=%d\n", section, key, tagBuffer))
|
||||
|
||||
#else
|
||||
@@ -43,8 +43,8 @@ static char tagBuffer[6];
|
||||
|
||||
#endif
|
||||
|
||||
#define NO_SPACE_SECTION(a) DEBUG_FATAL(strchr(a, ' ') != NULL, ("No spaces are allowed in config file section names: %s", a))
|
||||
#define NO_SPACE_KEY(a) DEBUG_FATAL(strchr(a, ' ') != NULL, ("No spaces are allowed in config file key names: %s", a))
|
||||
#define NO_SPACE_SECTION(a) DEBUG_FATAL(strchr(a, ' ') != nullptr, ("No spaces are allowed in config file section names: %s", a))
|
||||
#define NO_SPACE_KEY(a) DEBUG_FATAL(strchr(a, ' ') != nullptr, ("No spaces are allowed in config file key names: %s", a))
|
||||
|
||||
// ======================================================================
|
||||
|
||||
@@ -81,7 +81,7 @@ void ConfigFile::install(void)
|
||||
#endif
|
||||
|
||||
ms_sections = new ConfigFile::SectionMap;
|
||||
ms_currentSection = NULL;
|
||||
ms_currentSection = nullptr;
|
||||
ExitChain::add(ConfigFile::remove, "ConfigFile::remove");
|
||||
ms_installed = true;
|
||||
}
|
||||
@@ -110,7 +110,7 @@ void ConfigFile::remove(void)
|
||||
for (std::map<const char *, Section *, StringCompare>::iterator it = ms_sections->begin(); it != ms_sections->end(); ++it)
|
||||
delete it->second;
|
||||
delete ms_sections;
|
||||
ms_sections = NULL;
|
||||
ms_sections = nullptr;
|
||||
ms_installed = false;
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ bool ConfigFile::loadFromCommandLine(const char *buffer)
|
||||
while (isspace(*buffer))
|
||||
{
|
||||
++buffer;
|
||||
// advancing buffer, check for null (trailing white space on command line)
|
||||
// advancing buffer, check for nullptr (trailing white space on command line)
|
||||
if(! *buffer)
|
||||
break;
|
||||
}
|
||||
@@ -196,7 +196,7 @@ bool ConfigFile::loadFromCommandLine(const char *buffer)
|
||||
//allocate a new section and set it as the current one
|
||||
Section *newSection = createSection(sectionName);
|
||||
//note that newSection is memory owned by the created Section object
|
||||
//while sectionName is memory allocated to create a null terminated string
|
||||
//while sectionName is memory allocated to create a nullptr terminated string
|
||||
ms_currentSection = newSection;
|
||||
}
|
||||
delete[] sectionName;
|
||||
@@ -292,7 +292,7 @@ bool ConfigFile::loadFromBuffer(char const * const buffer, int const length)
|
||||
processLine(currentLine);
|
||||
delete[] currentLine;
|
||||
bufferPosition += lineLength+1;
|
||||
//trim ending whitespace. Remember that this string is not guaranteed to be NULL terminated.
|
||||
//trim ending whitespace. Remember that this string is not guaranteed to be nullptr terminated.
|
||||
while (*bufferPosition && (bufferPosition < buffer + length) && isspace(static_cast<unsigned char>(*bufferPosition)))
|
||||
++bufferPosition;
|
||||
}
|
||||
@@ -311,26 +311,26 @@ bool ConfigFile::loadFile(const char *file)
|
||||
{
|
||||
DEBUG_FATAL(!ms_installed, ("ConfigFile not installed"));
|
||||
NOT_NULL(file);
|
||||
ms_currentSection = NULL;
|
||||
HANDLE handle = CreateFile(file, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
ms_currentSection = nullptr;
|
||||
HANDLE handle = CreateFile(file, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
|
||||
if (handle != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
// get the length of the config file
|
||||
const DWORD length = GetFileSize(handle, NULL);
|
||||
const DWORD length = GetFileSize(handle, nullptr);
|
||||
|
||||
if (length != 0xffffffff)
|
||||
{
|
||||
// create a buffer to load the config file into
|
||||
char * const buffer = new char[length+2];
|
||||
|
||||
// make sure the buffer is null terminated
|
||||
// make sure the buffer is nullptr terminated
|
||||
buffer[length] = '\n';
|
||||
buffer[length+1] = '\0';
|
||||
|
||||
// read the config file in
|
||||
DWORD readResult;
|
||||
const BOOL result = ReadFile(handle, buffer, length, &readResult, NULL);
|
||||
const BOOL result = ReadFile(handle, buffer, length, &readResult, nullptr);
|
||||
|
||||
// make sure we read all the correct stuff
|
||||
if (result && readResult == length)
|
||||
@@ -360,7 +360,7 @@ void ConfigFile::processLine(const char *line)
|
||||
{
|
||||
DEBUG_FATAL(!ms_installed, ("ConfigFile not installed"));
|
||||
// validate argument
|
||||
DEBUG_FATAL(!line, ("ConfigFile::processLine NULL"));
|
||||
DEBUG_FATAL(!line, ("ConfigFile::processLine nullptr"));
|
||||
|
||||
// check for a full line comment
|
||||
if (*line == '#' || *line == ';')
|
||||
@@ -418,7 +418,7 @@ void ConfigFile::processLine(const char *line)
|
||||
//allocate a new section and set it as the current one
|
||||
Section *newSection = createSection(sectionName);
|
||||
//note that newSection is memory owned by the created Section object
|
||||
//while sectionName is memory allocated to create a null terminated string
|
||||
//while sectionName is memory allocated to create a nullptr terminated string
|
||||
ms_currentSection = newSection;
|
||||
}
|
||||
delete[] sectionName;
|
||||
@@ -468,7 +468,7 @@ void ConfigFile::processKeys(const char *line)
|
||||
while (*endValue)
|
||||
{
|
||||
//build the value
|
||||
char *value = NULL;
|
||||
char *value = nullptr;
|
||||
while(isspace(*beginValue))
|
||||
++beginValue;
|
||||
if (*beginValue != '"')
|
||||
@@ -542,7 +542,7 @@ void ConfigFile::processKeys(const char *line)
|
||||
/** Get a Section pointer from a string
|
||||
*
|
||||
* @param section the name of the section
|
||||
* @return the pointer if valid, otherwise NULL
|
||||
* @return the pointer if valid, otherwise nullptr
|
||||
*/
|
||||
ConfigFile::Section *ConfigFile::getSection(const char *section)
|
||||
{
|
||||
@@ -550,7 +550,7 @@ ConfigFile::Section *ConfigFile::getSection(const char *section)
|
||||
if (it != ms_sections->end())
|
||||
return it->second;
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -581,7 +581,7 @@ void ConfigFile::removeSection(const char *name)
|
||||
if (iter != ms_sections->end())
|
||||
{
|
||||
delete iter->second;
|
||||
iter->second = NULL;
|
||||
iter->second = nullptr;
|
||||
ms_sections->erase(iter);
|
||||
}
|
||||
}
|
||||
@@ -991,7 +991,7 @@ Tag ConfigFile::getKeyTag(const char *section, const char *key, Tag defaultValue
|
||||
|
||||
ConfigFile::Element::Element(void)
|
||||
:
|
||||
m_entry(NULL)
|
||||
m_entry(nullptr)
|
||||
{}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -1105,8 +1105,8 @@ Tag ConfigFile::Element::getAsTag(void) const
|
||||
|
||||
ConfigFile::Key::Key(const char *name, const char *value, bool lazyAdd)
|
||||
:
|
||||
m_elements(NULL),
|
||||
m_name(NULL),
|
||||
m_elements(nullptr),
|
||||
m_name(nullptr),
|
||||
m_lazyAdd(lazyAdd)
|
||||
{
|
||||
m_name = new char[strlen(name)+1];
|
||||
@@ -1248,8 +1248,8 @@ void ConfigFile::Key::dump(const char *keyName) const
|
||||
|
||||
ConfigFile::Section::Section(const char *name)
|
||||
:
|
||||
m_keys(NULL),
|
||||
m_name(NULL)
|
||||
m_keys(nullptr),
|
||||
m_name(nullptr)
|
||||
{
|
||||
m_name = new char[strlen(name)+1];
|
||||
strcpy(m_name, name);
|
||||
@@ -1284,7 +1284,7 @@ ConfigFile::Key *ConfigFile::Section::findKey(const char *key) const
|
||||
if (it != m_keys->end())
|
||||
return it->second;
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
int getKeyInt (const char *key, int index, int defaultValue = 0) const;
|
||||
bool getKeyBool (const char *key, int index, bool defaultValue = false) const;
|
||||
float getKeyFloat (const char *key, int index, float defaultValue = 0.f) const;
|
||||
const char *getKeyString(const char *key, int index, const char *defaultValue = NULL) const;
|
||||
const char *getKeyString(const char *key, int index, const char *defaultValue = nullptr) const;
|
||||
Tag getKeyTag (const char *key, int index, Tag defaultValue = 0) const;
|
||||
int getKeyCount(const char *key) const;
|
||||
void addKey(const char *keyName, const char *value, bool lazyAdd = false);
|
||||
|
||||
@@ -87,7 +87,7 @@ char const * CrashReportInformation::getEntry(int index)
|
||||
if (index < static_cast<int>(ms_dynamicText.size()))
|
||||
return ms_dynamicText[index];
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
|
||||
@@ -99,7 +99,7 @@ uint32 Crc::calculateWithToLower(const char *string)
|
||||
|
||||
uint32 Crc::calculate(const void *data, int length, uint32 initCrc)
|
||||
{
|
||||
DEBUG_FATAL(!data, ("null data arg"));
|
||||
DEBUG_FATAL(!data, ("nullptr data arg"));
|
||||
|
||||
uint32 crc;
|
||||
const byte *d = reinterpret_cast<const byte *>(data);
|
||||
|
||||
@@ -31,9 +31,9 @@ using namespace CrcStringTableNamespace;
|
||||
CrcStringTable::CrcStringTable()
|
||||
:
|
||||
m_numberOfEntries(0),
|
||||
m_crcTable(NULL),
|
||||
m_stringsOffsetTable(NULL),
|
||||
m_strings(NULL)
|
||||
m_crcTable(nullptr),
|
||||
m_stringsOffsetTable(nullptr),
|
||||
m_strings(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -42,9 +42,9 @@ CrcStringTable::CrcStringTable()
|
||||
CrcStringTable::CrcStringTable(char const * fileName)
|
||||
:
|
||||
m_numberOfEntries(0),
|
||||
m_crcTable(NULL),
|
||||
m_stringsOffsetTable(NULL),
|
||||
m_strings(NULL)
|
||||
m_crcTable(nullptr),
|
||||
m_stringsOffsetTable(nullptr),
|
||||
m_strings(nullptr)
|
||||
{
|
||||
load(fileName);
|
||||
}
|
||||
@@ -69,7 +69,7 @@ void CrcStringTable::load(char const * fileName)
|
||||
if(fileName)
|
||||
DEBUG_WARNING(true, ("Could not load CrcStringTable %s", fileName));
|
||||
else
|
||||
DEBUG_WARNING(true, ("Could not load CrcStringTable, NULL file given"));
|
||||
DEBUG_WARNING(true, ("Could not load CrcStringTable, nullptr file given"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ private:
|
||||
template <typename T>
|
||||
inline void DataResourceList<T>::install()
|
||||
{
|
||||
if (ms_bindings == NULL)
|
||||
if (ms_bindings == nullptr)
|
||||
{
|
||||
ms_bindings = new CreateDataResourceMap();
|
||||
ms_loaded = new LoadedDataResourceMap();
|
||||
@@ -100,7 +100,7 @@ inline void DataResourceList<T>::install()
|
||||
template <typename T>
|
||||
inline void DataResourceList<T>::remove(void)
|
||||
{
|
||||
if (ms_loaded != NULL)
|
||||
if (ms_loaded != nullptr)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
if (!ms_loaded->empty())
|
||||
@@ -122,13 +122,13 @@ inline void DataResourceList<T>::remove(void)
|
||||
#endif // _DEBUG
|
||||
|
||||
delete ms_loaded;
|
||||
ms_loaded = NULL;
|
||||
ms_loaded = nullptr;
|
||||
}
|
||||
|
||||
if (ms_bindings != NULL)
|
||||
if (ms_bindings != nullptr)
|
||||
{
|
||||
delete ms_bindings;
|
||||
ms_bindings = NULL;
|
||||
ms_bindings = nullptr;
|
||||
}
|
||||
} // DataResourceList<T>::remove
|
||||
|
||||
@@ -144,7 +144,7 @@ template <typename T>
|
||||
inline void DataResourceList<T>::registerTemplate(Tag id,
|
||||
CreateDataResourceFunc createFunc)
|
||||
{
|
||||
if (ms_bindings == NULL)
|
||||
if (ms_bindings == nullptr)
|
||||
install();
|
||||
|
||||
#ifdef _DEBUG
|
||||
@@ -237,7 +237,7 @@ inline T * DataResourceList<T>::fetch(Tag id)
|
||||
|
||||
typename CreateDataResourceMap::iterator iter = ms_bindings->find(id);
|
||||
if (iter == ms_bindings->end())
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return (*(*iter).second)("");
|
||||
} // DataResourceList<T>::fetch(Tag)
|
||||
@@ -268,11 +268,11 @@ inline const T * DataResourceList<T>::fetch(Iff &source)
|
||||
char buffer[5];
|
||||
ConvertTagToString(id, buffer);
|
||||
DEBUG_WARNING(true, ("DataResourceList::fetch Iff: trying to fetch resource for unknown tag %s!", buffer));
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
T *newDataResource = (*(*createIter).second)(source.getFileName());
|
||||
if (newDataResource != NULL)
|
||||
if (newDataResource != nullptr)
|
||||
{
|
||||
// initialize the data resource
|
||||
newDataResource->loadFromIff(source);
|
||||
@@ -310,11 +310,11 @@ inline const T * DataResourceList<T>::fetch(const CrcString &filename)
|
||||
// load the template
|
||||
Iff iff;
|
||||
if (!iff.open(filename.getString(), true))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
// put the template in the loaded list
|
||||
const T * const newDataResource = fetch(iff);
|
||||
if (newDataResource != NULL)
|
||||
if (newDataResource != nullptr)
|
||||
{
|
||||
newDataResource->addReference();
|
||||
ms_loaded->insert(std::make_pair(&newDataResource->getCrcName (), newDataResource));
|
||||
@@ -337,13 +337,13 @@ inline void DataResourceList<T>::release(const T & dataResource)
|
||||
{
|
||||
NOT_NULL(ms_loaded);
|
||||
|
||||
if (ms_loaded != NULL && dataResource.getReferenceCount() == 0)
|
||||
if (ms_loaded != nullptr && dataResource.getReferenceCount() == 0)
|
||||
{
|
||||
typename LoadedDataResourceMap::iterator iter = ms_loaded->find(&dataResource.getCrcName());
|
||||
if (iter != ms_loaded->end())
|
||||
{
|
||||
const T * const temp = (*iter).second;
|
||||
(*iter).second = NULL;
|
||||
(*iter).second = nullptr;
|
||||
ms_loaded->erase(iter);
|
||||
delete temp;
|
||||
}
|
||||
@@ -369,11 +369,11 @@ inline T * DataResourceList<T>::reload(Iff &source)
|
||||
if (iter == ms_loaded->end())
|
||||
{
|
||||
DEBUG_WARNING(true, ("DataResourceList::reload: trying to reload unloaded resource %s!", source.getFileName()));
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
T * const dataResource = const_cast<T *>((*iter).second);
|
||||
if (dataResource != NULL)
|
||||
if (dataResource != nullptr)
|
||||
{
|
||||
// initialize the data resource
|
||||
dataResource->loadFromIff(source);
|
||||
|
||||
@@ -115,7 +115,7 @@ void ExitChain::add(Function function, const char *debugName, int priority, bool
|
||||
#endif
|
||||
|
||||
// linked list traversal with a back pointer
|
||||
for (back = NULL, front = PerThreadData::getExitChainFirstEntry(); front && front->priority > priority; back = front, front = front->next)
|
||||
for (back = nullptr, front = PerThreadData::getExitChainFirstEntry(); front && front->priority > priority; back = front, front = front->next)
|
||||
;
|
||||
|
||||
// hook it into the linked list
|
||||
@@ -133,7 +133,7 @@ void ExitChain::add(Function function, const char *debugName, int priority, bool
|
||||
* The ExitChain will automatically remove a function from the ExitChain when it calls the function, so an
|
||||
* exit function should not attempt to remove itself from the ExitChain.
|
||||
*
|
||||
* Calling this routine with a NULL pointer will cause this routine to call Fatal in debug compilations.
|
||||
* Calling this routine with a nullptr pointer will cause this routine to call Fatal in debug compilations.
|
||||
*
|
||||
* Calling this routine with a function that is not on the ExitChain will cause this routine to call
|
||||
* Fatal in debug compilations.
|
||||
@@ -145,14 +145,14 @@ void ExitChain::remove(Function function)
|
||||
{
|
||||
Entry *back, *front;
|
||||
|
||||
if (function == NULL)
|
||||
if (function == nullptr)
|
||||
{
|
||||
DEBUG_FATAL(true, ("ExitChain::remove NULL function"));
|
||||
DEBUG_FATAL(true, ("ExitChain::remove nullptr function"));
|
||||
return; //lint !e527 // Warning -- Unreachable
|
||||
}
|
||||
|
||||
// linked list traversal with a back pointer
|
||||
for (back = NULL, front = PerThreadData::getExitChainFirstEntry(); front && front->function != function; back = front, front = front->next)
|
||||
for (back = nullptr, front = PerThreadData::getExitChainFirstEntry(); front && front->function != function; back = front, front = front->next)
|
||||
;
|
||||
|
||||
// make sure it was found
|
||||
@@ -191,7 +191,7 @@ void ExitChain::run(void)
|
||||
|
||||
PerThreadData::setExitChainRunning(true);
|
||||
|
||||
while ((entry = PerThreadData::getExitChainFirstEntry()) != NULL)
|
||||
while ((entry = PerThreadData::getExitChainFirstEntry()) != nullptr)
|
||||
{
|
||||
// remove the first entry off the ExitChain
|
||||
PerThreadData::setExitChainFirstEntry(entry->next);
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace FatalNamespace
|
||||
int ms_numberOfWarnings = 0;
|
||||
bool ms_strict = false;
|
||||
|
||||
WarningCallback s_warningCallback = NULL;
|
||||
WarningCallback s_warningCallback = nullptr;
|
||||
|
||||
#if PRODUCTION == 0
|
||||
PixCounter::ResetInteger ms_numberOfWarningsThisFrame;
|
||||
@@ -70,7 +70,7 @@ static void formatMessage(char *buffer, int bufferLength, int stackDepth, const
|
||||
else
|
||||
DebugHelp::getCallStack(callStack, callStackOffset + stackDepth);
|
||||
|
||||
// make sure the buffer is always null terminated
|
||||
// make sure the buffer is always nullptr terminated
|
||||
buffer[--bufferLength] = '\0';
|
||||
|
||||
// look up the caller's file and line
|
||||
@@ -191,7 +191,7 @@ static void InternalWarning(const char *format, int extraFlags, va_list va, int
|
||||
|
||||
char buffer[4 * 1024];
|
||||
|
||||
if (NULL != s_warningCallback)
|
||||
if (nullptr != s_warningCallback)
|
||||
{
|
||||
strcpy(buffer, "WARNING: ");
|
||||
vsnprintf(buffer + 9, sizeof(buffer) - 9, format, va);
|
||||
|
||||
@@ -68,15 +68,15 @@ void SetWarningCallback(WarningCallback);
|
||||
template <class T>
|
||||
inline T *NonNull(T *pointer, const char *name)
|
||||
{
|
||||
WARNING(!pointer, ("%s pointer is null", name));
|
||||
WARNING(!pointer, ("%s pointer is nullptr", name));
|
||||
return pointer;
|
||||
}
|
||||
|
||||
#define NON_NULL(a) NonNull(a, #a)
|
||||
#define NOT_NULL(a) FATAL(!a, ("%s pointer is null", #a))
|
||||
#define NOT_NULL(a) FATAL(!a, ("%s pointer is nullptr", #a))
|
||||
|
||||
// FATAL if the specified pointer is not NULL (i.e. assert that the pointer is null, the opposite of NOT_NULL).
|
||||
#define IS_NULL(a) FATAL(a, ("%s pointer is not null, unexpected.", #a))
|
||||
// FATAL if the specified pointer is not nullptr (i.e. assert that the pointer is nullptr, the opposite of NOT_NULL).
|
||||
#define IS_NULL(a) FATAL(a, ("%s pointer is not nullptr, unexpected.", #a))
|
||||
|
||||
#else
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ inline FormattedString<bufferSize>::FormattedString()
|
||||
template <int bufferSize>
|
||||
inline char const * FormattedString<bufferSize>::sprintf(char const * const format, ...)
|
||||
{
|
||||
char const * result = NULL;
|
||||
char const * result = nullptr;
|
||||
va_list va;
|
||||
|
||||
va_start(va, format);
|
||||
@@ -64,7 +64,7 @@ inline char const * FormattedString<bufferSize>::vsprintf(char const * const for
|
||||
int const charactersWritten = vsnprintf(m_text, lastIndex, format, va);
|
||||
|
||||
// vsnprintf returns the number of characters written, not including
|
||||
// the terminating null character, or a negative value if an output error occurs.
|
||||
// the terminating nullptr character, or a negative value if an output error occurs.
|
||||
// If the number of characters to write exceeds count, then count characters are
|
||||
// written and -1 is returned.
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ const char * LabelHash::findLabel( char const * const domain, uint32 hashValue )
|
||||
{
|
||||
// Domain not found
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// ----------
|
||||
@@ -127,6 +127,6 @@ const char * LabelHash::findLabel( char const * const domain, uint32 hashValue )
|
||||
// ----------
|
||||
// String not found
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -138,8 +138,8 @@ using namespace MemoryBlockManagerNamespace;
|
||||
MemoryBlockManager::Allocator::Allocator(const int elementSize)
|
||||
:
|
||||
m_referenceCount(0),
|
||||
m_firstBlock(NULL),
|
||||
m_firstFreeElement(NULL),
|
||||
m_firstBlock(nullptr),
|
||||
m_firstFreeElement(nullptr),
|
||||
m_elementSize(elementSize),
|
||||
m_elementsPerBlock(64),
|
||||
m_currentNumberOfBlocks(0),
|
||||
@@ -157,8 +157,8 @@ MemoryBlockManager::Allocator::Allocator(const int elementSize)
|
||||
MemoryBlockManager::Allocator::Allocator(int elementSize, int elementsPerBlock, int minimumBlocks, int maximumNumberOfBlocks)
|
||||
:
|
||||
m_referenceCount(0),
|
||||
m_firstBlock(NULL),
|
||||
m_firstFreeElement(NULL),
|
||||
m_firstBlock(nullptr),
|
||||
m_firstFreeElement(nullptr),
|
||||
m_elementSize(elementSize),
|
||||
m_elementsPerBlock(elementsPerBlock),
|
||||
m_currentNumberOfBlocks(0),
|
||||
@@ -188,8 +188,8 @@ MemoryBlockManager::Allocator::~Allocator()
|
||||
delete block;
|
||||
}
|
||||
|
||||
m_firstBlock = NULL;
|
||||
m_firstFreeElement = NULL;
|
||||
m_firstBlock = nullptr;
|
||||
m_firstFreeElement = nullptr;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -427,7 +427,7 @@ MemoryBlockManager::MemoryBlockManager(char const * name, bool shared, int eleme
|
||||
: m_name(name),
|
||||
m_shared(shared),
|
||||
m_currentNumberOfElements(0),
|
||||
m_allocator(NULL)
|
||||
m_allocator(nullptr)
|
||||
{
|
||||
//-- Handle config option where we force all MemoryBlockManagers to be non-shared.
|
||||
if (shared && ms_forceAllNonShared)
|
||||
@@ -598,7 +598,7 @@ void *MemoryBlockManager::allocate(bool returnNullOnFailure)
|
||||
{
|
||||
ms_globalCriticalSection.leave();
|
||||
DEBUG_FATAL(!returnNullOnFailure, ("MBM %s is full %d", m_name, m_currentNumberOfElements));
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
++m_currentNumberOfElements;
|
||||
|
||||
@@ -105,7 +105,7 @@ void MessageQueue::clearDataFromMessageList(MessageList &messageList, bool destr
|
||||
{
|
||||
DEBUG_WARNING(!destructor, ("clearing message data from beginFrame"));
|
||||
delete message.m_data;
|
||||
message.m_data = NULL;
|
||||
message.m_data = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -199,7 +199,7 @@ void MessageQueue::clearMessage(const int index)
|
||||
VALIDATE_RANGE_INCLUSIVE_EXCLUSIVE(0, index, getNumberOfMessages());
|
||||
|
||||
Message& message = (*m_messageQueueRead)[static_cast<uint>(index)];
|
||||
DEBUG_WARNING(message.m_data, ("MessageQueue::clearMessage - clearing message with non-null data"));
|
||||
DEBUG_WARNING(message.m_data, ("MessageQueue::clearMessage - clearing message with non-nullptr data"));
|
||||
message.m_message = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ template<class T>inline void Zero(T &t)
|
||||
* the source string into the new memory, and then returns a pointer to
|
||||
* the new memory.
|
||||
*
|
||||
* This routine will return NULL if called with NULL.
|
||||
* This routine will return nullptr if called with nullptr.
|
||||
*
|
||||
* @param source The string to copy
|
||||
* @return A pointer to a copy of the source argument
|
||||
@@ -144,7 +144,7 @@ template<class T>inline void Zero(T &t)
|
||||
inline char *DuplicateString(const char *source)
|
||||
{
|
||||
if (!source)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
const uint length = strlen(source)+1;
|
||||
char *result = NON_NULL (new char[length]);
|
||||
@@ -160,7 +160,7 @@ inline char *DuplicateString(const char *source)
|
||||
* the source string into the new memory, and then returns a pointer to
|
||||
* the new memory.
|
||||
*
|
||||
* This routine will return NULL if called with NULL.
|
||||
* This routine will return nullptr if called with nullptr.
|
||||
*
|
||||
* @param source The string to copy
|
||||
* @return A pointer to a copy of the source argument
|
||||
@@ -169,7 +169,7 @@ inline char *DuplicateString(const char *source)
|
||||
inline char *DuplicateStringWithToLower(const char *source)
|
||||
{
|
||||
if (!source)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
const uint length = strlen(source)+1;
|
||||
char *result = NON_NULL (new char[length]);
|
||||
@@ -193,7 +193,7 @@ inline char *DuplicateStringWithToLower(const char *source)
|
||||
|
||||
inline void imemset(void *data, int value, int length)
|
||||
{
|
||||
DEBUG_FATAL(!data, ("null data arg"));
|
||||
DEBUG_FATAL(!data, ("nullptr data arg"));
|
||||
memset(data, value, static_cast<uint>(length));
|
||||
}
|
||||
|
||||
@@ -210,8 +210,8 @@ inline void imemset(void *data, int value, int length)
|
||||
|
||||
inline void imemcpy(void *destination, const void *source, int length)
|
||||
{
|
||||
DEBUG_FATAL(!destination, ("null destination arg"));
|
||||
DEBUG_FATAL(!source, ("null source arg"));
|
||||
DEBUG_FATAL(!destination, ("nullptr destination arg"));
|
||||
DEBUG_FATAL(!source, ("nullptr source arg"));
|
||||
memcpy(destination, source, static_cast<uint>(length));
|
||||
}
|
||||
|
||||
@@ -228,8 +228,8 @@ inline void imemcpy(void *destination, const void *source, int length)
|
||||
|
||||
inline void *memmove(void *destination, const void *source, int length)
|
||||
{
|
||||
DEBUG_FATAL(!destination, ("null destination arg"));
|
||||
DEBUG_FATAL(!source, ("null source arg"));
|
||||
DEBUG_FATAL(!destination, ("nullptr destination arg"));
|
||||
DEBUG_FATAL(!source, ("nullptr source arg"));
|
||||
return memmove(destination, source, static_cast<uint>(length));
|
||||
}
|
||||
|
||||
@@ -243,7 +243,7 @@ inline void *memmove(void *destination, const void *source, int length)
|
||||
|
||||
inline int istrlen(const char *string)
|
||||
{
|
||||
DEBUG_FATAL(!string, ("null string arg"));
|
||||
DEBUG_FATAL(!string, ("nullptr string arg"));
|
||||
return static_cast<int>(strlen(string));
|
||||
}
|
||||
|
||||
|
||||
@@ -50,23 +50,23 @@ void PersistentCrcString::install()
|
||||
void PersistentCrcStringNamespace::remove()
|
||||
{
|
||||
delete ms_memoryBlockManager8;
|
||||
ms_memoryBlockManager8 = NULL;
|
||||
ms_memoryBlockManager8 = nullptr;
|
||||
delete ms_memoryBlockManager16;
|
||||
ms_memoryBlockManager16 = NULL;
|
||||
ms_memoryBlockManager16 = nullptr;
|
||||
delete ms_memoryBlockManager32;
|
||||
ms_memoryBlockManager32 = NULL;
|
||||
ms_memoryBlockManager32 = nullptr;
|
||||
delete ms_memoryBlockManager48;
|
||||
ms_memoryBlockManager48 = NULL;
|
||||
ms_memoryBlockManager48 = nullptr;
|
||||
delete ms_memoryBlockManager64;
|
||||
ms_memoryBlockManager64 = NULL;
|
||||
ms_memoryBlockManager64 = nullptr;
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
|
||||
PersistentCrcString::PersistentCrcString()
|
||||
: CrcString(),
|
||||
m_memoryBlockManager(NULL),
|
||||
m_buffer(NULL)
|
||||
m_memoryBlockManager(nullptr),
|
||||
m_buffer(nullptr)
|
||||
{
|
||||
DEBUG_FATAL(!ms_memoryBlockManager8, ("Constructing a PersistentCrcString before the class is installed"));
|
||||
}
|
||||
@@ -75,8 +75,8 @@ PersistentCrcString::PersistentCrcString()
|
||||
|
||||
PersistentCrcString::PersistentCrcString(CrcString const &rhs)
|
||||
: CrcString(),
|
||||
m_memoryBlockManager(NULL),
|
||||
m_buffer(NULL)
|
||||
m_memoryBlockManager(nullptr),
|
||||
m_buffer(nullptr)
|
||||
{
|
||||
DEBUG_FATAL(!ms_memoryBlockManager8, ("Constructing a PersistentCrcString before the class is installed"));
|
||||
|
||||
@@ -88,8 +88,8 @@ PersistentCrcString::PersistentCrcString(CrcString const &rhs)
|
||||
|
||||
PersistentCrcString::PersistentCrcString(PersistentCrcString const &rhs)
|
||||
: CrcString(), //lint !e1738 // non copy constructor used to initialize base class // this appears to be intentional.
|
||||
m_memoryBlockManager(NULL),
|
||||
m_buffer(NULL)
|
||||
m_memoryBlockManager(nullptr),
|
||||
m_buffer(nullptr)
|
||||
{
|
||||
DEBUG_FATAL(!ms_memoryBlockManager8, ("Constructing a PersistentCrcString before the class is installed"));
|
||||
|
||||
@@ -101,8 +101,8 @@ PersistentCrcString::PersistentCrcString(PersistentCrcString const &rhs)
|
||||
|
||||
PersistentCrcString::PersistentCrcString(char const * string, bool applyNormalize)
|
||||
: CrcString(),
|
||||
m_memoryBlockManager(NULL),
|
||||
m_buffer(NULL)
|
||||
m_memoryBlockManager(nullptr),
|
||||
m_buffer(nullptr)
|
||||
{
|
||||
DEBUG_FATAL(!ms_memoryBlockManager8, ("Constructing a PersistentCrcString before the class is installed"));
|
||||
|
||||
@@ -114,8 +114,8 @@ PersistentCrcString::PersistentCrcString(char const * string, bool applyNormaliz
|
||||
|
||||
PersistentCrcString::PersistentCrcString(char const * string, uint32 crc)
|
||||
: CrcString(),
|
||||
m_memoryBlockManager(NULL),
|
||||
m_buffer(NULL)
|
||||
m_memoryBlockManager(nullptr),
|
||||
m_buffer(nullptr)
|
||||
{
|
||||
DEBUG_FATAL(!ms_memoryBlockManager8, ("Constructing a PersistentCrcString before the class is installed"));
|
||||
|
||||
@@ -169,18 +169,18 @@ void PersistentCrcString::internalFree()
|
||||
{
|
||||
if (m_memoryBlockManager == ms_fakeConstCharMemoryBlockManager)
|
||||
{
|
||||
m_memoryBlockManager = NULL;
|
||||
m_memoryBlockManager = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_memoryBlockManager->free(m_buffer);
|
||||
m_memoryBlockManager = NULL;
|
||||
m_memoryBlockManager = nullptr;
|
||||
}
|
||||
}
|
||||
else
|
||||
delete [] m_buffer;
|
||||
|
||||
m_buffer = NULL;
|
||||
m_buffer = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ void PersistentCrcString::internalSet(char const * string, bool applyNormalize)
|
||||
const int stringLength = istrlen(string) + 1;
|
||||
DEBUG_FATAL(stringLength > Os::MAX_PATH_LENGTH, ("string too long for a filename"));
|
||||
|
||||
m_memoryBlockManager = NULL;
|
||||
m_memoryBlockManager = nullptr;
|
||||
if (stringLength <= 8)
|
||||
m_memoryBlockManager = ms_memoryBlockManager8;
|
||||
else
|
||||
|
||||
@@ -158,7 +158,7 @@ inline Tag ConvertIntToTag(int value)
|
||||
* array with the name of the specified tag. If a character of the tag
|
||||
* is not printable, it will be replaced with a question mark.
|
||||
*
|
||||
* A null-character will be appended to the output buffer.
|
||||
* A nullptr-character will be appended to the output buffer.
|
||||
*
|
||||
* This routine assumes the specified character buffer is at least 5 characters
|
||||
* in length.
|
||||
@@ -171,7 +171,7 @@ inline void ConvertTagToString(Tag tag, char *buffer)
|
||||
{
|
||||
int i, j, ch;
|
||||
|
||||
DEBUG_FATAL(!buffer, ("buffer is null"));
|
||||
DEBUG_FATAL(!buffer, ("buffer is nullptr"));
|
||||
|
||||
for (i = 0, j = 24; i < 4; ++i, j -= 8)
|
||||
{
|
||||
|
||||
@@ -82,7 +82,7 @@ void WatchedByList::install()
|
||||
/**
|
||||
* Destroy a WatchedByList.
|
||||
*
|
||||
* All watchers currently watching the owner of this object will be reset to NULL.
|
||||
* All watchers currently watching the owner of this object will be reset to nullptr.
|
||||
*/
|
||||
|
||||
WatchedByList::~WatchedByList()
|
||||
@@ -92,7 +92,7 @@ WatchedByList::~WatchedByList()
|
||||
if (m_list)
|
||||
{
|
||||
deleteList(m_list);
|
||||
m_list = NULL;
|
||||
m_list = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
// @todo How do I get this into doxygen? It's information that really spans multiple classes
|
||||
//
|
||||
// The Watcher system allows pointers to objects to be automatically
|
||||
// reset to NULL when the object watching them is destoyed.
|
||||
// reset to nullptr when the object watching them is destoyed.
|
||||
//
|
||||
// For something <T> to be watchable, it must provide a routine of the form:
|
||||
//
|
||||
@@ -66,7 +66,7 @@ class Watcher : public BaseWatcher
|
||||
{
|
||||
public:
|
||||
|
||||
explicit Watcher(T *data=NULL);
|
||||
explicit Watcher(T *data=nullptr);
|
||||
Watcher(const Watcher &newValue);
|
||||
~Watcher(); //lint !e1509 // Warning -- base class destructor for class is not virtual
|
||||
|
||||
@@ -96,7 +96,7 @@ class ConstWatcher : public BaseWatcher
|
||||
{
|
||||
public:
|
||||
|
||||
explicit ConstWatcher(const T *data=NULL);
|
||||
explicit ConstWatcher(const T *data=nullptr);
|
||||
ConstWatcher(const ConstWatcher &newValue);
|
||||
~ConstWatcher(); //lint !e1509 // Warning -- base class destructor for class is not virtual
|
||||
|
||||
@@ -177,7 +177,7 @@ inline BaseWatcher::BaseWatcher(void *data)
|
||||
|
||||
inline void BaseWatcher::reset()
|
||||
{
|
||||
m_data = NULL;
|
||||
m_data = nullptr;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -190,7 +190,7 @@ inline void BaseWatcher::reset()
|
||||
|
||||
inline BaseWatcher::~BaseWatcher()
|
||||
{
|
||||
m_data = NULL;
|
||||
m_data = nullptr;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -593,11 +593,11 @@ inline const T *ConstWatcher<T>::operator ->() const
|
||||
/**
|
||||
* Construct a WatchedByList.
|
||||
*
|
||||
* This list of watchers remains NULL until someone first watches the object.
|
||||
* This list of watchers remains nullptr until someone first watches the object.
|
||||
*/
|
||||
|
||||
inline WatchedByList::WatchedByList()
|
||||
: m_list(NULL)
|
||||
: m_list(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
+48
-48
@@ -106,8 +106,8 @@ m_value(),
|
||||
m_position(-1),
|
||||
m_cachedValueDirty(true)
|
||||
{
|
||||
m_cachedValue[0] = NULL;
|
||||
m_cachedValue[1] = NULL;
|
||||
m_cachedValue[0] = nullptr;
|
||||
m_cachedValue[1] = nullptr;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -131,8 +131,8 @@ DynamicVariable::DynamicVariable(const DynamicVariable &rhs) :
|
||||
m_position(rhs.m_position),
|
||||
m_cachedValueDirty(true)
|
||||
{
|
||||
m_cachedValue[0] = NULL;
|
||||
m_cachedValue[1] = NULL;
|
||||
m_cachedValue[0] = nullptr;
|
||||
m_cachedValue[1] = nullptr;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -158,8 +158,8 @@ DynamicVariable& DynamicVariable::operator=(const DynamicVariable &rhs)
|
||||
(*f)(m_cachedValue[0]);
|
||||
}
|
||||
|
||||
m_cachedValue[0] = NULL;
|
||||
m_cachedValue[1] = NULL;
|
||||
m_cachedValue[0] = nullptr;
|
||||
m_cachedValue[1] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,8 +201,8 @@ void DynamicVariable::load(int position, int typeId, const Unicode::String &pack
|
||||
(*f)(m_cachedValue[0]);
|
||||
}
|
||||
|
||||
m_cachedValue[0] = NULL;
|
||||
m_cachedValue[1] = NULL;
|
||||
m_cachedValue[0] = nullptr;
|
||||
m_cachedValue[1] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,8 +235,8 @@ DynamicVariable::DynamicVariable(int value) :
|
||||
m_position(-1),
|
||||
m_cachedValueDirty(true)
|
||||
{
|
||||
m_cachedValue[0] = NULL;
|
||||
m_cachedValue[1] = NULL;
|
||||
m_cachedValue[0] = nullptr;
|
||||
m_cachedValue[1] = nullptr;
|
||||
|
||||
pack(value, m_value);
|
||||
}
|
||||
@@ -249,8 +249,8 @@ DynamicVariable::DynamicVariable(const std::vector<int> & value) :
|
||||
m_position(-1),
|
||||
m_cachedValueDirty(true)
|
||||
{
|
||||
m_cachedValue[0] = NULL;
|
||||
m_cachedValue[1] = NULL;
|
||||
m_cachedValue[0] = nullptr;
|
||||
m_cachedValue[1] = nullptr;
|
||||
|
||||
pack(value, m_value);
|
||||
}
|
||||
@@ -263,8 +263,8 @@ DynamicVariable::DynamicVariable(float value) :
|
||||
m_position(-1),
|
||||
m_cachedValueDirty(true)
|
||||
{
|
||||
m_cachedValue[0] = NULL;
|
||||
m_cachedValue[1] = NULL;
|
||||
m_cachedValue[0] = nullptr;
|
||||
m_cachedValue[1] = nullptr;
|
||||
|
||||
pack(value, m_value);
|
||||
}
|
||||
@@ -277,8 +277,8 @@ DynamicVariable::DynamicVariable(const std::vector<float> & value) :
|
||||
m_position(-1),
|
||||
m_cachedValueDirty(true)
|
||||
{
|
||||
m_cachedValue[0] = NULL;
|
||||
m_cachedValue[1] = NULL;
|
||||
m_cachedValue[0] = nullptr;
|
||||
m_cachedValue[1] = nullptr;
|
||||
|
||||
pack(value, m_value);
|
||||
}
|
||||
@@ -291,8 +291,8 @@ DynamicVariable::DynamicVariable(const Unicode::String &value) :
|
||||
m_position(-1),
|
||||
m_cachedValueDirty(true)
|
||||
{
|
||||
m_cachedValue[0] = NULL;
|
||||
m_cachedValue[1] = NULL;
|
||||
m_cachedValue[0] = nullptr;
|
||||
m_cachedValue[1] = nullptr;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -303,8 +303,8 @@ DynamicVariable::DynamicVariable(const std::string &value) :
|
||||
m_position(-1),
|
||||
m_cachedValueDirty(true)
|
||||
{
|
||||
m_cachedValue[0] = NULL;
|
||||
m_cachedValue[1] = NULL;
|
||||
m_cachedValue[0] = nullptr;
|
||||
m_cachedValue[1] = nullptr;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -315,8 +315,8 @@ DynamicVariable::DynamicVariable(const std::vector<Unicode::String> & value) :
|
||||
m_position(-1),
|
||||
m_cachedValueDirty(true)
|
||||
{
|
||||
m_cachedValue[0] = NULL;
|
||||
m_cachedValue[1] = NULL;
|
||||
m_cachedValue[0] = nullptr;
|
||||
m_cachedValue[1] = nullptr;
|
||||
|
||||
pack(value, m_value);
|
||||
}
|
||||
@@ -329,8 +329,8 @@ DynamicVariable::DynamicVariable(const NetworkId & value) :
|
||||
m_position(-1),
|
||||
m_cachedValueDirty(true)
|
||||
{
|
||||
m_cachedValue[0] = NULL;
|
||||
m_cachedValue[1] = NULL;
|
||||
m_cachedValue[0] = nullptr;
|
||||
m_cachedValue[1] = nullptr;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -341,8 +341,8 @@ DynamicVariable::DynamicVariable(const std::vector<NetworkId> & value) :
|
||||
m_position(-1),
|
||||
m_cachedValueDirty(true)
|
||||
{
|
||||
m_cachedValue[0] = NULL;
|
||||
m_cachedValue[1] = NULL;
|
||||
m_cachedValue[0] = nullptr;
|
||||
m_cachedValue[1] = nullptr;
|
||||
|
||||
pack(value, m_value);
|
||||
}
|
||||
@@ -355,8 +355,8 @@ DynamicVariable::DynamicVariable(const DynamicVariableLocationData & value) :
|
||||
m_position(-1),
|
||||
m_cachedValueDirty(true)
|
||||
{
|
||||
m_cachedValue[0] = NULL;
|
||||
m_cachedValue[1] = NULL;
|
||||
m_cachedValue[0] = nullptr;
|
||||
m_cachedValue[1] = nullptr;
|
||||
|
||||
pack(value, m_value);
|
||||
}
|
||||
@@ -369,8 +369,8 @@ DynamicVariable::DynamicVariable(const std::vector<DynamicVariableLocationData>
|
||||
m_position(-1),
|
||||
m_cachedValueDirty(true)
|
||||
{
|
||||
m_cachedValue[0] = NULL;
|
||||
m_cachedValue[1] = NULL;
|
||||
m_cachedValue[0] = nullptr;
|
||||
m_cachedValue[1] = nullptr;
|
||||
|
||||
pack(value, m_value);
|
||||
}
|
||||
@@ -383,8 +383,8 @@ DynamicVariable::DynamicVariable(const StringId &value) :
|
||||
m_position(-1),
|
||||
m_cachedValueDirty(true)
|
||||
{
|
||||
m_cachedValue[0] = NULL;
|
||||
m_cachedValue[1] = NULL;
|
||||
m_cachedValue[0] = nullptr;
|
||||
m_cachedValue[1] = nullptr;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -395,8 +395,8 @@ DynamicVariable::DynamicVariable(const std::vector<StringId> &value) :
|
||||
m_position(-1),
|
||||
m_cachedValueDirty(true)
|
||||
{
|
||||
m_cachedValue[0] = NULL;
|
||||
m_cachedValue[1] = NULL;
|
||||
m_cachedValue[0] = nullptr;
|
||||
m_cachedValue[1] = nullptr;
|
||||
|
||||
pack(value, m_value);
|
||||
}
|
||||
@@ -409,8 +409,8 @@ DynamicVariable::DynamicVariable(const Transform &value) :
|
||||
m_position(-1),
|
||||
m_cachedValueDirty(true)
|
||||
{
|
||||
m_cachedValue[0] = NULL;
|
||||
m_cachedValue[1] = NULL;
|
||||
m_cachedValue[0] = nullptr;
|
||||
m_cachedValue[1] = nullptr;
|
||||
|
||||
pack(value, m_value);
|
||||
}
|
||||
@@ -423,8 +423,8 @@ DynamicVariable::DynamicVariable(const std::vector<Transform> &value) :
|
||||
m_position(-1),
|
||||
m_cachedValueDirty(true)
|
||||
{
|
||||
m_cachedValue[0] = NULL;
|
||||
m_cachedValue[1] = NULL;
|
||||
m_cachedValue[0] = nullptr;
|
||||
m_cachedValue[1] = nullptr;
|
||||
|
||||
pack(value, m_value);
|
||||
}
|
||||
@@ -437,8 +437,8 @@ DynamicVariable::DynamicVariable(const Vector &value) :
|
||||
m_position(-1),
|
||||
m_cachedValueDirty(true)
|
||||
{
|
||||
m_cachedValue[0] = NULL;
|
||||
m_cachedValue[1] = NULL;
|
||||
m_cachedValue[0] = nullptr;
|
||||
m_cachedValue[1] = nullptr;
|
||||
|
||||
pack(value, m_value);
|
||||
}
|
||||
@@ -451,8 +451,8 @@ DynamicVariable::DynamicVariable(const std::vector<Vector> &value) :
|
||||
m_position(-1),
|
||||
m_cachedValueDirty(true)
|
||||
{
|
||||
m_cachedValue[0] = NULL;
|
||||
m_cachedValue[1] = NULL;
|
||||
m_cachedValue[0] = nullptr;
|
||||
m_cachedValue[1] = nullptr;
|
||||
|
||||
pack(value, m_value);
|
||||
}
|
||||
@@ -786,7 +786,7 @@ bool DynamicVariable::get(DynamicVariableLocationData & value) const
|
||||
char tempCell[BUFSIZE];
|
||||
std::string data(Unicode::wideToNarrow(m_value));
|
||||
const char * bufptrStart = data.c_str();
|
||||
char * bufptrEnd = NULL;
|
||||
char * bufptrEnd = nullptr;
|
||||
cachedValue.pos.x = static_cast<float>(strtod(bufptrStart, &bufptrEnd));
|
||||
bufptrStart = bufptrEnd;
|
||||
while (*bufptrStart != '\0' && isspace(*bufptrStart))
|
||||
@@ -811,7 +811,7 @@ bool DynamicVariable::get(DynamicVariableLocationData & value) const
|
||||
while (*bufptrStart != '\0' && isspace(*bufptrStart))
|
||||
++bufptrStart;
|
||||
bufptrEnd = const_cast<char *>(strchr(bufptrStart, ' '));
|
||||
if (bufptrEnd == NULL || bufptrEnd - bufptrStart >= BUFSIZE)
|
||||
if (bufptrEnd == nullptr || bufptrEnd - bufptrStart >= BUFSIZE)
|
||||
{
|
||||
WARNING_STRICT_FATAL(true, ("DynamicVariable::get location buffer overflow in scene"));
|
||||
return false;
|
||||
@@ -875,7 +875,7 @@ bool DynamicVariable::get(std::vector<DynamicVariableLocationData> & value) cons
|
||||
char tempCell[BUFSIZE];
|
||||
|
||||
const char * bufptrStart = buffer;
|
||||
char * bufptrEnd = NULL;
|
||||
char * bufptrEnd = nullptr;
|
||||
temp.pos.x = static_cast<float>(strtod(bufptrStart, &bufptrEnd));
|
||||
bufptrStart = bufptrEnd;
|
||||
while (*bufptrStart != '\0' && isspace(*bufptrStart))
|
||||
@@ -900,7 +900,7 @@ bool DynamicVariable::get(std::vector<DynamicVariableLocationData> & value) cons
|
||||
while (*bufptrStart != '\0' && isspace(*bufptrStart))
|
||||
++bufptrStart;
|
||||
bufptrEnd = const_cast<char *>(strchr(bufptrStart, ' '));
|
||||
if (bufptrEnd == NULL || bufptrEnd - bufptrStart >= BUFSIZE)
|
||||
if (bufptrEnd == nullptr || bufptrEnd - bufptrStart >= BUFSIZE)
|
||||
{
|
||||
WARNING_STRICT_FATAL(true, ("DynamicVariable::get location array buffer overflow in scene"));
|
||||
return false;
|
||||
@@ -1430,8 +1430,8 @@ namespace Archive
|
||||
(*f)(target.m_cachedValue[0]);
|
||||
}
|
||||
|
||||
target.m_cachedValue[0] = NULL;
|
||||
target.m_cachedValue[1] = NULL;
|
||||
target.m_cachedValue[0] = nullptr;
|
||||
target.m_cachedValue[1] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -150,8 +150,8 @@ private:
|
||||
// caching the value so we don't constantly convert them from the string representation
|
||||
//
|
||||
// if the value can fit in m_cachedValue, we directly store it there
|
||||
// int uses m_cachedValue[0], m_cachedValue[1] = NULL
|
||||
// float uses m_cachedValue[0], m_cachedValue[1] = NULL
|
||||
// int uses m_cachedValue[0], m_cachedValue[1] = nullptr
|
||||
// float uses m_cachedValue[0], m_cachedValue[1] = nullptr
|
||||
// NetworkId uses both m_cachedValue[0] and m_cachedValue[1]
|
||||
//
|
||||
// if not, we allocate storage for the value and store the pointer to it
|
||||
|
||||
Reference in New Issue
Block a user