Re: [PATCH] Revert to using zlib-provided compress bound

2010-08-06 Thread Michael Spang
On Fri, Aug 6, 2010 at 1:51 PM, Peter Samuelson  wrote:
>
> [Michael Spang]
>> This reverts to using the zlib-provided version, since the old version
>> of zlib that was missing this function should be quite rare these
>> days.
>
> Maybe I'm just old ... but I bet there's still some zlib 1.1.4
> out there.  Maybe do the following instead?  (Untested.)

Yeah that does seem better.

Michael


[PATCH] Revert to using zlib-provided compress bound

2010-08-06 Thread Michael Spang
We have a local definition of zlib's compressBound which is not in
sync with recent versions of zlib. This may cause a "Compression of
svndiff data failed" message from the Subversion server when the
buffer provided to zlib is not large enough.

This reverts to using the zlib-provided version, since the old version
of zlib that was missing this function should be quite rare these
days.
---
 subversion/libsvn_delta/svndiff.c |7 +--
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/subversion/libsvn_delta/svndiff.c 
b/subversion/libsvn_delta/svndiff.c
index bf6afa9..c0187b5 100644
--- a/subversion/libsvn_delta/svndiff.c
+++ b/subversion/libsvn_delta/svndiff.c
@@ -31,11 +31,6 @@
 #include "svn_private_config.h"
 #include 
 
-/* This macro is taken from zlib, and was originally the function
-   compressBound.  It shouldn't ever change, but once every millenium,
-   it may be useful for someone to make sure. */
-#define svnCompressBound(LEN) ((LEN) + ((LEN) >> 12) + ((LEN) >> 14) + 11)
-
 /* For svndiff1, address/instruction/new data under this size will not
be compressed using zlib as a secondary compressor.  */
 #define MIN_COMPRESS_SIZE 512
@@ -152,7 +147,7 @@ zlib_encode(const char *data, apr_size_t len, 
svn_stringbuf_t *out)
 }
   else
 {
-  svn_stringbuf_ensure(out, svnCompressBound(len) + intlen);
+  svn_stringbuf_ensure(out, compressBound(len) + intlen);
   endlen = out->blocksize;
 
   if (compress2((unsigned char *)out->data + intlen, &endlen,
-- 
1.7.1