mirror of
https://github.com/0x5eal/rbxts-pako.git
synced 2025-04-11 22:31:00 +01:00
Fixed bug in inflate options logic
This commit is contained in:
parent
7701d13f4b
commit
5370c1382d
1 changed files with 10 additions and 2 deletions
|
@ -88,15 +88,23 @@ var Inflate = function(options) {
|
||||||
|
|
||||||
this.options = utils.assign({
|
this.options = utils.assign({
|
||||||
chunkSize: 16384,
|
chunkSize: 16384,
|
||||||
windowBits: 15 + 32 // By default - autodetect deflate/gzip
|
windowBits: 15
|
||||||
}, options || {});
|
}, options || {});
|
||||||
|
|
||||||
var opt = this.options;
|
var opt = this.options;
|
||||||
|
|
||||||
if (opt.raw && (opt.windowBits > 0)) {
|
// check `raw` if `windowBits` NOT defined directly,
|
||||||
|
// or we will get bug because of autodetect
|
||||||
|
if (opt.raw && (opt.windowBits > 0) && (opt.windowBits < 16)) {
|
||||||
opt.windowBits = -opt.windowBits;
|
opt.windowBits = -opt.windowBits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate
|
||||||
|
if ((opt.windowBits > 0) && (opt.windowBits < 16) &&
|
||||||
|
!(options && options.windowBits)) {
|
||||||
|
opt.windowBits += 32;
|
||||||
|
}
|
||||||
|
|
||||||
this.err = 0; // error code, if happens (0 = Z_OK)
|
this.err = 0; // error code, if happens (0 = Z_OK)
|
||||||
this.msg = ''; // error message
|
this.msg = ''; // error message
|
||||||
this.ended = false; // used to avoid multiple onEnd() calls
|
this.ended = false; // used to avoid multiple onEnd() calls
|
||||||
|
|
Loading…
Add table
Reference in a new issue