diff --git a/libraries/ZVulkan/include/zvulkan/vulkanobjects.h b/libraries/ZVulkan/include/zvulkan/vulkanobjects.h index c7842f6701..e3bf4505cb 100644 --- a/libraries/ZVulkan/include/zvulkan/vulkanobjects.h +++ b/libraries/ZVulkan/include/zvulkan/vulkanobjects.h @@ -569,7 +569,7 @@ inline RenderPassBegin& RenderPassBegin::Framebuffer(VulkanFramebuffer* framebuf inline RenderPassBegin& RenderPassBegin::AddClearColor(float r, float g, float b, float a) { VkClearValue clearValue = { }; - clearValue.color = { r, g, b, a }; + clearValue.color = { { r, g, b, a } }; clearValues.push_back(clearValue); renderPassInfo.clearValueCount = (uint32_t)clearValues.size(); diff --git a/src/common/audio/music/music.cpp b/src/common/audio/music/music.cpp index 3da91a6e9d..610f0368f7 100644 --- a/src/common/audio/music/music.cpp +++ b/src/common/audio/music/music.cpp @@ -410,7 +410,7 @@ static FString ReplayGainHash(ZMusicCustomReader* reader, int flength, int playe for (size_t j = 0; j < sizeof(digest); ++j) { - sprintf(digestout + (j * 2), "%02X", digest[j]); + snprintf(digestout + (j * 2), 3, "%02X", digest[j]); } digestout[32] = 0; diff --git a/src/common/filesystem/filesystem.cpp b/src/common/filesystem/filesystem.cpp index f18ad51381..6b60e8e68d 100644 --- a/src/common/filesystem/filesystem.cpp +++ b/src/common/filesystem/filesystem.cpp @@ -395,7 +395,7 @@ void FileSystem::AddFile (const char *filename, FileReader *filer, bool quiet, L for (size_t j = 0; j < sizeof(cksum); ++j) { - sprintf(cksumout + (j * 2), "%02X", cksum[j]); + snprintf(cksumout + (j * 2), 3, "%02X", cksum[j]); } fprintf(hashfile, "file: %s, hash: %s, size: %d\n", filename, cksumout, (int)filereader.GetLength()); @@ -417,7 +417,7 @@ void FileSystem::AddFile (const char *filename, FileReader *filer, bool quiet, L for (size_t j = 0; j < sizeof(cksum); ++j) { - sprintf(cksumout + (j * 2), "%02X", cksum[j]); + snprintf(cksumout + (j * 2), 3, "%02X", cksum[j]); } fprintf(hashfile, "file: %s, lump: %s, hash: %s, size: %d\n", filename, lump->getName(), cksumout, lump->LumpSize); diff --git a/src/common/models/models_iqm.cpp b/src/common/models/models_iqm.cpp index 9d4ab26526..a2d72b11ab 100644 --- a/src/common/models/models_iqm.cpp +++ b/src/common/models/models_iqm.cpp @@ -528,15 +528,15 @@ const TArray IQMModel::CalculateBones(int frame1, int frame2, double i const TArray& animationFrames = animationData ? *animationData : TRSData; if (Joints.Size() > 0) { - int numbones = Joints.Size(); + int numbones = Joints.SSize(); - if (boneComponentData->trscomponents[index].Size() != numbones) + if (boneComponentData->trscomponents[index].SSize() != numbones) boneComponentData->trscomponents[index].Resize(numbones); - if (boneComponentData->trsmatrix[index].Size() != numbones) + if (boneComponentData->trsmatrix[index].SSize() != numbones) boneComponentData->trsmatrix[index].Resize(numbones); - frame1 = clamp(frame1, 0, ((int)animationFrames.Size() - 1) / numbones); - frame2 = clamp(frame2, 0, ((int)animationFrames.Size() - 1) / numbones); + frame1 = clamp(frame1, 0, (animationFrames.SSize() - 1) / numbones); + frame2 = clamp(frame2, 0, (animationFrames.SSize() - 1) / numbones); int offset1 = frame1 * numbones; int offset2 = frame2 * numbones; diff --git a/src/common/platform/win32/i_system.cpp b/src/common/platform/win32/i_system.cpp index bd1d0dbbed..8b39061a69 100644 --- a/src/common/platform/win32/i_system.cpp +++ b/src/common/platform/win32/i_system.cpp @@ -405,7 +405,7 @@ BOOL CALLBACK IWADBoxCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa SendDlgItemMessage( hDlg, IDC_WELCOME_WIDESCREEN, BM_SETCHECK, (flags & 8) ? BST_CHECKED : BST_UNCHECKED, 0 ); // Set up our version string. - sprintf(szString, "Version %s.", GetVersionString()); + snprintf(szString, sizeof(szString), "Version %s.", GetVersionString()); SetDlgItemTextA (hDlg, IDC_WELCOME_VERSION, szString); // Populate the list with all the IWADs found diff --git a/src/common/rendering/vulkan/renderer/vk_renderpass.cpp b/src/common/rendering/vulkan/renderer/vk_renderpass.cpp index 5ecb3f65e3..257f35c16d 100644 --- a/src/common/rendering/vulkan/renderer/vk_renderpass.cpp +++ b/src/common/rendering/vulkan/renderer/vk_renderpass.cpp @@ -52,7 +52,7 @@ VkRenderPassManager::VkRenderPassManager(VulkanRenderDevice* fb) : fb(fb) { std::vector data; data.resize(fr.GetLength()); - if (fr.Read(data.data(), data.size()) == data.size()) + if (fr.Read(data.data(), data.size()) == (FileReader::Size)data.size()) { builder.InitialData(data.data(), data.size()); } diff --git a/src/common/utility/tarray.h b/src/common/utility/tarray.h index e3b234b472..29d62289ce 100644 --- a/src/common/utility/tarray.h +++ b/src/common/utility/tarray.h @@ -580,6 +580,10 @@ public: { return Count; } + int SSize() const + { + return (int)Count; + } unsigned int Max () const { return Most; diff --git a/src/gamedata/a_weapons.h b/src/gamedata/a_weapons.h index 1ef6d6cc19..3de18cf4b9 100644 --- a/src/gamedata/a_weapons.h +++ b/src/gamedata/a_weapons.h @@ -52,6 +52,7 @@ struct FWeaponSlots { FWeaponSlots() { Clear(); } FWeaponSlots(const FWeaponSlots &other) = default; + FWeaponSlots& operator=(const FWeaponSlots& other) = default; private: FWeaponSlot Slots[NUM_WEAPON_SLOTS]; diff --git a/src/playsim/fragglescript/t_script.h b/src/playsim/fragglescript/t_script.h index 94770645b7..a809870780 100644 --- a/src/playsim/fragglescript/t_script.h +++ b/src/playsim/fragglescript/t_script.h @@ -102,7 +102,7 @@ struct svalue_t } svalue_t(const svalue_t & other) = default; - + svalue_t& operator=(const svalue_t& other) = default; void setInt(int ip) { value.i = ip; diff --git a/src/sound/s_doomsound.cpp b/src/sound/s_doomsound.cpp index 697fdcc3a8..bc5c092b01 100644 --- a/src/sound/s_doomsound.cpp +++ b/src/sound/s_doomsound.cpp @@ -1344,7 +1344,7 @@ void DoomSoundEngine::PrintSoundList() const sfxinfo_t* sfx = soundEngine->GetSfx(FSoundID::fromInt(i)); if (sfx->bRandomHeader) { - Printf("%3d. %s -> #%d {", i, sfx->name.GetChars(), sfx->link); + Printf("%3d. %s -> #%d {", i, sfx->name.GetChars(), sfx->link.index()); const FRandomSoundList* list = &S_rnd[sfx->link.index()]; for (auto& me : list->Choices) { @@ -1354,7 +1354,7 @@ void DoomSoundEngine::PrintSoundList() } else if (sfx->UserData[0] & SND_PlayerReserve) { - Printf("%3d. %s <>\n", i, sfx->name.GetChars(), sfx->link); + Printf("%3d. %s <>\n", i, sfx->name.GetChars(), sfx->link.index()); } else if (S_sfx[i].lumpnum != -1) { diff --git a/src/utility/nodebuilder/nodebuild_events.cpp b/src/utility/nodebuilder/nodebuild_events.cpp index 84e187081e..3ac42a6c21 100644 --- a/src/utility/nodebuilder/nodebuild_events.cpp +++ b/src/utility/nodebuilder/nodebuild_events.cpp @@ -218,7 +218,7 @@ void FEventTree::PrintTree (const FEvent *event) const if (event != &Nil) { PrintTree(event->Left); - sprintf(buff, " Distance %g, vertex %d, seg %u\n", + snprintf(buff, sizeof(buff), " Distance %g, vertex %d, seg %u\n", g_sqrt(event->Distance/4294967296.0), event->Info.Vertex, (unsigned)event->Info.FrontSeg); Printf(PRINT_LOG, "%s", buff); PrintTree(event->Right); diff --git a/src/utility/nodebuilder/nodebuild_gl.cpp b/src/utility/nodebuilder/nodebuild_gl.cpp index d2b987e048..6e9074210f 100644 --- a/src/utility/nodebuilder/nodebuild_gl.cpp +++ b/src/utility/nodebuilder/nodebuild_gl.cpp @@ -99,7 +99,7 @@ void FNodeBuilder::FixSplitSharers (const node_t &node) // Use the CRT's printf so the formatting matches ZDBSP's D(char buff[200]); - D(sprintf(buff, "Considering events on seg %d(%d[%d,%d]->%d[%d,%d]) [%g:%g]\n", seg, + D(snprintf(buff, sizeof(buff), "Considering events on seg %d(%d[%d,%d]->%d[%d,%d]) [%g:%g]\n", seg, Segs[seg].v1, Vertices[Segs[seg].v1].x>>16, Vertices[Segs[seg].v1].y>>16,