Fix some type conversion warnings

This commit is contained in:
Andreas Schmitt
2021-06-21 09:10:40 +02:00
parent f3b39b12a8
commit e1214a6d8b
7 changed files with 11 additions and 11 deletions

View File

@@ -171,8 +171,8 @@ void Save_CPDP()
*/
void Load_CPDP()
{
uint count = SlGetFieldLength() / 16;
uint last_cargo_packet_id = (uint) -1;
uint count = static_cast<uint>(SlGetFieldLength() / 16);
uint last_cargo_packet_id = std::numeric_limits<uint32_t>::max();
for (uint i = 0; i < count; i++) {
uint64 k = SlReadUint64();

View File

@@ -644,9 +644,9 @@ static void loadVL(const SlxiSubChunkInfo *info, uint32 length)
static uint32 saveVL(const SlxiSubChunkInfo *info, bool dry_run)
{
size_t length = strlen(_openttd_revision);
const size_t length = strlen(_openttd_revision);
if (!dry_run) MemoryDumper::GetCurrent()->CopyBytes(reinterpret_cast<const byte *>(_openttd_revision), length);
return length;
return static_cast<uint32>(length);
}
static void loadLC(const SlxiSubChunkInfo *info, uint32 length)

View File

@@ -800,9 +800,9 @@ void SlSetLength(size_t length)
SlWriteByte(CH_EXT_HDR);
SlWriteUint32(static_cast<uint32>(SLCEHF_BIG_RIFF));
}
SlWriteUint32((uint32)((length & 0xFFFFFF) | ((length >> 24) << 28)));
SlWriteUint32(static_cast<uint32>((length & 0xFFFFFF) | ((length >> 24) << 28)));
if (length >= (1 << 28)) {
SlWriteUint32(length >> 28);
SlWriteUint32(static_cast<uint32>(length >> 28));
}
break;
case CH_ARRAY: