From 4a9ef5bd12d11fe3920551e9db98480120e84ab0 Mon Sep 17 00:00:00 2001 From: Michael Steenbeek Date: Wed, 13 Dec 2017 13:26:27 +0100 Subject: [PATCH] Explicitly cast to size_t --- src/openrct2/util/SawyerCoding.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/openrct2/util/SawyerCoding.cpp b/src/openrct2/util/SawyerCoding.cpp index 4f81e743f8..25f291cd85 100644 --- a/src/openrct2/util/SawyerCoding.cpp +++ b/src/openrct2/util/SawyerCoding.cpp @@ -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);