{"thread":{"id":"250","subject":"compiling git with ZLIB < 1.2","startedAt":"2005-04-22T22:12:06Z","lastAt":"2005-04-22T22:12:06Z","messageCount":1,"participants":["Andreas Gal"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"1329","messageId":"Pine.LNX.4.58.0504221508530.22285@sam.ics.uci.edu","threadId":"250","inReplyTo":"S262157AbVDVVWs/20050422212248Z+375@vger.kernel.org","subject":"compiling git with ZLIB < 1.2","fromName":"Andreas Gal","fromEmail":"gal@uci.edu","sentAt":"2005-04-22T22:12:06Z","receivedAt":"2005-04-22T22:12:06Z","isPatch":false,"sender":{"key":"gal@uci.edu","avatar":null},"body":"\ndeflateBound() was added in ZLIB 1.2, but there is unfortunately no easy \nway to check against the ZLIB version. I would suggest to use the fix \nbelow until everyone has a recent ZLIB installed (neither my RHEL3 nor my \nDarwin box does by default).\n\nAndreas\n\n--- a/sha1_file.c\n+++ b/sha1_file.c\n@@ -240,7 +240,11 @@ int write_sha1_file(char *buf, unsigned \n \t/* Set it up */\n \tmemset(&stream, 0, sizeof(stream));\n \tdeflateInit(&stream, Z_BEST_COMPRESSION);\n+#ifdef ONCE_EVERYONE_UPDATED_TO_ZLIB_12\n \tsize = deflateBound(&stream, len);\n+#else\t\n+\tsize = len + ((len + 7) >> 3) + ((len + 63) >> 6) + 11;\n+#endif\t\n \tcompressed = malloc(size);\n \n \t/* Compress it */\n"}]}