From: Andreas Gal <gal@uci.edu>
To: git@vger.kernel.org
Subject: compiling git with ZLIB < 1.2
Date: Fri, 22 Apr 2005 15:12:06 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.58.0504221508530.22285@sam.ics.uci.edu> (raw)
In-Reply-To: <S262157AbVDVVWs/20050422212248Z+375@vger.kernel.org>
deflateBound() was added in ZLIB 1.2, but there is unfortunately no easy
way to check against the ZLIB version. I would suggest to use the fix
below until everyone has a recent ZLIB installed (neither my RHEL3 nor my
Darwin box does by default).
Andreas
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -240,7 +240,11 @@ int write_sha1_file(char *buf, unsigned
/* Set it up */
memset(&stream, 0, sizeof(stream));
deflateInit(&stream, Z_BEST_COMPRESSION);
+#ifdef ONCE_EVERYONE_UPDATED_TO_ZLIB_12
size = deflateBound(&stream, len);
+#else
+ size = len + ((len + 7) >> 3) + ((len + 63) >> 6) + 11;
+#endif
compressed = malloc(size);
/* Compress it */
parent reply other threads:[~2005-04-22 22:08 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <S262157AbVDVVWs/20050422212248Z+375@vger.kernel.org>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.58.0504221508530.22285@sam.ics.uci.edu \
--to=gal@uci.edu \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).