1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-23 15:52:55 +01:00

Explicitly cast to size_t

This commit is contained in:
Michael Steenbeek
2017-12-13 13:26:27 +01:00
parent 717d71eb24
commit 4a9ef5bd12

View File

@@ -109,10 +109,10 @@ size_t sawyercoding_decode_sc4(const uint8 *src, uint8 *dst, size_t length, size
size_t decodedLength = decode_chunk_rle_with_size(src, dst, length - 4, bufferLength);
// Decode
for (size_t i = 0x60018; i <= Math::Min(decodedLength - 1, 0x1F8353ul); i++)
for (size_t i = 0x60018; i <= Math::Min(decodedLength - 1, (size_t)0x1F8353); i++)
dst[i] = dst[i] ^ 0x9C;
for (size_t i = 0x60018; i <= Math::Min(decodedLength - 1, 0x1F8350ul); i += 4) {
for (size_t i = 0x60018; i <= Math::Min(decodedLength - 1, (size_t)0x1F8350); i += 4) {
dst[i + 1] = ror8(dst[i + 1], 3);
uint32 *code = (uint32*)&dst[i];
@@ -315,7 +315,7 @@ static size_t encode_chunk_repeat(const uint8 *src_buffer, uint8 *dst_buffer, si
size_t bestRepeatCount = 0;
for (size_t repeatIndex = searchIndex; repeatIndex <= searchEnd; repeatIndex++) {
size_t repeatCount = 0;
size_t maxRepeatCount = Math::Min(Math::Min(7ul, searchEnd - repeatIndex), length - i - 1);
size_t maxRepeatCount = Math::Min(Math::Min((size_t)7, searchEnd - repeatIndex), length - i - 1);
// maxRepeatCount should not exceed length
assert(repeatIndex + maxRepeatCount < length);
assert(i + maxRepeatCount < length);