Merge branch 'jc/zlib-wrap'
* jc/zlib-wrap: zlib: allow feeding more than 4GB in one go zlib: zlib can only process 4GB at a time zlib: wrap deflateBound() too zlib: wrap deflate side of the API zlib: wrap inflateInit2 used to accept only for gzip format zlib: wrap remaining calls to direct inflate/inflateEnd zlib wrapper: refactor error message formatter Conflicts: sha1_file.c
This commit is contained in:
@ -265,7 +265,7 @@ static void unlink_base_data(struct base_data *c)
|
||||
static void *unpack_entry_data(unsigned long offset, unsigned long size)
|
||||
{
|
||||
int status;
|
||||
z_stream stream;
|
||||
git_zstream stream;
|
||||
void *buf = xmalloc(size);
|
||||
|
||||
memset(&stream, 0, sizeof(stream));
|
||||
@ -355,7 +355,7 @@ static void *get_data_from_pack(struct object_entry *obj)
|
||||
off_t from = obj[0].idx.offset + obj[0].hdr_size;
|
||||
unsigned long len = obj[1].idx.offset - from;
|
||||
unsigned char *data, *inbuf;
|
||||
z_stream stream;
|
||||
git_zstream stream;
|
||||
int status;
|
||||
|
||||
data = xmalloc(obj->size);
|
||||
@ -666,26 +666,26 @@ static void parse_pack_objects(unsigned char *sha1)
|
||||
|
||||
static int write_compressed(struct sha1file *f, void *in, unsigned int size)
|
||||
{
|
||||
z_stream stream;
|
||||
git_zstream stream;
|
||||
int status;
|
||||
unsigned char outbuf[4096];
|
||||
|
||||
memset(&stream, 0, sizeof(stream));
|
||||
deflateInit(&stream, zlib_compression_level);
|
||||
git_deflate_init(&stream, zlib_compression_level);
|
||||
stream.next_in = in;
|
||||
stream.avail_in = size;
|
||||
|
||||
do {
|
||||
stream.next_out = outbuf;
|
||||
stream.avail_out = sizeof(outbuf);
|
||||
status = deflate(&stream, Z_FINISH);
|
||||
status = git_deflate(&stream, Z_FINISH);
|
||||
sha1write(f, outbuf, sizeof(outbuf) - stream.avail_out);
|
||||
} while (status == Z_OK);
|
||||
|
||||
if (status != Z_STREAM_END)
|
||||
die("unable to deflate appended object (%d)", status);
|
||||
size = stream.total_out;
|
||||
deflateEnd(&stream);
|
||||
git_deflate_end(&stream);
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user