| Index: third_party/zlib/adler32.c
|
| ===================================================================
|
| --- third_party/zlib/adler32.c (revision 113739)
|
| +++ third_party/zlib/adler32.c (working copy)
|
| @@ -1,13 +1,16 @@
|
| /* adler32.c -- compute the Adler-32 checksum of a data stream
|
| - * Copyright (C) 1995-2004 Mark Adler
|
| + * Copyright (C) 1995-2007 Mark Adler
|
| * For conditions of distribution and use, see copyright notice in zlib.h
|
| */
|
|
|
| -/* @(#) $Id: adler32.c,v 3.6 2005/08/04 19:14:14 tor%cs.brown.edu Exp $ */
|
| +/* @(#) $Id$ */
|
|
|
| -#define ZLIB_INTERNAL
|
| -#include "zlib.h"
|
| +#include "zutil.h"
|
|
|
| +#define local static
|
| +
|
| +local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2);
|
| +
|
| #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 +128,10 @@
|
| }
|
|
|
| /* ========================================================================= */
|
| -uLong ZEXPORT adler32_combine(adler1, adler2, len2)
|
| +local uLong adler32_combine_(adler1, adler2, len2)
|
| uLong adler1;
|
| uLong adler2;
|
| - z_off_t len2;
|
| + z_off64_t len2;
|
| {
|
| unsigned long sum1;
|
| unsigned long sum2;
|
| @@ -141,9 +144,26 @@
|
| MOD(sum2);
|
| sum1 += (adler2 & 0xffff) + BASE - 1;
|
| sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
|
| - if (sum1 > BASE) sum1 -= BASE;
|
| - if (sum1 > BASE) sum1 -= BASE;
|
| - if (sum2 > (BASE << 1)) sum2 -= (BASE << 1);
|
| - if (sum2 > BASE) sum2 -= BASE;
|
| + if (sum1 >= BASE) sum1 -= BASE;
|
| + if (sum1 >= BASE) sum1 -= BASE;
|
| + if (sum2 >= (BASE << 1)) sum2 -= (BASE << 1);
|
| + 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);
|
| +}
|
| +
|
| +uLong ZEXPORT adler32_combine64(adler1, adler2, len2)
|
| + uLong adler1;
|
| + uLong adler2;
|
| + z_off64_t len2;
|
| +{
|
| + return adler32_combine_(adler1, adler2, len2);
|
| +}
|
|
|