diff options
author | Brian White <mscdex@mscdex.net> | 2013-07-01 05:42:19 -0400 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2013-07-01 19:37:29 +0200 |
commit | 95dcd11dde4fff1ad69b5b5bd9e6c55a9ff1c4a0 (patch) | |
tree | 8c0cab8cbe045e12812fa296f24bddf03ce8623f /lib/zlib.js | |
parent | 92903850579727d404916ccb39a65ed8beafc7a6 (diff) | |
download | android-node-v8-95dcd11dde4fff1ad69b5b5bd9e6c55a9ff1c4a0.tar.gz android-node-v8-95dcd11dde4fff1ad69b5b5bd9e6c55a9ff1c4a0.tar.bz2 android-node-v8-95dcd11dde4fff1ad69b5b5bd9e6c55a9ff1c4a0.zip |
zlib: allow zero values for level and strategy
This is a back-port of commit c9644fb from the master branch.
Diffstat (limited to 'lib/zlib.js')
-rw-r--r-- | lib/zlib.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/zlib.js b/lib/zlib.js index c9263142de..a1896baeb8 100644 --- a/lib/zlib.js +++ b/lib/zlib.js @@ -298,10 +298,16 @@ function Zlib(opts, mode) { self.emit('error', error); }; + var level = exports.Z_DEFAULT_COMPRESSION; + if (typeof opts.level === 'number') level = opts.level; + + var strategy = exports.Z_DEFAULT_STRATEGY; + if (typeof opts.strategy === 'number') strategy = opts.strategy; + this._binding.init(opts.windowBits || exports.Z_DEFAULT_WINDOWBITS, - opts.level || exports.Z_DEFAULT_COMPRESSION, + level, opts.memLevel || exports.Z_DEFAULT_MEMLEVEL, - opts.strategy || exports.Z_DEFAULT_STRATEGY, + strategy, opts.dictionary); this._buffer = new Buffer(this._chunkSize); |