Commit b0ac240f authored by Mike Tinglof's avatar Mike Tinglof

re-enable history buffer (used as sliding window for decompress)

parent 0fa6748c
...@@ -198,7 +198,7 @@ function JSUnzip() { ...@@ -198,7 +198,7 @@ function JSUnzip() {
*/ */
"use strict"; "use strict";
function TINF() { function TINF() {
this.OK = 0; this.OK = 0;
...@@ -502,16 +502,16 @@ this.inflate_block_data = function(d, lt, dt) ...@@ -502,16 +502,16 @@ this.inflate_block_data = function(d, lt, dt)
dist = this.decode_symbol(d, dt); dist = this.decode_symbol(d, dt);
/* possibly get more bits from distance code */ /* possibly get more bits from distance code */
offs = ddestlength - this.read_bits(d, this.dist_bits[dist], this.dist_base[dist]); offs = d.history.length - this.read_bits(d, this.dist_bits[dist], this.dist_base[dist]);
if (offs < 0) if (offs < 0)
throw ("Invalid zlib offset " + offs); throw ("Invalid zlib offset " + offs);
/* copy match */ /* copy match */
for (i = offs; i < offs + length; ++i) { for (i = offs; i < offs + length; ++i) {
ddest[ddestlength++] = ddest[i]; //ddest[ddestlength++] = ddest[i];
//ddest[ddestlength++] = d.history[i]; ddest[ddestlength++] = d.history[i];
//d.history.push(d.history[i]); d.history.push(d.history[i]);
} }
} }
} }
...@@ -657,7 +657,6 @@ this.uncompress = function(source, offset) ...@@ -657,7 +657,6 @@ this.uncompress = function(source, offset)
} while (!bfinal && d.sourceIndex < d.source.length); } while (!bfinal && d.sourceIndex < d.source.length);
//d.history.push.apply(d.history, d.dest);
d.history = d.history.slice(-this.WINDOW_SIZE); d.history = d.history.slice(-this.WINDOW_SIZE);
return { 'status' : this.OK, 'data' : d.dest }; return { 'status' : this.OK, 'data' : d.dest };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment