mirror of
https://github.com/0x5eal/rbxts-pako.git
synced 2025-04-10 22:00:58 +01:00
Ensure backward compatibility for headers.extra
This commit is contained in:
parent
77f1c17c6d
commit
174a1d12b6
2 changed files with 5 additions and 2 deletions
|
@ -1738,9 +1738,12 @@ const deflate = (strm, flush) => {
|
||||||
beg = 0;
|
beg = 0;
|
||||||
left -= copy;
|
left -= copy;
|
||||||
}
|
}
|
||||||
|
// JS specific: s.gzhead.extra may be TypedArray or Array for backward compatibility
|
||||||
|
// TypedArray.slice and TypedArray.from don't exist in IE10-IE11
|
||||||
|
let gzhead_extra = new Uint8Array(s.gzhead.extra);
|
||||||
// zmemcpy(s->pending_buf + s->pending,
|
// zmemcpy(s->pending_buf + s->pending,
|
||||||
// s->gzhead->extra + s->gzindex, left);
|
// s->gzhead->extra + s->gzindex, left);
|
||||||
s.pending_buf.set(s.gzhead.extra.subarray(s.gzindex, s.gzindex + left), s.pending);
|
s.pending_buf.set(gzhead_extra.subarray(s.gzindex, s.gzindex + left), s.pending);
|
||||||
s.pending += left;
|
s.pending += left;
|
||||||
//--- HCRC_UPDATE(beg) ---//
|
//--- HCRC_UPDATE(beg) ---//
|
||||||
if (s.gzhead.hcrc && s.pending > beg) {
|
if (s.gzhead.hcrc && s.pending > beg) {
|
||||||
|
|
|
@ -38,7 +38,7 @@ describe('Gzip special cases', () => {
|
||||||
os: 15,
|
os: 15,
|
||||||
name: 'test name',
|
name: 'test name',
|
||||||
comment: 'test comment',
|
comment: 'test comment',
|
||||||
extra: new Uint8Array([ 4, 5, 6 ])
|
extra: [ 4, 5, 6 ]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
deflator.push(data, true);
|
deflator.push(data, true);
|
||||||
|
|
Loading…
Add table
Reference in a new issue