[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] Revert to using zlib-provided compress bound

From: Michael Spang <spang_at_google.com>
Date: Fri, 6 Aug 2010 12:06:40 -0700

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 <zlib.h>
 
-/* 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
Received on 2010-08-06 21:21:31 CEST

This is an archived mail posted to the Subversion Dev mailing list.