Improve speed of gzprintf() in transparent mode.

This commit is contained in:
Mark Adler
2015-07-05 18:14:53 -07:00
parent 8a979f6c79
commit 95698093f0
4 changed files with 70 additions and 51 deletions

View File

@@ -331,6 +331,8 @@ int ZEXPORT gzbuffer(file, size)
return -1;
/* check and set requested size */
if ((size << 1) < size)
return -1; /* need to be able to double it */
if (size < 2)
size = 2; /* need two bytes to check magic header */
state->want = size;