diff --git a/compress/function/zstd.c b/compress/function/zstd.c index d5ba8cc..5614b9e 100644 --- a/compress/function/zstd.c +++ b/compress/function/zstd.c @@ -106,7 +106,8 @@ static enum b_status compress(struct b_compressor *compressor) while (1) { size_t in_available = 0, out_capacity = 0; - void *in_buf = NULL, *out_buf = NULL; + const void *in_buf = NULL; + void *out_buf = NULL; status = b_ringbuffer_open_read_buffer(in, &in_buf, &in_available); if (!B_OK(status)) { @@ -221,7 +222,8 @@ static enum b_status decompress(struct b_compressor *compressor) while (!(compressor->c_flags & COMPRESSOR_EOF)) { size_t in_available = 0, out_capacity = 0; - void *in_buf = NULL, *out_buf = NULL; + const void *in_buf = NULL; + void *out_buf = NULL; status = b_ringbuffer_open_read_buffer(in, &in_buf, &in_available); if (!B_OK(status)) { @@ -267,7 +269,7 @@ static enum b_status decompress(struct b_compressor *compressor) b_ringbuffer_close_write_buffer(out, &out_buf, z_out.pos); } - if ((status == B_ERR_NO_SPACE || status == B_ERR_NO_SPACE) + if ((status == B_ERR_NO_SPACE || status == B_ERR_NO_DATA) && nr_consumed > 0) { status = B_SUCCESS; }