Skip to content

Commit 88793e4

Browse files
committed
Convert all NULLs to nullptr
Resolves the ambiguity of implementation defined NULLs Fixes: 8844f42 ("tools: Remove custom NULL")
1 parent a39bc24 commit 88793e4

Some content is hidden

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

81 files changed

+1313
-1313
lines changed

src/engine/animmodel.h

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ struct animmodel : model
114114
bool alphablend, cullface;
115115
shaderparamskey *key;
116116

117-
skin() : owner(0), tex(notexture), masks(notexture), envmap(NULL), normalmap(NULL), shader(NULL), alphablend(true), cullface(true), key(NULL) {}
117+
skin() : owner(0), tex(notexture), masks(notexture), envmap(nullptr), normalmap(nullptr), shader(nullptr), alphablend(true), cullface(true), key(nullptr) {}
118118

119119
bool masked() const { return masks != notexture; }
120120
bool envmapped() { return envmapmax>0 && envmapmodels; }
@@ -175,7 +175,7 @@ struct animmodel : model
175175
{
176176
#define DOMODELSHADER(name, body) \
177177
do { \
178-
static Shader *name##shader = NULL; \
178+
static Shader *name##shader = nullptr; \
179179
if(!name##shader) name##shader = useshaderbyname(#name); \
180180
body; \
181181
} while(0)
@@ -200,7 +200,7 @@ struct animmodel : model
200200

201201
void cleanup()
202202
{
203-
if(shader && shader->standard) shader = NULL;
203+
if(shader && shader->standard) shader = nullptr;
204204
}
205205

206206
void preloadBIH()
@@ -297,7 +297,7 @@ struct animmodel : model
297297
char *name;
298298
bool noclip;
299299

300-
mesh() : group(NULL), name(NULL), noclip(false)
300+
mesh() : group(nullptr), name(nullptr), noclip(false)
301301
{
302302
}
303303

@@ -491,7 +491,7 @@ struct animmodel : model
491491
char *name;
492492
vector<mesh *> meshes;
493493

494-
meshgroup() : next(NULL), shared(0), name(NULL)
494+
meshgroup() : next(nullptr), shared(0), name(nullptr)
495495
{
496496
}
497497

@@ -600,7 +600,7 @@ struct animmodel : model
600600
}
601601
};
602602

603-
virtual meshgroup *loadmeshes(const char *name, va_list args) { return NULL; }
603+
virtual meshgroup *loadmeshes(const char *name, va_list args) { return nullptr; }
604604

605605
meshgroup *sharemeshes(const char *name, ...)
606606
{
@@ -611,7 +611,7 @@ struct animmodel : model
611611
va_start(args, name);
612612
meshgroup *group = loadmeshes(name, args);
613613
va_end(args);
614-
if(!group) return NULL;
614+
if(!group) return nullptr;
615615
meshgroups.add(group);
616616
}
617617
return meshgroups[name];
@@ -625,7 +625,7 @@ struct animmodel : model
625625
modelattach *attached;
626626
matrix4 matrix;
627627

628-
linkedpart() : p(NULL), tag(-1), anim(-1), basetime(0), translate(0, 0, 0), rotate(0, 0, 0), attached(NULL) {}
628+
linkedpart() : p(nullptr), tag(-1), anim(-1), basetime(0), translate(0, 0, 0), rotate(0, 0, 0), attached(nullptr) {}
629629
};
630630

631631
struct part
@@ -640,9 +640,9 @@ struct animmodel : model
640640
float pitchscale, pitchoffset, pitchmin, pitchmax;
641641
vec translate;
642642

643-
part(animmodel *model, int index = 0) : model(model), index(index), meshes(NULL), numanimparts(1), pitchscale(1), pitchoffset(0), pitchmin(0), pitchmax(0), translate(0, 0, 0)
643+
part(animmodel *model, int index = 0) : model(model), index(index), meshes(nullptr), numanimparts(1), pitchscale(1), pitchoffset(0), pitchmin(0), pitchmax(0), translate(0, 0, 0)
644644
{
645-
loopk(MAXANIMPARTS) anims[k] = NULL;
645+
loopk(MAXANIMPARTS) anims[k] = nullptr;
646646
}
647647
virtual ~part()
648648
{
@@ -685,7 +685,7 @@ struct animmodel : model
685685
}
686686
}
687687

688-
bool link(part *p, const char *tag, const vec &translate = vec(0, 0, 0), const vec &rotate = vec(0, 0, 0), int anim = -1, int basetime = 0, modelattach *attached = NULL)
688+
bool link(part *p, const char *tag, const vec &translate = vec(0, 0, 0), const vec &rotate = vec(0, 0, 0), int anim = -1, int basetime = 0, modelattach *attached = nullptr)
689689
{
690690
int i = meshes ? meshes->findtag(tag) : -1;
691691
if(i<0)
@@ -774,7 +774,7 @@ struct animmodel : model
774774
}
775775
else
776776
{
777-
animspec *spec = NULL;
777+
animspec *spec = nullptr;
778778
if(anims[animpart])
779779
{
780780
int primaryidx = anim&ANIM_INDEX;
@@ -1009,7 +1009,7 @@ struct animmodel : model
10091009
animmodel *m = (animmodel *)a[i].m;
10101010
if(!m)
10111011
{
1012-
if(a[i].pos) link(NULL, a[i].tag, vec(0, 0, 0), vec(0, 0, 0), 0, 0, &a[i]);
1012+
if(a[i].pos) link(nullptr, a[i].tag, vec(0, 0, 0), vec(0, 0, 0), 0, 0, &a[i]);
10131013
continue;
10141014
}
10151015
part *p = m->parts[0];
@@ -1031,14 +1031,14 @@ struct animmodel : model
10311031
}
10321032

10331033
animstate as[MAXANIMPARTS];
1034-
parts[0]->render(anim, basetime, basetime2, pitch, axis, forward, d, NULL, as);
1034+
parts[0]->render(anim, basetime, basetime2, pitch, axis, forward, d, nullptr, as);
10351035

10361036
if(a) for(int i = numtags-1; i >= 0; i--)
10371037
{
10381038
animmodel *m = (animmodel *)a[i].m;
10391039
if(!m)
10401040
{
1041-
if(a[i].pos) unlink(NULL);
1041+
if(a[i].pos) unlink(nullptr);
10421042
continue;
10431043
}
10441044
part *p = m->parts[0];
@@ -1192,7 +1192,7 @@ struct animmodel : model
11921192
return bih;
11931193
}
11941194

1195-
bool link(part *p, const char *tag, const vec &translate = vec(0, 0, 0), const vec &rotate = vec(0, 0, 0), int anim = -1, int basetime = 0, modelattach *attached = NULL)
1195+
bool link(part *p, const char *tag, const vec &translate = vec(0, 0, 0), const vec &rotate = vec(0, 0, 0), int anim = -1, int basetime = 0, modelattach *attached = nullptr)
11961196
{
11971197
if(parts.empty()) return false;
11981198
return parts[0]->link(p, tag, translate, rotate, anim, basetime, attached);
@@ -1352,7 +1352,7 @@ struct animmodel : model
13521352
enablecullface = true;
13531353
lastalphatest = -1;
13541354
lastvbuf = lasttcbuf = lastxbuf = lastnbuf = lastbbuf = lastebuf = lastenvmaptex = closestenvmaptex = 0;
1355-
lasttex = lastmasks = lastnormalmap = NULL;
1355+
lasttex = lastmasks = lastnormalmap = nullptr;
13561356
transparent = sizescale = 1;
13571357
shaderparamskey::invalidate();
13581358
}
@@ -1410,11 +1410,11 @@ bool animmodel::enabletc = false, animmodel::enablealphablend = false,
14101410
animmodel::enablecullface = true,
14111411
animmodel::enablenormals = false, animmodel::enabletangents = false, animmodel::enablebones = false, animmodel::enabledepthoffset = false;
14121412
vec animmodel::lightdir(0, 0, 1), animmodel::lightcolor(1, 1, 1);
1413-
const bvec *animmodel::lightmaterial = NULL;
1413+
const bvec *animmodel::lightmaterial = nullptr;
14141414
float animmodel::transparent = 1, animmodel::lastalphatest = -1, animmodel::sizescale = 1;
14151415
GLuint animmodel::lastvbuf = 0, animmodel::lasttcbuf = 0, animmodel::lastnbuf = 0, animmodel::lastxbuf = 0, animmodel::lastbbuf = 0,
14161416
animmodel::lastebuf = 0, animmodel::lastenvmaptex = 0, animmodel::closestenvmaptex = 0;
1417-
Texture *animmodel::lasttex = NULL, *animmodel::lastmasks = NULL, *animmodel::lastnormalmap = NULL;
1417+
Texture *animmodel::lasttex = nullptr, *animmodel::lastmasks = nullptr, *animmodel::lastnormalmap = nullptr;
14181418
int animmodel::matrixpos = 0;
14191419
matrix4 animmodel::matrixstack[64];
14201420

@@ -1441,7 +1441,7 @@ template<class MDL> struct modelloader
14411441
static bool multimeshed() { return true; }
14421442
};
14431443

1444-
template<class MDL> MDL *modelloader<MDL>::loading = NULL;
1444+
template<class MDL> MDL *modelloader<MDL>::loading = nullptr;
14451445
template<class MDL> string modelloader<MDL>::dir = {'\0'}; // crashes clang if "" is used here
14461446

14471447
template<class MDL, class MESH> struct modelcommands

src/engine/bih.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ void BIH::build(mesh &m, ushort *indices, int numindices, const ivec &vmin, cons
260260
}
261261

262262
BIH::BIH(vector<mesh> &buildmeshes)
263-
: meshes(NULL), nummeshes(0), nodes(NULL), numnodes(0), tribbs(NULL), numtris(0), bbmin(1e16f, 1e16f, 1e16f), bbmax(-1e16f, -1e16f, -1e16f), center(0, 0, 0), radius(0), entradius(0)
263+
: meshes(nullptr), nummeshes(0), nodes(nullptr), numnodes(0), tribbs(nullptr), numtris(0), bbmin(1e16f, 1e16f, 1e16f), bbmax(-1e16f, -1e16f, -1e16f), center(0, 0, 0), radius(0), entradius(0)
264264
{
265265
if(buildmeshes.empty()) return;
266266
loopv(buildmeshes) numtris += buildmeshes[i].numtris;

src/engine/bih.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ struct BIH
4949
int flags;
5050
vec bbmin, bbmax;
5151

52-
mesh() : numnodes(0), numtris(0), tex(NULL), flags(0) {}
52+
mesh() : numnodes(0), numtris(0), tex(nullptr), flags(0) {}
5353

5454
vec getpos(int i) const { return *(const vec *)(pos + i*posstride); }
5555
vec2 gettc(int i) const { return *(const vec2 *)(tc + i*tcstride); }

src/engine/blend.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ struct BlendMapCache
124124

125125
BlendMapCache *newblendmapcache() { return new BlendMapCache; }
126126

127-
void freeblendmapcache(BlendMapCache *&cache) { delete cache; cache = NULL; }
127+
void freeblendmapcache(BlendMapCache *&cache) { delete cache; cache = nullptr; }
128128

129129
bool setblendmaporigin(BlendMapCache *cache, const ivec &o, int size)
130130
{

src/engine/blob.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ struct blobrenderer
6363
uchar blobalpha;
6464

6565
blobrenderer(const char *texname)
66-
: texname(texname), tex(NULL),
67-
cache(NULL), cachesize(0),
68-
blobs(NULL), maxblobs(0), startblob(0), endblob(0),
69-
verts(NULL), maxverts(0), startvert(0), endvert(0), availverts(0),
70-
indexes(NULL), maxindexes(0), startindex(0), endindex(0), availindexes(0),
71-
ebo(0), vbo(0), edata(NULL), vdata(NULL), numedata(0), numvdata(0),
72-
startrender(NULL), endrender(NULL), lastblob(NULL)
66+
: texname(texname), tex(nullptr),
67+
cache(nullptr), cachesize(0),
68+
blobs(nullptr), maxblobs(0), startblob(0), endblob(0),
69+
verts(nullptr), maxverts(0), startvert(0), endvert(0), availverts(0),
70+
indexes(nullptr), maxindexes(0), startindex(0), endindex(0), availindexes(0),
71+
ebo(0), vbo(0), edata(nullptr), vdata(nullptr), numedata(0), numvdata(0),
72+
startrender(nullptr), endrender(nullptr), lastblob(nullptr)
7373
{}
7474

7575
~blobrenderer()
@@ -87,7 +87,7 @@ struct blobrenderer
8787
DELETEA(edata);
8888
DELETEA(vdata);
8989
numedata = numvdata = 0;
90-
startrender = endrender = NULL;
90+
startrender = endrender = nullptr;
9191
}
9292

9393
void init(int tris)
@@ -307,7 +307,7 @@ struct blobrenderer
307307
}
308308
}
309309

310-
void gentris(cube &cu, int orient, const ivec &o, int size, materialsurface *mat = NULL, int vismask = 0)
310+
void gentris(cube &cu, int orient, const ivec &o, int size, materialsurface *mat = nullptr, int vismask = 0)
311311
{
312312
vec pos[MAXFACEVERTS+8];
313313
int dim = dimension(orient), numverts = 0, numplanes = 1, flat = -1;
@@ -452,7 +452,7 @@ struct blobrenderer
452452
int vismask = cu[i].visible;
453453
if(vismask&0xC0)
454454
{
455-
if(vismask&0x80) loopj(6) gentris(cu[i], j, co, size, NULL, vismask);
455+
if(vismask&0x80) loopj(6) gentris(cu[i], j, co, size, nullptr, vismask);
456456
else loopj(6) if(vismask&(1<<j)) gentris(cu[i], j, co, size);
457457
}
458458
}
@@ -488,7 +488,7 @@ struct blobrenderer
488488
blobalphahigh = scale / blobfadehigh;
489489
blobalpha = uchar(scale);
490490
gentris(worldroot, ivec(0, 0, 0), hdr.worldsize>>1);
491-
return !(b.flags & BL_DUP) ? &b : NULL;
491+
return !(b.flags & BL_DUP) ? &b : nullptr;
492492
}
493493

494494
static void setuprenderstate()
@@ -618,9 +618,9 @@ struct blobrenderer
618618
if(!vbo) glGenBuffers_(1, &vbo);
619619

620620
gle::bindebo(ebo);
621-
glBufferData_(GL_ELEMENT_ARRAY_BUFFER, maxindexes*sizeof(ushort), NULL, GL_STREAM_DRAW);
621+
glBufferData_(GL_ELEMENT_ARRAY_BUFFER, maxindexes*sizeof(ushort), nullptr, GL_STREAM_DRAW);
622622
gle::bindvbo(vbo);
623-
glBufferData_(GL_ARRAY_BUFFER, maxverts*sizeof(blobvert), NULL, GL_STREAM_DRAW);
623+
glBufferData_(GL_ARRAY_BUFFER, maxverts*sizeof(blobvert), nullptr, GL_STREAM_DRAW);
624624

625625
ushort *estart;
626626
blobvert *vstart;
@@ -644,7 +644,7 @@ struct blobrenderer
644644
b->flags &= ~BL_RENDER;
645645
if(b->next >= maxblobs) break;
646646
}
647-
startrender = endrender = NULL;
647+
startrender = endrender = nullptr;
648648
return;
649649
}
650650
}
@@ -661,7 +661,7 @@ struct blobrenderer
661661
vdst += b->endvert - b->startvert;
662662
if(b->next >= maxblobs) break;
663663
}
664-
startrender = endrender = NULL;
664+
startrender = endrender = nullptr;
665665

666666
if(intel_mapbufferrange_bug)
667667
{
@@ -686,7 +686,7 @@ struct blobrenderer
686686
};
687687

688688
int blobrenderer::lastreset = 0;
689-
blobrenderer *blobrenderer::lastrender = NULL;
689+
blobrenderer *blobrenderer::lastrender = nullptr;
690690

691691
VARF(IDF_PERSIST, blobstattris, 128, 4096, 16384, initblobs(BLOB_STATIC));
692692
VARF(IDF_PERSIST, blobdyntris, 128, 4096, 16384, initblobs(BLOB_DYNAMIC));
@@ -719,7 +719,7 @@ void flushblobs()
719719
{
720720
loopi(sizeof(blobs)/sizeof(blobs[0])) blobs[i].flushblobs();
721721
if(blobrenderer::lastrender) blobrenderer::cleanuprenderstate();
722-
blobrenderer::lastrender = NULL;
722+
blobrenderer::lastrender = nullptr;
723723
}
724724

725725
void cleanupblobs()

0 commit comments

Comments
 (0)