mirror of
https://github.com/SWG-Source/src.git
synced 2026-09-27 14:12:54 -04:00
newer standards prefer nullptr over NULL - this is most of them but there are others too
This commit is contained in:
@@ -69,7 +69,7 @@ namespace CachedFileManagerNamespace
|
||||
|
||||
Tag const TAG_CACH = TAG (C,A,C,H);
|
||||
|
||||
char * ms_filenames = NULL;
|
||||
char * ms_filenames = nullptr;
|
||||
size_t ms_filenamesLength = 0;
|
||||
size_t ms_filenamesCurrentPos = 0;
|
||||
unsigned long ms_totalTime;
|
||||
@@ -150,7 +150,7 @@ void CachedFileManager::install(bool const allowFileCaching)
|
||||
iff.enterForm (TAG_CACH);
|
||||
iff.enterChunk (TAG_0000);
|
||||
|
||||
//-- the entire chunk is filled with null terminated strings
|
||||
//-- the entire chunk is filled with nullptr terminated strings
|
||||
ms_filenamesLength = iff.getChunkLengthLeft();
|
||||
ms_filenames = iff.readRest_char();
|
||||
|
||||
@@ -168,7 +168,7 @@ void CachedFileManager::install(bool const allowFileCaching)
|
||||
void CachedFileManagerNamespace::remove ()
|
||||
{
|
||||
delete[] ms_filenames;
|
||||
ms_filenames = NULL;
|
||||
ms_filenames = nullptr;
|
||||
ms_filenamesCurrentPos = 0;
|
||||
ms_filenamesLength = 0;
|
||||
|
||||
@@ -255,7 +255,7 @@ void CachedFileManager::preloadSomeAssets ()
|
||||
#endif
|
||||
|
||||
delete[] ms_filenames;
|
||||
ms_filenames = NULL;
|
||||
ms_filenames = nullptr;
|
||||
ms_filenamesCurrentPos = 0;
|
||||
ms_filenamesLength = 0;
|
||||
}
|
||||
@@ -266,7 +266,7 @@ void CachedFileManager::preloadSomeAssets ()
|
||||
|
||||
bool CachedFileManager::donePreloading ()
|
||||
{
|
||||
return ms_filenames == NULL || (ms_filenamesCurrentPos >= ms_filenamesLength);
|
||||
return ms_filenames == nullptr || (ms_filenamesCurrentPos >= ms_filenamesLength);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -70,7 +70,7 @@ void CurrentUserOptionManager::load (char const * const userName)
|
||||
ms_optionManager->load (ms_userName.c_str ());
|
||||
}
|
||||
else
|
||||
DEBUG_WARNING (true, ("CurrentUserOptionManager::load: userName is null"));
|
||||
DEBUG_WARNING (true, ("CurrentUserOptionManager::load: userName is nullptr"));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -82,7 +82,7 @@ void CurrentUserOptionManager::save ()
|
||||
if (!ms_userName.empty ())
|
||||
ms_optionManager->save (ms_userName.c_str ());
|
||||
else
|
||||
DEBUG_REPORT_LOG (s_verbose, ("CurrentUserOptionManager::save: userName is null\n"));
|
||||
DEBUG_REPORT_LOG (s_verbose, ("CurrentUserOptionManager::save: userName is nullptr\n"));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -50,7 +50,7 @@ DataTable::~DataTable()
|
||||
if (*k)
|
||||
{
|
||||
delete static_cast<std::multimap<int, int> *>(*k);
|
||||
*k = NULL;
|
||||
*k = nullptr;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -59,7 +59,7 @@ DataTable::~DataTable()
|
||||
if (*k)
|
||||
{
|
||||
delete static_cast<std::multimap<float, int> *>(*k);
|
||||
*k = NULL;
|
||||
*k = nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -69,7 +69,7 @@ DataTable::~DataTable()
|
||||
if (*k)
|
||||
{
|
||||
delete static_cast<std::pair<std::multimap<const std::string, int>, std::multimap<int, int> > *>(*k);
|
||||
*k = NULL;
|
||||
*k = nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -83,7 +83,7 @@ DataTable::~DataTable()
|
||||
case DataTableColumnType::DT_PackedObjVars:
|
||||
default:
|
||||
{
|
||||
WARNING_STRICT_FATAL((*k) != NULL, ("Bad column Index %d. Unsupported datatype. This may leak memory.", count));
|
||||
WARNING_STRICT_FATAL((*k) != nullptr, ("Bad column Index %d. Unsupported datatype. This may leak memory.", count));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -112,7 +112,7 @@ DataTable::~DataTable()
|
||||
}
|
||||
|
||||
delete m_columnIndexMap;
|
||||
m_columnIndexMap = NULL;
|
||||
m_columnIndexMap = nullptr;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -464,12 +464,12 @@ void DataTable::load(Iff & iff)
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
//initialize the table index used for searching.
|
||||
m_index.push_back(NULL);
|
||||
m_index.push_back(nullptr);
|
||||
}
|
||||
|
||||
buildColumnIndexMap();
|
||||
|
||||
if (NULL != iff.getFileName())
|
||||
if (nullptr != iff.getFileName())
|
||||
m_name = iff.getFileName();
|
||||
else
|
||||
m_name.clear();
|
||||
|
||||
@@ -148,7 +148,7 @@ DataTableColumnType::DataTableColumnType(std::string const &desc) :
|
||||
std::string::size_type endPos = enumList.find(',');
|
||||
std::string label = enumList.substr(0, eqPos);
|
||||
std::string val = enumList.substr(eqPos+1, endPos-eqPos-1);
|
||||
(*m_enumMap)[label] = static_cast<int>(strtol(val.c_str(), NULL, 0));
|
||||
(*m_enumMap)[label] = static_cast<int>(strtol(val.c_str(), nullptr, 0));
|
||||
enumList.erase(0, endPos+1);
|
||||
}
|
||||
// assure the default is a member of the enumeration
|
||||
@@ -173,7 +173,7 @@ DataTableColumnType::DataTableColumnType(std::string const &desc) :
|
||||
std::string::size_type endPos = enumList.find(',');
|
||||
std::string label = enumList.substr(0, eqPos);
|
||||
std::string val = enumList.substr(eqPos+1, endPos-eqPos-1);
|
||||
int bit = static_cast<int>(strtol(val.c_str(), NULL, 0));
|
||||
int bit = static_cast<int>(strtol(val.c_str(), nullptr, 0));
|
||||
if((bit < 1) || (bit > 32))
|
||||
{
|
||||
WARNING(true, ("Flags value [%s] is not a whole number from 1 to 32", label.c_str()));
|
||||
@@ -247,7 +247,7 @@ void DataTableColumnType::createDefaultCell()
|
||||
switch(m_basicType)
|
||||
{
|
||||
case DT_Int:
|
||||
m_defaultCell = new DataTableCell(static_cast<int>(strtol(value.c_str(), NULL, 0)));
|
||||
m_defaultCell = new DataTableCell(static_cast<int>(strtol(value.c_str(), nullptr, 0)));
|
||||
break;
|
||||
case DT_Float:
|
||||
m_defaultCell = new DataTableCell(static_cast<float>(atof(value.c_str())));
|
||||
|
||||
@@ -129,7 +129,7 @@ DataTable * DataTableManager::getTable(const std::string& table, bool openIfNotF
|
||||
if (!dt)
|
||||
{
|
||||
DEBUG_WARNING(true, ("Could not find table [%s]", table.c_str()));
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -140,7 +140,7 @@ DataTable * DataTableManager::getTable(const std::string& table, bool openIfNotF
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ DataTable* DataTableManager::reload(const std::string & table)
|
||||
|
||||
DataTable * const dataTable = open(table);
|
||||
|
||||
if (dataTable != NULL)
|
||||
if (dataTable != nullptr)
|
||||
{
|
||||
std::multimap<std::string, DataTableReloadCallback>::const_iterator i = m_reloadCallbacks.lower_bound(table);
|
||||
for (; i != m_reloadCallbacks.end() && (*i).first == table; ++i)
|
||||
@@ -175,7 +175,7 @@ DataTable* DataTableManager::reloadIfOpen(const std::string & table)
|
||||
if(isOpen(table))
|
||||
return reload(table);
|
||||
else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -591,7 +591,7 @@ bool DataTableWriter::save(const char * outputFileName, bool optional) const
|
||||
{
|
||||
if (!outputFileName || outputFileName[0] != '\0')
|
||||
{
|
||||
DEBUG_FATAL(true, ("OutputFileName is NULL or empty."));
|
||||
DEBUG_FATAL(true, ("OutputFileName is nullptr or empty."));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -728,7 +728,7 @@ DataTableCell *DataTableWriter::_getNewCell(DataTableColumnType const &columnTyp
|
||||
switch (columnType.getBasicType())
|
||||
{
|
||||
case DataTableColumnType::DT_Int:
|
||||
return new DataTableCell(static_cast<int>(strtol(value.c_str(), NULL, 0)));
|
||||
return new DataTableCell(static_cast<int>(strtol(value.c_str(), nullptr, 0)));
|
||||
break;
|
||||
case DataTableColumnType::DT_Float:
|
||||
return new DataTableCell(static_cast<float>(atof(value.c_str())));
|
||||
|
||||
@@ -52,14 +52,14 @@ FileName::FileName (FileName::Path path, const char* filename, const char* ext)
|
||||
|
||||
// see if the filename already begins with the path
|
||||
const char *prePath = pathTable [path].path;
|
||||
if (prePath != NULL && *prePath != '\0')
|
||||
if (prePath != nullptr && *prePath != '\0')
|
||||
{
|
||||
if (strncmp(filename, prePath, strlen(prePath)) == 0)
|
||||
prePath = "";
|
||||
}
|
||||
|
||||
// see if the filename already ends in the extension
|
||||
if (ext != NULL && *ext != '\0')
|
||||
if (ext != nullptr && *ext != '\0')
|
||||
{
|
||||
int extLen = strlen(ext);
|
||||
int filenameLen = strlen(filename);
|
||||
|
||||
@@ -42,7 +42,7 @@ void*
|
||||
RotaryCache::add(const CrcLowerString& keyString, void* valuePtr)
|
||||
{
|
||||
CacheListEntry listEntry;
|
||||
void* returnVal = NULL;
|
||||
void* returnVal = nullptr;
|
||||
|
||||
listEntry.key = keyString;
|
||||
listEntry.value = valuePtr;
|
||||
@@ -93,7 +93,7 @@ RotaryCache::fetch(const CrcLowerString& keyString)
|
||||
return entryList.value;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void*
|
||||
@@ -103,7 +103,7 @@ RotaryCache::remove(const CrcLowerString& keyString)
|
||||
|
||||
if(iterFind != mMap.end())
|
||||
{
|
||||
void* retVal = NULL;
|
||||
void* retVal = nullptr;
|
||||
CacheMapEntry& entryFind = (*iterFind).second;
|
||||
|
||||
RotaryList::iterator iterList = entryFind.iter;
|
||||
@@ -119,7 +119,7 @@ RotaryCache::remove(const CrcLowerString& keyString)
|
||||
return retVal;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ RotaryCache::getNext()
|
||||
return retVal;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -109,7 +109,7 @@ void SetupSharedUtility::installFileManifestEntries ()
|
||||
if (!fileName.empty())
|
||||
FileManifest::addStoredManifestEntry(fileName.c_str(), sceneId.c_str(), fileSize);
|
||||
else
|
||||
DEBUG_WARNING(true, ("SetupSharedUtility::installFileManifestEntries(): found an entry with a null filename: (row %i)\n", i));
|
||||
DEBUG_WARNING(true, ("SetupSharedUtility::installFileManifestEntries(): found an entry with a nullptr filename: (row %i)\n", i));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -951,7 +951,7 @@ DynamicVariableParamData::~DynamicVariableParamData()
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
DynamicVariableParamData *temp = m_data.lparam->at(i);
|
||||
m_data.lparam->at(i) = NULL;
|
||||
m_data.lparam->at(i) = nullptr;
|
||||
delete temp;
|
||||
}
|
||||
delete m_data.lparam;
|
||||
@@ -1134,15 +1134,15 @@ void DynamicVariableParam::cleanSingleParam(void)
|
||||
{
|
||||
case DynamicVariableParamData::INTEGER:
|
||||
delete m_dataSingle.m_data.iparam;
|
||||
m_dataSingle.m_data.iparam = NULL;
|
||||
m_dataSingle.m_data.iparam = nullptr;
|
||||
break;
|
||||
case DynamicVariableParamData::FLOAT:
|
||||
delete m_dataSingle.m_data.fparam;
|
||||
m_dataSingle.m_data.fparam = NULL;
|
||||
m_dataSingle.m_data.fparam = nullptr;
|
||||
break;
|
||||
case DynamicVariableParamData::STRING:
|
||||
delete m_dataSingle.m_data.sparam;
|
||||
m_dataSingle.m_data.sparam = NULL;
|
||||
m_dataSingle.m_data.sparam = nullptr;
|
||||
break;
|
||||
case DynamicVariableParamData::LIST:
|
||||
{
|
||||
@@ -1152,11 +1152,11 @@ void DynamicVariableParam::cleanSingleParam(void)
|
||||
++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = NULL;
|
||||
*iter = nullptr;
|
||||
}
|
||||
}
|
||||
delete m_dataSingle.m_data.lparam;
|
||||
m_dataSingle.m_data.lparam = NULL;
|
||||
m_dataSingle.m_data.lparam = nullptr;
|
||||
break;
|
||||
case DynamicVariableParamData::UNKNOWN:
|
||||
default:
|
||||
|
||||
@@ -210,19 +210,19 @@ inline void TemplateBase<DataType, ReturnType>::cleanData(void)
|
||||
++iter)
|
||||
{
|
||||
delete (*iter).value;
|
||||
(*iter).value = NULL;
|
||||
(*iter).value = nullptr;
|
||||
}
|
||||
delete m_data.weightedList;
|
||||
m_data.weightedList = NULL;
|
||||
m_data.weightedList = nullptr;
|
||||
}
|
||||
break;
|
||||
case RANGE:
|
||||
delete m_data.range;
|
||||
m_data.range = NULL;
|
||||
m_data.range = nullptr;
|
||||
break;
|
||||
case DIE_ROLL:
|
||||
delete m_data.dieRoll;
|
||||
m_data.dieRoll = NULL;
|
||||
m_data.dieRoll = nullptr;
|
||||
break;
|
||||
case NONE:
|
||||
default:
|
||||
@@ -288,7 +288,7 @@ inline const typename TemplateBase<DataType, ReturnType>::Range * TemplateBase<D
|
||||
{
|
||||
if (m_dataType == RANGE)
|
||||
return m_data.range;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <class DataType, class ReturnType>
|
||||
@@ -296,7 +296,7 @@ inline const typename TemplateBase<DataType, ReturnType>::DieRoll * TemplateBase
|
||||
{
|
||||
if (m_dataType == DIE_ROLL)
|
||||
return m_data.dieRoll;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <class DataType, class ReturnType>
|
||||
@@ -304,7 +304,7 @@ inline const typename TemplateBase<DataType, ReturnType>::WeightedList * Templat
|
||||
{
|
||||
if (m_dataType == WEIGHTED_LIST)
|
||||
return m_data.weightedList;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <class DataType, class ReturnType>
|
||||
@@ -541,7 +541,7 @@ inline const IntegerParam::DieRoll * IntegerParam::getDieRollStruct(void) const
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -553,7 +553,7 @@ inline const IntegerParam::Range * IntegerParam::getRangeStruct(void) const
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -637,7 +637,7 @@ inline const FloatParam::Range * FloatParam::getRangeStruct() const
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -765,7 +765,7 @@ class TriggerVolumeData
|
||||
{
|
||||
friend class TriggerVolumeParam;
|
||||
public:
|
||||
TriggerVolumeData(void) : m_name(NULL), m_radius(0.0f) {}
|
||||
TriggerVolumeData(void) : m_name(nullptr), m_radius(0.0f) {}
|
||||
TriggerVolumeData(const std::string & name, float radius) : m_name(&name), m_radius(radius) {}
|
||||
|
||||
const std::string & getName(void) const;
|
||||
@@ -962,7 +962,7 @@ inline TemplateBase<SP *, SP *> *StructParam<SP>::createNewParam(void)
|
||||
template <class SP>
|
||||
inline StructParam<SP>::StructParam(void) : TemplateBase<SP *, SP *>()
|
||||
{
|
||||
this->m_dataSingle = NULL;
|
||||
this->m_dataSingle = nullptr;
|
||||
} // StructParam<SP>::StructParam
|
||||
|
||||
/**
|
||||
@@ -974,7 +974,7 @@ inline StructParam<SP>::~StructParam()
|
||||
if (this->m_dataType == TemplateBase<SP *, SP *>::SINGLE)
|
||||
{
|
||||
delete this->m_dataSingle;
|
||||
this->m_dataSingle = NULL;
|
||||
this->m_dataSingle = nullptr;
|
||||
this->m_dataType = TemplateBase<SP *, SP *>::NONE;
|
||||
}
|
||||
} // StructParam<SP>::~StructParam
|
||||
@@ -986,7 +986,7 @@ template <class SP>
|
||||
inline void StructParam<SP>::cleanSingleParam(void)
|
||||
{
|
||||
delete this->m_dataSingle;
|
||||
this->m_dataSingle = NULL;
|
||||
this->m_dataSingle = nullptr;
|
||||
} // StructParam<SP>::cleanSingleParam
|
||||
|
||||
/**
|
||||
|
||||
@@ -103,7 +103,7 @@ bool ValueDictionary::exists(std::string const & name) const
|
||||
|
||||
ValueTypeBase * ValueDictionary::getCopy(std::string const & name) const
|
||||
{
|
||||
ValueTypeBase * returnValue = NULL;
|
||||
ValueTypeBase * returnValue = nullptr;
|
||||
|
||||
DictionaryValueMap::const_iterator iter = m_valueMap.find(name);
|
||||
if (iter != m_valueMap.end())
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Archive
|
||||
|
||||
std::string name;
|
||||
std::string type;
|
||||
ValueTypeBase * value = NULL;
|
||||
ValueTypeBase * value = nullptr;
|
||||
ValueObjectUnpackHandlerMap::const_iterator iterFind;
|
||||
for (int i = 0; i < static_cast<int>(count); ++i)
|
||||
{
|
||||
@@ -77,7 +77,7 @@ namespace Archive
|
||||
target.insert(name, *value);
|
||||
|
||||
delete value;
|
||||
value = NULL;
|
||||
value = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user