diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2011-09-11 11:04:49 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2011-09-11 11:04:49 -0700 |
commit | 10daf0d4d7815447799d555d04d30325836e1d44 (patch) | |
tree | 75579fbe11e42dc3197acca53f5f887ac3808b57 /deflate.c | |
parent | 9712272c78b9d9c93746d9c8e156a3728c65ca72 (diff) | |
download | zlib-1.2.5.1.tar.gz zlib-1.2.5.1.tar.bz2 zlib-1.2.5.1.zip |
zlib 1.2.5.1v1.2.5.1
Diffstat (limited to 'deflate.c')
-rw-r--r-- | deflate.c | 24 |
1 files changed, 18 insertions, 6 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* deflate.c -- compress data using the deflation algorithm | 1 | /* deflate.c -- compress data using the deflation algorithm |
2 | * Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler | 2 | * Copyright (C) 1995-2011 Jean-loup Gailly and Mark Adler |
3 | * For conditions of distribution and use, see copyright notice in zlib.h | 3 | * For conditions of distribution and use, see copyright notice in zlib.h |
4 | */ | 4 | */ |
5 | 5 | ||
@@ -37,7 +37,7 @@ | |||
37 | * REFERENCES | 37 | * REFERENCES |
38 | * | 38 | * |
39 | * Deutsch, L.P.,"DEFLATE Compressed Data Format Specification". | 39 | * Deutsch, L.P.,"DEFLATE Compressed Data Format Specification". |
40 | * Available in http://www.ietf.org/rfc/rfc1951.txt | 40 | * Available in http://tools.ietf.org/html/rfc1951 |
41 | * | 41 | * |
42 | * A description of the Rabin and Karp algorithm is given in the book | 42 | * A description of the Rabin and Karp algorithm is given in the book |
43 | * "Algorithms" by R. Sedgewick, Addison-Wesley, p252. | 43 | * "Algorithms" by R. Sedgewick, Addison-Wesley, p252. |
@@ -52,7 +52,7 @@ | |||
52 | #include "deflate.h" | 52 | #include "deflate.h" |
53 | 53 | ||
54 | const char deflate_copyright[] = | 54 | const char deflate_copyright[] = |
55 | " deflate 1.2.5 Copyright 1995-2010 Jean-loup Gailly and Mark Adler "; | 55 | " deflate 1.2.5.1 Copyright 1995-2010 Jean-loup Gailly and Mark Adler "; |
56 | /* | 56 | /* |
57 | If you use the zlib library in a product, an acknowledgment is welcome | 57 | If you use the zlib library in a product, an acknowledgment is welcome |
58 | in the documentation of your product. If for some reason you cannot | 58 | in the documentation of your product. If for some reason you cannot |
@@ -397,6 +397,18 @@ int ZEXPORT deflateSetHeader (strm, head) | |||
397 | } | 397 | } |
398 | 398 | ||
399 | /* ========================================================================= */ | 399 | /* ========================================================================= */ |
400 | int ZEXPORT deflatePending (strm, pending, bits) | ||
401 | unsigned *pending; | ||
402 | int *bits; | ||
403 | z_streamp strm; | ||
404 | { | ||
405 | if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; | ||
406 | *pending = strm->state->pending; | ||
407 | *bits = strm->state->bi_valid; | ||
408 | return Z_OK; | ||
409 | } | ||
410 | |||
411 | /* ========================================================================= */ | ||
400 | int ZEXPORT deflatePrime (strm, bits, value) | 412 | int ZEXPORT deflatePrime (strm, bits, value) |
401 | z_streamp strm; | 413 | z_streamp strm; |
402 | int bits; | 414 | int bits; |
@@ -1001,15 +1013,15 @@ local int read_buf(strm, buf, size) | |||
1001 | 1013 | ||
1002 | strm->avail_in -= len; | 1014 | strm->avail_in -= len; |
1003 | 1015 | ||
1016 | zmemcpy(buf, strm->next_in, len); | ||
1004 | if (strm->state->wrap == 1) { | 1017 | if (strm->state->wrap == 1) { |
1005 | strm->adler = adler32(strm->adler, strm->next_in, len); | 1018 | strm->adler = adler32(strm->adler, buf, len); |
1006 | } | 1019 | } |
1007 | #ifdef GZIP | 1020 | #ifdef GZIP |
1008 | else if (strm->state->wrap == 2) { | 1021 | else if (strm->state->wrap == 2) { |
1009 | strm->adler = crc32(strm->adler, strm->next_in, len); | 1022 | strm->adler = crc32(strm->adler, buf, len); |
1010 | } | 1023 | } |
1011 | #endif | 1024 | #endif |
1012 | zmemcpy(buf, strm->next_in, len); | ||
1013 | strm->next_in += len; | 1025 | strm->next_in += len; |
1014 | strm->total_in += len; | 1026 | strm->total_in += len; |
1015 | 1027 | ||