diff --git a/src/framework/tarray.h b/src/framework/tarray.h index b5012c2..f22605e 100644 --- a/src/framework/tarray.h +++ b/src/framework/tarray.h @@ -67,14 +67,14 @@ public: { Most = 0; Count = 0; - Array = NULL; + Array = nullptr; } TArray (int max) { Most = max; Count = 0; Array = (T *)malloc (sizeof(T)*max); - if (Array == NULL) + if (Array == nullptr) { throw std::bad_alloc(); } @@ -87,7 +87,7 @@ public: { if (&other != this) { - if (Array != NULL) + if (Array != nullptr) { if (Count > 0) { @@ -108,7 +108,7 @@ public: DoDelete (0, Count-1); } free (Array); - Array = NULL; + Array = nullptr; Count = 0; Most = 0; } @@ -198,10 +198,10 @@ public: Most = Count; if (Most == 0) { - if (Array != NULL) + if (Array != nullptr) { free (Array); - Array = NULL; + Array = nullptr; } } else @@ -281,7 +281,7 @@ private: if (Count != 0) { Array = (T *)malloc (sizeof(T)*Most); - if (Array == NULL) + if (Array == nullptr) { throw std::bad_alloc(); } @@ -292,7 +292,7 @@ private: } else { - Array = NULL; + Array = nullptr; } } @@ -300,7 +300,7 @@ private: { size_t allocsize = sizeof(T)*Most; Array = (T *)realloc (Array, allocsize); - if (Array == NULL) + if (Array == nullptr) { throw std::bad_alloc(); } @@ -326,7 +326,7 @@ public: { for (unsigned int i = 0; i < TArray::Size(); ++i) { - if ((*this)[i] != NULL) + if ((*this)[i] != nullptr) delete (*this)[i]; } } diff --git a/src/framework/templates.h b/src/framework/templates.h index 092936e..27239a3 100644 --- a/src/framework/templates.h +++ b/src/framework/templates.h @@ -54,7 +54,7 @@ // key - The key value to look for // // Returns: -// A pointer to the element with a matching key or NULL if none found. +// A pointer to the element with a matching key or nullptr if none found. //========================================================================== template @@ -83,7 +83,7 @@ const ClassType *BinarySearch (const ClassType *first, int max, max = mid - 1; } } - return NULL; + return nullptr; } //========================================================================== diff --git a/src/level/level.cpp b/src/level/level.cpp index 797bca9..fae17da 100644 --- a/src/level/level.cpp +++ b/src/level/level.cpp @@ -526,7 +526,7 @@ void FProcessor::BuildNodes() { NodesBuilt = true; - FNodeBuilder *builder = NULL; + FNodeBuilder *builder = nullptr; // ZDoom's UDMF spec requires compressed GL nodes. // No other UDMF spec has defined anything regarding nodes yet. @@ -553,7 +553,7 @@ void FProcessor::BuildNodes() SSELevel = 0; } builder = new FNodeBuilder(Level, PolyStarts, PolyAnchors, Wad.LumpName(Lump), BuildGLNodes); - if (builder == NULL) + if (builder == nullptr) { throw std::runtime_error(" Not enough memory to build nodes!"); } @@ -583,7 +583,7 @@ void FProcessor::BuildNodes() // Now repeat the process to obtain regular nodes delete builder; builder = new FNodeBuilder(Level, PolyStarts, PolyAnchors, Wad.LumpName(Lump), false); - if (builder == NULL) + if (builder == nullptr) { throw std::runtime_error(" Not enough memory to build regular nodes!"); } @@ -597,11 +597,11 @@ void FProcessor::BuildNodes() } } delete builder; - builder = NULL; + builder = nullptr; } catch (...) { - if (builder != NULL) + if (builder != nullptr) { delete builder; } @@ -689,7 +689,7 @@ void FProcessor::Write (FWadWriter &out) memcpy (Level.Blockmap, blocks, Level.BlockmapSize*sizeof(uint16_t)); Level.RejectSize = (Level.NumSectors()*Level.NumSectors() + 7) / 8; - Level.Reject = NULL; + Level.Reject = nullptr; switch (RejectMode) { @@ -710,7 +710,7 @@ void FProcessor::Write (FWadWriter &out) { // If the reject is the wrong size, don't use it. delete[] Level.Reject; - Level.Reject = NULL; + Level.Reject = nullptr; if (Level.RejectSize != 0) { // Do not warn about 0-length rejects printf (" REJECT is the wrong size, so it will be removed.\n"); @@ -742,7 +742,7 @@ void FProcessor::Write (FWadWriter &out) if (!isUDMF) { - if (Level.GLNodes != NULL ) + if (Level.GLNodes != nullptr ) { gl5 = V5GLNodes || (Level.NumGLVertices > 32767) || @@ -826,7 +826,7 @@ void FProcessor::Write (FWadWriter &out) { LMBuilder.AddLightmapLump(out); }*/ - if (Level.GLNodes != NULL && !compressGL) + if (Level.GLNodes != nullptr && !compressGL) { char glname[9]; glname[0] = 'G'; @@ -878,7 +878,7 @@ MapNodeEx *FProcessor::NodesToEx (const MapNode *nodes, int count) { if (count == 0) { - return NULL; + return nullptr; } MapNodeEx *Nodes = new MapNodeEx[Level.NumNodes]; @@ -913,7 +913,7 @@ MapSubsectorEx *FProcessor::SubsectorsToEx (const MapSubsector *ssec, int count) { if (count == 0) { - return NULL; + return nullptr; } MapSubsectorEx *out = new MapSubsectorEx[Level.NumSubsectors]; @@ -932,7 +932,7 @@ MapSegGLEx *FProcessor::SegGLsToEx (const MapSegGL *segs, int count) { if (count == 0) { - return NULL; + return nullptr; } MapSegGLEx *out = new MapSegGLEx[count]; @@ -1238,7 +1238,7 @@ void FProcessor::WriteBlockmap (FWadWriter &out) void FProcessor::WriteReject (FWadWriter &out) { - if (RejectMode == ERM_Create0 || Level.Reject == NULL) + if (RejectMode == ERM_Create0 || Level.Reject == nullptr) { out.CreateLabel ("REJECT"); } diff --git a/src/level/level_udmf.cpp b/src/level/level_udmf.cpp index dffd0f9..417b4a5 100644 --- a/src/level/level_udmf.cpp +++ b/src/level/level_udmf.cpp @@ -78,7 +78,7 @@ public: char * Copy(const char * p) { - return p != NULL? strcpy(Alloc(strlen(p)+1) , p) : NULL; + return p != nullptr? strcpy(Alloc(strlen(p)+1) , p) : nullptr; } }; diff --git a/src/lightmap/kexlib/math/angle.cpp b/src/lightmap/kexlib/math/angle.cpp index e6e38ca..904e0a7 100644 --- a/src/lightmap/kexlib/math/angle.cpp +++ b/src/lightmap/kexlib/math/angle.cpp @@ -239,7 +239,7 @@ kexVec3 kexAngle::ToForwardAxis() { kexVec3 vec; - ToAxis(&vec, NULL, NULL); + ToAxis(&vec, nullptr, nullptr); return vec; } @@ -251,7 +251,7 @@ kexVec3 kexAngle::ToUpAxis() { kexVec3 vec; - ToAxis(NULL, &vec, NULL); + ToAxis(nullptr, &vec, nullptr); return vec; } @@ -263,7 +263,7 @@ kexVec3 kexAngle::ToRightAxis() { kexVec3 vec; - ToAxis(NULL, NULL, &vec); + ToAxis(nullptr, nullptr, &vec); return vec; } diff --git a/src/lightmap/surfaces.cpp b/src/lightmap/surfaces.cpp index 1890454..f1590b3 100644 --- a/src/lightmap/surfaces.cpp +++ b/src/lightmap/surfaces.cpp @@ -148,7 +148,7 @@ static void CreateSideSurfaces(FLevel &doomMap, IntSideDef *side) } // middle seg - if (back == NULL) + if (back == nullptr) { surf = new surface_t(); surf->numVerts = 4; @@ -175,7 +175,7 @@ static void CreateSideSurfaces(FLevel &doomMap, IntSideDef *side) static void CreateSubsectorSurfaces(FLevel &doomMap) { surface_t *surf; - IntSector *sector = NULL; + IntSector *sector = nullptr; int i; int j; diff --git a/src/main.cpp b/src/main.cpp index 6867864..ef105a3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -90,7 +90,7 @@ extern "C" char *optarg; // PUBLIC DATA DEFINITIONS ------------------------------------------------- -const char *Map = NULL; +const char *Map = nullptr; const char *InName; const char *OutName = "tmp.wad"; bool BuildNodes = true; @@ -176,7 +176,7 @@ int main(int argc, char **argv) ParseArgs(argc, argv); - if (InName == NULL) + if (InName == nullptr) { if (optind >= argc || optind < argc - 1) { // Source file is unspecified or followed by junk @@ -203,7 +203,7 @@ int main(int argc, char **argv) char *out = new char[strlen(OutName) + 3], *dot; - if (out == NULL) + if (out == nullptr) { throw std::runtime_error("Could not create temporary file name."); } @@ -251,7 +251,7 @@ int main(int argc, char **argv) else if (inwad.IsGLNodes(lump)) { // Ignore GL nodes from the input for any maps we process. - if (BuildNodes && (Map == NULL || stricmp(inwad.LumpName(lump) + 3, Map) == 0)) + if (BuildNodes && (Map == nullptr || stricmp(inwad.LumpName(lump) + 3, Map) == 0)) { lump = inwad.SkipGLNodes(lump); } @@ -320,7 +320,7 @@ static void ParseArgs(int argc, char **argv) { int ch; - while ((ch = getopt_long(argc, argv, short_opts, long_opts, NULL)) != EOF) + while ((ch = getopt_long(argc, argv, short_opts, long_opts, nullptr)) != EOF) { switch (ch) { @@ -591,13 +591,13 @@ static bool CheckInOutNames() HANDLE inFile, outFile; outFile = CreateFile(OutName, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, OPEN_EXISTING, 0, NULL); + nullptr, OPEN_EXISTING, 0, nullptr); if (outFile == INVALID_HANDLE_VALUE) { return false; } inFile = CreateFile(InName, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, OPEN_EXISTING, 0, NULL); + nullptr, OPEN_EXISTING, 0, nullptr); if (inFile == INVALID_HANDLE_VALUE) { CloseHandle(outFile); diff --git a/src/nodebuilder/nodebuild.h b/src/nodebuilder/nodebuild.h index 64db581..3eff724 100644 --- a/src/nodebuilder/nodebuild.h +++ b/src/nodebuilder/nodebuild.h @@ -26,8 +26,8 @@ public: ~FEventTree (); FEvent *GetMinimum (); - FEvent *GetSuccessor (FEvent *event) const { FEvent *node = Successor(event); return node == &Nil ? NULL : node; } - FEvent *GetPredecessor (FEvent *event) const { FEvent *node = Predecessor(event); return node == &Nil ? NULL : node; } + FEvent *GetSuccessor (FEvent *event) const { FEvent *node = Successor(event); return node == &Nil ? nullptr : node; } + FEvent *GetPredecessor (FEvent *event) const { FEvent *node = Predecessor(event); return node == &Nil ? nullptr : node; } FEvent *GetNewNode (); void Insert (FEvent *event); diff --git a/src/nodebuilder/nodebuild_events.cpp b/src/nodebuilder/nodebuild_events.cpp index b0e4b5c..4fbb927 100644 --- a/src/nodebuilder/nodebuild_events.cpp +++ b/src/nodebuilder/nodebuild_events.cpp @@ -23,7 +23,7 @@ #include "nodebuilder/nodebuild.h" FEventTree::FEventTree () -: Root (&Nil), Spare (NULL) +: Root (&Nil), Spare (nullptr) { memset (&Nil, 0, sizeof(Nil)); } @@ -34,7 +34,7 @@ FEventTree::~FEventTree () DeleteAll (); probe = Spare; - while (probe != NULL) + while (probe != nullptr) { FEvent *next = probe->Left; delete probe; @@ -50,7 +50,7 @@ void FEventTree::DeleteAll () void FEventTree::DeletionTraverser (FEvent *node) { - if (node != &Nil && node != NULL) + if (node != &Nil && node != nullptr) { DeletionTraverser (node->Left); DeletionTraverser (node->Right); @@ -63,7 +63,7 @@ FEvent *FEventTree::GetNewNode () { FEvent *node; - if (Spare != NULL) + if (Spare != nullptr) { node = Spare; Spare = node->Left; @@ -174,7 +174,7 @@ FEvent *FEventTree::FindEvent (double key) const node = node->Right; } } - return NULL; + return nullptr; } FEvent *FEventTree::GetMinimum () @@ -183,7 +183,7 @@ FEvent *FEventTree::GetMinimum () if (node == &Nil) { - return NULL; + return nullptr; } while (node->Left != &Nil) { diff --git a/src/nodebuilder/nodebuild_extract.cpp b/src/nodebuilder/nodebuild_extract.cpp index 3d79147..98e492f 100644 --- a/src/nodebuilder/nodebuild_extract.cpp +++ b/src/nodebuilder/nodebuild_extract.cpp @@ -155,7 +155,7 @@ int FNodeBuilder::CloseSubsector (TArray &segs, int subsector) for (i = first + 1; i < max; ++i) { angle_t bestdiff = ANGLE_MAX; - FPrivSeg *bestseg = NULL; + FPrivSeg *bestseg = nullptr; int bestj = -1; for (j = first; j < max; ++j) { @@ -176,7 +176,7 @@ int FNodeBuilder::CloseSubsector (TArray &segs, int subsector) bestj = j; } } - if (bestseg != NULL) + if (bestseg != nullptr) { seg = bestseg; } @@ -272,7 +272,7 @@ int FNodeBuilder::OutputDegenerateSubsector (TArray &segs, int subse for (i = first + 1; i < max; ++i) { double bestdot = bestinit[bForward]; - FPrivSeg *bestseg = NULL; + FPrivSeg *bestseg = nullptr; for (j = first + 1; j < max; ++j) { seg = &Segs[SegList[j].SegNum]; @@ -301,7 +301,7 @@ int FNodeBuilder::OutputDegenerateSubsector (TArray &segs, int subse } } } - if (bestseg != NULL) + if (bestseg != nullptr) { if (prev->v2 != bestseg->v1) { diff --git a/src/nodebuilder/nodebuild_gl.cpp b/src/nodebuilder/nodebuild_gl.cpp index 8055089..8a4771a 100644 --- a/src/nodebuilder/nodebuild_gl.cpp +++ b/src/nodebuilder/nodebuild_gl.cpp @@ -44,7 +44,7 @@ double FNodeBuilder::AddIntersection (const node_t &node, int vertex) FEvent *event = Events.FindEvent (dist); - if (event == NULL) + if (event == nullptr) { event = Events.GetNewNode (); event->Distance = dist; @@ -72,7 +72,7 @@ void FNodeBuilder::FixSplitSharers () FEvent *event = Events.FindEvent (SplitSharers[i].Distance); FEvent *next; - if (event == NULL) + if (event == nullptr) { // Should not happen continue; } @@ -89,7 +89,7 @@ void FNodeBuilder::FixSplitSharers () if (SplitSharers[i].Forward) { event = Events.GetSuccessor (event); - if (event == NULL) + if (event == nullptr) { continue; } @@ -98,14 +98,14 @@ void FNodeBuilder::FixSplitSharers () else { event = Events.GetPredecessor (event); - if (event == NULL) + if (event == nullptr) { continue; } next = Events.GetPredecessor (event); } - while (event != NULL && next != NULL && event->Info.Vertex != v2) + while (event != nullptr && next != nullptr && event->Info.Vertex != v2) { D(printf("Forced split of seg %d(%d[%d,%d]->%d[%d,%d]) at %d(%d,%d):%g\n", seg, Segs[seg].v1, @@ -161,11 +161,11 @@ void FNodeBuilder::FixSplitSharers () void FNodeBuilder::AddMinisegs (const node_t &node, uint32_t splitseg, uint32_t &fset, uint32_t &bset) { - FEvent *event = Events.GetMinimum (), *prev = NULL; + FEvent *event = Events.GetMinimum (), *prev = nullptr; - while (event != NULL) + while (event != nullptr) { - if (prev != NULL) + if (prev != nullptr) { uint32_t fseg1, bseg1, fseg2, bseg2; uint32_t fnseg, bnseg; @@ -236,7 +236,7 @@ uint32_t FNodeBuilder::AddMiniseg (int v1, int v2, uint32_t partner, uint32_t se newseg.loopnum = 0; newseg.next = DWORD_MAX; newseg.planefront = true; - newseg.hashnext = NULL; + newseg.hashnext = nullptr; newseg.storedseg = DWORD_MAX; newseg.frontsector = -1; newseg.backsector = -1; diff --git a/src/nodebuilder/nodebuild_utility.cpp b/src/nodebuilder/nodebuild_utility.cpp index 9144e10..66c2d4a 100644 --- a/src/nodebuilder/nodebuild_utility.cpp +++ b/src/nodebuilder/nodebuild_utility.cpp @@ -115,7 +115,7 @@ int FNodeBuilder::CreateSeg (int linenum, int sidenum) seg.loopnum = 0; seg.offset = 0; seg.partner = DWORD_MAX; - seg.hashnext = NULL; + seg.hashnext = nullptr; seg.planefront = false; seg.planenum = DWORD_MAX; seg.storedseg = DWORD_MAX; @@ -163,7 +163,7 @@ void FNodeBuilder::GroupSegPlanes () { FPrivSeg *seg = &Segs[i]; seg->next = i+1; - seg->hashnext = NULL; + seg->hashnext = nullptr; } Segs[Segs.Size()-1].next = DWORD_MAX; @@ -182,7 +182,7 @@ void FNodeBuilder::GroupSegPlanes () FPrivSeg *check = buckets[ang >>= 31-bucketbits]; - while (check != NULL) + while (check != nullptr) { fixed_t cx1 = Vertices[check->v1].x; fixed_t cy1 = Vertices[check->v1].y; @@ -195,7 +195,7 @@ void FNodeBuilder::GroupSegPlanes () } check = check->hashnext; } - if (check != NULL) + if (check != nullptr) { seg->planenum = check->planenum; const FSimpleLine *line = &Planes[seg->planenum]; diff --git a/src/parse/sc_man.cpp b/src/parse/sc_man.cpp index 899c817..9f08cbb 100644 --- a/src/parse/sc_man.cpp +++ b/src/parse/sc_man.cpp @@ -116,7 +116,7 @@ static void SC_PrepareScript () ScriptOpen = true; sc_String = StringBuffer; AlreadyGot = false; - SavedScriptPtr = NULL; + SavedScriptPtr = nullptr; CMode = false; } @@ -130,7 +130,7 @@ void SC_Close () { if (ScriptOpen) { - ScriptBuffer = NULL; + ScriptBuffer = nullptr; ScriptOpen = false; } } @@ -148,7 +148,7 @@ void SC_SavePos () CheckOpen (); if (sc_End) { - SavedScriptPtr = NULL; + SavedScriptPtr = nullptr; } else { @@ -341,7 +341,7 @@ bool SC_GetString () else { grabtoken: - while ((*ScriptPtr > ' ') && (strchr (stopchars, *ScriptPtr) == NULL) + while ((*ScriptPtr > ' ') && (strchr (stopchars, *ScriptPtr) == nullptr) && (CMode || *ScriptPtr != ASCII_COMMENT) && !(ScriptPtr[0] == CPP_COMMENT && (ScriptPtr < ScriptEndPtr - 1) && (ScriptPtr[1] == CPP_COMMENT || ScriptPtr[1] == C_COMMENT))) @@ -632,7 +632,7 @@ int SC_MatchString (const char **strings) { int i; - for (i = 0; *strings != NULL; i++) + for (i = 0; *strings != nullptr; i++) { if (SC_Compare (*strings++)) { @@ -655,7 +655,7 @@ int SC_MustMatchString (const char **strings) i = SC_MatchString (strings); if (i == -1) { - SC_ScriptError (NULL); + SC_ScriptError (nullptr); } return i; } @@ -684,7 +684,7 @@ bool SC_Compare (const char *text) void SC_ScriptError (const char *message, ...) { char composed[2048]; - if (message == NULL) + if (message == nullptr) { message = "Bad syntax."; } diff --git a/src/viewer/view.cpp b/src/viewer/view.cpp index 428287f..cadeb8c 100644 --- a/src/viewer/view.cpp +++ b/src/viewer/view.cpp @@ -170,7 +170,7 @@ INT_PTR CALLBACK ViewDialogFunc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPa { Viewing = newmode; ResetViews (); - InvalidateRect (GetDlgItem (hDlg, IDC_MAPVIEW), NULL, TRUE); + InvalidateRect (GetDlgItem (hDlg, IDC_MAPVIEW), nullptr, TRUE); } } break; @@ -239,12 +239,12 @@ static void DrawSubsector (HDC dc, int ssec) int seg = Level->Subsectors[ssec].firstline + i; if (Level->Segs[seg].side == 0) { - MoveToEx (dc, VERTX(Level->Segs[seg].v1), VERTY(Level->Segs[seg].v1), NULL); + MoveToEx (dc, VERTX(Level->Segs[seg].v1), VERTY(Level->Segs[seg].v1), nullptr); LineTo (dc, VERTX(Level->Segs[seg].v2), VERTY(Level->Segs[seg].v2)); } else { - MoveToEx (dc, VERTX(Level->Segs[seg].v2), VERTY(Level->Segs[seg].v2), NULL); + MoveToEx (dc, VERTX(Level->Segs[seg].v2), VERTY(Level->Segs[seg].v2), nullptr); LineTo (dc, VERTX(Level->Segs[seg].v1), VERTY(Level->Segs[seg].v1)); } } @@ -255,10 +255,10 @@ static void DrawSubsectorGL (HDC dc, int ssec, HPEN miniPen, HPEN badPen) int seg; seg = Level->GLSubsectors[ssec].firstline; - MoveToEx (dc, GLVERTX(Level->GLSegs[seg].v1), GLVERTY(Level->GLSegs[seg].v1), NULL); + MoveToEx (dc, GLVERTX(Level->GLSegs[seg].v1), GLVERTY(Level->GLSegs[seg].v1), nullptr); for (uint32_t i = 0; i < Level->GLSubsectors[ssec].numlines; ++i) { - HPEN oldPen = NULL; + HPEN oldPen = nullptr; seg = Level->GLSubsectors[ssec].firstline + i; if (Level->GLSegs[seg].linedef == NO_INDEX) { @@ -273,15 +273,15 @@ static void DrawSubsectorGL (HDC dc, int ssec, HPEN miniPen, HPEN badPen) } if (Level->GLSegs[seg].side == 0 || 1) { - //MoveToEx (dc, GLVERTX(Level->GLSegs[seg].v1), GLVERTY(Level->GLSegs[seg].v1), NULL); + //MoveToEx (dc, GLVERTX(Level->GLSegs[seg].v1), GLVERTY(Level->GLSegs[seg].v1), nullptr); LineTo (dc, GLVERTX(Level->GLSegs[seg].v2), GLVERTY(Level->GLSegs[seg].v2)); } else { - //MoveToEx (dc, GLVERTX(Level->GLSegs[seg].v2), GLVERTY(Level->GLSegs[seg].v2), NULL); + //MoveToEx (dc, GLVERTX(Level->GLSegs[seg].v2), GLVERTY(Level->GLSegs[seg].v2), nullptr); LineTo (dc, GLVERTX(Level->GLSegs[seg].v1), GLVERTY(Level->GLSegs[seg].v1)); } - if (oldPen != NULL) + if (oldPen != nullptr) { SelectObject (dc, oldPen); } @@ -402,7 +402,7 @@ static void DrawSplitter (HDC dc, MapNodeEx *node) dy <<= 1; } SelectObject (dc, Splitter); - MoveToEx (dc, (node->x - dx) >> 16, (node->y - dy) >> 16, NULL); + MoveToEx (dc, (node->x - dx) >> 16, (node->y - dy) >> 16, nullptr); LineTo (dc, (node->x + 2*dx) >> 16, (node->y + 2*dy) >> 16); } @@ -609,7 +609,7 @@ static void DrawLevelReject (HDC dc) { choice = SEE_FROM; } - else if (Level->Reject != NULL) + else if (Level->Reject != nullptr) { int pnum = seeFromRow + Level->Sides[Level->Lines[i].sidenum[0]].sector; if (Level->Reject[pnum>>3] & (1<<(pnum&7))) @@ -632,7 +632,7 @@ static void DrawLevelReject (HDC dc) { choice = SEE_FROM; } - else if (Level->Reject != NULL && choice < CAN_SEE) + else if (Level->Reject != nullptr && choice < CAN_SEE) { int pnum = seeFromRow + Level->Sides[Level->Lines[i].sidenum[1]].sector; if (Level->Reject[pnum>>3] & (1<<(pnum&7))) @@ -662,7 +662,7 @@ static void DrawLevelReject (HDC dc) default: break; } } - MoveToEx (dc, VERTX(Level->Lines[i].v1), VERTY(Level->Lines[i].v1), NULL); + MoveToEx (dc, VERTX(Level->Lines[i].v1), VERTY(Level->Lines[i].v1), nullptr); LineTo (dc, VERTX(Level->Lines[i].v2), VERTY(Level->Lines[i].v2)); } } @@ -768,7 +768,7 @@ static void DrawLevel (HDC dc) for (i = 0; i < Level->NumSegs; ++i) { - MoveToEx (dc, VERTX(Level->Segs[i].v1), VERTY(Level->Segs[i].v1), NULL); + MoveToEx (dc, VERTX(Level->Segs[i].v1), VERTY(Level->Segs[i].v1), nullptr); LineTo (dc, VERTX(Level->Segs[i].v2), VERTY(Level->Segs[i].v2)); } */ @@ -793,7 +793,7 @@ void SizeView (HWND wnd, bool firstTime) else if (sinfo.nPos > sinfo.nMax - (int)sinfo.nPage) { int delta = sinfo.nPos - sinfo.nMax + (int)sinfo.nPage; - ScrollWindowEx (wnd, 0, (delta + Divisor-1) / Divisor, NULL, NULL, NULL, NULL, SW_INVALIDATE|SW_ERASE); + ScrollWindowEx (wnd, 0, (delta + Divisor-1) / Divisor, nullptr, nullptr, nullptr, nullptr, SW_INVALIDATE|SW_ERASE); sinfo.nPos = sinfo.nMax - sinfo.nPage; } SetScrollInfo (wnd, SB_VERT, &sinfo, TRUE); @@ -809,7 +809,7 @@ void SizeView (HWND wnd, bool firstTime) else if (sinfo.nPos > sinfo.nMax - (int)sinfo.nPage) { int delta = sinfo.nPos - sinfo.nMax + (int)sinfo.nPage; - ScrollWindowEx (wnd, (delta + Divisor-1) / Divisor, 0, NULL, NULL, NULL, NULL, SW_INVALIDATE|SW_ERASE); + ScrollWindowEx (wnd, (delta + Divisor-1) / Divisor, 0, nullptr, nullptr, nullptr, nullptr, SW_INVALIDATE|SW_ERASE); sinfo.nPos = sinfo.nMax - sinfo.nPage; } SetScrollInfo (wnd, SB_HORZ, &sinfo, TRUE); @@ -831,24 +831,24 @@ LRESULT CALLBACK MapViewFunc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam case WM_SIZE: SizeView (hWnd, false); - //InvalidateRect (hWnd, NULL, TRUE); + //InvalidateRect (hWnd, nullptr, TRUE); break; case WM_PAINT: - if (GetUpdateRect (hWnd, NULL, FALSE)) + if (GetUpdateRect (hWnd, nullptr, FALSE)) { PAINTSTRUCT paint; HDC dc = BeginPaint (hWnd, &paint); - if (dc != NULL) + if (dc != nullptr) { sinfo.fMask = SIF_POS; GetScrollInfo (hWnd, SB_HORZ, &sinfo); pos = sinfo.nPos; GetScrollInfo (hWnd, SB_VERT, &sinfo); SetMapMode (dc, MM_ANISOTROPIC); - ScaleWindowExtEx (dc, Divisor, 1, Divisor, -1, NULL); - SetWindowOrgEx (dc, pos + MapBounds.left, MapBounds.bottom - sinfo.nPos, NULL); + ScaleWindowExtEx (dc, Divisor, 1, Divisor, -1, nullptr); + SetWindowOrgEx (dc, pos + MapBounds.left, MapBounds.bottom - sinfo.nPos, nullptr); DrawLevel (dc); EndPaint (hWnd, &paint); } @@ -880,7 +880,7 @@ LRESULT CALLBACK MapViewFunc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam PostMessage (GetParent (hWnd), WM_APP, DesiredSector, 0); break; } - InvalidateRect (hWnd, NULL, TRUE); + InvalidateRect (hWnd, nullptr, TRUE); return 0; case WM_HSCROLL: @@ -902,7 +902,7 @@ LRESULT CALLBACK MapViewFunc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam SetScrollPos (hWnd, SB_HORZ, pos, TRUE); int oldx = sinfo.nPos / Divisor; int newx = pos / Divisor; - ScrollWindowEx (hWnd, oldx - newx, 0, NULL, NULL, NULL, NULL, SW_INVALIDATE|SW_ERASE); + ScrollWindowEx (hWnd, oldx - newx, 0, nullptr, nullptr, nullptr, nullptr, SW_INVALIDATE|SW_ERASE); UpdateWindow (hWnd); } return 0; @@ -924,7 +924,7 @@ LRESULT CALLBACK MapViewFunc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam if (pos != sinfo.nPos) { SetScrollPos (hWnd, SB_VERT, pos, TRUE); - ScrollWindowEx (hWnd, 0, (sinfo.nPos - pos) / Divisor, NULL, NULL, NULL, NULL, SW_INVALIDATE|SW_ERASE); + ScrollWindowEx (hWnd, 0, (sinfo.nPos - pos) / Divisor, nullptr, nullptr, nullptr, nullptr, SW_INVALIDATE|SW_ERASE); UpdateWindow (hWnd); } return 0; @@ -938,7 +938,7 @@ LRESULT CALLBACK MapViewFunc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam if (pos != sinfo.nPos) { SetScrollPos (hWnd, SB_VERT, pos, TRUE); - ScrollWindowEx (hWnd, 0, (sinfo.nPos - pos) / Divisor, NULL, NULL, NULL, NULL, SW_INVALIDATE|SW_ERASE); + ScrollWindowEx (hWnd, 0, (sinfo.nPos - pos) / Divisor, nullptr, nullptr, nullptr, nullptr, SW_INVALIDATE|SW_ERASE); UpdateWindow (hWnd); } return 0; @@ -975,7 +975,7 @@ LRESULT CALLBACK MapViewFunc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam if (pos != sinfo.nPos) { SetScrollPos (hWnd, SB_HORZ, pos, TRUE); - ScrollWindowEx (hWnd, (sinfo.nPos - pos) / Divisor, 0, NULL, NULL, NULL, NULL, SW_INVALIDATE|SW_ERASE); + ScrollWindowEx (hWnd, (sinfo.nPos - pos) / Divisor, 0, nullptr, nullptr, nullptr, nullptr, SW_INVALIDATE|SW_ERASE); UpdateWindow (hWnd); } } @@ -990,7 +990,7 @@ LRESULT CALLBACK MapViewFunc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam if (pos != sinfo.nPos) { SetScrollPos (hWnd, SB_VERT, pos, TRUE); - ScrollWindowEx (hWnd, 0, (sinfo.nPos - pos) / Divisor, NULL, NULL, NULL, NULL, SW_INVALIDATE|SW_ERASE); + ScrollWindowEx (hWnd, 0, (sinfo.nPos - pos) / Divisor, nullptr, nullptr, nullptr, nullptr, SW_INVALIDATE|SW_ERASE); UpdateWindow (hWnd); } } @@ -1022,7 +1022,7 @@ void ShowView (FLevel *level) { Level = level; - if (level->Blockmap != NULL) + if (level->Blockmap != nullptr) { MapBounds.left = short(level->Blockmap[0]) - 8; MapBounds.right = short(level->Blockmap[0]) + (level->Blockmap[2] << BLOCKBITS) + 8; @@ -1040,7 +1040,7 @@ void ShowView (FLevel *level) MapSize.y = MapBounds.bottom - MapBounds.top; Divisor = 1; - if (Level->Subsectors == NULL) + if (Level->Subsectors == nullptr) { Viewing = ViewGLSubsectors; } @@ -1050,7 +1050,7 @@ void ShowView (FLevel *level) } ResetViews (); - DialogBox (GetModuleHandle(0), MAKEINTRESOURCE(IDD_MAPVIEW), NULL, ViewDialogFunc); + DialogBox (GetModuleHandle(0), MAKEINTRESOURCE(IDD_MAPVIEW), nullptr, ViewDialogFunc); UnregisterClass ("MapViewer", GetModuleHandle(0)); } } diff --git a/src/wad/wad.cpp b/src/wad/wad.cpp index 7609738..0cad418 100644 --- a/src/wad/wad.cpp +++ b/src/wad/wad.cpp @@ -61,10 +61,10 @@ static const char GLLumpNames[5][9] = }; FWadReader::FWadReader (const char *filename) - : Lumps (NULL), File (NULL) + : Lumps (nullptr), File (nullptr) { File = fopen (filename, "rb"); - if (File == NULL) + if (File == nullptr) { throw std::runtime_error("Could not open input file"); } @@ -76,7 +76,7 @@ FWadReader::FWadReader (const char *filename) Header.Magic[3] != 'D') { fclose (File); - File = NULL; + File = nullptr; throw std::runtime_error("Input file is not a wad"); } @@ -341,10 +341,10 @@ const char *FWadReader::LumpName (int lump) } FWadWriter::FWadWriter (const char *filename, bool iwad) - : File (NULL) + : File (nullptr) { File = fopen (filename, "wb"); - if (File == NULL) + if (File == nullptr) { throw std::runtime_error("Could not open output file"); } @@ -387,7 +387,7 @@ void FWadWriter::Close () fseek (File, 4, SEEK_SET); SafeWrite (head, 8); fclose (File); - File = NULL; + File = nullptr; } } @@ -419,7 +419,7 @@ void FWadWriter::CopyLump (FWadReader &wad, int lump) int size; ReadLump (wad, lump, data, size); - if (data != NULL) + if (data != nullptr) { WriteLump (wad.LumpName (lump), data, size); delete[] data; @@ -442,7 +442,7 @@ void FWadWriter::SafeWrite (const void *buffer, size_t size) if (fwrite (buffer, 1, size, File) != size) { fclose (File); - File = NULL; + File = nullptr; throw std::runtime_error( "Failed to write. Check that this directory is writable and\n" "that you have enough free disk space."); diff --git a/src/wad/wad.h b/src/wad/wad.h index 2e4ec39..b029d65 100644 --- a/src/wad/wad.h +++ b/src/wad/wad.h @@ -59,7 +59,7 @@ void ReadLump (FWadReader &wad, int index, T *&data, int &size) { if ((unsigned)index >= (unsigned)wad.Header.NumLumps) { - data = NULL; + data = nullptr; size = 0; return; }