Skip to content

Commit d88acf7

Browse files
committed
refactor: modernize NULL to nullptr in two more files
1 parent ab8c963 commit d88acf7

File tree

2 files changed

+48
-48
lines changed

2 files changed

+48
-48
lines changed

Core/GameEngine/Source/Common/System/MiniDumper.cpp

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
#include "gitinfo.h"
2525

2626
// Globals for storing the pointer to the exception
27-
_EXCEPTION_POINTERS* g_dumpException = NULL;
27+
_EXCEPTION_POINTERS* g_dumpException = nullptr;
2828
DWORD g_dumpExceptionThreadId = 0;
2929

30-
MiniDumper* TheMiniDumper = NULL;
30+
MiniDumper* TheMiniDumper = nullptr;
3131

3232
// Globals containing state about the current exception that's used for context in the mini dump.
3333
// These are populated by MiniDumper::DumpingExceptionFilter to store a copy of the exception in case it goes out of scope
@@ -39,7 +39,7 @@ constexpr const char* DumpFileNamePrefix = "Crash";
3939

4040
void MiniDumper::initMiniDumper(const AsciiString& userDirPath)
4141
{
42-
DEBUG_ASSERTCRASH(TheMiniDumper == NULL, ("MiniDumper::initMiniDumper called on already created instance"));
42+
DEBUG_ASSERTCRASH(TheMiniDumper == nullptr, ("MiniDumper::initMiniDumper called on already created instance"));
4343

4444
// Use placement new on the process heap so TheMiniDumper is placed outside the MemoryPoolFactory managed area.
4545
// If the crash is due to corrupted MemoryPoolFactory structures, try to mitigate the chances of MiniDumper memory also being corrupted
@@ -54,7 +54,7 @@ void MiniDumper::shutdownMiniDumper()
5454
TheMiniDumper->ShutDown();
5555
TheMiniDumper->~MiniDumper();
5656
::HeapFree(::GetProcessHeap(), NULL, TheMiniDumper);
57-
TheMiniDumper = NULL;
57+
TheMiniDumper = nullptr;
5858
}
5959
}
6060

@@ -63,10 +63,10 @@ MiniDumper::MiniDumper()
6363
m_miniDumpInitialized = false;
6464
m_loadedDbgHelp = false;
6565
m_requestedDumpType = DumpType_Minimal;
66-
m_dumpRequested = NULL;
67-
m_dumpComplete = NULL;
68-
m_quitting = NULL;
69-
m_dumpThread = NULL;
66+
m_dumpRequested = nullptr;
67+
m_dumpComplete = nullptr;
68+
m_quitting = nullptr;
69+
m_dumpThread = nullptr;
7070
m_dumpThreadId = 0;
7171
m_dumpDir[0] = 0;
7272
m_dumpFile[0] = 0;
@@ -145,7 +145,7 @@ void MiniDumper::Initialize(const AsciiString& userDirPath)
145145
return;
146146
}
147147

148-
DWORD executableSize = ::GetModuleFileNameW(NULL, m_executablePath, ARRAY_SIZE(m_executablePath));
148+
DWORD executableSize = ::GetModuleFileNameW(nullptr, m_executablePath, ARRAY_SIZE(m_executablePath));
149149
if (executableSize == 0 || executableSize == ARRAY_SIZE(m_executablePath))
150150
{
151151
DEBUG_LOG(("MiniDumper::Initialize: Could not get executable file name. Returned value=%u", executableSize));
@@ -158,18 +158,18 @@ void MiniDumper::Initialize(const AsciiString& userDirPath)
158158
return;
159159
}
160160

161-
m_dumpRequested = CreateEvent(NULL, TRUE, FALSE, NULL);
162-
m_dumpComplete = CreateEvent(NULL, TRUE, FALSE, NULL);
163-
m_quitting = CreateEvent(NULL, TRUE, FALSE, NULL);
161+
m_dumpRequested = CreateEvent(nullptr, TRUE, FALSE, nullptr);
162+
m_dumpComplete = CreateEvent(nullptr, TRUE, FALSE, nullptr);
163+
m_quitting = CreateEvent(nullptr, TRUE, FALSE, nullptr);
164164

165-
if (m_dumpRequested == NULL || m_dumpComplete == NULL || m_quitting == NULL)
165+
if (m_dumpRequested == nullptr || m_dumpComplete == nullptr || m_quitting == nullptr)
166166
{
167167
// Something went wrong with the creation of the events..
168168
DEBUG_LOG(("MiniDumper::Initialize: Unable to create events: error=%u", ::GetLastError()));
169169
return;
170170
}
171171

172-
m_dumpThread = ::CreateThread(NULL, 0, MiniDumpThreadProc, this, CREATE_SUSPENDED, &m_dumpThreadId);
172+
m_dumpThread = ::CreateThread(nullptr, 0, MiniDumpThreadProc, this, CREATE_SUSPENDED, &m_dumpThreadId);
173173
if (!m_dumpThread)
174174
{
175175
DEBUG_LOG(("MiniDumper::Initialize: Unable to create thread: error=%u", ::GetLastError()));
@@ -194,7 +194,7 @@ Bool MiniDumper::IsInitialized() const
194194
Bool MiniDumper::IsDumpThreadStillRunning() const
195195
{
196196
DWORD exitCode;
197-
if (m_dumpThread != NULL && ::GetExitCodeThread(m_dumpThread, &exitCode) && exitCode == STILL_ACTIVE)
197+
if (m_dumpThread != nullptr && ::GetExitCodeThread(m_dumpThread, &exitCode) && exitCode == STILL_ACTIVE)
198198
{
199199
return true;
200200
}
@@ -211,7 +211,7 @@ Bool MiniDumper::InitializeDumpDirectory(const AsciiString& userDirPath)
211211
strlcat(m_dumpDir, "CrashDumps\\", ARRAY_SIZE(m_dumpDir));
212212
if (::_access(m_dumpDir, 0) != 0)
213213
{
214-
if (!::CreateDirectory(m_dumpDir, NULL))
214+
if (!::CreateDirectory(m_dumpDir, nullptr))
215215
{
216216
DEBUG_LOG(("MiniDumper::Initialize: Unable to create path for crash dumps at '%s': error=%u", m_dumpDir, ::GetLastError()));
217217
return false;
@@ -229,7 +229,7 @@ void MiniDumper::ShutdownDumpThread()
229229
{
230230
if (IsDumpThreadStillRunning())
231231
{
232-
DEBUG_ASSERTCRASH(m_quitting != NULL, ("MiniDumper::ShutdownDumpThread: Dump thread still running despite m_quitting being NULL"));
232+
DEBUG_ASSERTCRASH(m_quitting != nullptr, ("MiniDumper::ShutdownDumpThread: Dump thread still running despite m_quitting being nullptr"));
233233
::SetEvent(m_quitting);
234234

235235
DWORD waitRet = ::WaitForSingleObject(m_dumpThread, 3000);
@@ -256,29 +256,29 @@ void MiniDumper::ShutDown()
256256
{
257257
ShutdownDumpThread();
258258

259-
if (m_dumpThread != NULL)
259+
if (m_dumpThread != nullptr)
260260
{
261261
DEBUG_ASSERTCRASH(!IsDumpThreadStillRunning(), ("MiniDumper::ShutDown: ShutdownDumpThread() was unable to stop Dump thread"));
262262
::CloseHandle(m_dumpThread);
263-
m_dumpThread = NULL;
263+
m_dumpThread = nullptr;
264264
}
265265

266-
if (m_quitting != NULL)
266+
if (m_quitting != nullptr)
267267
{
268268
::CloseHandle(m_quitting);
269-
m_quitting = NULL;
269+
m_quitting = nullptr;
270270
}
271271

272-
if (m_dumpComplete != NULL)
272+
if (m_dumpComplete != nullptr)
273273
{
274274
::CloseHandle(m_dumpComplete);
275-
m_dumpComplete = NULL;
275+
m_dumpComplete = nullptr;
276276
}
277277

278-
if (m_dumpRequested != NULL)
278+
if (m_dumpRequested != nullptr)
279279
{
280280
::CloseHandle(m_dumpRequested);
281-
m_dumpRequested = NULL;
281+
m_dumpRequested = nullptr;
282282
}
283283

284284
if (m_loadedDbgHelp)
@@ -320,9 +320,9 @@ DWORD MiniDumper::ThreadProcInternal()
320320

321321
DWORD WINAPI MiniDumper::MiniDumpThreadProc(LPVOID lpParam)
322322
{
323-
if (lpParam == NULL)
323+
if (lpParam == nullptr)
324324
{
325-
DEBUG_LOG(("MiniDumper::MiniDumpThreadProc: The provided parameter was NULL, exiting thread."));
325+
DEBUG_LOG(("MiniDumper::MiniDumpThreadProc: The provided parameter was nullptr, exiting thread."));
326326
return MiniDumperExitCode_FailureParam;
327327
}
328328

@@ -350,16 +350,16 @@ void MiniDumper::CreateMiniDump(DumpType dumpType)
350350
sysTime.wDay, sysTime.wHour, sysTime.wMinute, sysTime.wSecond,
351351
GitShortSHA1, currentProcessId);
352352

353-
HANDLE dumpFile = ::CreateFile(m_dumpFile, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
354-
if (dumpFile == NULL || dumpFile == INVALID_HANDLE_VALUE)
353+
HANDLE dumpFile = ::CreateFile(m_dumpFile, GENERIC_READ | GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
354+
if (dumpFile == nullptr || dumpFile == INVALID_HANDLE_VALUE)
355355
{
356356
DEBUG_LOG(("MiniDumper::CreateMiniDump: Unable to create dump file '%s': error=%u", m_dumpFile, ::GetLastError()));
357357
return;
358358
}
359359

360-
PMINIDUMP_EXCEPTION_INFORMATION exceptionInfoPtr = NULL;
360+
PMINIDUMP_EXCEPTION_INFORMATION exceptionInfoPtr = nullptr;
361361
MINIDUMP_EXCEPTION_INFORMATION exceptionInfo = { 0 };
362-
if (g_dumpException != NULL)
362+
if (g_dumpException != nullptr)
363363
{
364364
exceptionInfo.ExceptionPointers = g_dumpException;
365365
exceptionInfo.ThreadId = g_dumpExceptionThreadId;
@@ -386,8 +386,8 @@ void MiniDumper::CreateMiniDump(DumpType dumpType)
386386
dumpFile,
387387
miniDumpType,
388388
exceptionInfoPtr,
389-
NULL,
390-
NULL);
389+
nullptr,
390+
nullptr);
391391

392392
if (!success)
393393
{

Core/Libraries/Source/WWVegas/WWLib/DbgHelpLoader.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include "DbgHelpLoader.h"
2020

2121

22-
DbgHelpLoader* DbgHelpLoader::Inst = NULL;
22+
DbgHelpLoader* DbgHelpLoader::Inst = nullptr;
2323
CriticalSectionClass DbgHelpLoader::CriticalSection;
2424

2525
DbgHelpLoader::DbgHelpLoader()
@@ -34,7 +34,7 @@ DbgHelpLoader::DbgHelpLoader()
3434
, m_symFunctionTableAccess(NULL)
3535
, m_stackWalk(NULL)
3636
#ifdef RTS_ENABLE_CRASHDUMP
37-
, m_miniDumpWriteDump(NULL)
37+
, m_miniDumpWriteDump(nullptr)
3838
#endif
3939
, m_dllModule(HMODULE(0))
4040
, m_referenceCount(0)
@@ -51,7 +51,7 @@ bool DbgHelpLoader::isLoaded()
5151
{
5252
CriticalSectionClass::LockClass lock(CriticalSection);
5353

54-
return Inst != NULL && Inst->m_dllModule != HMODULE(0);
54+
return Inst != nullptr && Inst->m_dllModule != HMODULE(0);
5555
}
5656

5757
bool DbgHelpLoader::isLoadedFromSystem()
@@ -65,14 +65,14 @@ bool DbgHelpLoader::isFailed()
6565
{
6666
CriticalSectionClass::LockClass lock(CriticalSection);
6767

68-
return Inst != NULL && Inst->m_failed;
68+
return Inst != nullptr && Inst->m_failed;
6969
}
7070

7171
bool DbgHelpLoader::load()
7272
{
7373
CriticalSectionClass::LockClass lock(CriticalSection);
7474

75-
if (Inst == NULL)
75+
if (Inst == nullptr)
7676
{
7777
// Cannot use new/delete here when this is loaded during game memory initialization.
7878
void* p = GlobalAlloc(GMEM_FIXED, sizeof(DbgHelpLoader));
@@ -139,7 +139,7 @@ void DbgHelpLoader::unload()
139139
{
140140
CriticalSectionClass::LockClass lock(CriticalSection);
141141

142-
if (Inst == NULL)
142+
if (Inst == nullptr)
143143
return;
144144

145145
if (--Inst->m_referenceCount != 0)
@@ -149,7 +149,7 @@ void DbgHelpLoader::unload()
149149

150150
Inst->~DbgHelpLoader();
151151
GlobalFree(Inst);
152-
Inst = NULL;
152+
Inst = nullptr;
153153
}
154154

155155
void DbgHelpLoader::freeResources()
@@ -242,7 +242,7 @@ BOOL DbgHelpLoader::symLoadModule(
242242
{
243243
CriticalSectionClass::LockClass lock(CriticalSection);
244244

245-
if (Inst != NULL && Inst->m_symLoadModule)
245+
if (Inst != nullptr && Inst->m_symLoadModule)
246246
return Inst->m_symLoadModule(hProcess, hFile, ImageName, ModuleName, BaseOfDll, SizeOfDll);
247247

248248
return FALSE;
@@ -254,7 +254,7 @@ DWORD DbgHelpLoader::symGetModuleBase(
254254
{
255255
CriticalSectionClass::LockClass lock(CriticalSection);
256256

257-
if (Inst != NULL && Inst->m_symGetModuleBase)
257+
if (Inst != nullptr && Inst->m_symGetModuleBase)
258258
return Inst->m_symGetModuleBase(hProcess, dwAddr);
259259

260260
return 0u;
@@ -266,7 +266,7 @@ BOOL DbgHelpLoader::symUnloadModule(
266266
{
267267
CriticalSectionClass::LockClass lock(CriticalSection);
268268

269-
if (Inst != NULL && Inst->m_symUnloadModule)
269+
if (Inst != nullptr && Inst->m_symUnloadModule)
270270
return Inst->m_symUnloadModule(hProcess, BaseOfDll);
271271

272272
return FALSE;
@@ -280,7 +280,7 @@ BOOL DbgHelpLoader::symGetSymFromAddr(
280280
{
281281
CriticalSectionClass::LockClass lock(CriticalSection);
282282

283-
if (Inst != NULL && Inst->m_symGetSymFromAddr)
283+
if (Inst != nullptr && Inst->m_symGetSymFromAddr)
284284
return Inst->m_symGetSymFromAddr(hProcess, Address, Displacement, Symbol);
285285

286286
return FALSE;
@@ -294,7 +294,7 @@ BOOL DbgHelpLoader::symGetLineFromAddr(
294294
{
295295
CriticalSectionClass::LockClass lock(CriticalSection);
296296

297-
if (Inst != NULL && Inst->m_symGetLineFromAddr)
297+
if (Inst != nullptr && Inst->m_symGetLineFromAddr)
298298
return Inst->m_symGetLineFromAddr(hProcess, dwAddr, pdwDisplacement, Line);
299299

300300
return FALSE;
@@ -305,7 +305,7 @@ DWORD DbgHelpLoader::symSetOptions(
305305
{
306306
CriticalSectionClass::LockClass lock(CriticalSection);
307307

308-
if (Inst != NULL && Inst->m_symSetOptions)
308+
if (Inst != nullptr && Inst->m_symSetOptions)
309309
return Inst->m_symSetOptions(SymOptions);
310310

311311
return 0u;
@@ -317,7 +317,7 @@ LPVOID DbgHelpLoader::symFunctionTableAccess(
317317
{
318318
CriticalSectionClass::LockClass lock(CriticalSection);
319319

320-
if (Inst != NULL && Inst->m_symFunctionTableAccess)
320+
if (Inst != nullptr && Inst->m_symFunctionTableAccess)
321321
return Inst->m_symFunctionTableAccess(hProcess, AddrBase);
322322

323323
return NULL;
@@ -336,7 +336,7 @@ BOOL DbgHelpLoader::stackWalk(
336336
{
337337
CriticalSectionClass::LockClass lock(CriticalSection);
338338

339-
if (Inst != NULL && Inst->m_stackWalk)
339+
if (Inst != nullptr && Inst->m_stackWalk)
340340
return Inst->m_stackWalk(MachineType, hProcess, hThread, StackFrame, ContextRecord, ReadMemoryRoutine, FunctionTableAccessRoutine, GetModuleBaseRoutine, TranslateAddress);
341341

342342
return FALSE;

0 commit comments

Comments
 (0)