some fixes

This commit is contained in:
nik 2014-02-17 18:53:37 -03:00
parent 90e1a6ff31
commit 202d870375
2 changed files with 4 additions and 5 deletions

View file

@ -151,7 +151,7 @@ function longest_match(s, cur_match) {
var _win = s.window; // shortcut var _win = s.window; // shortcut
var wmask = s.wmask; var wmask = s.w_mask;
var prev = s.prev; var prev = s.prev;
/* Stop when cur_match becomes <= limit. To simplify the code, /* Stop when cur_match becomes <= limit. To simplify the code,
@ -556,8 +556,7 @@ function deflate_fast(s, flush) {
/* Insert new strings in the hash table only if the match length /* Insert new strings in the hash table only if the match length
* is not too large. This saves time but degrades compression. * is not too large. This saves time but degrades compression.
*/ */
if (s.match_length <= s.max_insert_length && if (s.match_length <= s.max_lazy_match && s.lookahead >= MIN_MATCH) {
s.lookahead >= MIN_MATCH) {
s.match_length--; /* string at strstart already in table */ s.match_length--; /* string at strstart already in table */
do { do {
s.strstart++; s.strstart++;

View file

@ -659,7 +659,7 @@ function build_tree(s, desc)
/* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
* establish sub-heaps of increasing lengths: * establish sub-heaps of increasing lengths:
*/ */
for (n = s.heap_len/2; n >= 1; n--) { pqdownheap(s, tree, n); } for (n = Math.floor(s.heap_len / 2); n >= 1; n--) { pqdownheap(s, tree, n); }
/* Construct the Huffman tree by repeatedly combining the least two /* Construct the Huffman tree by repeatedly combining the least two
* frequent nodes. * frequent nodes.
@ -745,7 +745,7 @@ function scan_tree(s, tree, max_code)
s.bl_tree[REPZ_3_10*2]/*.Freq*/++; s.bl_tree[REPZ_3_10*2]/*.Freq*/++;
} else { } else {
s.bl_tree[REPZ_11_138]/*.Freq*/++; s.bl_tree[REPZ_11_138*2]/*.Freq*/++;
} }
count = 0; count = 0;