Typo fix & var rename

This commit is contained in:
Vitaly Puzrin 2014-02-14 08:59:43 +04:00
parent c78fe44ca1
commit be9d4902bd

View file

@ -132,16 +132,16 @@ function read_buf(strm, buf, start, size) {
* option -- not supported here). * option -- not supported here).
*/ */
function fill_window(s) { function fill_window(s) {
var wsize = s.w_size; var _w_size = s.w_size;
var p = 0, n = 0, m = 0; var p = 0, n = 0, m = 0, more, str;
//Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead"); //Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");
do { 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) { if (more === 0 && s.strstart === 0 && s.lookahead === 0) {
more = wsize; more = _w_size;
} else if (more === -1) { } else if (more === -1) {
/* Very unlikely, but possible on 16 bit machine if /* 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, /* 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. * 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); utils.arraySet(s.window, s.window, _w_size, _w_size, 0);
s.match_start -= wsize; s.match_start -= _w_size;
s.strstart -= wsize; s.strstart -= _w_size;
/* we now have strstart >= MAX_DIST */ /* 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 /* Slide the hash table (could be avoided with 32 bit values
at the expense of memory usage). We slide even when level == 0 at the expense of memory usage). We slide even when level == 0
@ -172,20 +172,20 @@ function fill_window(s) {
p = n; p = n;
do { do {
m = s.head[--p]; m = s.head[--p];
s.head[p] = m >= wsize ? m - wsize : 0; s.head[p] = m >= _w_size ? m - _w_size : 0;
} while (--n); } while (--n);
n = wsize; n = _w_size;
p = n; p = n;
do { do {
m = s.head[--p]; m = s.prev[--p];
s.head[p] = m >= wsize ? m - wsize : 0; s.prev[p] = m >= _w_size ? m - _w_size : 0;
/* If n is not on any hash chain, prev[n] is garbage but /* If n is not on any hash chain, prev[n] is garbage but
* its value will never be used. * its value will never be used.
*/ */
} while (--n); } while (--n);
more += wsize; more += _w_size;
} }
if (s.strm.avail_in === 0) { if (s.strm.avail_in === 0) {
break; break;
@ -208,7 +208,7 @@ function fill_window(s) {
/* Initialize the hash value now that we have some input: */ /* Initialize the hash value now that we have some input: */
if (s.lookahead + s.insert >= MIN_MATCH) { 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 = s.window[str];
s.ins_h = update_hash(s, s.ins_h, s.window[str + 1]); s.ins_h = update_hash(s, s.ins_h, s.window[str + 1]);
//#if MIN_MATCH != 3 //#if MIN_MATCH != 3