Skip to content

Commit 441ace4

Browse files
committed
Convert NULL to nullptr in pointer comparisons
1 parent 9098a2b commit 441ace4

File tree

72 files changed

+148
-148
lines changed

Some content is hidden

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

72 files changed

+148
-148
lines changed

Core/GameEngine/Include/Common/AsciiString.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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/Source/Common/Audio/simpleplayer.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ CSimplePlayer::CSimplePlayer( HRESULT* phr )
3939
*phr = S_OK;
4040

4141
m_hOpenEvent = CreateEvent( nullptr, FALSE, FALSE, SIMPLE_PLAYER_OPEN_EVENT );
42-
if ( NULL == m_hOpenEvent )
42+
if ( nullptr == m_hOpenEvent )
4343
{
4444
*phr = E_OUTOFMEMORY;
4545
}
4646
m_hCloseEvent = CreateEvent( nullptr, FALSE, FALSE, SIMPLE_PLAYER_CLOSE_EVENT );
47-
if ( NULL == m_hCloseEvent )
47+
if ( nullptr == m_hCloseEvent )
4848
{
4949
*phr = E_OUTOFMEMORY;
5050
}
@@ -165,7 +165,7 @@ HRESULT STDMETHODCALLTYPE CSimplePlayer::OnSample(
165165

166166
LPWAVEHDR pwh = (LPWAVEHDR) new BYTE[ sizeof( WAVEHDR ) + cbData ];
167167

168-
if( NULL == pwh )
168+
if( nullptr == pwh )
169169
{
170170
DEBUG_LOG(( "OnSample OUT OF MEMORY! "));
171171

@@ -234,7 +234,7 @@ HRESULT CSimplePlayer::Play( LPCWSTR pszUrl, DWORD dwSecDuration, HANDLE hComple
234234
//
235235
LPWSTR pszCheck = _wfullpath( wszFullUrl, pszUrl, MAX_PATH );
236236

237-
if( NULL == pszCheck )
237+
if( nullptr == pszCheck )
238238
{
239239
DEBUG_LOG(( "internal error %lu" , GetLastError() ));
240240
return E_UNEXPECTED ;
@@ -250,7 +250,7 @@ HRESULT CSimplePlayer::Play( LPCWSTR pszUrl, DWORD dwSecDuration, HANDLE hComple
250250

251251
m_pszUrl = new WCHAR[ wcslen( pszUrl ) + 1 ];
252252

253-
if( NULL == m_pszUrl )
253+
if( nullptr == m_pszUrl )
254254
{
255255
DEBUG_LOG(( "insufficient Memory" )) ;
256256
return( E_OUTOFMEMORY );
@@ -342,7 +342,7 @@ HRESULT CSimplePlayer::Play( LPCWSTR pszUrl, DWORD dwSecDuration, HANDLE hComple
342342
pwszName = new WCHAR[ cchNamelen ];
343343
pValue = new BYTE[ cbLength ];
344344

345-
if( NULL == pwszName || NULL == pValue )
345+
if( nullptr == pwszName || nullptr == pValue )
346346
{
347347
hr = E_OUTOFMEMORY;
348348
break;
@@ -625,7 +625,7 @@ HRESULT CSimplePlayer::Close()
625625
{
626626
HRESULT hr = S_OK;
627627

628-
if( NULL != m_pReader )
628+
if( nullptr != m_pReader )
629629
{
630630
hr = m_pReader->Close();
631631

@@ -677,7 +677,7 @@ void CALLBACK CSimplePlayer::WaveProc(
677677
HRESULT CSimplePlayer::AddWaveHeader( LPWAVEHDR pwh )
678678
{
679679
WAVEHDR_LIST *tmp = new WAVEHDR_LIST;
680-
if( NULL == tmp )
680+
if( nullptr == tmp )
681681
{
682682
return( E_OUTOFMEMORY );
683683
}
@@ -696,7 +696,7 @@ void CSimplePlayer::RemoveWaveHeaders( )
696696
WAVEHDR_LIST *tmp;
697697

698698
EnterCriticalSection( &m_CriSec );
699-
while( NULL != m_whdrHead )
699+
while( nullptr != m_whdrHead )
700700
{
701701
tmp = m_whdrHead->next;
702702
DEBUG_ASSERTCRASH( m_whdrHead->pwh->dwFlags & WHDR_DONE, ("RemoveWaveHeaders!") );

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

Lines changed: 12 additions & 12 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
}
@@ -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/GameMemory.cpp

Lines changed: 4 additions & 4 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

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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ void MiniDumper::Initialize(const AsciiString& userDirPath)
163163
m_dumpComplete = CreateEvent(nullptr, TRUE, FALSE, nullptr);
164164
m_quitting = CreateEvent(nullptr, TRUE, FALSE, nullptr);
165165

166-
if (m_dumpRequested == NULL || m_dumpComplete == NULL || m_quitting == nullptr)
166+
if (m_dumpRequested == nullptr || m_dumpComplete == nullptr || m_quitting == nullptr)
167167
{
168168
// Something went wrong with the creation of the events..
169169
DEBUG_LOG(("MiniDumper::Initialize: Unable to create events: error=%u", ::GetLastError()));
@@ -195,7 +195,7 @@ Bool MiniDumper::IsInitialized() const
195195
Bool MiniDumper::IsDumpThreadStillRunning() const
196196
{
197197
DWORD exitCode;
198-
if (m_dumpThread != NULL && ::GetExitCodeThread(m_dumpThread, &exitCode) && exitCode == STILL_ACTIVE)
198+
if (m_dumpThread != nullptr && ::GetExitCodeThread(m_dumpThread, &exitCode) && exitCode == STILL_ACTIVE)
199199
{
200200
return true;
201201
}
@@ -352,7 +352,7 @@ void MiniDumper::CreateMiniDump(DumpType dumpType)
352352
GitShortSHA1, currentProcessId);
353353

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

Core/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1484,7 +1484,7 @@ void W3DRadar::refreshObjects()
14841484
{
14851485
14861486
// sanity
1487-
if( listHead == NULL || texture == nullptr )
1487+
if( listHead == nullptr || texture == nullptr )
14881488
return;
14891489
14901490
// get surface for texture to render into

Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,7 @@ static void drawAudioLocations( Drawable *draw, void *userData )
899899

900900
const ThingTemplate * thingTemplate = draw->getTemplate();
901901

902-
if ( thingTemplate == NULL || thingTemplate->getEditorSorting() != ES_AUDIO )
902+
if ( thingTemplate == nullptr || thingTemplate->getEditorSorting() != ES_AUDIO )
903903
{
904904
return; // All done
905905
}

0 commit comments

Comments
 (0)