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

Re: svndiff1 and compressBound

From: Garrett Rooney <rooneg_at_electricjellyfish.net>
Date: 2006-02-22 05:35:21 CET

On 2/21/06, Daniel Berlin <dberlin@dberlin.org> wrote:

> Errr, not if you are keeping up to date on your redhat updates you
> didn't.
>
> -bash-3.00$ cat /etc/redhat-release
> Red Hat Enterprise Linux AS release 4 (Nahant Update 2)
> -bash-3.00$ grep compressBound /usr/include/zlib.h
> ...
> ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));

I am perfectly willing to stipulate that my RHEL install is out of date ;-)

> Anyhoo, i believe the correct solution is to simply paste the definition
> of compressBound into the file as a macro, note where it came from, and
> be done with it.
>
> compressBound is defined as:
>
> /* If the default memLevel or windowBits for deflateInit() is changed,
> then this function needs to be updated. */
> uLong ZEXPORT compressBound (sourceLen)
> uLong sourceLen;
> {
> return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + 11;
> }
>
>
>
> When i suggested this on IRC, there was some acrimony over the idea that
> this calculation may sometime change but
> 1. It hasn't changed since zlib has started
> 2. They have no plans to ever change it, AFAIK
> 3. The docs above it simply say that *if you change the window bits,
> etc, you need to change these numbers*. They didn't even make the
> numbers a define.
> 4. If it ever broke, you'd just get errors from zlib on compress about
> the output buffer not being large enough and we'd fix it rather quickly.
>
> " compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
> memory, Z_BUF_ERROR if there was not enough room in the output buffer,
> Z_STREAM_ERROR if the level parameter is invalid."
>
> There is no solution to "not using compressBound" in some form, whether
> we inline it or not.
>
> A configure test where we select either the zlib.h version or our
> version would be silly, because then, in the remote possibility it ever
> did change, your subversion would break depending on whether you had a
> new enough zlib around it could pull compressBound from or not.
>
> If we inline it, and zlib changes the output buffer size requirement, it
> will at least fail consistently :)

Works for me. Add the #define.

-garrett

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Feb 22 05:35:51 2006

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.