|
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" |
@@ -359,34 +361,29 @@ static void unpack_non_delta_entry(enum object_type type, unsigned long size, |
359 | 361 |
|
360 | 362 | struct input_zstream_data { |
361 | 363 | git_zstream *zstream; |
362 | | - unsigned char buf[8192]; |
363 | 364 | int status; |
364 | 365 | }; |
365 | 366 |
|
366 | | -static const void *feed_input_zstream(struct odb_write_stream *in_stream, |
367 | | - unsigned long *readlen) |
| 367 | +static ssize_t feed_input_zstream(struct odb_write_stream *in_stream, |
| 368 | + unsigned char *buf, size_t buf_len) |
368 | 369 | { |
369 | 370 | struct input_zstream_data *data = in_stream->data; |
370 | 371 | git_zstream *zstream = data->zstream; |
371 | 372 | void *in = fill(1); |
372 | 373 |
|
373 | | - if (in_stream->is_finished) { |
374 | | - *readlen = 0; |
375 | | - return NULL; |
376 | | - } |
| 374 | + if (in_stream->is_finished) |
| 375 | + return 0; |
377 | 376 |
|
378 | | - zstream->next_out = data->buf; |
379 | | - zstream->avail_out = sizeof(data->buf); |
| 377 | + zstream->next_out = buf; |
| 378 | + zstream->avail_out = buf_len; |
380 | 379 | zstream->next_in = in; |
381 | 380 | zstream->avail_in = len; |
382 | 381 |
|
383 | 382 | data->status = git_inflate(zstream, 0); |
384 | 383 |
|
385 | 384 | in_stream->is_finished = data->status != Z_OK; |
386 | 385 | use(len - zstream->avail_in); |
387 | | - *readlen = sizeof(data->buf) - zstream->avail_out; |
388 | | - |
389 | | - return data->buf; |
| 386 | + return buf_len - zstream->avail_out; |
390 | 387 | } |
391 | 388 |
|
392 | 389 | static void stream_blob(unsigned long size, unsigned nr) |
|
0 commit comments