refactor(Core): replace NULL with nullptr (#4593)

This commit is contained in:
Kitzunu
2021-03-02 01:34:20 +01:00
committed by GitHub
parent dbefa17a53
commit 28f1dc5c0c
231 changed files with 923 additions and 923 deletions

View File

@@ -67,7 +67,7 @@ public:
uint32 Idx = 0;
const T* temp;
if (m_obj2Idx.getRemove(&obj, temp, Idx))
m_objects[Idx] = NULL;
m_objects[Idx] = nullptr;
else
m_objects_to_push.remove(&obj);
}

View File

@@ -12,12 +12,12 @@ namespace MMAP
{
// ######################## MMapFactory ########################
// our global singleton copy
MMapManager* g_MMapManager = NULL;
MMapManager* g_MMapManager = nullptr;
bool MMapFactory::forbiddenMaps[1000] = {0};
MMapManager* MMapFactory::createOrGetMMapManager()
{
if (g_MMapManager == NULL)
if (g_MMapManager == nullptr)
g_MMapManager = new MMapManager();
return g_MMapManager;
@@ -43,7 +43,7 @@ namespace MMAP
if (g_MMapManager)
{
delete g_MMapManager;
g_MMapManager = NULL;
g_MMapManager = nullptr;
}
}
}

View File

@@ -218,7 +218,7 @@ namespace MMAP
dtStatus status;
{
ACORE_WRITE_GUARD(ACE_RW_Thread_Mutex, GetMMapLock(mapId));
status = mmap->navMesh->removeTile(tileRef, NULL, NULL);
status = mmap->navMesh->removeTile(tileRef, nullptr, nullptr);
}
// unload, and mark as non loaded
@@ -266,7 +266,7 @@ namespace MMAP
dtStatus status;
{
ACORE_WRITE_GUARD(ACE_RW_Thread_Mutex, GetMMapLock(mapId));
status = mmap->navMesh->removeTile(i->second, NULL, NULL);
status = mmap->navMesh->removeTile(i->second, nullptr, nullptr);
}
if (status != DT_SUCCESS)
@@ -329,7 +329,7 @@ namespace MMAP
//ACORE_READ_GUARD(ACE_RW_Thread_Mutex, MMapManagerLock);
if (loadedMMaps.find(mapId) == loadedMMaps.end())
return NULL;
return nullptr;
return loadedMMaps[mapId]->navMesh;
}
@@ -340,7 +340,7 @@ namespace MMAP
//ACORE_READ_GUARD(ACE_RW_Thread_Mutex, MMapManagerLock);
if (loadedMMaps.find(mapId) == loadedMMaps.end())
return NULL;
return nullptr;
MMapData* mmap = loadedMMaps[mapId];
if (mmap->navMeshQueries.find(instanceId) == mmap->navMeshQueries.end())
@@ -357,7 +357,7 @@ namespace MMAP
{
dtFreeNavMeshQuery(query);
sLog->outError("MMAP:GetNavMeshQuery: Failed to initialize dtNavMeshQuery for mapId %03u instanceId %u", mapId, instanceId);
return NULL;
return nullptr;
}
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)

View File

@@ -9,7 +9,7 @@
namespace VMAP
{
IVMapManager* gVMapManager = NULL;
IVMapManager* gVMapManager = nullptr;
//===============================================
// just return the instance
@@ -25,6 +25,6 @@ namespace VMAP
void VMapFactory::clear()
{
delete gVMapManager;
gVMapManager = NULL;
gVMapManager = nullptr;
}
}

View File

@@ -137,7 +137,7 @@ namespace VMAP
bool VMapManager2::isInLineOfSight(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_VMAP_CHECKS)
if (!isLineOfSightCalcEnabled() || DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_LOS))
if (!isLineOfSightCalcEnabled() || DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, nullptr, VMAP_DISABLE_LOS))
return true;
#endif
@@ -162,7 +162,7 @@ namespace VMAP
bool VMapManager2::getObjectHitPos(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float& ry, float& rz, float modifyDist)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_VMAP_CHECKS)
if (isLineOfSightCalcEnabled() && !DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_LOS))
if (isLineOfSightCalcEnabled() && !DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, nullptr, VMAP_DISABLE_LOS))
#endif
{
InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId);
@@ -194,7 +194,7 @@ namespace VMAP
float VMapManager2::getHeight(unsigned int mapId, float x, float y, float z, float maxSearchDist)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_VMAP_CHECKS)
if (isHeightCalcEnabled() && !DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_HEIGHT))
if (isHeightCalcEnabled() && !DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, nullptr, VMAP_DISABLE_HEIGHT))
#endif
{
InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId);
@@ -215,7 +215,7 @@ namespace VMAP
bool VMapManager2::getAreaInfo(unsigned int mapId, float x, float y, float& z, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_VMAP_CHECKS)
if (!DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_AREAFLAG))
if (!DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, nullptr, VMAP_DISABLE_AREAFLAG))
#endif
{
InstanceTreeMap::const_iterator instanceTree = iInstanceMapTrees.find(mapId);
@@ -235,7 +235,7 @@ namespace VMAP
bool VMapManager2::GetLiquidLevel(uint32 mapId, float x, float y, float z, uint8 reqLiquidType, float& level, float& floor, uint32& type) const
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_VMAP_CHECKS)
if (!DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_LIQUIDSTATUS))
if (!DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, nullptr, VMAP_DISABLE_LIQUIDSTATUS))
#endif
{
InstanceTreeMap::const_iterator instanceTree = iInstanceMapTrees.find(mapId);
@@ -272,7 +272,7 @@ namespace VMAP
{
sLog->outError("VMapManager2: could not load '%s%s.vmo'", basepath.c_str(), filename.c_str());
delete worldmodel;
return NULL;
return nullptr;
}
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_MAPS, "VMapManager2: loading file '%s%s'", basepath.c_str(), filename.c_str());

View File

@@ -41,7 +41,7 @@ namespace VMAP
//=================================================================
TileAssembler::TileAssembler(const std::string& pSrcDirName, const std::string& pDestDirName)
: iDestDir(pDestDirName), iSrcDir(pSrcDirName), iFilterMethod(NULL), iCurrentUniqueNameId(0)
: iDestDir(pDestDirName), iSrcDir(pSrcDirName), iFilterMethod(nullptr), iCurrentUniqueNameId(0)
{
//mkdir(iDestDir);
//init();

View File

@@ -140,13 +140,13 @@ GameObjectModel* GameObjectModel::Create(const GameObject& go)
{
const GameObjectDisplayInfoEntry* info = sGameObjectDisplayInfoStore.LookupEntry(go.GetDisplayId());
if (!info)
return NULL;
return nullptr;
GameObjectModel* mdl = new GameObjectModel();
if (!mdl->initialize(go, *info))
{
delete mdl;
return NULL;
return nullptr;
}
return mdl;

View File

@@ -314,7 +314,7 @@ namespace VMAP
triangles.clear();
vertices.clear();
delete iLiquid;
iLiquid = NULL;
iLiquid = nullptr;
if (result && fread(&iBound, sizeof(G3D::AABox), 1, rf) != 1) result = false;
if (result && fread(&iMogpFlags, sizeof(uint32), 1, rf) != 1) result = false;

View File

@@ -124,7 +124,7 @@ inline float finiteAlways(float f) { return isfinite(f) ? f : 0.0f; }
inline bool myisfinite(float f) { return isfinite(f) && !isnan(f); }
#define atol(a) strtoul( a, NULL, 10)
#define atol(a) strtoul( a, nullptr, 10)
#define STRINGIZE(a) #a

View File

@@ -99,7 +99,7 @@ BigNumber BigNumber::operator/=(BigNumber const& bn)
BN_CTX* bnctx;
bnctx = BN_CTX_new();
BN_div(_bn, NULL, _bn, bn._bn, bnctx);
BN_div(_bn, nullptr, _bn, bn._bn, bnctx);
BN_CTX_free(bnctx);
return *this;

View File

@@ -34,7 +34,7 @@ bool BasicStatementTask::Execute()
if (!result || !result->GetRowCount())
{
delete result;
m_result.set(QueryResult(NULL));
m_result.set(QueryResult(nullptr));
return false;
}
result->NextRow();

View File

@@ -23,7 +23,7 @@ int DatabaseWorker::svc()
if (!m_queue)
return -1;
SQLOperation* request = NULL;
SQLOperation* request = nullptr;
while (1)
{
request = (SQLOperation*)(m_queue->dequeue());

View File

@@ -149,7 +149,7 @@ QueryResult DatabaseWorkerPool<T>::Query(const char* sql, T* conn /* = nullptr*/
if (!result || !result->GetRowCount())
{
delete result;
return QueryResult(NULL);
return QueryResult(nullptr);
}
result->NextRow();
@@ -169,7 +169,7 @@ PreparedQueryResult DatabaseWorkerPool<T>::Query(PreparedStatement* stmt)
if (!ret || !ret->GetRowCount())
{
delete ret;
return PreparedQueryResult(NULL);
return PreparedQueryResult(nullptr);
}
return PreparedQueryResult(ret);

View File

@@ -8,7 +8,7 @@
Field::Field()
{
data.value = NULL;
data.value = nullptr;
data.type = MYSQL_TYPE_NULL;
data.length = 0;
data.raw = false;

View File

@@ -219,7 +219,7 @@ public:
if (IsNumeric())
{
sLog->outSQLDriver("Error: GetCString() on numeric field. Using type: %s.", FieldTypeToString(data.type));
return NULL;
return nullptr;
}
#endif
return static_cast<char const*>(data.value);
@@ -381,7 +381,7 @@ private:
case MYSQL_TYPE_NEWDATE:
return "NEWDATE";
case MYSQL_TYPE_NULL:
return "NULL";
return "nullptr";
case MYSQL_TYPE_SET:
return "SET";
case MYSQL_TYPE_SHORT:

View File

@@ -26,9 +26,9 @@
MySQLConnection::MySQLConnection(MySQLConnectionInfo& connInfo) :
m_reconnecting(false),
m_prepareError(false),
m_queue(NULL),
m_worker(NULL),
m_Mysql(NULL),
m_queue(nullptr),
m_worker(nullptr),
m_Mysql(nullptr),
m_connectionInfo(connInfo),
m_connectionFlags(CONNECTION_SYNCH)
{
@@ -38,7 +38,7 @@ MySQLConnection::MySQLConnection(ACE_Activation_Queue* queue, MySQLConnectionInf
m_reconnecting(false),
m_prepareError(false),
m_queue(queue),
m_Mysql(NULL),
m_Mysql(nullptr),
m_connectionInfo(connInfo),
m_connectionFlags(CONNECTION_ASYNC)
{
@@ -64,7 +64,7 @@ void MySQLConnection::Close()
bool MySQLConnection::Open()
{
MYSQL* mysqlInit;
mysqlInit = mysql_init(NULL);
mysqlInit = mysql_init(nullptr);
if (!mysqlInit)
{
sLog->outError("Could not initialize Mysql connection to database `%s`", m_connectionInfo.database.c_str());
@@ -313,15 +313,15 @@ bool MySQLConnection::_Query(PreparedStatement* stmt, MYSQL_RES** pResult, uint6
ResultSet* MySQLConnection::Query(const char* sql)
{
if (!sql)
return NULL;
return nullptr;
MYSQL_RES* result = NULL;
MYSQL_FIELD* fields = NULL;
MYSQL_RES* result = nullptr;
MYSQL_FIELD* fields = nullptr;
uint64 rowCount = 0;
uint32 fieldCount = 0;
if (!_Query(sql, &result, &fields, &rowCount, &fieldCount))
return NULL;
return nullptr;
return new ResultSet(result, fields, rowCount, fieldCount);
}
@@ -460,7 +460,7 @@ void MySQLConnection::PrepareStatement(uint32 index, const char* sql, Connection
// to save memory that will not be used.
if (!(m_connectionFlags & flags))
{
m_stmts[index] = NULL;
m_stmts[index] = nullptr;
return;
}
@@ -490,12 +490,12 @@ void MySQLConnection::PrepareStatement(uint32 index, const char* sql, Connection
PreparedResultSet* MySQLConnection::Query(PreparedStatement* stmt)
{
MYSQL_RES* result = NULL;
MYSQL_RES* result = nullptr;
uint64 rowCount = 0;
uint32 fieldCount = 0;
if (!_Query(stmt, &result, &rowCount, &fieldCount))
return NULL;
return nullptr;
if (mysql_more_results(m_Mysql))
{

View File

@@ -9,7 +9,7 @@
#include "Log.h"
PreparedStatement::PreparedStatement(uint32 index) :
m_stmt(NULL),
m_stmt(nullptr),
m_index(index)
{
}
@@ -192,9 +192,9 @@ void PreparedStatement::setNull(const uint8 index)
}
MySQLPreparedStatement::MySQLPreparedStatement(MYSQL_STMT* stmt) :
m_stmt(NULL),
m_stmt(nullptr),
m_Mstmt(stmt),
m_bind(NULL)
m_bind(nullptr)
{
/// Initialize variable parameters
m_paramCount = mysql_stmt_param_count(stmt);
@@ -224,9 +224,9 @@ void MySQLPreparedStatement::ClearParameters()
for (uint32 i = 0; i < m_paramCount; ++i)
{
delete m_bind[i].length;
m_bind[i].length = NULL;
m_bind[i].length = nullptr;
delete[] (char*) m_bind[i].buffer;
m_bind[i].buffer = NULL;
m_bind[i].buffer = nullptr;
m_paramsSet[i] = false;
}
}
@@ -356,11 +356,11 @@ void MySQLPreparedStatement::setNull(const uint8 index)
MYSQL_BIND* param = &m_bind[index];
param->buffer_type = MYSQL_TYPE_NULL;
delete [] static_cast<char*>(param->buffer);
param->buffer = NULL;
param->buffer = nullptr;
param->buffer_length = 0;
param->is_null_value = 1;
delete param->length;
param->length = NULL;
param->length = nullptr;
}
void MySQLPreparedStatement::setValue(MYSQL_BIND* param, enum_field_types type, const void* value, uint32 len, bool isUnsigned)
@@ -370,7 +370,7 @@ void MySQLPreparedStatement::setValue(MYSQL_BIND* param, enum_field_types type,
param->buffer = new char[len];
param->buffer_length = 0;
param->is_null_value = 0;
param->length = NULL; // Only != NULL for strings
param->length = nullptr; // Only != nullptr for strings
param->is_unsigned = isUnsigned;
memcpy(param->buffer, value, len);
@@ -425,7 +425,7 @@ std::string MySQLPreparedStatement::getQueryString(std::string const& sqlPattern
ss << '\'' << m_stmt->statement_data[i].str << '\'';
break;
case TYPE_NULL:
ss << "NULL";
ss << "nullptr";
break;
}
@@ -464,7 +464,7 @@ bool PreparedStatementTask::Execute()
if (!result || !result->GetRowCount())
{
delete result;
m_result.set(PreparedQueryResult(NULL));
m_result.set(PreparedQueryResult(nullptr));
return false;
}
m_result.set(PreparedQueryResult(result));

View File

@@ -23,7 +23,7 @@ bool SQLQueryHolder::SetQuery(size_t index, const char* sql)
element.element.query = strdup(sql);
SQLResultSetUnion result;
result.qresult = NULL;
result.qresult = nullptr;
m_queries[index] = SQLResultPair(element, result);
return true;
@@ -66,7 +66,7 @@ bool SQLQueryHolder::SetPreparedQuery(size_t index, PreparedStatement* stmt)
element.element.stmt = stmt;
SQLResultSetUnion result;
result.presult = NULL;
result.presult = nullptr;
m_queries[index] = SQLResultPair(element, result);
return true;
@@ -79,13 +79,13 @@ QueryResult SQLQueryHolder::GetResult(size_t index)
{
ResultSet* result = m_queries[index].second.qresult;
if (!result || !result->GetRowCount())
return QueryResult(NULL);
return QueryResult(nullptr);
result->NextRow();
return QueryResult(result);
}
else
return QueryResult(NULL);
return QueryResult(nullptr);
}
PreparedQueryResult SQLQueryHolder::GetPreparedResult(size_t index)
@@ -95,12 +95,12 @@ PreparedQueryResult SQLQueryHolder::GetPreparedResult(size_t index)
{
PreparedResultSet* result = m_queries[index].second.presult;
if (!result || !result->GetRowCount())
return PreparedQueryResult(NULL);
return PreparedQueryResult(nullptr);
return PreparedQueryResult(result);
}
else
return PreparedQueryResult(NULL);
return PreparedQueryResult(nullptr);
}
void SQLQueryHolder::SetResult(size_t index, ResultSet* result)
@@ -108,7 +108,7 @@ void SQLQueryHolder::SetResult(size_t index, ResultSet* result)
if (result && !result->GetRowCount())
{
delete result;
result = NULL;
result = nullptr;
}
/// store the result in the holder
@@ -121,7 +121,7 @@ void SQLQueryHolder::SetPreparedResult(size_t index, PreparedResultSet* result)
if (result && !result->GetRowCount())
{
delete result;
result = NULL;
result = nullptr;
}
/// store the result in the holder

View File

@@ -21,11 +21,11 @@ PreparedResultSet::PreparedResultSet(MYSQL_STMT* stmt, MYSQL_RES* result, uint64
m_rowCount(rowCount),
m_rowPosition(0),
m_fieldCount(fieldCount),
m_rBind(NULL),
m_rBind(nullptr),
m_stmt(stmt),
m_res(result),
m_isNull(NULL),
m_length(NULL)
m_isNull(nullptr),
m_length(nullptr)
{
if (!m_res)
return;
@@ -67,7 +67,7 @@ PreparedResultSet::PreparedResultSet(MYSQL_STMT* stmt, MYSQL_RES* result, uint64
m_rBind[i].buffer_length = size;
m_rBind[i].length = &m_length[i];
m_rBind[i].is_null = &m_isNull[i];
m_rBind[i].error = NULL;
m_rBind[i].error = nullptr;
m_rBind[i].is_unsigned = field->flags & UNSIGNED_FLAG;
++i;
@@ -198,13 +198,13 @@ void ResultSet::CleanUp()
if (_currentRow)
{
delete [] _currentRow;
_currentRow = NULL;
_currentRow = nullptr;
}
if (_result)
{
mysql_free_result(_result);
_result = NULL;
_result = nullptr;
}
}

View File

@@ -16,7 +16,7 @@
@brief This file contains definitions of functions used for reporting critical application errors
It is very important that (std::)abort is NEVER called in place of *((volatile int*)NULL) = 0;
It is very important that (std::)abort is NEVER called in place of *((volatile int*)nullptr) = 0;
Calling abort() on Windows does not invoke unhandled exception filters - a mechanism used by WheatyExceptionReport
to log crashes. exit(1) calls here are for static analysis tools to indicate that calling functions defined in this file
terminates the application.

View File

@@ -35,11 +35,11 @@ inline LPTSTR ErrorMessage(DWORD dw)
DWORD formatResult = FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
nullptr,
dw,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf,
0, NULL);
0, nullptr);
if (formatResult != 0)
return (LPTSTR)lpMsgBuf;
else
@@ -130,7 +130,7 @@ LONG WINAPI WheatyExceptionReport::WheatyUnhandledExceptionFilter(
TCHAR crash_folder_path[MAX_PATH];
sprintf_s(crash_folder_path, "%s\\%s", module_folder_name, CrashFolder);
if (!CreateDirectory(crash_folder_path, NULL))
if (!CreateDirectory(crash_folder_path, nullptr))
{
if (GetLastError() != ERROR_ALREADY_EXISTS)
return 0;
@@ -220,7 +220,7 @@ BOOL WheatyExceptionReport::_GetProcessorName(TCHAR* sProcessorName, DWORD maxco
return FALSE;
TCHAR szTmp[2048];
DWORD cntBytes = sizeof(szTmp);
lRet = ::RegQueryValueEx(hKey, _T("ProcessorNameString"), NULL, NULL,
lRet = ::RegQueryValueEx(hKey, _T("ProcessorNameString"), nullptr, nullptr,
(LPBYTE)szTmp, &cntBytes);
if (lRet != ERROR_SUCCESS)
return FALSE;
@@ -582,7 +582,7 @@ void WheatyExceptionReport::GenerateExceptionReport(
CONTEXT trashableContext = *pCtx;
WriteStackDetails(&trashableContext, false, NULL);
WriteStackDetails(&trashableContext, false, nullptr);
printTracesForAllThreads(false);
// #ifdef _M_IX86 // X86 Only!
@@ -591,7 +591,7 @@ void WheatyExceptionReport::GenerateExceptionReport(
Log(_T("Local Variables And Parameters\r\n"));
trashableContext = *pCtx;
WriteStackDetails(&trashableContext, true, NULL);
WriteStackDetails(&trashableContext, true, nullptr);
printTracesForAllThreads(true);
SymCleanup(GetCurrentProcess());
@@ -764,7 +764,7 @@ void WheatyExceptionReport::WriteStackDetails(
// Get the next stack frame
if (! StackWalk64(dwMachineType,
m_hProcess,
pThreadHandle != NULL ? pThreadHandle : GetCurrentThread(),
pThreadHandle != nullptr ? pThreadHandle : GetCurrentThread(),
&sf,
pContext,
0,
@@ -969,7 +969,7 @@ void WheatyExceptionReport::DumpTypeIndex(
char buffer[50];
FormatOutputValue(buffer, btStdString, 0, (PVOID)offset, sizeof(buffer));
symbolDetails.top().Value = buffer;
if (Name != NULL && Name[0] != '\0')
if (Name != nullptr && Name[0] != '\0')
symbolDetails.top().Name = Name;
bHandled = true;
return;
@@ -978,7 +978,7 @@ void WheatyExceptionReport::DumpTypeIndex(
char buffer[WER_SMALL_BUFFER_SIZE];
wcstombs(buffer, pwszTypeName, sizeof(buffer));
buffer[WER_SMALL_BUFFER_SIZE - 1] = '\0';
if (Name != NULL && Name[0] != '\0')
if (Name != nullptr && Name[0] != '\0')
{
symbolDetails.top().Type = buffer;
symbolDetails.top().Name = Name;
@@ -988,7 +988,7 @@ void WheatyExceptionReport::DumpTypeIndex(
LocalFree(pwszTypeName);
}
else if (Name != NULL && Name[0] != '\0')
else if (Name != nullptr && Name[0] != '\0')
symbolDetails.top().Name = Name;
if (!StoreSymbol(dwTypeIndex, offset))
@@ -1005,7 +1005,7 @@ void WheatyExceptionReport::DumpTypeIndex(
case SymTagPointerType:
if (SymGetTypeInfo(m_hProcess, modBase, dwTypeIndex, TI_GET_TYPEID, &innerTypeID))
{
if (Name != NULL && Name[0] != '\0')
if (Name != nullptr && Name[0] != '\0')
symbolDetails.top().Name = Name;
BOOL isReference;
@@ -1083,7 +1083,7 @@ void WheatyExceptionReport::DumpTypeIndex(
offset, bHandled, symbolDetails.top().Name.c_str(), "", false, logChildren);
break;
case SymTagPointerType:
if (Name != NULL && Name[0] != '\0')
if (Name != nullptr && Name[0] != '\0')
symbolDetails.top().Name = Name;
DumpTypeIndex(modBase, innerTypeID,
offset, bHandled, symbolDetails.top().Name.c_str(), "", false, logChildren);

View File

@@ -28,7 +28,7 @@ public:
void DeregisterSelf(void) { FactoryHolderRegistry::instance()->RemoveItem(this, false); }
/// Abstract Factory create method
virtual T* Create(void* data = NULL) const = 0;
virtual T* Create(void* data = nullptr) const = 0;
private:
Key i_key;
};

View File

@@ -24,9 +24,9 @@ public:
[[nodiscard]] Reference<TO, FROM> const* getLast() const { return ((Reference<TO, FROM> const*) LinkedListHead::getLast()); }
iterator begin() { return iterator(getFirst()); }
iterator end() { return iterator(NULL); }
iterator end() { return iterator(nullptr); }
iterator rbegin() { return iterator(getLast()); }
iterator rend() { return iterator(NULL); }
iterator rend() { return iterator(nullptr); }
void clearReferences()
{

View File

@@ -33,7 +33,7 @@ public:
// Create new link
void link(TO* toObj, FROM* fromObj)
{
ASSERT(fromObj); // fromObj MUST not be NULL
ASSERT(fromObj); // fromObj MUST not be nullptr
if (isValid())
unlink();
if (toObj != nullptr)

View File

@@ -25,7 +25,7 @@ public:
const T* GetRegistryItem(Key key) const
{
typename RegistryMapType::const_iterator iter = i_registeredObjects.find(key);
return ( iter == i_registeredObjects.end() ? NULL : iter->second );
return ( iter == i_registeredObjects.end() ? nullptr : iter->second );
}
static ObjectRegistry<T, Key>* instance()

View File

@@ -86,20 +86,20 @@ template<class OBJECT_TYPES>
class TypeMapContainer
{
public:
template<class SPECIFIC_TYPE> [[nodiscard]] size_t Count() const { return acore::Count(i_elements, (SPECIFIC_TYPE*)NULL); }
template<class SPECIFIC_TYPE> [[nodiscard]] size_t Count() const { return acore::Count(i_elements, (SPECIFIC_TYPE*)nullptr); }
/// inserts a specific object into the container
template<class SPECIFIC_TYPE> bool insert(SPECIFIC_TYPE* obj)
{
SPECIFIC_TYPE* t = acore::Insert(i_elements, obj);
return (t != NULL);
return (t != nullptr);
}
/// Removes the object from the container, and returns the removed object
//template<class SPECIFIC_TYPE> bool remove(SPECIFIC_TYPE* obj)
//{
// SPECIFIC_TYPE* t = acore::Remove(i_elements, obj);
// return (t != NULL);
// return (t != nullptr);
//}
ContainerMapList<OBJECT_TYPES>& GetElements() { return i_elements; }

View File

@@ -56,20 +56,20 @@ namespace acore
template<class SPECIFIC_TYPE> SPECIFIC_TYPE* Insert(ContainerMapList<TypeNull>& /*elements*/, SPECIFIC_TYPE* /*obj*/)
{
return NULL;
return nullptr;
}
// this is a missed
template<class SPECIFIC_TYPE, class T> SPECIFIC_TYPE* Insert(ContainerMapList<T>& /*elements*/, SPECIFIC_TYPE* /*obj*/)
{
return NULL; // a missed
return nullptr; // a missed
}
// Recursion
template<class SPECIFIC_TYPE, class H, class T> SPECIFIC_TYPE* Insert(ContainerMapList<TypeList<H, T>>& elements, SPECIFIC_TYPE* obj)
{
SPECIFIC_TYPE* t = Insert(elements._elements, obj);
return (t != NULL ? t : Insert(elements._TailElements, obj));
return (t != nullptr ? t : Insert(elements._TailElements, obj));
}
//// non-const remove method
@@ -81,20 +81,20 @@ namespace acore
//template<class SPECIFIC_TYPE> SPECIFIC_TYPE* Remove(ContainerMapList<TypeNull> &/*elements*/, SPECIFIC_TYPE * /*obj*/)
//{
// return NULL;
// return nullptr;
//}
//// this is a missed
//template<class SPECIFIC_TYPE, class T> SPECIFIC_TYPE* Remove(ContainerMapList<T> &/*elements*/, SPECIFIC_TYPE * /*obj*/)
//{
// return NULL; // a missed
// return nullptr; // a missed
//}
//template<class SPECIFIC_TYPE, class T, class H> SPECIFIC_TYPE* Remove(ContainerMapList<TypeList<H, T> > &elements, SPECIFIC_TYPE *obj)
//{
// // The head element is bad
// SPECIFIC_TYPE* t = Remove(elements._elements, obj);
// return ( t != NULL ? t : Remove(elements._TailElements, obj) );
// return ( t != nullptr ? t : Remove(elements._TailElements, obj) );
//}
}
#endif

View File

@@ -50,17 +50,17 @@ namespace acore
template<class SPECIFIC_TYPE> CountedPtr<SPECIFIC_TYPE>& Find(ContainerMapList<SPECIFIC_TYPE>& elements, OBJECT_HANDLE hdl, CountedPtr<SPECIFIC_TYPE>* /*fake*/)
{
typename std::map<OBJECT_HANDLE, CountedPtr<SPECIFIC_TYPE>>::iterator iter = elements._element.find(hdl);
return (iter == elements._element.end() ? NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)NULL) : iter->second);
return (iter == elements._element.end() ? NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)nullptr) : iter->second);
};
template<class SPECIFIC_TYPE> CountedPtr<SPECIFIC_TYPE>& Find(ContainerMapList<TypeNull>& elements, OBJECT_HANDLE hdl, CountedPtr<SPECIFIC_TYPE>* /*fake*/)
{
return NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)NULL);// terminate recursion
return NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)nullptr);// terminate recursion
}
template<class SPECIFIC_TYPE, class T> CountedPtr<SPECIFIC_TYPE>& Find(ContainerMapList<T>& elements, OBJECT_HANDLE hdl, CountedPtr<SPECIFIC_TYPE>* /*fake*/)
{
return NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)NULL);// this is a missed
return NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)nullptr);// this is a missed
}
template<class SPECIFIC_TYPE, class H, class T> CountedPtr<SPECIFIC_TYPE>& Find(ContainerMapList<TypeList<H, T>>& elements, OBJECT_HANDLE hdl, CountedPtr<SPECIFIC_TYPE>* fake)
@@ -73,17 +73,17 @@ namespace acore
template<class SPECIFIC_TYPE> const CountedPtr<SPECIFIC_TYPE>& Find(const ContainerMapList<SPECIFIC_TYPE>& elements, OBJECT_HANDLE hdl, CountedPtr<SPECIFIC_TYPE>* /*fake*/)
{
typename CountedPtr<SPECIFIC_TYPE>::iterator iter = elements._element.find(hdl);
return (iter == elements._element.end() ? NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)NULL) : iter->second);
return (iter == elements._element.end() ? NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)nullptr) : iter->second);
};
template<class SPECIFIC_TYPE> const CountedPtr<SPECIFIC_TYPE>& Find(const ContainerMapList<TypeNull>& elements, OBJECT_HANDLE hdl, CountedPtr<SPECIFIC_TYPE>* /*fake*/)
{
return NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)NULL);
return NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)nullptr);
}
template<class SPECIFIC_TYPE, class T> const CountedPtr<SPECIFIC_TYPE>& Find(const ContainerMapList<T>& elements, OBJECT_HANDLE hdl, CountedPtr<SPECIFIC_TYPE>* /*fake*/)
{
return NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)NULL);
return NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)nullptr);
}
template<class SPECIFIC_TYPE, class H, class T> CountedPtr<SPECIFIC_TYPE>& Find(const ContainerMapList<TypeList<H, T>>& elements, OBJECT_HANDLE hdl, CountedPtr<SPECIFIC_TYPE>* fake)
@@ -104,13 +104,13 @@ namespace acore
template<class SPECIFIC_TYPE> CountedPtr<SPECIFIC_TYPE>& Insert(ContainerMapList<TypeNull>& elements, CountedPtr<SPECIFIC_TYPE>& obj, OBJECT_HANDLE hdl)
{
return NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)NULL);
return NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)nullptr);
}
// this is a missed
template<class SPECIFIC_TYPE, class T> CountedPtr<SPECIFIC_TYPE>& Insert(ContainerMapList<T>& elements, CountedPtr<SPECIFIC_TYPE>& obj, OBJECT_HANDLE hdl)
{
return NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)NULL);// a missed
return NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)nullptr);// a missed
}
// Recursion

View File

@@ -18,8 +18,8 @@ extern LoginDatabaseWorkerPool LoginDatabase;
#include <stdio.h>
Log::Log() :
raLogfile(NULL), logfile(NULL), gmLogfile(NULL), charLogfile(NULL),
dberLogfile(NULL), chatLogfile(NULL), sqlLogFile(NULL), sqlDevLogFile(NULL), miscLogFile(NULL),
raLogfile(nullptr), logfile(nullptr), gmLogfile(nullptr), charLogfile(nullptr),
dberLogfile(nullptr), chatLogfile(nullptr), sqlLogFile(nullptr), sqlDevLogFile(nullptr), miscLogFile(nullptr),
m_gmlog_per_account(false), m_enableLogDB(false), m_colored(false)
{
Initialize();
@@ -27,41 +27,41 @@ Log::Log() :
Log::~Log()
{
if (logfile != NULL)
if (logfile != nullptr)
fclose(logfile);
logfile = NULL;
logfile = nullptr;
if (gmLogfile != NULL)
if (gmLogfile != nullptr)
fclose(gmLogfile);
gmLogfile = NULL;
gmLogfile = nullptr;
if (charLogfile != NULL)
if (charLogfile != nullptr)
fclose(charLogfile);
charLogfile = NULL;
charLogfile = nullptr;
if (dberLogfile != NULL)
if (dberLogfile != nullptr)
fclose(dberLogfile);
dberLogfile = NULL;
dberLogfile = nullptr;
if (raLogfile != NULL)
if (raLogfile != nullptr)
fclose(raLogfile);
raLogfile = NULL;
raLogfile = nullptr;
if (chatLogfile != NULL)
if (chatLogfile != nullptr)
fclose(chatLogfile);
chatLogfile = NULL;
chatLogfile = nullptr;
if (sqlLogFile != NULL)
if (sqlLogFile != nullptr)
fclose(sqlLogFile);
sqlLogFile = NULL;
sqlLogFile = nullptr;
if (sqlDevLogFile != NULL)
if (sqlDevLogFile != nullptr)
fclose(sqlDevLogFile);
sqlDevLogFile = NULL;
sqlDevLogFile = nullptr;
if (miscLogFile != NULL)
if (miscLogFile != nullptr)
fclose(miscLogFile);
miscLogFile = NULL;
miscLogFile = nullptr;
}
std::unique_ptr<ILog>& getLogInstance()
@@ -145,11 +145,11 @@ void Log::Initialize()
}
charLogfile = openLogFile("CharLogFile", "CharLogTimestamp", "a");
dberLogfile = openLogFile("DBErrorLogFile", NULL, "a");
raLogfile = openLogFile("RaLogFile", NULL, "a");
dberLogfile = openLogFile("DBErrorLogFile", nullptr, "a");
raLogfile = openLogFile("RaLogFile", nullptr, "a");
chatLogfile = openLogFile("ChatLogFile", "ChatLogTimestamp", "a");
sqlLogFile = openLogFile("SQLDriverLogFile", NULL, "a");
sqlDevLogFile = openLogFile("SQLDeveloperLogFile", NULL, "a");
sqlLogFile = openLogFile("SQLDriverLogFile", nullptr, "a");
sqlDevLogFile = openLogFile("SQLDeveloperLogFile", nullptr, "a");
miscLogFile = fopen((m_logsDir + "Misc.log").c_str(), "a");
// Main log file settings
@@ -185,7 +185,7 @@ FILE* Log::openLogFile(char const* configFileName, char const* configTimeStampFl
{
std::string logfn = sConfigMgr->GetOption<std::string>(configFileName, "", false);
if (logfn.empty())
return NULL;
return nullptr;
if (configTimeStampFlag && sConfigMgr->GetOption<bool>(configTimeStampFlag, false, false))
{
@@ -202,7 +202,7 @@ FILE* Log::openLogFile(char const* configFileName, char const* configTimeStampFl
FILE* Log::openGmlogPerAccount(uint32 account)
{
if (m_gmlog_filename_format.empty())
return NULL;
return nullptr;
char namebuf[ACORE_PATH_MAX];
snprintf(namebuf, ACORE_PATH_MAX, m_gmlog_filename_format.c_str(), account);
@@ -211,7 +211,7 @@ FILE* Log::openGmlogPerAccount(uint32 account)
void Log::outTimestamp(FILE* file)
{
time_t t = time(NULL);
time_t t = time(nullptr);
tm* aTm = localtime(&t);
// YYYY year
// MM month (2 digits 01-12)
@@ -337,7 +337,7 @@ void Log::ResetColor(bool stdout_stream)
std::string Log::GetTimestampStr()
{
time_t t = time(NULL);
time_t t = time(nullptr);
tm aTm;
localtime_r(&t, &aTm);
// YYYY year
@@ -918,7 +918,7 @@ void Log::outChar(const char* str, ...)
void Log::outCharDump(const char* str, uint32 account_id, uint32 guid, const char* name)
{
FILE* file = NULL;
FILE* file = nullptr;
if (m_charLog_Dump_Separate)
{
char fileName[29]; // Max length: name(12) + guid(11) + _.log (5) + \0

View File

@@ -89,7 +89,7 @@ public:
//! Resets all underlying variables (param, result and stage)
void Reset()
{
SetParam(NULL);
SetParam(nullptr);
FreeResult();
ResetStage();
}
@@ -180,7 +180,7 @@ public:
void Reset()
{
SetFirstParam(0);
SetSecondParam(NULL);
SetSecondParam(nullptr);
FreeResult();
ResetStage();
}
@@ -281,9 +281,9 @@ public:
//! Resets all underlying variables (param, result and stage)
void Reset()
{
SetFirstParam(NULL);
SetSecondParam(NULL);
SetThirdParam(NULL);
SetFirstParam(nullptr);
SetSecondParam(nullptr);
SetThirdParam(nullptr);
FreeResult();
ResetStage();
}