Skip to content

Commit 318152c

Browse files
committed
fix: reflesh outdata buf
1 parent f12556f commit 318152c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ext/zstdruby/streaming_compress.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ rb_streaming_compress_write(int argc, VALUE *argv, VALUE obj)
147147
struct streaming_compress_t* sc;
148148
TypedData_Get_Struct(obj, struct streaming_compress_t, &streaming_compress_type, sc);
149149
const char* output_data = RSTRING_PTR(sc->buf);
150-
ZSTD_outBuffer output = { (void*)output_data, sc->buf_size, 0 };
151150

152151
while (argc-- > 0) {
153152
VALUE str = *argv++;
@@ -157,6 +156,7 @@ rb_streaming_compress_write(int argc, VALUE *argv, VALUE obj)
157156
ZSTD_inBuffer input = { input_data, input_size, 0 };
158157

159158
while (input.pos < input.size) {
159+
ZSTD_outBuffer output = { (void*)output_data, sc->buf_size, 0 };
160160
size_t const ret = zstd_compress(sc->ctx, &output, &input, ZSTD_e_continue);
161161
if (ZSTD_isError(ret)) {
162162
rb_raise(rb_eRuntimeError, "compress error error code: %s", ZSTD_getErrorName(ret));

0 commit comments

Comments
 (0)