summaryrefslogtreecommitdiff
path: root/server-info.c
diff options
context:
space:
mode:
authorLibravatar René Scharfe <rene.scharfe@lsrfire.ath.cx>2013-03-15 23:21:51 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2013-03-16 22:07:02 -0700
commitc3c2e1a09b84dc932d90fa09d1632e5efa34c940 (patch)
tree35f5ce56cefcb5118af51427214da4155f0fc4f2 /server-info.c
parentarchive-zip: fix compressed size for stored export-subst files (diff)
downloadtgif-c3c2e1a09b84dc932d90fa09d1632e5efa34c940.tar.xz
archive-zip: use deflateInit2() to ask for raw compressed data
We use the function git_deflate_init() -- which wraps the zlib function deflateInit() -- to initialize compression of ZIP file entries. This results in compressed data prefixed with a two-bytes long header and followed by a four-bytes trailer. ZIP file entries consist of ZIP headers and raw compressed data instead, so we remove the zlib wrapper before writing the result. We can ask zlib for the the raw compressed data without the unwanted parts in the first place by using deflateInit2() and specifying a negative number of bits to size the window. For that purpose, factor out the function do_git_deflate_init() and add git_deflate_init_raw(), which wraps it. Then use the latter in archive-zip.c and get rid of the code that stripped the zlib header and trailer. Also rename the helper function zlib_deflate() to zlib_deflate_raw() to reflect the change. Thus we avoid generating data that we throw away anyway, the code becomes shorter and some magic constants are removed. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'server-info.c')
0 files changed, 0 insertions, 0 deletions