Skip to content

Commit 312551d

Browse files
committed
refactor: convert NULL to nullptr in debug message string literals
Update debug messages and string literals containing "NULL" to use "nullptr" for consistency with code modernization.
1 parent b67a5b9 commit 312551d

File tree

102 files changed

+205
-206
lines changed

Some content is hidden

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

102 files changed

+205
-206
lines changed

Core/GameEngine/Include/Common/GameMemory.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ private: \
589589
order-of-execution problem for static variables, ensuring this is not executed \
590590
prior to the initialization of TheMemoryPoolFactory. \
591591
*/ \
592-
DEBUG_ASSERTCRASH(TheMemoryPoolFactory, ("TheMemoryPoolFactory is NULL")); \
592+
DEBUG_ASSERTCRASH(TheMemoryPoolFactory, ("TheMemoryPoolFactory is nullptr")); \
593593
static MemoryPool *The##ARGCLASS##Pool = TheMemoryPoolFactory->findMemoryPool(ARGPOOLNAME); \
594594
DEBUG_ASSERTCRASH(The##ARGCLASS##Pool, ("Pool \"%s\" not found (did you set it up in initMemoryPools?)", ARGPOOLNAME)); \
595595
DEBUG_ASSERTCRASH(The##ARGCLASS##Pool->getAllocationSize() >= sizeof(ARGCLASS), ("Pool \"%s\" is too small for this class (currently %d, need %d)", ARGPOOLNAME, The##ARGCLASS##Pool->getAllocationSize(), sizeof(ARGCLASS))); \
@@ -608,7 +608,7 @@ private: \
608608
order-of-execution problem for static variables, ensuring this is not executed \
609609
prior to the initialization of TheMemoryPoolFactory. \
610610
*/ \
611-
DEBUG_ASSERTCRASH(TheMemoryPoolFactory, ("TheMemoryPoolFactory is NULL")); \
611+
DEBUG_ASSERTCRASH(TheMemoryPoolFactory, ("TheMemoryPoolFactory is nullptr")); \
612612
static MemoryPool *The##ARGCLASS##Pool = TheMemoryPoolFactory->createMemoryPool(ARGPOOLNAME, sizeof(ARGCLASS), ARGINITIAL, ARGOVERFLOW); \
613613
DEBUG_ASSERTCRASH(The##ARGCLASS##Pool, ("Pool \"%s\" not found (did you set it up in initMemoryPools?)", ARGPOOLNAME)); \
614614
DEBUG_ASSERTCRASH(The##ARGCLASS##Pool->getAllocationSize() >= sizeof(ARGCLASS), ("Pool \"%s\" is too small for this class (currently %d, need %d)", ARGPOOLNAME, The##ARGCLASS##Pool->getAllocationSize(), sizeof(ARGCLASS))); \

Core/GameEngine/Include/GameNetwork/ConnectionManager.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ class ConnectionManager
176176
void requestFrameDataResend(Int playerID, UnsignedInt frame); ///< request of this player that he send the specified frame's data.
177177

178178
// The connections are set up like the slot list. The connection corresponding to the local
179-
// player's position in the slot list will be NULL. Connections corresponding to slots that
180-
// do not have a player will also be NULL.
179+
// player's position in the slot list will be nullptr. Connections corresponding to slots that
180+
// do not have a player will also be nullptr.
181181
Connection *m_connections[MAX_SLOTS];
182182

183183
Transport *m_transport;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ char* RAMFile::readEntireAndClose()
551551

552552
if (m_data == nullptr)
553553
{
554-
DEBUG_CRASH(("m_data is NULL in RAMFile::readEntireAndClose -- should not happen!"));
554+
DEBUG_CRASH(("m_data is nullptr in RAMFile::readEntireAndClose -- should not happen!"));
555555
return NEW char[1]; // just to avoid crashing...
556556
}
557557

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ Bool Radar::addObject( Object *obj )
395395

396396
// sanity
397397
DEBUG_ASSERTCRASH( obj->friend_getRadarData() == nullptr,
398-
("Radar: addObject - non NULL radar data for '%s'",
398+
("Radar: addObject - non nullptr radar data for '%s'",
399399
obj->getTemplate()->getName().str()) );
400400

401401
// allocate a new object
@@ -452,7 +452,7 @@ Bool Radar::deleteFromList( Object *obj, RadarObject **list )
452452
else
453453
prevObject->friend_setNext( radarObject->friend_getNext() );
454454

455-
// set the object radar data to NULL
455+
// set the object radar data to nullptr
456456
obj->friend_setRadarData( nullptr );
457457

458458
// delete the object instance
@@ -757,7 +757,7 @@ Object *Radar::searchListForRadarLocationMatch( RadarObject *listHead, ICoord2D
757757
if( obj == nullptr )
758758
{
759759

760-
DEBUG_CRASH(( "Radar::searchListForRadarLocationMatch - NULL object encountered in list" ));
760+
DEBUG_CRASH(( "Radar::searchListForRadarLocationMatch - nullptr object encountered in list" ));
761761
continue;
762762

763763
}
@@ -1318,12 +1318,12 @@ static void xferRadarObjectList( Xfer *xfer, RadarObject **head )
13181318
{
13191319
if (!radarObject->friend_getObject()->isDestroyed())
13201320
{
1321-
DEBUG_CRASH(( "xferRadarObjectList - List head should be NULL, or contain only destroyed objects" ));
1321+
DEBUG_CRASH(( "xferRadarObjectList - List head should be nullptr, or contain only destroyed objects" ));
13221322
throw SC_INVALID_DATA;
13231323
}
13241324
}
13251325
#else
1326-
DEBUG_CRASH(( "xferRadarObjectList - List head should be NULL, but isn't" ));
1326+
DEBUG_CRASH(( "xferRadarObjectList - List head should be nullptr, but isn't" ));
13271327
throw SC_INVALID_DATA;
13281328
#endif
13291329
}
@@ -1554,7 +1554,7 @@ void Radar::linkRadarObject( RadarObject *newObj, RadarObject **list )
15541554
RadarObject *prevObject;
15551555
RadarObject *nextObject;
15561556

1557-
DEBUG_ASSERTCRASH(newObj->friend_getNext() == nullptr, ("newObj->friend_getNext is not NULL"));
1557+
DEBUG_ASSERTCRASH(newObj->friend_getNext() == nullptr, ("newObj->friend_getNext is not nullptr"));
15581558

15591559
prevObject = nullptr;
15601560
prevPriority = RADAR_PRIORITY_INVALID;

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ XferSave::~XferSave( void )
8383
{
8484

8585
// tell the user there is an error
86-
DEBUG_CRASH(( "Warning: XferSave::~XferSave - m_blockStack was not NULL!" ));
86+
DEBUG_CRASH(( "Warning: XferSave::~XferSave - m_blockStack was not nullptr!" ));
8787

8888
// delete the block stack
8989
XferBlockData *next;
@@ -166,7 +166,7 @@ Int XferSave::beginBlock( void )
166166
{
167167

168168
// sanity
169-
DEBUG_ASSERTCRASH( m_fileFP != nullptr, ("Xfer begin block - file pointer for '%s' is NULL",
169+
DEBUG_ASSERTCRASH( m_fileFP != nullptr, ("Xfer begin block - file pointer for '%s' is nullptr",
170170
m_identifier.str()) );
171171

172172
// get the current file position so we can back up here for the next end block call
@@ -186,7 +186,7 @@ Int XferSave::beginBlock( void )
186186
// save this block position on the top of the "stack"
187187
XferBlockData *top = newInstance(XferBlockData);
188188
// impossible -- exception will be thrown (srj)
189-
// if( top == NULL )
189+
// if( top == nullptr )
190190
// {
191191
//
192192
// DEBUG_CRASH(( "XferSave - Begin block, out of memory - can't save block stack data" ));
@@ -211,7 +211,7 @@ void XferSave::endBlock( void )
211211
{
212212

213213
// sanity
214-
DEBUG_ASSERTCRASH( m_fileFP != nullptr, ("Xfer end block - file pointer for '%s' is NULL",
214+
DEBUG_ASSERTCRASH( m_fileFP != nullptr, ("Xfer end block - file pointer for '%s' is nullptr",
215215
m_identifier.str()) );
216216

217217
// sanity, make sure we have a block started
@@ -258,7 +258,7 @@ void XferSave::skip( Int dataSize )
258258
{
259259

260260
// sanity
261-
DEBUG_ASSERTCRASH( m_fileFP != nullptr, ("XferSave - file pointer for '%s' is NULL",
261+
DEBUG_ASSERTCRASH( m_fileFP != nullptr, ("XferSave - file pointer for '%s' is nullptr",
262262
m_identifier.str()) );
263263

264264

@@ -343,7 +343,7 @@ void XferSave::xferImplementation( void *data, Int dataSize )
343343
{
344344

345345
// sanity
346-
DEBUG_ASSERTCRASH( m_fileFP != nullptr, ("XferSave - file pointer for '%s' is NULL",
346+
DEBUG_ASSERTCRASH( m_fileFP != nullptr, ("XferSave - file pointer for '%s' is nullptr",
347347
m_identifier.str()) );
348348

349349
// write data to file

Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1091,7 +1091,7 @@ void ConnectionManager::ackCommand(NetCommandRef *ref, UnsignedInt localSlot) {
10911091
// DEBUG_LOG(("ConnectionManager::ackCommand - acking command %d from player %d directly to player.", commandID, msg->getPlayerID()));
10921092
m_connections[msg->getPlayerID()]->sendNetCommandMsg(ackmsg, 1 << msg->getPlayerID());
10931093
} else {
1094-
// DEBUG_ASSERTCRASH(m_connections[msg->getPlayerID()] != NULL, ("Connection to player is nullptr"));
1094+
// DEBUG_ASSERTCRASH(m_connections[msg->getPlayerID()] != nullptr, ("Connection to player is nullptr"));
10951095
}
10961096
} else {
10971097
DEBUG_ASSERTCRASH((msg->getPlayerID() >= 0) && (msg->getPlayerID() < MAX_SLOTS), ("Command sent by an invalid player ID."));

Core/GameEngine/Source/GameNetwork/FirewallHelper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ UnsignedShort FirewallHelperClass::getManglerResponse(UnsignedShort packetID, In
424424
{
425425
ManglerMessage *msg = nullptr;
426426

427-
// SpareSocketStruct *spareSocket = NULL;
427+
// SpareSocketStruct *spareSocket = nullptr;
428428

429429
sockaddr_in addr;
430430

Core/GameEngine/Source/GameNetwork/GameSpy/Thread/PeerThread.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2975,7 +2975,7 @@ static void listingGamesCallback(PEER peer, PEERBool success, const char * name,
29752975
resp.stagingServerName = MultiByteToWideCharSingleLine( gameName.str() );
29762976
DEBUG_LOG(("Server had basic=%d, full=%d", SBServerHasBasicKeys(server), SBServerHasFullKeys(server)));
29772977
#ifdef DEBUG_LOGGING
2978-
//SBServerEnumKeys(server, enumFunc, NULL);
2978+
//SBServerEnumKeys(server, enumFunc, nullptr);
29792979
#endif
29802980
break;
29812981
case PEER_REMOVE:

Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,7 +1108,7 @@ Int WaterRenderObjClass::init(Real waterLevel, Real dx, Real dy, SceneClass *par
11081108

11091109
m_riverTexture=WW3DAssetManager::Get_Instance()->Get_Texture(TheWaterTransparency->m_standingWaterTexture.str());
11101110

1111-
//For some reason setting a NULL texture does not result in 0xffffffff for pixel shaders so using explicit "white" texture.
1111+
//For some reason setting a nullptr texture does not result in 0xffffffff for pixel shaders so using explicit "white" texture.
11121112
m_whiteTexture=MSGNEW("TextureClass") TextureClass(1,1,WW3D_FORMAT_A4R4G4B4,MIP_LEVELS_1);
11131113
SurfaceClass *surface=m_whiteTexture->Get_Surface_Level();
11141114
surface->DrawPixel(0,0,0xffffffff);
@@ -1349,7 +1349,7 @@ void WaterRenderObjClass::loadSetting( Setting *setting, TimeOfDay timeOfDay )
13491349
SurfaceClass::SurfaceDescription surfaceDesc;
13501350

13511351
// sanity
1352-
DEBUG_ASSERTCRASH( setting, ("WaterRenderObjClass::loadSetting, NULL setting") );
1352+
DEBUG_ASSERTCRASH( setting, ("WaterRenderObjClass::loadSetting, nullptr setting") );
13531353

13541354
// textures
13551355
setting->skyTexture = WW3DAssetManager::Get_Instance()->Get_Texture( WaterSettings[ timeOfDay ].m_skyTextureFile.str() );
@@ -1717,7 +1717,7 @@ void WaterRenderObjClass::Render(RenderInfoClass & rinfo)
17171717
}
17181718

17191719
//Clean up after any pixel shaders.
1720-
//Force render state apply so that the "nullptr" texture gets applied to D3D, thus releasing shroud reference count.
1720+
//Force render state apply so that the "NULL" texture gets applied to D3D, thus releasing shroud reference count.
17211721
DX8Wrapper::Apply_Render_State_Changes();
17221722
DX8Wrapper::Invalidate_Cached_Render_States();
17231723

@@ -2625,7 +2625,7 @@ void WaterRenderObjClass::setGridResolution(Real gridCellsX, Real gridCellsY, Re
26252625
{
26262626

26272627
delete [] m_meshData;//free previously allocated grid and allocate new size
2628-
m_meshData = nullptr; // must set to NULL so that we properly re-allocate
2628+
m_meshData = nullptr; // must set to nullptr so that we properly re-allocate
26292629
m_meshDataSize = 0;
26302630

26312631
Bool enable = m_doWaterGrid;
@@ -2956,7 +2956,7 @@ void WaterRenderObjClass::setupFlatWaterShader(void)
29562956
DX8Wrapper::_Get_D3D_Device8()->SetRenderState(D3DRS_ZFUNC, D3DCMP_LESSEQUAL);
29572957
}
29582958
else
2959-
{ //Assume no shroud, so stage 3 will be "nullptr" texture but using actual white because
2959+
{ //Assume no shroud, so stage 3 will be "NULL" texture but using actual white because
29602960
//pixel shader on GF4 generates random colors with SetTexture(3,nullptr).
29612961
if (!m_whiteTexture->Is_Initialized())
29622962
{ m_whiteTexture->Init();

Core/Libraries/Source/WWVegas/WW3D2/composite.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,9 @@ void CompositeRenderObjClass::Set_Name(const char * name)
206206
*=============================================================================================*/
207207
void CompositeRenderObjClass::Set_Base_Model_Name(const char *name)
208208
{
209-
// NULL is a legal value for BaseModelName. Unfortunately,
209+
// nullptr is a legal value for BaseModelName. Unfortunately,
210210
// StringClass::operator= does not modify the string when
211-
// assigning NULL, so we explicitly handle that case here.
211+
// assigning nullptr, so we explicitly handle that case here.
212212
if (name != nullptr) {
213213
BaseModelName = name;
214214
} else {

0 commit comments

Comments
 (0)