Skip to content

Commit 16c7200

Browse files
committed
refactor: convert ternary operators from NULL to nullptr
1 parent e747239 commit 16c7200

File tree

33 files changed

+43
-42
lines changed

33 files changed

+43
-42
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ WWINLINE void* FastAllocatorGeneral::Realloc(void* pAlloc, unsigned int n){
587587
pointer address(reference x) const { return &x; }
588588
const_pointer address(const_reference x) const { return &x; }
589589

590-
T* allocate(size_type n, const void* = nullptr) { return n != 0 ? static_cast<T*>(FastAllocatorGeneral::Get_Allocator()->Alloc(n*sizeof(T))) : NULL; }
590+
T* allocate(size_type n, const void* = nullptr) { return n != 0 ? static_cast<T*>(FastAllocatorGeneral::Get_Allocator()->Alloc(n*sizeof(T))) : nullptr; }
591591
void deallocate(pointer p, size_type n) { FastAllocatorGeneral::Get_Allocator()->Free(p); }
592592
size_type max_size() const { return size_t(-1) / sizeof(T); }
593593
void construct(pointer p, const T& val) { new(p) T(val); }

Core/Libraries/Source/profile/profile_funclevel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ ProfileFuncLevelTracer::Profile *ProfileFuncLevelTracer::ProfileMap::Find(int fr
464464
{
465465
List *p=root;
466466
for (;p&&p->frame<frame;p=p->next);
467-
return p&&p->frame==frame?&p->p:NULL;
467+
return p&&p->frame==frame?&p->p: nullptr;
468468
}
469469

470470
void ProfileFuncLevelTracer::ProfileMap::Append(int frame, const Profile &p)

Core/Libraries/Source/profile/profile_result.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ ProfileResultInterface *ProfileResultFileDOT::Create(int argn, const char * cons
149149
return new (ProfileAllocMemory(sizeof(ProfileResultFileDOT)))
150150
ProfileResultFileDOT(argn>0?argv[0]:nullptr,
151151
argn>1?argv[1]:nullptr,
152-
argn>2?atoi(argv[2]):NULL);
152+
argn>2?atoi(argv[2]): nullptr);
153153
}
154154

155155
ProfileResultFileDOT::ProfileResultFileDOT(const char *fileName, const char *frameName, int foldThreshold)

Core/Tools/WW3D/max2w3d/AlphaModifier.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class AlphaModifierClass : public Modifier
107107
// Direct paramblock access
108108
int NumParamBlocks() {return 1;}
109109
IParamBlock2* GetParamBlock(int i) { return pblock;}
110-
IParamBlock2* GetParamBlockByID(BlockID id) {return (pblock->ID() == id) ? pblock : NULL;}
110+
IParamBlock2* GetParamBlockByID(BlockID id) {return (pblock->ID() == id) ? pblock : nullptr;}
111111
int GetParamBlockIndex(int id) {return id;}
112112

113113
// Does not use createmouse callbacks

Core/Tools/WW3D/max2w3d/dllmain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ TCHAR * Get_String( int id )
200200
{
201201
static TCHAR buf[256];
202202
if (AppInstance)
203-
return LoadString(AppInstance, id, buf, sizeof(buf)) ? buf : NULL;
203+
return LoadString(AppInstance, id, buf, sizeof(buf)) ? buf : nullptr;
204204
return nullptr;
205205
}
206206

Core/Tools/WW3D/max2w3d/gridsnapmodifier.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class GridSnapModifierClass : public SimpleMod2
8888
// Direct paramblock access
8989
int NumParamBlocks() { return 1; }
9090
IParamBlock2* GetParamBlock(int i) { return pblock2; }
91-
IParamBlock2* GetParamBlockByID(BlockID id) { return (pblock2->ID() == id) ? pblock2 : NULL; }
91+
IParamBlock2* GetParamBlockByID(BlockID id) { return (pblock2->ID() == id) ? pblock2 : nullptr; }
9292

9393
// From simple mod
9494
Deformer& GetDeformer(TimeValue t,ModContext &mc,Matrix3& mat,Matrix3& invmat);

Generals/Code/GameEngine/Include/Common/BitFlags.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ class BitFlags
266266

267267
static const char* getNameFromSingleBit(Int i)
268268
{
269-
return (i >= 0 && i < NUMBITS) ? s_bitNameList[i] : NULL;
269+
return (i >= 0 && i < NUMBITS) ? s_bitNameList[i] : nullptr;
270270
}
271271

272272
static Int getSingleBitFromName(const char* token)
@@ -284,7 +284,7 @@ class BitFlags
284284

285285
const char* getBitNameIfSet(Int i) const
286286
{
287-
return test(i) ? s_bitNameList[i] : NULL;
287+
return test(i) ? s_bitNameList[i] : nullptr;
288288
}
289289

290290
Bool setBitByName(const char* token)

Generals/Code/GameEngine/Include/Common/Thing.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ class Thing : public MemoryPoolObject
8484
{
8585
// note, it is explicitly OK to pass null for 'thing' here;
8686
// they will check for null and return null in these cases.
87-
friend inline Object *AsObject(Thing *thing) { return thing ? thing->asObjectMeth() : NULL; }
88-
friend inline Drawable *AsDrawable(Thing *thing) { return thing ? thing->asDrawableMeth() : NULL; }
89-
friend inline const Object *AsObject(const Thing *thing) { return thing ? thing->asObjectMeth() : NULL; }
90-
friend inline const Drawable *AsDrawable(const Thing *thing) { return thing ? thing->asDrawableMeth() : NULL; }
87+
friend inline Object *AsObject(Thing *thing) { return thing ? thing->asObjectMeth() : nullptr; }
88+
friend inline Drawable *AsDrawable(Thing *thing) { return thing ? thing->asDrawableMeth() : nullptr; }
89+
friend inline const Object *AsObject(const Thing *thing) { return thing ? thing->asObjectMeth() : nullptr; }
90+
friend inline const Drawable *AsDrawable(const Thing *thing) { return thing ? thing->asDrawableMeth() : nullptr; }
9191

9292
MEMORY_POOL_GLUE_ABC(Thing)
9393

Generals/Code/GameEngine/Include/GameClient/Drawable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ class Drawable : public Thing,
454454
// that the team is nonnull.
455455
void changedTeam();
456456

457-
const TWheelInfo *getWheelInfo(void) const { return m_locoInfo ? &m_locoInfo->m_wheelInfo : NULL; }
457+
const TWheelInfo *getWheelInfo(void) const { return m_locoInfo ? &m_locoInfo->m_wheelInfo : nullptr; }
458458

459459
// this method must ONLY be called from the client, NEVER From the logic, not even indirectly.
460460
Bool clientOnly_getFirstRenderObjInfo(Coord3D* pos, Real* boundingSphereRadius, Matrix3D* transform);

Generals/Code/GameEngine/Include/GameLogic/AIPathfind.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ class PathfindCell
317317
/// remove all cells from closed list.
318318
static Int releaseOpenList( PathfindCell *list );
319319

320-
inline PathfindCell *getNextOpen(void) {return m_info->m_nextOpen?m_info->m_nextOpen->m_cell:NULL;}
320+
inline PathfindCell *getNextOpen(void) {return m_info->m_nextOpen?m_info->m_nextOpen->m_cell: nullptr;}
321321

322322
inline UnsignedShort getXIndex(void) const {return m_info->m_pos.x;}
323323
inline UnsignedShort getYIndex(void) const {return m_info->m_pos.y;}
@@ -336,7 +336,7 @@ class PathfindCell
336336
void setParentCell(PathfindCell* parent);
337337
void clearParentCell(void);
338338
void setParentCellHierarchical(PathfindCell* parent);
339-
inline PathfindCell* getParentCell(void) const {return m_info->m_pathParent?m_info->m_pathParent->m_cell:NULL;}
339+
inline PathfindCell* getParentCell(void) const {return m_info->m_pathParent?m_info->m_pathParent->m_cell: nullptr;}
340340

341341
Bool startPathfind( PathfindCell *goalCell );
342342
Bool getPinched(void) const {return m_pinched;}

0 commit comments

Comments
 (0)