diff options
Diffstat (limited to 'trees.c')
-rw-r--r-- | trees.c | 24 |
1 files changed, 0 insertions, 24 deletions
@@ -394,7 +394,6 @@ void ZLIB_INTERNAL _tr_init(s) | |||
394 | 394 | ||
395 | s->bi_buf = 0; | 395 | s->bi_buf = 0; |
396 | s->bi_valid = 0; | 396 | s->bi_valid = 0; |
397 | s->last_eob_len = 8; /* enough lookahead for inflate */ | ||
398 | #ifdef DEBUG | 397 | #ifdef DEBUG |
399 | s->compressed_len = 0L; | 398 | s->compressed_len = 0L; |
400 | s->bits_sent = 0L; | 399 | s->bits_sent = 0L; |
@@ -880,13 +879,6 @@ void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last) | |||
880 | /* =========================================================================== | 879 | /* =========================================================================== |
881 | * Send one empty static block to give enough lookahead for inflate. | 880 | * Send one empty static block to give enough lookahead for inflate. |
882 | * This takes 10 bits, of which 7 may remain in the bit buffer. | 881 | * This takes 10 bits, of which 7 may remain in the bit buffer. |
883 | * The current inflate code requires 9 bits of lookahead. If the | ||
884 | * last two codes for the previous block (real code plus EOB) were coded | ||
885 | * on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode | ||
886 | * the last real code. In this case we send two empty static blocks instead | ||
887 | * of one. (There are no problems if the previous block is stored or fixed.) | ||
888 | * To simplify the code, we assume the worst case of last real code encoded | ||
889 | * on one bit only. | ||
890 | */ | 882 | */ |
891 | void ZLIB_INTERNAL _tr_align(s) | 883 | void ZLIB_INTERNAL _tr_align(s) |
892 | deflate_state *s; | 884 | deflate_state *s; |
@@ -897,20 +889,6 @@ void ZLIB_INTERNAL _tr_align(s) | |||
897 | s->compressed_len += 10L; /* 3 for block type, 7 for EOB */ | 889 | s->compressed_len += 10L; /* 3 for block type, 7 for EOB */ |
898 | #endif | 890 | #endif |
899 | bi_flush(s); | 891 | bi_flush(s); |
900 | /* Of the 10 bits for the empty block, we have already sent | ||
901 | * (10 - bi_valid) bits. The lookahead for the last real code (before | ||
902 | * the EOB of the previous block) was thus at least one plus the length | ||
903 | * of the EOB plus what we have just sent of the empty static block. | ||
904 | */ | ||
905 | if (1 + s->last_eob_len + 10 - s->bi_valid < 9) { | ||
906 | send_bits(s, STATIC_TREES<<1, 3); | ||
907 | send_code(s, END_BLOCK, static_ltree); | ||
908 | #ifdef DEBUG | ||
909 | s->compressed_len += 10L; | ||
910 | #endif | ||
911 | bi_flush(s); | ||
912 | } | ||
913 | s->last_eob_len = 7; | ||
914 | } | 892 | } |
915 | 893 | ||
916 | /* =========================================================================== | 894 | /* =========================================================================== |
@@ -1113,7 +1091,6 @@ local void compress_block(s, ltree, dtree) | |||
1113 | } while (lx < s->last_lit); | 1091 | } while (lx < s->last_lit); |
1114 | 1092 | ||
1115 | send_code(s, END_BLOCK, ltree); | 1093 | send_code(s, END_BLOCK, ltree); |
1116 | s->last_eob_len = ltree[END_BLOCK].Len; | ||
1117 | } | 1094 | } |
1118 | 1095 | ||
1119 | /* =========================================================================== | 1096 | /* =========================================================================== |
@@ -1221,7 +1198,6 @@ local void copy_block(s, buf, len, header) | |||
1221 | int header; /* true if block header must be written */ | 1198 | int header; /* true if block header must be written */ |
1222 | { | 1199 | { |
1223 | bi_windup(s); /* align on byte boundary */ | 1200 | bi_windup(s); /* align on byte boundary */ |
1224 | s->last_eob_len = 8; /* enough lookahead for inflate */ | ||
1225 | 1201 | ||
1226 | if (header) { | 1202 | if (header) { |
1227 | put_short(s, (ush)len); | 1203 | put_short(s, (ush)len); |