Merge branch 'jc/zlib-wrap' into maint
* 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
This commit is contained in:
10
diff.c
10
diff.c
@ -1839,20 +1839,20 @@ static unsigned char *deflate_it(char *data,
|
||||
{
|
||||
int bound;
|
||||
unsigned char *deflated;
|
||||
z_stream stream;
|
||||
git_zstream stream;
|
||||
|
||||
memset(&stream, 0, sizeof(stream));
|
||||
deflateInit(&stream, zlib_compression_level);
|
||||
bound = deflateBound(&stream, size);
|
||||
git_deflate_init(&stream, zlib_compression_level);
|
||||
bound = git_deflate_bound(&stream, size);
|
||||
deflated = xmalloc(bound);
|
||||
stream.next_out = deflated;
|
||||
stream.avail_out = bound;
|
||||
|
||||
stream.next_in = (unsigned char *)data;
|
||||
stream.avail_in = size;
|
||||
while (deflate(&stream, Z_FINISH) == Z_OK)
|
||||
while (git_deflate(&stream, Z_FINISH) == Z_OK)
|
||||
; /* nothing */
|
||||
deflateEnd(&stream);
|
||||
git_deflate_end(&stream);
|
||||
*result_size = stream.total_out;
|
||||
return deflated;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user