diff --git a/lib/zlib/deflate.js b/lib/zlib/deflate.js index d9bec99..7e0754f 100644 --- a/lib/zlib/deflate.js +++ b/lib/zlib/deflate.js @@ -132,16 +132,16 @@ function read_buf(strm, buf, start, size) { * option -- not supported here). */ function fill_window(s) { - var wsize = s.w_size; - var p = 0, n = 0, m = 0; + var _w_size = s.w_size; + var p = 0, n = 0, m = 0, more, str; //Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead"); do { - var more = s.window_size - s.lookahead - s.strstart; + more = s.window_size - s.lookahead - s.strstart; if (more === 0 && s.strstart === 0 && s.lookahead === 0) { - more = wsize; + more = _w_size; } else if (more === -1) { /* Very unlikely, but possible on 16 bit machine if @@ -154,13 +154,13 @@ function fill_window(s) { /* If the window is almost full and there is insufficient lookahead, * move the upper half to the lower one to make room in the upper half. */ - if (s.strstart >= wsize + (wsize - MIN_LOOKAHEAD)) { + if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) { - utils.arraySet(s.window, s.window, wsize, wsize, 0); - s.match_start -= wsize; - s.strstart -= wsize; + utils.arraySet(s.window, s.window, _w_size, _w_size, 0); + s.match_start -= _w_size; + s.strstart -= _w_size; /* we now have strstart >= MAX_DIST */ - s.block_start -= wsize; + s.block_start -= _w_size; /* Slide the hash table (could be avoided with 32 bit values at the expense of memory usage). We slide even when level == 0 @@ -172,20 +172,20 @@ function fill_window(s) { p = n; do { m = s.head[--p]; - s.head[p] = m >= wsize ? m - wsize : 0; + s.head[p] = m >= _w_size ? m - _w_size : 0; } while (--n); - n = wsize; + n = _w_size; p = n; do { - m = s.head[--p]; - s.head[p] = m >= wsize ? m - wsize : 0; + m = s.prev[--p]; + s.prev[p] = m >= _w_size ? m - _w_size : 0; /* If n is not on any hash chain, prev[n] is garbage but * its value will never be used. */ } while (--n); - more += wsize; + more += _w_size; } if (s.strm.avail_in === 0) { break; @@ -208,7 +208,7 @@ function fill_window(s) { /* Initialize the hash value now that we have some input: */ if (s.lookahead + s.insert >= MIN_MATCH) { - var str = s.strstart - s.insert; + str = s.strstart - s.insert; s.ins_h = s.window[str]; s.ins_h = update_hash(s, s.ins_h, s.window[str + 1]); //#if MIN_MATCH != 3