- /*
- * If the compression level is 0 or if the entropy
- * is high, the "compressing" data will take more
- * room then the uncompressed data due to the zlib
- * overhead.
- *
- * XXX: The overhead isn't constant and 30 bytes
- * may not be enough for everybody
- */
- new_length = *buffer_length + 30;
+ /* Let zlib figure out the maximum length of the compressed data */
+ new_length = compressBound((uLongf)*buffer_length);