- fixed several warnings emitted by Clang.

This commit is contained in:
Christoph Oelckers 2023-03-26 08:33:09 +02:00
parent 9c3907136d
commit 47b76180d6
12 changed files with 21 additions and 16 deletions

View file

@ -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();

View file

@ -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;

View file

@ -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);

View file

@ -528,15 +528,15 @@ const TArray<VSMatrix> IQMModel::CalculateBones(int frame1, int frame2, double i
const TArray<TRS>& 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;

View file

@ -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

View file

@ -52,7 +52,7 @@ VkRenderPassManager::VkRenderPassManager(VulkanRenderDevice* fb) : fb(fb)
{
std::vector<uint8_t> 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());
}

View file

@ -580,6 +580,10 @@ public:
{
return Count;
}
int SSize() const
{
return (int)Count;
}
unsigned int Max () const
{
return Most;

View file

@ -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];

View file

@ -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;

View file

@ -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 <<player sound %d>>\n", i, sfx->name.GetChars(), sfx->link);
Printf("%3d. %s <<player sound %d>>\n", i, sfx->name.GetChars(), sfx->link.index());
}
else if (S_sfx[i].lumpnum != -1)
{

View file

@ -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);

View file

@ -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,