(s)
| 18565 | * option -- not supported here). |
| 18566 | */ |
| 18567 | function fill_window(s) { |
| 18568 | var _w_size = s.w_size; |
| 18569 | var p, n, m, more, str; |
| 18570 | |
| 18571 | //Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead"); |
| 18572 | |
| 18573 | do { |
| 18574 | more = s.window_size - s.lookahead - s.strstart; |
| 18575 | |
| 18576 | // JS ints have 32 bit, block below not needed |
| 18577 | /* Deal with !@#$% 64K limit: */ |
| 18578 | //if (sizeof(int) <= 2) { |
| 18579 | // if (more == 0 && s->strstart == 0 && s->lookahead == 0) { |
| 18580 | // more = wsize; |
| 18581 | // |
| 18582 | // } else if (more == (unsigned)(-1)) { |
| 18583 | // /* Very unlikely, but possible on 16 bit machine if |
| 18584 | // * strstart == 0 && lookahead == 1 (input done a byte at time) |
| 18585 | // */ |
| 18586 | // more--; |
| 18587 | // } |
| 18588 | //} |
| 18589 | |
| 18590 | |
| 18591 | /* If the window is almost full and there is insufficient lookahead, |
| 18592 | * move the upper half to the lower one to make room in the upper half. |
| 18593 | */ |
| 18594 | if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) { |
| 18595 | |
| 18596 | utils.arraySet(s.window, s.window, _w_size, _w_size, 0); |
| 18597 | s.match_start -= _w_size; |
| 18598 | s.strstart -= _w_size; |
| 18599 | /* we now have strstart >= MAX_DIST */ |
| 18600 | s.block_start -= _w_size; |
| 18601 | |
| 18602 | /* Slide the hash table (could be avoided with 32 bit values |
| 18603 | at the expense of memory usage). We slide even when level == 0 |
| 18604 | to keep the hash table consistent if we switch back to level > 0 |
| 18605 | later. (Using level 0 permanently is not an optimal usage of |
| 18606 | zlib, so we don't care about this pathological case.) |
| 18607 | */ |
| 18608 | |
| 18609 | n = s.hash_size; |
| 18610 | p = n; |
| 18611 | do { |
| 18612 | m = s.head[--p]; |
| 18613 | s.head[p] = (m >= _w_size ? m - _w_size : 0); |
| 18614 | } while (--n); |
| 18615 | |
| 18616 | n = _w_size; |
| 18617 | p = n; |
| 18618 | do { |
| 18619 | m = s.prev[--p]; |
| 18620 | s.prev[p] = (m >= _w_size ? m - _w_size : 0); |
| 18621 | /* If n is not on any hash chain, prev[n] is garbage but |
| 18622 | * its value will never be used. |
| 18623 | */ |
| 18624 | } while (--n); |
no test coverage detected