/W4: Fix type demotion warnings

Explicitly demote to 'int' to suppress pesky compiler warnings.
This commit is contained in:
Kawe Mazidjatari 2023-04-02 16:03:01 +02:00
parent 24a06f28c6
commit e1f0e72af4
3 changed files with 11 additions and 11 deletions

View File

@ -86,7 +86,7 @@ void CBanSystem::Save(void) const
jsOut["totalBans"] = m_vBanList.size();
string svJsOut = jsOut.dump(4);
FileSystem()->Write(svJsOut.data(), svJsOut.size(), pFile);
FileSystem()->Write(svJsOut.data(), int(svJsOut.size()), pFile);
}
catch (const std::exception& ex)
{

View File

@ -416,7 +416,7 @@ void CPackedStore::PackWorkspace(const VPKPair_t& vPair, const string& svWorkspa
{
VPKChunkDescriptor_t& vDescriptor = vEntryBlock.m_vFragments[j];
FileSystem()->Read(s_EntryBuf, vDescriptor.m_nCompressedSize, hAsset);
FileSystem()->Read(s_EntryBuf, int(vDescriptor.m_nCompressedSize), hAsset);
vDescriptor.m_nPackFileOffset = FileSystem()->Tell(hPackFile);
if (vEntryValue.m_bUseDataSharing)
@ -455,7 +455,7 @@ void CPackedStore::PackWorkspace(const VPKPair_t& vPair, const string& svWorkspa
}
vDescriptor.m_bIsCompressed = vDescriptor.m_nCompressedSize != vDescriptor.m_nUncompressedSize;
FileSystem()->Write(s_EntryBuf, vDescriptor.m_nCompressedSize, hPackFile);
FileSystem()->Write(s_EntryBuf, int(vDescriptor.m_nCompressedSize), hPackFile);
}
MemAllocSingleton()->Free(pBuf);
@ -527,8 +527,8 @@ void CPackedStore::UnpackWorkspace(const VPKDir_t& vDirectory, const string& svW
const VPKChunkDescriptor_t& vChunk = vEntryBlock.m_vFragments[k];
m_nChunkCount++;
FileSystem()->Seek(hPackFile, vChunk.m_nPackFileOffset, FileSystemSeek_t::FILESYSTEM_SEEK_HEAD);
FileSystem()->Read(s_EntryBuf, vChunk.m_nCompressedSize, hPackFile);
FileSystem()->Seek(hPackFile, int(vChunk.m_nPackFileOffset), FileSystemSeek_t::FILESYSTEM_SEEK_HEAD);
FileSystem()->Read(s_EntryBuf, int(vChunk.m_nCompressedSize), hPackFile);
if (vChunk.m_bIsCompressed)
{
@ -548,12 +548,12 @@ void CPackedStore::UnpackWorkspace(const VPKDir_t& vDirectory, const string& svW
}
else // If successfully decompressed, write to file.
{
FileSystem()->Write(s_DecompBuf, nDstLen, hAsset);
FileSystem()->Write(s_DecompBuf, int(nDstLen), hAsset);
}
}
else // If not compressed, write source data into output file.
{
FileSystem()->Write(s_EntryBuf, vChunk.m_nUncompressedSize, hAsset);
FileSystem()->Write(s_EntryBuf, int(vChunk.m_nUncompressedSize), hAsset);
}
}
@ -881,14 +881,14 @@ uint64_t VPKDir_t::WriteDescriptor(FileHandle_t hDirectoryFile, std::map<string,
for (auto& iKeyValue : vMap)
{
FileSystem()->Write(iKeyValue.first.c_str(), (iKeyValue.first.length() + 1), hDirectoryFile);
FileSystem()->Write(iKeyValue.first.c_str(), int(iKeyValue.first.length() + 1), hDirectoryFile);
for (auto& jKeyValue : iKeyValue.second)
{
FileSystem()->Write(jKeyValue.first.c_str(), (jKeyValue.first.length() + 1), hDirectoryFile);
FileSystem()->Write(jKeyValue.first.c_str(), int(jKeyValue.first.length() + 1), hDirectoryFile);
for (auto& vEntry : jKeyValue.second)
{
string pszEntryPath = GetFileName(vEntry.m_svEntryPath, true);
FileSystem()->Write(pszEntryPath.c_str(), (pszEntryPath.length() + 1), hDirectoryFile);
FileSystem()->Write(pszEntryPath.c_str(), int(pszEntryPath.length() + 1), hDirectoryFile);
FileSystem()->Write(&vEntry.m_nFileCRC, sizeof(uint32_t), hDirectoryFile);
FileSystem()->Write(&vEntry.m_iPreloadSize, sizeof(uint16_t), hDirectoryFile);

View File

@ -578,7 +578,7 @@ void RTech_Decompress_f(const CCommand& args)
}
memcpy_s(pDecompBuf, sizeof(RPakHeader_t), pPakBuf, sizeof(RPakHeader_t));// Overwrite first 0x80 bytes which are NULL with the header data.
FileSystem()->Write(pDecompBuf, decompState.m_nDecompSize, hDecompFile);
FileSystem()->Write(pDecompBuf, int(decompState.m_nDecompSize), hDecompFile);
DevMsg(eDLL_T::RTECH, " |-- Checksum : '0x%08X'\n", crc32::update(NULL, pDecompBuf, decompState.m_nDecompSize));
DevMsg(eDLL_T::RTECH, "-+ Decompressed pak file to: '%s'\n", svPakNameOut.c_str());