mirror of
https://github.com/libretro/devilutionX.git
synced 2026-11-07 10:25:57 -10:00
Fix MSVC x86 warnings
This commit is contained in:
1 parent
780015bfd4
commit
95205294e8
5 files changed
+14
-13
No files matched your search
@@ -149,7 +149,7 @@ struct AssetRef {
|
||||
int32_t error;
|
||||
return archive->GetUnpackedFileSize(fileNumber, error);
|
||||
}
|
||||
return SDL_RWsize(directHandle);
|
||||
return static_cast<size_t>(SDL_RWsize(directHandle));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ std::unique_ptr<std::byte[]> MpqArchive::ReadFile(std::string_view filename, std
|
||||
if (error != 0)
|
||||
return result;
|
||||
|
||||
result = std::make_unique<std::byte[]>(unpackedSize);
|
||||
result = std::make_unique<std::byte[]>(static_cast<size_t>(unpackedSize));
|
||||
|
||||
const std::size_t blockSize = GetBlockSize(fileNumber, 0, error);
|
||||
if (error != 0)
|
||||
@@ -92,7 +92,7 @@ std::unique_ptr<std::byte[]> MpqArchive::ReadFile(std::string_view filename, std
|
||||
}
|
||||
CloseBlockOffsetTable(fileNumber);
|
||||
|
||||
fileSize = unpackedSize;
|
||||
fileSize = static_cast<size_t>(unpackedSize);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ std::size_t MpqArchive::GetUnpackedFileSize(uint32_t fileNumber, int32_t &error)
|
||||
{
|
||||
libmpq__off_t unpackedSize;
|
||||
error = libmpq__file_size_unpacked(archive_, fileNumber, &unpackedSize);
|
||||
return unpackedSize;
|
||||
return static_cast<size_t>(unpackedSize);
|
||||
}
|
||||
|
||||
uint32_t MpqArchive::GetNumBlocks(uint32_t fileNumber, int32_t &error)
|
||||
@@ -134,7 +134,7 @@ std::size_t MpqArchive::GetBlockSize(uint32_t fileNumber, uint32_t blockNumber,
|
||||
{
|
||||
libmpq__off_t blockSize;
|
||||
error = libmpq__block_size_unpacked(archive_, fileNumber, blockNumber, &blockSize);
|
||||
return blockSize;
|
||||
return static_cast<size_t>(blockSize);
|
||||
}
|
||||
|
||||
bool MpqArchive::HasFile(std::string_view filename) const
|
||||
|
||||
+1
-1
@@ -284,7 +284,7 @@ void CreateDetailDiffs(std::string_view prefix, std::string_view memoryMapFile,
|
||||
return;
|
||||
}
|
||||
|
||||
size_t readBytes = SDL_RWsize(handle);
|
||||
size_t readBytes = static_cast<size_t>(SDL_RWsize(handle));
|
||||
std::unique_ptr<std::byte[]> memoryMapFileData { new std::byte[readBytes] };
|
||||
SDL_RWread(handle, memoryMapFileData.get(), readBytes, 1);
|
||||
SDL_RWclose(handle);
|
||||
|
||||
+5
-5
@@ -348,7 +348,7 @@ bool StoreAutoPlace(Item &item, bool persistItem)
|
||||
return AutoPlaceItemInInventory(player, item, persistItem, true);
|
||||
}
|
||||
|
||||
void ScrollVendorStore(Item *itemData, size_t storeLimit, int idx, int selling = true)
|
||||
void ScrollVendorStore(Item *itemData, int storeLimit, int idx, int selling = true)
|
||||
{
|
||||
ClearSText(5, 21);
|
||||
stextup = 5;
|
||||
@@ -393,7 +393,7 @@ void StartSmith()
|
||||
|
||||
void ScrollSmithBuy(int idx)
|
||||
{
|
||||
ScrollVendorStore(smithitem, std::size(smithitem), idx);
|
||||
ScrollVendorStore(smithitem, static_cast<int>(std::size(smithitem)), idx);
|
||||
}
|
||||
|
||||
uint32_t TotalPlayerGold()
|
||||
@@ -439,7 +439,7 @@ void ScrollSmithPremiumBuy(int boughtitems)
|
||||
boughtitems--;
|
||||
}
|
||||
|
||||
ScrollVendorStore(premiumitems, std::size(premiumitems), idx);
|
||||
ScrollVendorStore(premiumitems, static_cast<int>(std::size(premiumitems)), idx);
|
||||
}
|
||||
|
||||
bool StartSmithPremiumBuy()
|
||||
@@ -689,7 +689,7 @@ void StartWitch()
|
||||
|
||||
void ScrollWitchBuy(int idx)
|
||||
{
|
||||
ScrollVendorStore(witchitem, std::size(witchitem), idx);
|
||||
ScrollVendorStore(witchitem, static_cast<int>(std::size(witchitem)), idx);
|
||||
}
|
||||
|
||||
void WitchBookLevel(Item &bookItem)
|
||||
@@ -1038,7 +1038,7 @@ void StartHealer()
|
||||
|
||||
void ScrollHealerBuy(int idx)
|
||||
{
|
||||
ScrollVendorStore(healitem, std::size(healitem), idx);
|
||||
ScrollVendorStore(healitem, static_cast<int>(std::size(healitem)), idx);
|
||||
}
|
||||
|
||||
void StartHealerBuy()
|
||||
|
||||
@@ -387,8 +387,9 @@ TEST(Writehero, pfile_write_hero)
|
||||
pfile_write_hero();
|
||||
|
||||
const char *path = "multi_0.sv";
|
||||
uintmax_t size;
|
||||
ASSERT_TRUE(GetFileSize(path, &size));
|
||||
uintmax_t fileSize;
|
||||
ASSERT_TRUE(GetFileSize(path, &fileSize));
|
||||
size_t size = static_cast<size_t>(fileSize);
|
||||
FILE *f = std::fopen(path, "rb");
|
||||
ASSERT_TRUE(f != nullptr);
|
||||
std::unique_ptr<char[]> data { new char[size] };
|
||||
|
||||
Reference in new issue
Block a user