Skip to content

Commit 17af19e

Browse files
committed
refactor: convert NULL to nullptr in array/struct initializers and ternary operators
1 parent 95ac9d0 commit 17af19e

File tree

131 files changed

+4013
-228
lines changed

Some content is hidden

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

131 files changed

+4013
-228
lines changed

Core/GameEngine/Include/Common/Radar.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ static const char *const RadarPriorityNames[] =
143143
"UNIT", // unit level drawing priority
144144
"LOCAL_UNIT_ONLY", // unit priority, but only on the radar if controlled by the local player
145145

146-
NULL
146+
nullptr
147147
};
148148
static_assert(ARRAY_SIZE(RadarPriorityNames) == RADAR_PRIORITY_NUM_PRIORITIES + 1, "Incorrect array size");
149149
#endif // DEFINE_RADAR_PRIOTITY_NAMES

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ static const FieldParse audioSettingsFieldParseTable[] =
133133
{ "ZoomMaxDistance", INI::parseReal, nullptr, offsetof( AudioSettings, m_zoomMaxDistance ) },
134134
{ "ZoomSoundVolumePercentageAmount", INI::parsePercentToReal, nullptr, offsetof( AudioSettings, m_zoomSoundVolumePercentageAmount ) },
135135

136-
{ nullptr, nullptr, nullptr, NULL }
136+
{ nullptr, nullptr, nullptr, 0 }
137137
};
138138

139139
// Singleton TheAudio /////////////////////////////////////////////////////////////////////////////

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2791,7 +2791,7 @@ static const char* s_specialPrefixes[MAX_SPECIAL_USED] =
27912791
"W3A_",
27922792
"STL_",
27932793
"STR_",
2794-
NULL
2794+
nullptr
27952795
};
27962796

27972797
#endif

Core/GameEngine/Source/GameNetwork/NetMessageStream.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,24 @@
4343
4444
// The per-player pointers for the list of commands
4545
static CommandMsg *CommandHead[MAX_SLOTS] = { /// @todo: remove static initialization
46-
NULL,
47-
NULL,
48-
NULL,
49-
NULL,
50-
NULL,
51-
NULL,
52-
NULL,
53-
NULL
46+
nullptr,
47+
nullptr,
48+
nullptr,
49+
nullptr,
50+
nullptr,
51+
nullptr,
52+
nullptr,
53+
nullptr
5454
};
5555
static CommandMsg *CommandTail[MAX_SLOTS] = {
56-
NULL,
57-
NULL,
58-
NULL,
59-
NULL,
60-
NULL,
61-
NULL,
62-
NULL,
63-
NULL
56+
nullptr,
57+
nullptr,
58+
nullptr,
59+
nullptr,
60+
nullptr,
61+
nullptr,
62+
nullptr,
63+
nullptr
6464
};
6565
6666
/**

Core/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ void MilesAudioManager::audioDebugDisplay(DebugDisplayInterface *dd, void *, FIL
222222
AsciiString filenameNoSlashes;
223223

224224
const Int maxChannels = 64;
225-
PlayingAudio *playingArray[maxChannels] = { NULL };
225+
PlayingAudio *playingArray[maxChannels] = { nullptr };
226226

227227
// 2-D Sounds
228228
if( dd )

Core/Libraries/Source/WWVegas/WW3D2/rendobj.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ static const char* const TheAnimModeNames[] =
644644
"LOOP_PINGPONG",
645645
"LOOP_BACKWARDS",
646646
"ONCE_BACKWARDS",
647-
NULL
647+
nullptr
648648
};
649649
static_assert(ARRAY_SIZE(TheAnimModeNames) == RenderObjClass::ANIM_MODE_COUNT + 1, "Incorrect array size");
650650
#endif

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/Babylon/TransDB.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static LANGINFO langinfo[] =
4545
{ LANGID_KOREAN, "Korean", "ko", "k" },
4646
{ LANGID_CHINESE, "Chinese", "ch", "c" },
4747
{ LANGID_JABBER, "Jabberwockie", "jb", "e" },
48-
{ LANGID_UNKNOWN, "Unknown", nullptr, NULL }
48+
{ LANGID_UNKNOWN, "Unknown", nullptr, nullptr }
4949
};
5050

5151
LANGINFO *GetLangInfo ( int index )

0 commit comments

Comments
 (0)