aboutsummaryrefslogtreecommitdiff
path: root/trees.c
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2011-09-09 23:32:36 -0700
committerMark Adler <madler@alumni.caltech.edu>2011-09-09 23:32:36 -0700
commit67cc20d0041a32bee12bd9eb20ae218f91b73f77 (patch)
treed7e1b94bd15c30efd57cf9036f5fe89306b6bba0 /trees.c
parent7751bd4c715ea8478113e34b49b5a794a4642e8e (diff)
downloadzlib-67cc20d0041a32bee12bd9eb20ae218f91b73f77.tar.gz
zlib-67cc20d0041a32bee12bd9eb20ae218f91b73f77.tar.bz2
zlib-67cc20d0041a32bee12bd9eb20ae218f91b73f77.zip
zlib 1.2.4-pre1v1.2.4-pre1
Diffstat (limited to 'trees.c')
-rw-r--r--trees.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/trees.c b/trees.c
index aa599a5..1a6e997 100644
--- a/trees.c
+++ b/trees.c
@@ -867,13 +867,13 @@ local void send_all_trees(s, lcodes, dcodes, blcodes)
867/* =========================================================================== 867/* ===========================================================================
868 * Send a stored block 868 * Send a stored block
869 */ 869 */
870void _tr_stored_block(s, buf, stored_len, eof) 870void _tr_stored_block(s, buf, stored_len, last)
871 deflate_state *s; 871 deflate_state *s;
872 charf *buf; /* input block */ 872 charf *buf; /* input block */
873 ulg stored_len; /* length of input block */ 873 ulg stored_len; /* length of input block */
874 int eof; /* true if this is the last block for a file */ 874 int last; /* one if this is the last block for a file */
875{ 875{
876 send_bits(s, (STORED_BLOCK<<1)+eof, 3); /* send block type */ 876 send_bits(s, (STORED_BLOCK<<1)+last, 3); /* send block type */
877#ifdef DEBUG 877#ifdef DEBUG
878 s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; 878 s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;
879 s->compressed_len += (stored_len + 4) << 3; 879 s->compressed_len += (stored_len + 4) << 3;
@@ -921,11 +921,11 @@ void _tr_align(s)
921 * Determine the best encoding for the current block: dynamic trees, static 921 * Determine the best encoding for the current block: dynamic trees, static
922 * trees or store, and output the encoded block to the zip file. 922 * trees or store, and output the encoded block to the zip file.
923 */ 923 */
924void _tr_flush_block(s, buf, stored_len, eof) 924void _tr_flush_block(s, buf, stored_len, last)
925 deflate_state *s; 925 deflate_state *s;
926 charf *buf; /* input block, or NULL if too old */ 926 charf *buf; /* input block, or NULL if too old */
927 ulg stored_len; /* length of input block */ 927 ulg stored_len; /* length of input block */
928 int eof; /* true if this is the last block for a file */ 928 int last; /* one if this is the last block for a file */
929{ 929{
930 ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */ 930 ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
931 int max_blindex = 0; /* index of last bit length code of non zero freq */ 931 int max_blindex = 0; /* index of last bit length code of non zero freq */
@@ -981,20 +981,20 @@ void _tr_flush_block(s, buf, stored_len, eof)
981 * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to 981 * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to
982 * transform a block into a stored block. 982 * transform a block into a stored block.
983 */ 983 */
984 _tr_stored_block(s, buf, stored_len, eof); 984 _tr_stored_block(s, buf, stored_len, last);
985 985
986#ifdef FORCE_STATIC 986#ifdef FORCE_STATIC
987 } else if (static_lenb >= 0) { /* force static trees */ 987 } else if (static_lenb >= 0) { /* force static trees */
988#else 988#else
989 } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) { 989 } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) {
990#endif 990#endif
991 send_bits(s, (STATIC_TREES<<1)+eof, 3); 991 send_bits(s, (STATIC_TREES<<1)+last, 3);
992 compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree); 992 compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree);
993#ifdef DEBUG 993#ifdef DEBUG
994 s->compressed_len += 3 + s->static_len; 994 s->compressed_len += 3 + s->static_len;
995#endif 995#endif
996 } else { 996 } else {
997 send_bits(s, (DYN_TREES<<1)+eof, 3); 997 send_bits(s, (DYN_TREES<<1)+last, 3);
998 send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, 998 send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1,
999 max_blindex+1); 999 max_blindex+1);
1000 compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree); 1000 compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree);
@@ -1008,14 +1008,14 @@ void _tr_flush_block(s, buf, stored_len, eof)
1008 */ 1008 */
1009 init_block(s); 1009 init_block(s);
1010 1010
1011 if (eof) { 1011 if (last) {
1012 bi_windup(s); 1012 bi_windup(s);
1013#ifdef DEBUG 1013#ifdef DEBUG
1014 s->compressed_len += 7; /* align on byte boundary */ 1014 s->compressed_len += 7; /* align on byte boundary */
1015#endif 1015#endif
1016 } 1016 }
1017 Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, 1017 Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
1018 s->compressed_len-7*eof)); 1018 s->compressed_len-7*last));
1019} 1019}
1020 1020
1021/* =========================================================================== 1021/* ===========================================================================