From c47f09aa509d135d1c81d902d1a05ac0f0a52c8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathieu=20Border=C3=A9?= Date: Thu, 3 Jun 2021 17:04:33 +0200 Subject: [PATCH] compress: Fix build for i386 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mathieu Borderé --- src/compress.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compress.c b/src/compress.c index 0e709ef49..5e18df219 100644 --- a/src/compress.c +++ b/src/compress.c @@ -65,7 +65,7 @@ int Compress(struct raft_buffer bufs[], unsigned n_bufs, /* Guestimate of eventual compressed size, mainly not to allocate a huge * buffer as `LZ4F_compressBound` calculates the worst case scenario. */ dst_size = LZ4F_compressBound( - max(MEGABYTE, lz4_pref.frameInfo.contentSize / 10), &lz4_pref); + max(MEGABYTE, (size_t)lz4_pref.frameInfo.contentSize / 10), &lz4_pref); dst_size += LZ4F_HEADER_SIZE_MAX_RAFT; compressed->base = raft_malloc(dst_size); if (compressed->base == NULL) { @@ -92,7 +92,7 @@ int Compress(struct raft_buffer bufs[], unsigned n_bufs, src_size = min(bufs[i].len - src_offset, (size_t)MEGABYTE); dst_size_needed = LZ4F_compressBound(src_size, &lz4_pref); if (dst_size - dst_offset < dst_size_needed) { - dst_size += max(dst_size_needed, lz4_pref.frameInfo.contentSize / 10); + dst_size += max(dst_size_needed, (size_t)lz4_pref.frameInfo.contentSize / 10); compressed->base = raft_realloc(compressed->base, dst_size); if (compressed->base == NULL) { rv = RAFT_NOMEM; @@ -188,8 +188,8 @@ int Decompress(struct raft_buffer buf, struct raft_buffer *decompressed, } src_offset = src_size; - decompressed->base = raft_malloc(frameInfo.contentSize); - decompressed->len = frameInfo.contentSize; + decompressed->base = raft_malloc((size_t)frameInfo.contentSize); + decompressed->len = (size_t)frameInfo.contentSize; if (decompressed->base == NULL) { rv = RAFT_NOMEM; goto err_after_ctx_alloc;