Code

zlib: wrap deflateBound() too
[git.git] / zlib.c
diff --git a/zlib.c b/zlib.c
index ee47a3a4a9b9e01fbd0e30a326b208d7a492ceb1..8f19d2fe388b2a75699d873618da05a15dd4e2a0 100644 (file)
--- a/zlib.c
+++ b/zlib.c
@@ -78,6 +78,15 @@ int git_inflate(z_streamp strm, int flush)
        return status;
 }
 
+#if defined(NO_DEFLATE_BOUND) || ZLIB_VERNUM < 0x1200
+#define deflateBound(c,s)  ((s) + (((s) + 7) >> 3) + (((s) + 63) >> 6) + 11)
+#endif
+
+unsigned long git_deflate_bound(z_streamp strm, unsigned long size)
+{
+       return deflateBound(strm, size);
+}
+
 void git_deflate_init(z_streamp strm, int level)
 {
        int status = deflateInit(strm, level);