|
9 | 9 | #include "hex.h" |
10 | 10 | #include "object-file.h" |
11 | 11 | #include "odb.h" |
| 12 | +#include "odb/streaming.h" |
| 13 | +#include "odb/transaction.h" |
12 | 14 | #include "object.h" |
13 | 15 | #include "delta.h" |
14 | 16 | #include "pack.h" |
@@ -358,34 +360,29 @@ static void unpack_non_delta_entry(enum object_type type, unsigned long size, |
358 | 360 |
|
359 | 361 | struct input_zstream_data { |
360 | 362 | git_zstream *zstream; |
361 | | - unsigned char buf[8192]; |
362 | 363 | int status; |
363 | 364 | }; |
364 | 365 |
|
365 | | -static const void *feed_input_zstream(struct odb_write_stream *in_stream, |
366 | | - unsigned long *readlen) |
| 366 | +static ssize_t feed_input_zstream(struct odb_write_stream *in_stream, |
| 367 | + unsigned char *buf, size_t buf_len) |
367 | 368 | { |
368 | 369 | struct input_zstream_data *data = in_stream->data; |
369 | 370 | git_zstream *zstream = data->zstream; |
370 | 371 | void *in = fill(1); |
371 | 372 |
|
372 | | - if (in_stream->is_finished) { |
373 | | - *readlen = 0; |
374 | | - return NULL; |
375 | | - } |
| 373 | + if (in_stream->is_finished) |
| 374 | + return 0; |
376 | 375 |
|
377 | | - zstream->next_out = data->buf; |
378 | | - zstream->avail_out = sizeof(data->buf); |
| 376 | + zstream->next_out = buf; |
| 377 | + zstream->avail_out = buf_len; |
379 | 378 | zstream->next_in = in; |
380 | 379 | zstream->avail_in = len; |
381 | 380 |
|
382 | 381 | data->status = git_inflate(zstream, 0); |
383 | 382 |
|
384 | 383 | in_stream->is_finished = data->status != Z_OK; |
385 | 384 | use(len - zstream->avail_in); |
386 | | - *readlen = sizeof(data->buf) - zstream->avail_out; |
387 | | - |
388 | | - return data->buf; |
| 385 | + return buf_len - zstream->avail_out; |
389 | 386 | } |
390 | 387 |
|
391 | 388 | static void stream_blob(unsigned long size, unsigned nr) |
|
0 commit comments