MCPcopy Create free account
hub / github.com/TruthHun/BookStack / updatewindow

Function updatewindow

static/word2md/mammoth.browser.js:20790–20830  ·  view source on GitHub ↗
(strm, src, end, copy)

Source from the content-addressed store, hash-verified

20788 The advantage may be dependent on the size of the processor's data caches.
20789 */
20790function updatewindow(strm, src, end, copy) {
20791 var dist;
20792 var state = strm.state;
20793
20794 /* if it hasn't been done already, allocate space for the window */
20795 if (state.window === null) {
20796 state.wsize = 1 << state.wbits;
20797 state.wnext = 0;
20798 state.whave = 0;
20799
20800 state.window = new utils.Buf8(state.wsize);
20801 }
20802
20803 /* copy state->wsize or less output bytes into the circular window */
20804 if (copy >= state.wsize) {
20805 utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0);
20806 state.wnext = 0;
20807 state.whave = state.wsize;
20808 }
20809 else {
20810 dist = state.wsize - state.wnext;
20811 if (dist > copy) {
20812 dist = copy;
20813 }
20814 //zmemcpy(state->window + state->wnext, end - copy, dist);
20815 utils.arraySet(state.window, src, end - copy, dist, state.wnext);
20816 copy -= dist;
20817 if (copy) {
20818 //zmemcpy(state->window, end - copy, copy);
20819 utils.arraySet(state.window, src, end - copy, copy, 0);
20820 state.wnext = copy;
20821 state.whave = state.wsize;
20822 }
20823 else {
20824 state.wnext += dist;
20825 if (state.wnext === state.wsize) { state.wnext = 0; }
20826 if (state.whave < state.wsize) { state.whave += dist; }
20827 }
20828 }
20829 return 0;
20830}
20831
20832function inflate(strm, flush) {
20833 var state;

Callers 2

inflateFunction · 0.70
inflateSetDictionaryFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected