Skip to content

Commit d1a8209

Browse files
committed
refactor: modernize NULL to nullptr across entire codebase
1 parent e6c28a4 commit d1a8209

File tree

497 files changed

+6150
-5486
lines changed

Some content is hidden

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

497 files changed

+6150
-5486
lines changed

Core/GameEngine/Include/Common/AsciiString.h

Lines changed: 3 additions & 3 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).
@@ -390,7 +390,7 @@ inline char* AsciiString::peek() const
390390
}
391391

392392
// -----------------------------------------------------
393-
inline AsciiString::AsciiString() : m_data(0)
393+
inline AsciiString::AsciiString() : m_data(nullptr)
394394
{
395395
validate();
396396
}
@@ -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/AudioEventInfo.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ struct AudioEventInfo : public MemoryPoolObject
123123

124124
// DynamicAudioEventInfo interfacing functions
125125
virtual Bool isLevelSpecific() const { return false; } ///< If true, this sound is only defined on the current level and can be deleted when that level ends
126-
virtual DynamicAudioEventInfo * getDynamicAudioEventInfo() { return NULL; } ///< If this object is REALLY a DynamicAudioEventInfo, return a pointer to the derived class
127-
virtual const DynamicAudioEventInfo * getDynamicAudioEventInfo() const { return NULL; } ///< If this object is REALLY a DynamicAudioEventInfo, return a pointer to the derived class
126+
virtual DynamicAudioEventInfo * getDynamicAudioEventInfo() { return nullptr; } ///< If this object is REALLY a DynamicAudioEventInfo, return a pointer to the derived class
127+
virtual const DynamicAudioEventInfo * getDynamicAudioEventInfo() const { return nullptr; } ///< If this object is REALLY a DynamicAudioEventInfo, return a pointer to the derived class
128128

129129
/// Is this a permenant sound? That is, if I start this sound up, will it ever end
130130
/// "on its own" or only if I explicitly kill it?

Core/GameEngine/Include/Common/GameAudio.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ class AudioManagerDummy : public AudioManager
395395
virtual AsciiString getMusicTrackName() const { return ""; }
396396
virtual void openDevice() {}
397397
virtual void closeDevice() {}
398-
virtual void* getDevice() { return NULL; }
398+
virtual void* getDevice() { return nullptr; }
399399
virtual void notifyOfAudioCompletion(UnsignedInt audioCompleted, UnsignedInt flags) {}
400400
virtual UnsignedInt getProviderCount(void) const { return 0; };
401401
virtual AsciiString getProviderName(UnsignedInt providerNum) const { return ""; }
@@ -416,7 +416,7 @@ class AudioManagerDummy : public AudioManager
416416
virtual void removePlayingAudio(AsciiString eventName) {}
417417
virtual void removeAllDisabledAudio() {}
418418
virtual Bool has3DSensitiveStreamsPlaying(void) const { return false; }
419-
virtual void* getHandleForBink(void) { return NULL; }
419+
virtual void* getHandleForBink(void) { return nullptr; }
420420
virtual void releaseHandleForBink(void) {}
421421
virtual void friend_forcePlayAudioEventRTS(const AudioEventRTS* eventToPlay) {}
422422
virtual void setPreferredProvider(AsciiString providerNdx) {}

Core/GameEngine/Include/Common/GameMemory.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ class MemoryPoolFactory
545545
/// destroy the contents of all pools and dmas. (the pools and dma's are not destroyed, just reset)
546546
void reset();
547547

548-
void memoryPoolUsageReport( const char* filename, FILE *appendToFileInstead = NULL );
548+
void memoryPoolUsageReport( const char* filename, FILE *appendToFileInstead = nullptr );
549549

550550
#ifdef MEMORYPOOL_DEBUG
551551

@@ -743,7 +743,7 @@ class MemoryPoolObject
743743
virtual ~MemoryPoolObject() { }
744744

745745
protected:
746-
inline void *operator new(size_t s) { DEBUG_CRASH(("This should be impossible")); return 0; }
746+
inline void *operator new(size_t s) { DEBUG_CRASH(("This should be impossible")); return nullptr; }
747747
inline void operator delete(void *p) { DEBUG_CRASH(("This should be impossible")); }
748748

749749
protected:
@@ -902,9 +902,9 @@ class MemoryPoolObjectHolder
902902
private:
903903
MemoryPoolObject *m_mpo;
904904
public:
905-
MemoryPoolObjectHolder(MemoryPoolObject *mpo = NULL) : m_mpo(mpo) { }
905+
MemoryPoolObjectHolder(MemoryPoolObject *mpo = nullptr) : m_mpo(mpo) { }
906906
void hold(MemoryPoolObject *mpo) { DEBUG_ASSERTCRASH(!m_mpo, ("already holding")); m_mpo = mpo; }
907-
void release() { m_mpo = NULL; }
907+
void release() { m_mpo = nullptr; }
908908
~MemoryPoolObjectHolder() { deleteInstance(m_mpo); }
909909
};
910910

Core/GameEngine/Include/Common/Radar.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ class Radar : public Snapshot,
165165
virtual void update( void ); ///< subsystem per frame update
166166

167167
// is the game window parameter the radar window
168-
Bool isRadarWindow( GameWindow *window ) { return (m_radarWindow == window) && (m_radarWindow != NULL); }
168+
Bool isRadarWindow( GameWindow *window ) { return (m_radarWindow == window) && (m_radarWindow != nullptr); }
169169

170170
Bool radarToWorld( const ICoord2D *radar, Coord3D *world ); ///< radar point to world point on terrain
171171
Bool radarToWorld2D( const ICoord2D *radar, Coord3D *world ); ///< radar point to world point (x,y only!)

Core/GameEngine/Include/Common/UnicodeString.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ inline WideChar* UnicodeString::peek() const
364364
}
365365

366366
// -----------------------------------------------------
367-
inline UnicodeString::UnicodeString() : m_data(0)
367+
inline UnicodeString::UnicodeString() : m_data(nullptr)
368368
{
369369
validate();
370370
}
@@ -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/Common/file.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ class File : public MemoryPoolObject
183183
* END: means seek the specified number of bytes back from the end of the file
184184
*/
185185
virtual Bool flush() = 0; ///< flush data to disk
186-
virtual void nextLine(Char *buf = NULL, Int bufSize = 0) = 0; ///< reads until it reaches a new-line character
186+
virtual void nextLine(Char *buf = nullptr, Int bufSize = 0) = 0; ///< reads until it reaches a new-line character
187187

188188
virtual Bool scanInt(Int &newInt) = 0; ///< read an integer from the current file position.
189189
virtual Bool scanReal(Real &newReal) = 0; ///< read a real number from the current file position.

Core/Libraries/Source/WWVegas/WWLib/always.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ class W3DMPO
158158
static void* getClassMemoryPool()
159159
{
160160
assert(0); // must replace this via W3DMPO_GLUE
161-
return 0;
161+
return nullptr;
162162
}
163163
protected:
164164
// we never call this; it is present to cause compile errors in descendent classes

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,7 @@ void CPUDetectClass::Init_OS()
942942
OSVersionExtraInfo = os.szCSDVersion;
943943
#else
944944
typedef LONG(WINAPI * RtlGetVersionPtr)(PRTL_OSVERSIONINFOW);
945-
HMODULE ntdll = LoadLibraryExA("ntdll", NULL, 0);
945+
HMODULE ntdll = LoadLibraryExA("ntdll", nullptr, 0);
946946
if (ntdll != nullptr) {
947947
RtlGetVersionPtr RtlGetVersion = (RtlGetVersionPtr)::GetProcAddress(ntdll, "RtlGetVersion");
948948

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void CRCEngine::operator() (char datum)
9090
*=============================================================================================*/
9191
long CRCEngine::operator() (void const * buffer, int length)
9292
{
93-
if (buffer != NULL && length > 0) {
93+
if (buffer != nullptr && length > 0) {
9494
char const * dataptr = (char const *)buffer;
9595
int bytes_left = length;
9696

0 commit comments

Comments
 (0)