Permalink
Browse files

2009-08-23 Gonzalo Paniagua Javier <gonzalo@novell.com>

	* deflate.c:
	* gzio.c:
	* deflate.h:
	* zutil.h:
	* crc32.c:
	* trees.c:
	* zconf.h:
	* inffast.c:
	* compress.c:
	* zlib.h:
	* inftrees.c:
	* inflate.c:
	* inflate.h:
	* adler32.c:
	* infback.c: updated to 1.2.3.3


svn path=/trunk/mono/; revision=140453
  • Loading branch information...
gonzalop committed Aug 23, 2009
1 parent f277826 commit 5dd3f99e04bc79b4748c45ec075fb72f2197bf25
Showing with 664 additions and 253 deletions.
  1. +18 −0 support/ChangeLog
  2. +42 −2 support/adler32.c
  3. +3 −2 support/compress.c
  4. +39 −2 support/crc32.c
  5. +47 −15 support/deflate.c
  6. +1 −1 support/deflate.h
  7. +116 −22 support/gzio.c
  8. +40 −40 support/infback.c
  9. +39 −18 support/inffast.c
  10. +78 −45 support/inflate.c
  11. +3 −2 support/inflate.h
  12. +22 −22 support/inftrees.c
  13. +39 −15 support/trees.c
  14. +95 −37 support/zconf.h
  15. +66 −24 support/zlib.h
  16. +16 −6 support/zutil.h
View
@@ -1,3 +1,21 @@
+2009-08-23 Gonzalo Paniagua Javier <gonzalo@novell.com>
+
+ * deflate.c:
+ * gzio.c:
+ * deflate.h:
+ * zutil.h:
+ * crc32.c:
+ * trees.c:
+ * zconf.h:
+ * inffast.c:
+ * compress.c:
+ * zlib.h:
+ * inftrees.c:
+ * inflate.c:
+ * inflate.h:
+ * adler32.c:
+ * infback.c: updated to 1.2.3.3
+
2009-07-21 Gonzalo Paniagua Javier <gonzalo@novell.com>
* zlib-helper.c: use glib for malloc/free.
View
@@ -1,5 +1,5 @@
/* adler32.c -- compute the Adler-32 checksum of a data stream
- * Copyright (C) 1995-2004 Mark Adler
+ * Copyright (C) 1995-2006 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -8,6 +8,15 @@
#define ZLIB_INTERNAL
#include "zlib.h"
+#define local static
+
+#ifdef _LARGEFILE64_SOURCE
+ local uLong adler32_combine_(uLong adler1, uLong adler2, off64_t len2);
+#else
+ local uLong adler32_combine_(uLong adler1, uLong adler2, z_off_t len2);
+#endif
+
+
#define BASE 65521UL /* largest prime smaller than 65536 */
#define NMAX 5552
/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
@@ -125,10 +134,14 @@ uLong ZEXPORT adler32(adler, buf, len)
}
/* ========================================================================= */
-uLong ZEXPORT adler32_combine(adler1, adler2, len2)
+local uLong adler32_combine_(adler1, adler2, len2)
uLong adler1;
uLong adler2;
+#ifdef _LARGEFILE64_SOURCE
+ off64_t len2;
+#else
z_off_t len2;
+#endif
{
unsigned long sum1;
unsigned long sum2;
@@ -147,3 +160,30 @@ uLong ZEXPORT adler32_combine(adler1, adler2, len2)
if (sum2 > BASE) sum2 -= BASE;
return sum1 | (sum2 << 16);
}
+
+/* ========================================================================= */
+uLong ZEXPORT adler32_combine(adler1, adler2, len2)
+ uLong adler1;
+ uLong adler2;
+ z_off_t len2;
+{
+ return adler32_combine_(adler1, adler2, len2);
+}
+
+#ifdef _LARGEFILE64_SOURCE
+uLong ZEXPORT adler32_combine64(adler1, adler2, len2)
+ uLong adler1;
+ uLong adler2;
+ off64_t len2;
+{
+ return adler32_combine_(adler1, adler2, len2);
+}
+#else
+uLong ZEXPORT adler32_combine64(adler1, adler2, len2)
+ uLong adler1;
+ uLong adler2;
+ z_off_t len2;
+{
+ return adler32_combine_(adler1, adler2, len2);
+}
+#endif
View
@@ -1,5 +1,5 @@
/* compress.c -- compress a memory buffer
- * Copyright (C) 1995-2003 Jean-loup Gailly.
+ * Copyright (C) 1995-2005 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -75,5 +75,6 @@ int ZEXPORT compress (dest, destLen, source, sourceLen)
uLong ZEXPORT compressBound (sourceLen)
uLong sourceLen;
{
- return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + 11;
+ return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
+ (sourceLen >> 25) + 13;
}
View
@@ -1,5 +1,5 @@
/* crc32.c -- compute the CRC-32 of a data stream
- * Copyright (C) 1995-2005 Mark Adler
+ * Copyright (C) 1995-2006 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*
* Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster
@@ -68,6 +68,12 @@
local unsigned long gf2_matrix_times OF((unsigned long *mat,
unsigned long vec));
local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat));
+#ifdef _LARGEFILE64_SOURCE
+ local uLong crc32_combine_(uLong crc1, uLong crc2, off64_t len2);
+#else
+ local uLong crc32_combine_(uLong crc1, uLong crc2, z_off_t len2);
+#endif
+
#ifdef DYNAMIC_CRC_TABLE
@@ -367,10 +373,14 @@ local void gf2_matrix_square(square, mat)
}
/* ========================================================================= */
-uLong ZEXPORT crc32_combine(crc1, crc2, len2)
+local uLong crc32_combine_(crc1, crc2, len2)
uLong crc1;
uLong crc2;
+#ifdef _LARGEFILE64_SOURCE
+ off64_t len2;
+#else
z_off_t len2;
+#endif
{
int n;
unsigned long row;
@@ -421,3 +431,30 @@ uLong ZEXPORT crc32_combine(crc1, crc2, len2)
crc1 ^= crc2;
return crc1;
}
+
+/* ========================================================================= */
+uLong ZEXPORT crc32_combine(crc1, crc2, len2)
+ uLong crc1;
+ uLong crc2;
+ z_off_t len2;
+{
+ return crc32_combine_(crc1, crc2, len2);
+}
+
+#ifdef _LARGEFILE64_SOURCE
+uLong ZEXPORT crc32_combine64(crc1, crc2, len2)
+ uLong crc1;
+ uLong crc2;
+ off64_t len2;
+{
+ return crc32_combine_(crc1, crc2, len2);
+}
+#else
+uLong ZEXPORT crc32_combine64(crc1, crc2, len2)
+ uLong crc1;
+ uLong crc2;
+ z_off_t len2;
+{
+ return crc32_combine_(crc1, crc2, len2);
+}
+#endif
View
@@ -1,5 +1,5 @@
/* deflate.c -- compress data using the deflation algorithm
- * Copyright (C) 1995-2005 Jean-loup Gailly.
+ * Copyright (C) 1995-2006 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -52,7 +52,7 @@
#include "deflate.h"
const char deflate_copyright[] =
- " deflate 1.2.3 Copyright 1995-2005 Jean-loup Gailly ";
+ " deflate 1.2.3.3 Copyright 1995-2006 Jean-loup Gailly ";
/*
If you use the zlib library in a product, an acknowledgment is welcome
in the documentation of your product. If for some reason you cannot
@@ -481,33 +481,65 @@ int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain)
* resulting from using fixed blocks instead of stored blocks, which deflate
* can emit on compressed data for some combinations of the parameters.
*
- * This function could be more sophisticated to provide closer upper bounds
- * for every combination of windowBits and memLevel, as well as wrap.
- * But even the conservative upper bound of about 14% expansion does not
- * seem onerous for output buffer allocation.
+ * This function could be more sophisticated to provide closer upper bounds for
+ * every combination of windowBits and memLevel. But even the conservative
+ * upper bound of about 14% expansion does not seem onerous for output buffer
+ * allocation.
*/
uLong ZEXPORT deflateBound(strm, sourceLen)
z_streamp strm;
uLong sourceLen;
{
deflate_state *s;
- uLong destLen;
+ uLong complen, wraplen;
+ Bytef *str;
- /* conservative upper bound */
- destLen = sourceLen +
- ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 11;
+ /* conservative upper bound for compressed data */
+ complen = sourceLen +
+ ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5;
- /* if can't get parameters, return conservative bound */
+ /* if can't get parameters, return conservative bound plus zlib wrapper */
if (strm == Z_NULL || strm->state == Z_NULL)
- return destLen;
+ return complen + 6;
- /* if not default parameters, return conservative bound */
+ /* compute wrapper length */
s = strm->state;
+ switch (s->wrap) {
+ case 0: /* raw deflate */
+ wraplen = 0;
+ break;
+ case 1: /* zlib wrapper */
+ wraplen = 6 + (s->strstart ? 4 : 0);
+ break;
+ case 2: /* gzip wrapper */
+ wraplen = 18;
+ if (s->gzhead != NULL) { /* user-supplied gzip header */
+ if (s->gzhead->extra != NULL)
+ wraplen += 2 + s->gzhead->extra_len;
+ str = s->gzhead->name;
+ if (str != NULL)
+ do {
+ wraplen++;
+ } while (*str++);
+ str = s->gzhead->comment;
+ if (str != NULL)
+ do {
+ wraplen++;
+ } while (*str++);
+ if (s->gzhead->hcrc)
+ wraplen += 2;
+ }
+ break;
+ default: /* for compiler happiness */
+ wraplen = 6;
+ }
+
+ /* if not default parameters, return conservative bound */
if (s->w_bits != 15 || s->hash_bits != 8 + 7)
- return destLen;
+ return complen + wraplen;
/* default settings: return tight bound for that case */
- return compressBound(sourceLen);
+ return compressBound(sourceLen) - 6 + wraplen;
}
/* =========================================================================
View
@@ -1,5 +1,5 @@
/* deflate.h -- internal compression state
- * Copyright (C) 1995-2004 Jean-loup Gailly
+ * Copyright (C) 1995-2005 Jean-loup Gailly
* For conditions of distribution and use, see copyright notice in zlib.h
*/
Oops, something went wrong.

0 comments on commit 5dd3f99

Please sign in to comment.