Skip to content

Commit 050b3f0

Browse files
committed
fix: replace nullptr with 0 for integer return types to prevent crashes
1 parent 9501cce commit 050b3f0

File tree

99 files changed

+608
-344
lines changed

Some content is hidden

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

99 files changed

+608
-344
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,11 +439,11 @@ const char*
439439
AnimatedSoundMgrClass::Get_Embedded_Sound_Name (HAnimClass *anim)
440440
{
441441
if (anim == nullptr) {
442-
return nullptr;
442+
return 0;
443443
}
444444
ANIM_SOUND_LIST* list = Find_Sound_List (anim);
445445
if (list == nullptr) {
446-
return nullptr;
446+
return 0;
447447
}
448448

449449
return list->BoneName.str();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ void CompositeRenderObjClass::Set_User_Data(void *value, bool recursive)
554554
const char * CompositeRenderObjClass::Get_Base_Model_Name (void) const
555555
{
556556
if (BaseModelName.Is_Empty()) {
557-
return nullptr;
557+
return 0;
558558
}
559559

560560
return BaseModelName;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,14 @@ PrototypeClass *DistLODLoaderClass::Load_W3D( ChunkLoadClass &cload )
138138

139139
if (pCDistLODClass == nullptr)
140140
{
141-
return nullptr;
141+
return 0;
142142
}
143143

144144
if (pCDistLODClass->Load_W3D(cload) != WW3D_ERROR_OK)
145145
{
146146
// load failed, delete the model and return an error
147147
delete pCDistLODClass;
148-
return nullptr;
148+
return 0;
149149

150150
} else {
151151

@@ -586,7 +586,7 @@ RenderObjClass * DistLODClass::Get_Sub_Object(int index) const
586586
assert(index < LodCount);
587587

588588
if (Lods[index].Model == nullptr) {
589-
return nullptr;
589+
return 0;
590590
} else {
591591
Lods[index].Model->Add_Ref();
592592
return Lods[index].Model;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ RenderObjClass *IntersectionClass::Intersect_Sub_Object(float screenx, float scr
348348
if (Intersect_Screen_Point_RenderObject(screenx, screeny, layer, robj, result)) {
349349
return robj;
350350
}
351-
return nullptr;
351+
return 0;
352352
}
353353

354354
// finds the intersection of the nearest object in the array.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ TextureClass * MaterialRemapperClass::Remap_Texture(TextureClass * src)
192192
}
193193
}
194194
WWASSERT(0); // uh-oh didn't find the texture, what happend???
195-
return nullptr;
195+
return 0;
196196
}
197197

198198
VertexMaterialClass * MaterialRemapperClass::Remap_Vertex_Material(VertexMaterialClass * src)
@@ -207,7 +207,7 @@ VertexMaterialClass * MaterialRemapperClass::Remap_Vertex_Material(VertexMateria
207207
}
208208
}
209209
WWASSERT(0); // uh-oh didn't find the material, what happend???
210-
return nullptr;
210+
return 0;
211211
}
212212

213213
void MaterialRemapperClass::Remap_Mesh(const MeshMatDescClass * srcmeshmatdesc, MeshMatDescClass * destmeshmatdesc)

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,15 @@ PrototypeClass * MeshLoaderClass::Load_W3D(ChunkLoadClass & cload)
123123
MeshClass * mesh = NEW_REF( MeshClass, () );
124124

125125
if (mesh == nullptr) {
126-
return nullptr;
126+
return 0;
127127
}
128128

129129
if (mesh->Load_W3D(cload) != WW3D_ERROR_OK) {
130130

131131
// if the load failed, delete the mesh
132132
assert(mesh->Num_Refs() == 1);
133133
mesh->Release_Ref();
134-
return nullptr;
134+
return 0;
135135

136136
} else {
137137

@@ -161,14 +161,14 @@ PrototypeClass * HModelLoaderClass::Load_W3D(ChunkLoadClass & cload)
161161
HModelDefClass * hdef = W3DNEW HModelDefClass;
162162

163163
if (hdef == nullptr) {
164-
return nullptr;
164+
return 0;
165165
}
166166

167167
if (hdef->Load_W3D(cload) != HModelDefClass::OK) {
168168

169169
// load failed, delete the model and return an error
170170
delete hdef;
171-
return nullptr;
171+
return 0;
172172

173173
} else {
174174

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ inline Triangle* TriangleQueue::getTop (void) const
508508
for (int i = 0; i < 4; i++)
509509
if (m_bin[i])
510510
return m_bin[i]; // return head
511-
return nullptr; // end
511+
return 0; // end
512512
}
513513

514514
/*****************************************************************************
@@ -834,7 +834,7 @@ Triangle* Stripify::generateTriangleList (const Vector3i* inTris, int N)
834834
int* Stripify::stripify (const Vector3i* inTris, int N)
835835
{
836836
if (!inTris || N<=0) // boo!
837-
return nullptr;
837+
return 0;
838838

839839
//--------------------------------------------------------------------
840840
// Initial setup

Core/Libraries/Source/WWVegas/WWDebug/wwmemlog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ WWINLINE void * Get_Mem_Log_Mutex(void)
292292
#endif
293293

294294
#if DISABLE_MEMLOG
295-
return nullptr;
295+
return 0;
296296
#endif
297297
}
298298

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ const char *ArgvClass::Find_Again(const char *arg)
135135
}
136136
}
137137
}
138-
return nullptr;
138+
return 0;
139139
}
140140

141141
/***********************************************************************************************

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ HashableClass * HashTableClass::Find( const char * key )
116116
return node;
117117
}
118118
}
119-
return nullptr;
119+
return 0;
120120
}
121121

122122
int HashTableClass::Hash( const char * key )

0 commit comments

Comments
 (0)