Skip to content

Commit 3c433c3

Browse files
committed
refactor: convert pointer assignments and comparisons from NULL to nullptr
1 parent 2b44d0b commit 3c433c3

File tree

251 files changed

+806
-808
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

251 files changed

+806
-808
lines changed

Core/GameEngine/Include/Common/AsciiString.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ class AsciiString
353353
token was found. (note that this modifies 'this' as well, stripping
354354
the token off!)
355355
*/
356-
Bool nextToken(AsciiString* token, const char* seps = NULL);
356+
Bool nextToken(AsciiString* token, const char* seps = nullptr);
357357

358358
/**
359359
return true iff the string is "NONE" (case-insensitive).
@@ -420,7 +420,7 @@ inline int AsciiString::getByteCount() const
420420
inline Bool AsciiString::isEmpty() const
421421
{
422422
validate();
423-
return m_data == NULL || peek()[0] == 0;
423+
return m_data == nullptr || peek()[0] == 0;
424424
}
425425

426426
// -----------------------------------------------------

Core/GameEngine/Include/Common/UnicodeString.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ inline int UnicodeString::getByteCount() const
394394
inline Bool UnicodeString::isEmpty() const
395395
{
396396
validate();
397-
return m_data == NULL || peek()[0] == 0;
397+
return m_data == nullptr || peek()[0] == 0;
398398
}
399399

400400
// -----------------------------------------------------

Core/GameEngine/Include/GameNetwork/WOLBrowser/FEBDispatch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public C
6060
HRESULT TypeLibraryLoadResult;
6161
char filename[256];
6262

63-
GetModuleFileName(NULL, filename, sizeof(filename));
63+
GetModuleFileName(nullptr, filename, sizeof(filename));
6464
_bstr_t bstr(filename);
6565

6666
TypeLibraryLoadResult = LoadTypeLib(bstr, &ptlib);

Core/GameEngine/Source/Common/Audio/simpleplayer.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ CSimplePlayer::CSimplePlayer( HRESULT* phr )
3838

3939
*phr = S_OK;
4040

41-
m_hOpenEvent = CreateEvent( NULL, FALSE, FALSE, SIMPLE_PLAYER_OPEN_EVENT );
41+
m_hOpenEvent = CreateEvent( nullptr, FALSE, FALSE, SIMPLE_PLAYER_OPEN_EVENT );
4242
if ( NULL == m_hOpenEvent )
4343
{
4444
*phr = E_OUTOFMEMORY;
4545
}
46-
m_hCloseEvent = CreateEvent( NULL, FALSE, FALSE, SIMPLE_PLAYER_CLOSE_EVENT );
46+
m_hCloseEvent = CreateEvent( nullptr, FALSE, FALSE, SIMPLE_PLAYER_CLOSE_EVENT );
4747
if ( NULL == m_hCloseEvent )
4848
{
4949
*phr = E_OUTOFMEMORY;
@@ -267,11 +267,11 @@ HRESULT CSimplePlayer::Play( LPCWSTR pszUrl, DWORD dwSecDuration, HANDLE hComple
267267

268268
#ifdef SUPPORT_DRM
269269

270-
hr = WMCreateReader( NULL, WMT_RIGHT_PLAYBACK, &m_pReader );
270+
hr = WMCreateReader( , WMT_RIGHT_PLAYBACK, &m_pReader );
271271

272272
#else
273273

274-
hr = WMCreateReader( NULL, 0, &m_pReader );
274+
hr = WMCreateReader( , 0, &m_pReader );
275275

276276
#endif
277277

@@ -429,7 +429,7 @@ HRESULT CSimplePlayer::Play( LPCWSTR pszUrl, DWORD dwSecDuration, HANDLE hComple
429429

430430
DWORD cbBuffer = 0;
431431

432-
hr = pProps->GetMediaType( NULL, &cbBuffer );
432+
hr = pProps->GetMediaType( , &cbBuffer );
433433
if ( FAILED( hr ) )
434434
{
435435
pProps->Release( );

Core/GameEngine/Source/Common/Audio/urllaunch.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
///////////////////////////////////////////////////////////////////////////////
2727
HRESULT MakeEscapedURL( LPWSTR pszInURL, LPWSTR *ppszOutURL )
2828
{
29-
if( ( NULL == pszInURL ) || ( NULL == ppszOutURL ) )
29+
if( ( nullptr == pszInURL ) || ( nullptr == ppszOutURL ) )
3030
{
3131
return( E_INVALIDARG );
3232
}
@@ -46,7 +46,7 @@ HRESULT MakeEscapedURL( LPWSTR pszInURL, LPWSTR *ppszOutURL )
4646
{
4747
LPWSTR pchToEscape = wcspbrk( pszTemp, L" #$%&\\+,;=@[]^{}" );
4848

49-
if( NULL == pchToEscape )
49+
if( nullptr == pchToEscape )
5050
{
5151
break;
5252
}
@@ -68,7 +68,7 @@ HRESULT MakeEscapedURL( LPWSTR pszInURL, LPWSTR *ppszOutURL )
6868

6969
*ppszOutURL = new WCHAR[ cchNeeded ];
7070

71-
if( NULL == *ppszOutURL )
71+
if( nullptr == *ppszOutURL )
7272
{
7373
return( E_OUTOFMEMORY );
7474
}
@@ -90,7 +90,7 @@ HRESULT MakeEscapedURL( LPWSTR pszInURL, LPWSTR *ppszOutURL )
9090
{
9191
LPWSTR pchToEscape = wcspbrk( pszTemp, L" #$%&\\+,;=@[]^{}" );
9292

93-
if( NULL == pchToEscape )
93+
if( nullptr == pchToEscape )
9494
{
9595
//
9696
// Copy the rest of the input string and get out
@@ -187,7 +187,7 @@ HRESULT GetShellOpenCommand( LPTSTR ptszShellOpenCommand, DWORD cbShellOpenComma
187187
//
188188
if( !fFoundExtensionCommand )
189189
{
190-
if( NULL != hKey )
190+
if( nullptr != hKey )
191191
{
192192
RegCloseKey( hKey );
193193
}
@@ -211,12 +211,12 @@ HRESULT GetShellOpenCommand( LPTSTR ptszShellOpenCommand, DWORD cbShellOpenComma
211211
while( FALSE );
212212
}
213213

214-
if( NULL != hKey )
214+
if( nullptr != hKey )
215215
{
216216
RegCloseKey( hKey );
217217
}
218218

219-
if( NULL != hFileKey )
219+
if( nullptr != hFileKey )
220220
{
221221
RegCloseKey( hFileKey );
222222
}
@@ -249,12 +249,12 @@ HRESULT LaunchURL( LPCWSTR pszURL )
249249

250250
LPTSTR pszParam = _tcsstr( szShellOpenCommand, _T( "\"%1\"" ) );
251251

252-
if( NULL == pszParam )
252+
if( nullptr == pszParam )
253253
{
254254
pszParam = _tcsstr( szShellOpenCommand, _T( "\"%*\"" ) );
255255
}
256256

257-
if( NULL != pszParam )
257+
if( nullptr != pszParam )
258258
{
259259
*pszParam = _T( '\0' ) ;
260260

@@ -288,7 +288,7 @@ HRESULT LaunchURL( LPCWSTR pszURL )
288288
pchNext = _tcschr( pchFirst + 1, _T( ' ' ) );
289289
}
290290

291-
if( NULL == pchNext )
291+
if( nullptr == pchNext )
292292
{
293293
pchNext = szShellOpenCommand + _tcslen( szShellOpenCommand );
294294
}
@@ -313,8 +313,8 @@ HRESULT LaunchURL( LPCWSTR pszURL )
313313

314314
StartUp.cb = sizeof(STARTUPINFO);
315315

316-
if( !CreateProcess( szExe, szLaunchCommand, nullptr, NULL,
317-
FALSE, 0, nullptr, NULL, &StartUp, &ProcInfo) )
316+
if( !CreateProcess( szExe, szLaunchCommand, nullptr, nullptr,
317+
FALSE, 0, nullptr, nullptr, &StartUp, &ProcInfo) )
318318
{
319319
hr = HRESULT_FROM_WIN32( GetLastError() );
320320
}
@@ -324,12 +324,12 @@ HRESULT LaunchURL( LPCWSTR pszURL )
324324
// CreateProcess succeeded and we do not need the handles to the thread
325325
// or the process, so close them now.
326326
//
327-
if( NULL != ProcInfo.hThread )
327+
if( nullptr != ProcInfo.hThread )
328328
{
329329
CloseHandle( ProcInfo.hThread );
330330
}
331331

332-
if( NULL != ProcInfo.hProcess )
332+
if( nullptr != ProcInfo.hProcess )
333333
{
334334
CloseHandle( ProcInfo.hProcess );
335335
}

Core/GameEngine/Source/Common/CRCDebug.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ static AsciiString getFname(AsciiString path)
188188

189189
static void addCRCDebugLineInternal(bool count, const char *fmt, va_list args)
190190
{
191-
if (TheGameLogic == NULL || !(IS_FRAME_OK_TO_LOG))
191+
if (TheGameLogic == nullptr || !(IS_FRAME_OK_TO_LOG))
192192
return;
193193

194194
if (lastCRCDebugFrame != TheGameLogic->getFrame())

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ void DebugInit(int flags)
378378
return;
379379

380380
char dirbuf[ _MAX_PATH ];
381-
::GetModuleFileName( NULL, dirbuf, sizeof( dirbuf ) );
381+
::GetModuleFileName( nullptr, dirbuf, sizeof( dirbuf ) );
382382
if (char *pEnd = strrchr(dirbuf, '\\'))
383383
{
384384
*(pEnd + 1) = 0;
@@ -809,7 +809,7 @@ void ReleaseCrash(const char *reason)
809809
#if defined(RTS_DEBUG)
810810
/* static */ char buff[8192]; // not so static so we can be threadsafe
811811
snprintf(buff, 8192, "Sorry, a serious error occurred. (%s)", reason);
812-
::MessageBox(NULL, buff, "Technical Difficulties...", MB_OK|MB_SYSTEMMODAL|MB_ICONERROR);
812+
::MessageBox(nullptr, buff, "Technical Difficulties...", MB_OK|MB_SYSTEMMODAL|MB_ICONERROR);
813813
#else
814814
// crash error messaged changed 3/6/03 BGC
815815
// ::MessageBox(NULL, "Sorry, a serious error occurred.", "Technical Difficulties...", MB_OK|MB_TASKMODAL|MB_ICONERROR);

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ inline MemoryPoolSingleBlock *MemoryPoolSingleBlock::getNextRawBlock()
616616
*/
617617
inline void MemoryPoolSingleBlock::setNextRawBlock(MemoryPoolSingleBlock *b)
618618
{
619-
DEBUG_ASSERTCRASH(m_owningBlob == NULL && (!b || b->m_owningBlob == nullptr), ("must be called on raw block"));
619+
DEBUG_ASSERTCRASH(m_owningBlob == nullptr && (!b || b->m_owningBlob == nullptr), ("must be called on raw block"));
620620
m_nextBlock = b;
621621
#ifdef MPSB_DLINK
622622
if (b)
@@ -942,7 +942,7 @@ void MemoryPoolSingleBlock::removeBlockFromList(MemoryPoolSingleBlock **pHead)
942942
{
943943
DEBUG_ASSERTCRASH(this->m_owningBlob == nullptr, ("this function should only be used on raw blocks"));
944944
#ifdef MPSB_DLINK
945-
DEBUG_ASSERTCRASH(this->m_nextBlock == NULL || this->m_nextBlock->m_owningBlob == nullptr, ("this function should only be used on raw blocks"));
945+
DEBUG_ASSERTCRASH(this->m_nextBlock == nullptr || this->m_nextBlock->m_owningBlob == nullptr, ("this function should only be used on raw blocks"));
946946
if (this->m_prevBlock)
947947
{
948948
DEBUG_ASSERTCRASH(this->m_prevBlock->m_owningBlob == nullptr, ("this function should only be used on raw blocks"));
@@ -1038,11 +1038,11 @@ void MemoryPoolSingleBlock::debugVerifyBlock()
10381038
DEBUG_ASSERTCRASH(m_debugLiteralTagString != nullptr, ("bad tagstring"));
10391039
/// @todo Put this check back in after the AI memory usage is under control (MSB)
10401040
//DEBUG_ASSERTCRASH(m_logicalSize>0 && m_logicalSize < 0x00ffffff, ("unlikely value for m_logicalSize"));
1041-
DEBUG_ASSERTCRASH(m_nextBlock == NULL
1041+
DEBUG_ASSERTCRASH(m_nextBlock == nullptr
10421042
|| memcmp(&m_nextBlock->m_owningBlob, &s_initFillerValue, sizeof(s_initFillerValue)) == 0
10431043
|| m_nextBlock->m_owningBlob == m_owningBlob, ("owning blob mismatch..."));
10441044
#ifdef MPSB_DLINK
1045-
DEBUG_ASSERTCRASH(m_prevBlock == NULL
1045+
DEBUG_ASSERTCRASH(m_prevBlock == nullptr
10461046
|| memcmp(&m_prevBlock->m_owningBlob, &s_initFillerValue, sizeof(s_initFillerValue)) == 0
10471047
|| m_prevBlock->m_owningBlob == m_owningBlob, ("owning blob mismatch..."));
10481048
#endif
@@ -3118,7 +3118,7 @@ void MemoryPoolFactory::debugMemoryReport(Int flags, Int startCheckpoint, Int en
31183118
fprintf( fp, "Begin Pool Info Report\n" );
31193119
fprintf( fp, "------------------------------------------\n" );
31203120
}
3121-
MemoryPool::debugPoolInfoReport( NULL, fp );
3121+
MemoryPool::debugPoolInfoReport( , fp );
31223122
for (MemoryPool *pool = m_firstPoolInFactory; pool; pool = pool->getNextPoolInList())
31233123
{
31243124
MemoryPool::debugPoolInfoReport( pool, fp );
@@ -3210,7 +3210,7 @@ void MemoryPoolFactory::debugMemoryReport(Int flags, Int startCheckpoint, Int en
32103210
DEBUG_LOG(("Options: Between checkpoints %d and %d, report on (%s)",startCheckpoint,endCheckpoint,buf));
32113211
DEBUG_LOG(("------------------------------------------"));
32123212

3213-
BlockCheckpointInfo::doBlockCheckpointReport( NULL, "", 0, 0, 0 );
3213+
BlockCheckpointInfo::doBlockCheckpointReport( , "", 0, 0, 0 );
32143214
for (MemoryPool *pool = m_firstPoolInFactory; pool; pool = pool->getNextPoolInList())
32153215
{
32163216
pool->debugCheckpointReport(flags, startCheckpoint, endCheckpoint, pool->getPoolName());

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ void MemoryPoolFactory::debugSetInitFillerIndex(Int index)
108108
*/
109109
void initMemoryManager()
110110
{
111-
if (TheMemoryPoolFactory == NULL && TheDynamicMemoryAllocator == nullptr)
111+
if (TheMemoryPoolFactory == nullptr && TheDynamicMemoryAllocator == nullptr)
112112
{
113113
TheMemoryPoolFactory = new (malloc(sizeof MemoryPoolFactory)) MemoryPoolFactory;
114114
TheDynamicMemoryAllocator = new (malloc(sizeof DynamicMemoryAllocator)) DynamicMemoryAllocator;

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void MiniDumper::shutdownMiniDumper()
5454
{
5555
TheMiniDumper->ShutDown();
5656
TheMiniDumper->~MiniDumper();
57-
::HeapFree(::GetProcessHeap(), nullptr, TheMiniDumper);
57+
::HeapFree(::GetProcessHeap(), 0, TheMiniDumper);
5858
TheMiniDumper = nullptr;
5959
}
6060
}
@@ -146,7 +146,7 @@ void MiniDumper::Initialize(const AsciiString& userDirPath)
146146
return;
147147
}
148148

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

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

166166
if (m_dumpRequested == NULL || m_dumpComplete == NULL || m_quitting == nullptr)
167167
{
@@ -170,7 +170,7 @@ void MiniDumper::Initialize(const AsciiString& userDirPath)
170170
return;
171171
}
172172

173-
m_dumpThread = ::CreateThread(NULL, 0, MiniDumpThreadProc, this, CREATE_SUSPENDED, &m_dumpThreadId);
173+
m_dumpThread = ::CreateThread(nullptr, 0, MiniDumpThreadProc, this, CREATE_SUSPENDED, &m_dumpThreadId);
174174
if (!m_dumpThread)
175175
{
176176
DEBUG_LOG(("MiniDumper::Initialize: Unable to create thread: error=%u", ::GetLastError()));
@@ -351,7 +351,7 @@ void MiniDumper::CreateMiniDump(DumpType dumpType)
351351
sysTime.wDay, sysTime.wHour, sysTime.wMinute, sysTime.wSecond,
352352
GitShortSHA1, currentProcessId);
353353

354-
HANDLE dumpFile = ::CreateFile(m_dumpFile, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
354+
HANDLE dumpFile = ::CreateFile(m_dumpFile, GENERIC_READ | GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
355355
if (dumpFile == NULL || dumpFile == INVALID_HANDLE_VALUE)
356356
{
357357
DEBUG_LOG(("MiniDumper::CreateMiniDump: Unable to create dump file '%s': error=%u", m_dumpFile, ::GetLastError()));
@@ -387,8 +387,8 @@ void MiniDumper::CreateMiniDump(DumpType dumpType)
387387
dumpFile,
388388
miniDumpType,
389389
exceptionInfoPtr,
390-
NULL,
391-
NULL);
390+
nullptr,
391+
nullptr);
392392

393393
if (!success)
394394
{

0 commit comments

Comments
 (0)