From 97a42ea17ba38d151c0f1bcd1946e6e2c86f6efb Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Mon, 14 Jan 2019 00:12:25 -0500 Subject: [PATCH] Address some windows issues in buffer.c --- src/core/buffer.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/buffer.c b/src/core/buffer.c index 6f8c01af..59ca8970 100644 --- a/src/core/buffer.c +++ b/src/core/buffer.c @@ -56,7 +56,7 @@ void janet_buffer_ensure(JanetBuffer *buffer, int32_t capacity, int32_t growth) uint8_t *old = buffer->data; if (capacity <= buffer->capacity) return; int64_t big_capacity = capacity * growth; - capacity = big_capacity > INT32_MAX ? INT32_MAX : big_capacity; + capacity = big_capacity > INT32_MAX ? INT32_MAX : (int32_t) big_capacity; new_data = realloc(old, capacity * sizeof(uint8_t)); if (NULL == new_data) { JANET_OUT_OF_MEMORY; @@ -249,7 +249,7 @@ static void bitloc(int32_t argc, Janet *argv, JanetBuffer **b, int32_t *index, i if (bitindex != x || bitindex < 0 || byteindex >= buffer->count) janet_panicf("invalid bit index %v", argv[1]); *b = buffer; - *index = byteindex; + *index = (int32_t) byteindex; *bit = which_bit; } @@ -309,8 +309,8 @@ static Janet cfun_blit(int32_t argc, Janet *argv) { int64_t last = ((int64_t) offset_dest - offset_src) + length_src; if (last > INT32_MAX) janet_panic("buffer blit out of range"); - janet_buffer_ensure(dest, last, 2); - if (last > dest->count) dest->count = last; + janet_buffer_ensure(dest, (int32_t) last, 2); + if (last > dest->count) dest->count = (int32_t) last; memcpy(dest->data + offset_dest, src.bytes + offset_src, length_src); return argv[0]; }