diff --git a/source/common/2d/v_2ddrawer.h b/source/common/2d/v_2ddrawer.h index 3567f2bff1..c2be564dc9 100644 --- a/source/common/2d/v_2ddrawer.h +++ b/source/common/2d/v_2ddrawer.h @@ -192,7 +192,7 @@ class F2DDrawer TArray mVertices; TArray mData; int Width, Height; - bool isIn2D; + bool isIn2D = false; bool locked = false; // prevents clearing of the data so it can be reused multiple times (useful for screen fades) float screenFade = 1.f; DVector2 offset; @@ -317,7 +317,7 @@ class DShape2D : public DObject RefCountedPtr bufferInfo; - DrawParms* lastParms; + DrawParms* lastParms = nullptr; void OnDestroy() override; }; diff --git a/source/common/filesystem/include/fs_filesystem.h b/source/common/filesystem/include/fs_filesystem.h index bfd134758f..858b748374 100644 --- a/source/common/filesystem/include/fs_filesystem.h +++ b/source/common/filesystem/include/fs_filesystem.h @@ -154,20 +154,20 @@ class FileSystem std::vector FileInfo; std::vector Hashes; // one allocation for all hash lists. - uint32_t *FirstLumpIndex; // [RH] Hashing stuff moved out of lumpinfo structure - uint32_t *NextLumpIndex; + uint32_t *FirstLumpIndex = nullptr; // [RH] Hashing stuff moved out of lumpinfo structure + uint32_t *NextLumpIndex = nullptr; - uint32_t *FirstLumpIndex_FullName; // The same information for fully qualified paths from .zips - uint32_t *NextLumpIndex_FullName; + uint32_t *FirstLumpIndex_FullName = nullptr; // The same information for fully qualified paths from .zips + uint32_t *NextLumpIndex_FullName = nullptr; - uint32_t *FirstLumpIndex_NoExt; // The same information for fully qualified paths from .zips - uint32_t *NextLumpIndex_NoExt; + uint32_t *FirstLumpIndex_NoExt = nullptr; // The same information for fully qualified paths from .zips + uint32_t *NextLumpIndex_NoExt = nullptr; - uint32_t* FirstLumpIndex_ResId; // The same information for fully qualified paths from .zips - uint32_t* NextLumpIndex_ResId; + uint32_t* FirstLumpIndex_ResId = nullptr; // The same information for fully qualified paths from .zips + uint32_t* NextLumpIndex_ResId = nullptr; uint32_t NumEntries = 0; // Not necessarily the same as FileInfo.Size() - uint32_t NumWads; + uint32_t NumWads = 0; int IwadIndex = -1; int MaxIwadIndex = -1; diff --git a/source/common/filesystem/source/filesystem.cpp b/source/common/filesystem/source/filesystem.cpp index 74da5a2602..a310efb406 100644 --- a/source/common/filesystem/source/filesystem.cpp +++ b/source/common/filesystem/source/filesystem.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include "resourcefile.h" #include "fs_filesystem.h" @@ -415,7 +416,7 @@ void FileSystem::AddFile (const char *filename, FileReader *filer, LumpFilterInf snprintf(cksumout + (j * 2), 3, "%02X", cksum[j]); } - fprintf(hashfile, "file: %s, hash: %s, size: %d\n", filename, cksumout, (int)filereader.GetLength()); + fprintf(hashfile, "file: %s, hash: %s, size: %td\n", filename, cksumout, filereader.GetLength()); } else @@ -434,7 +435,7 @@ void FileSystem::AddFile (const char *filename, FileReader *filer, LumpFilterInf snprintf(cksumout + (j * 2), 3, "%02X", cksum[j]); } - fprintf(hashfile, "file: %s, lump: %s, hash: %s, size: %lu\n", filename, resfile->getName(i), cksumout, (uint64_t)resfile->Length(i)); + fprintf(hashfile, "file: %s, lump: %s, hash: %s, size: %zu\n", filename, resfile->getName(i), cksumout, (uint64_t)resfile->Length(i)); } } } diff --git a/source/common/scripting/core/symbols.h b/source/common/scripting/core/symbols.h index 15d547f7dd..b75d3a2ea2 100644 --- a/source/common/scripting/core/symbols.h +++ b/source/common/scripting/core/symbols.h @@ -54,7 +54,7 @@ class PSymbolType : public PSymbol { DECLARE_CLASS(PSymbolType, PSymbol); public: - PType *Type; + PType *Type = nullptr; PSymbolType(FName name, class PType *ty) : PSymbol(name), Type(ty) {} PSymbolType() : PSymbol(NAME_None) {} @@ -66,7 +66,7 @@ class PSymbolTreeNode : public PSymbol { DECLARE_CLASS(PSymbolTreeNode, PSymbol); public: - struct ZCC_TreeNode *Node; + struct ZCC_TreeNode *Node = nullptr; PSymbolTreeNode(FName name, struct ZCC_TreeNode *node) : PSymbol(name), Node(node) {} PSymbolTreeNode() : PSymbol(NAME_None) {} @@ -147,11 +147,11 @@ class PSymbolConstNumeric : public PSymbolConst void *Pad; }; - PSymbolConstNumeric(FName name, PType *type=NULL) : PSymbolConst(name, type) {} + PSymbolConstNumeric(FName name, PType *type=nullptr) : PSymbolConst(name, type), Float(0) {} PSymbolConstNumeric(FName name, PType *type, int val) : PSymbolConst(name, type), Value(val) {} PSymbolConstNumeric(FName name, PType *type, unsigned int val) : PSymbolConst(name, type), Value((int)val) {} PSymbolConstNumeric(FName name, PType *type, double val) : PSymbolConst(name, type), Float(val) {} - PSymbolConstNumeric() {} + PSymbolConstNumeric() : Float(0) {} }; // A constant string value -------------------------------------------------- diff --git a/source/common/textures/textures.h b/source/common/textures/textures.h index 6aa6c84a5c..3e4578cfb4 100644 --- a/source/common/textures/textures.h +++ b/source/common/textures/textures.h @@ -181,7 +181,7 @@ struct FTextureBuffer } FTextureBuffer(const FTextureBuffer &other) = delete; - FTextureBuffer(FTextureBuffer &&other) + FTextureBuffer(FTextureBuffer &&other) noexcept { mBuffer = other.mBuffer; mWidth = other.mWidth; @@ -190,7 +190,7 @@ struct FTextureBuffer other.mBuffer = nullptr; } - FTextureBuffer& operator=(FTextureBuffer &&other) + FTextureBuffer& operator=(FTextureBuffer &&other) noexcept { mBuffer = other.mBuffer; mWidth = other.mWidth; diff --git a/source/common/utility/tarray.h b/source/common/utility/tarray.h index 95f4842edd..a420b078a8 100644 --- a/source/common/utility/tarray.h +++ b/source/common/utility/tarray.h @@ -234,7 +234,7 @@ class TArray { DoCopy (other); } - TArray (TArray &&other) + TArray (TArray &&other) noexcept { Array = other.Array; other.Array = NULL; Most = other.Most; other.Most = 0; @@ -256,7 +256,7 @@ class TArray } return *this; } - TArray &operator= (TArray &&other) + TArray &operator= (TArray &&other) noexcept { if (Array) { @@ -1777,14 +1777,14 @@ class BitArray return *this; } - BitArray(BitArray && arr) + BitArray(BitArray && arr) noexcept : bytes(std::move(arr.bytes)) { size = arr.size; arr.size = 0; } - BitArray &operator=(BitArray && arr) + BitArray &operator=(BitArray && arr) noexcept { bytes = std::move(arr.bytes); size = arr.size; diff --git a/source/common/utility/zstring.h b/source/common/utility/zstring.h index dfbe47706d..5913d1e197 100644 --- a/source/common/utility/zstring.h +++ b/source/common/utility/zstring.h @@ -125,7 +125,7 @@ class FString // Copy constructors FString (const FString &other) { AttachToOther (other); } - FString (FString &&other) : Chars(other.Chars) { other.ResetToNull(); } + FString (FString &&other) noexcept : Chars(other.Chars) { other.ResetToNull(); } FString (const char *copyStr); FString (const char *copyStr, size_t copyLen); FString (char oneChar); diff --git a/source/core/initfs.cpp b/source/core/initfs.cpp index a482115aca..e79ac7a0a1 100644 --- a/source/core/initfs.cpp +++ b/source/core/initfs.cpp @@ -449,8 +449,8 @@ void InitFileSystem(TArray& groups) FILE* f = fopen("filesystem.dir", "wb"); for (int num = 0; num < fileSystem.GetNumEntries(); num++) { - int64_t fd = fileSystem.FileLength(num); - fprintf(f, "%.50s %60s %ld\n", fileSystem.GetFileFullName(num), fileSystem.GetResourceFileFullName(fileSystem.GetFileContainer(num)), fd); + auto fd = fileSystem.FileLength(num); + fprintf(f, "%.50s %60s %td\n", fileSystem.GetFileFullName(num), fileSystem.GetResourceFileFullName(fileSystem.GetFileContainer(num)), fd); } fclose(f); }