Skip to content

Commit 2c23ea0

Browse files
committed
FIX: possible loss of data warnings
1 parent ad1f2a0 commit 2c23ea0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/core/u-compress.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ void BrotliDefaultFreeFunc(void* opaque, void* address) {
362362

363363
/***********************************************************************
364364
**
365-
*/ REBSER *CompressBrotli(REBSER *input, REBINT index, REBCNT in_len, REBINT level)
365+
*/ REBSER *CompressBrotli(REBSER *input, REBINT index, REBLEN in_len, REBINT level)
366366
/*
367367
** Compress a binary (only) using Brotli compression.
368368
** data
@@ -390,7 +390,7 @@ void BrotliDefaultFreeFunc(void* opaque, void* address) {
390390
}
391391

392392
availableOut = BrotliEncoderMaxCompressedSize(availableIn);
393-
output = Make_Binary(availableOut);
393+
output = Make_Binary((REBLEN)availableOut);
394394

395395
inp = BIN_HEAD(input) + index;
396396
out = BIN_HEAD(output);
@@ -406,7 +406,7 @@ void BrotliDefaultFreeFunc(void* opaque, void* address) {
406406

407407
BrotliEncoderDestroyInstance(BrotliEncoder);
408408

409-
SERIES_TAIL(output) = totalOut;
409+
SERIES_TAIL(output) = (REBLEN)totalOut;
410410
if (SERIES_AVAIL(output) > (1<<14)) // Is there wasted space?
411411
output = Copy_Series(output); // Trim it down if too big. !!! Revisit this based on mem alloc alg.
412412
return output;
@@ -461,9 +461,9 @@ static BrotliDecoderState *BrotliDecoder = NULL;
461461

462462
// If the output buffer is full, resize it
463463
if (availableOut == 0 && (limit == 0 || limit < totalOut)) {
464-
SERIES_TAIL(output) = totalOut;
464+
SERIES_TAIL(output) = (REBLEN)totalOut;
465465
Expand_Series(output, AT_TAIL, out_len); //@@ May throw an error and so the decoder would not be released!
466-
SERIES_TAIL(output) = totalOut;
466+
SERIES_TAIL(output) = (REBLEN)totalOut;
467467
nextOut = BIN_HEAD(output) + totalOut; // Move the output pointer to the correct position
468468
availableOut = SERIES_AVAIL(output);
469469
}
@@ -475,7 +475,7 @@ static BrotliDecoderState *BrotliDecoder = NULL;
475475
if (limit > 0 && totalOut > limit) totalOut = limit;
476476

477477
SET_STR_END(output, totalOut);
478-
SERIES_TAIL(output) = totalOut;
478+
SERIES_TAIL(output) = (REBLEN)totalOut;
479479
return output;
480480

481481
error:

0 commit comments

Comments
 (0)