From 29bb7cb1afc991add807f2c83594d210c23512ae Mon Sep 17 00:00:00 2001 From: Zoltan Szabadka Date: Fri, 13 Dec 2013 15:30:20 +0100 Subject: [PATCH] Fix Microsoft VisualStudio 64-bit build of brotli --- dec/decode.c | 4 ++-- dec/streams.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dec/decode.c b/dec/decode.c index ed9ef86..f7ae1df 100644 --- a/dec/decode.c +++ b/dec/decode.c @@ -651,9 +651,9 @@ int BrotliDecompress(BrotliInput input, BrotliOutput output) { // Decode window size. window_bits = DecodeWindowBits(&br); - max_backward_distance = (1 << window_bits) - 16; + max_backward_distance = (1ULL << window_bits) - 16; - ringbuffer_size = 1 << window_bits; + ringbuffer_size = 1ULL << window_bits; ringbuffer_mask = ringbuffer_size - 1; ringbuffer = (uint8_t*)malloc(ringbuffer_size + kRingBufferWriteAheadSlack + diff --git a/dec/streams.c b/dec/streams.c index 2a34773..89e030a 100644 --- a/dec/streams.c +++ b/dec/streams.c @@ -34,7 +34,7 @@ int BrotliMemInputFunction(void* data, uint8_t* buf, size_t count) { } memcpy(buf, input->buffer + input->pos, count); input->pos += count; - return count; + return (int)count; } BrotliInput BrotliInitMemInput(const uint8_t* buffer, size_t length, @@ -55,7 +55,7 @@ int BrotliMemOutputFunction(void* data, const uint8_t* buf, size_t count) { } memcpy(output->buffer + output->pos, buf, count); output->pos += count; - return count; + return (int)count; } BrotliOutput BrotliInitMemOutput(uint8_t* buffer, size_t length, @@ -100,7 +100,7 @@ BrotliOutput BrotliStdoutOutput() { } int BrotliFileOutputFunction(void* data, const uint8_t* buf, size_t count) { - return fwrite(buf, 1, count, (FILE*)data); + return (int)fwrite(buf, 1, count, (FILE*)data); } BrotliOutput BrotliFileOutput(FILE* f) {