Skip to content

Commit 46474c2

Browse files
Start updating to 5.9.1
1 parent 49bcb75 commit 46474c2

28 files changed

+888
-638
lines changed

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
language: node_js
22
node_js:
3-
- "0.10"
3+
- "0.10"
4+
- 4.0
5+
- 5.0

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
"test": "test"
99
},
1010
"dependencies": {
11-
"pako": "~0.2.0"
11+
"pako": "~1.0.0"
1212
},
1313
"devDependencies": {
14-
"tape": "^2.12.3",
14+
"tape": "^4.5.1",
1515
"brfs": "^1.0.1"
1616
},
1717
"testling": {

src/binding.js

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ exports.UNZIP = 7;
2424
function Zlib(mode) {
2525
if (mode < exports.DEFLATE || mode > exports.UNZIP)
2626
throw new TypeError("Bad argument");
27-
27+
2828
this.mode = mode;
2929
this.init_done = false;
3030
this.write_in_progress = false;
@@ -42,18 +42,18 @@ Zlib.prototype.init = function(windowBits, level, memLevel, strategy, dictionary
4242
this.memLevel = memLevel;
4343
this.strategy = strategy;
4444
// dictionary not supported.
45-
45+
4646
if (this.mode === exports.GZIP || this.mode === exports.GUNZIP)
4747
this.windowBits += 16;
48-
48+
4949
if (this.mode === exports.UNZIP)
5050
this.windowBits += 32;
51-
51+
5252
if (this.mode === exports.DEFLATERAW || this.mode === exports.INFLATERAW)
5353
this.windowBits = -this.windowBits;
54-
54+
5555
this.strm = new zstream();
56-
56+
5757
switch (this.mode) {
5858
case exports.DEFLATE:
5959
case exports.GZIP:
@@ -79,12 +79,12 @@ Zlib.prototype.init = function(windowBits, level, memLevel, strategy, dictionary
7979
default:
8080
throw new Error("Unknown mode " + this.mode);
8181
}
82-
82+
8383
if (status !== exports.Z_OK) {
8484
this._error(status);
8585
return;
8686
}
87-
87+
8888
this.write_in_progress = false;
8989
this.init_done = true;
9090
};
@@ -96,31 +96,31 @@ Zlib.prototype.params = function() {
9696
Zlib.prototype._writeCheck = function() {
9797
if (!this.init_done)
9898
throw new Error("write before init");
99-
99+
100100
if (this.mode === exports.NONE)
101101
throw new Error("already finalized");
102-
102+
103103
if (this.write_in_progress)
104104
throw new Error("write already in progress");
105-
105+
106106
if (this.pending_close)
107107
throw new Error("close is pending");
108108
};
109109

110-
Zlib.prototype.write = function(flush, input, in_off, in_len, out, out_off, out_len) {
110+
Zlib.prototype.write = function(flush, input, in_off, in_len, out, out_off, out_len) {
111111
this._writeCheck();
112112
this.write_in_progress = true;
113-
113+
114114
var self = this;
115115
process.nextTick(function() {
116116
self.write_in_progress = false;
117117
var res = self._write(flush, input, in_off, in_len, out, out_off, out_len);
118118
self.callback(res[0], res[1]);
119-
119+
120120
if (self.pending_close)
121121
self.close();
122122
});
123-
123+
124124
return this;
125125
};
126126

@@ -138,7 +138,7 @@ Zlib.prototype.writeSync = function(flush, input, in_off, in_len, out, out_off,
138138

139139
Zlib.prototype._write = function(flush, input, in_off, in_len, out, out_off, out_len) {
140140
this.write_in_progress = true;
141-
141+
142142
if (flush !== exports.Z_NO_FLUSH &&
143143
flush !== exports.Z_PARTIAL_FLUSH &&
144144
flush !== exports.Z_SYNC_FLUSH &&
@@ -147,26 +147,26 @@ Zlib.prototype._write = function(flush, input, in_off, in_len, out, out_off, out
147147
flush !== exports.Z_BLOCK) {
148148
throw new Error("Invalid flush value");
149149
}
150-
150+
151151
if (input == null) {
152152
input = new Buffer(0);
153153
in_len = 0;
154154
in_off = 0;
155155
}
156-
156+
157157
if (out._set)
158158
out.set = out._set;
159159
else
160160
out.set = bufferSet;
161-
161+
162162
var strm = this.strm;
163163
strm.avail_in = in_len;
164164
strm.input = input;
165165
strm.next_in = in_off;
166166
strm.avail_out = out_len;
167167
strm.output = out;
168168
strm.next_out = out_off;
169-
169+
170170
switch (this.mode) {
171171
case exports.DEFLATE:
172172
case exports.GZIP:
@@ -182,11 +182,11 @@ Zlib.prototype._write = function(flush, input, in_off, in_len, out, out_off, out
182182
default:
183183
throw new Error("Unknown mode " + this.mode);
184184
}
185-
185+
186186
if (status !== exports.Z_STREAM_END && status !== exports.Z_OK) {
187187
this._error(status);
188188
}
189-
189+
190190
this.write_in_progress = false;
191191
return [strm.avail_in, strm.avail_out];
192192
};
@@ -196,15 +196,15 @@ Zlib.prototype.close = function() {
196196
this.pending_close = true;
197197
return;
198198
}
199-
199+
200200
this.pending_close = false;
201-
201+
202202
if (this.mode === exports.DEFLATE || this.mode === exports.GZIP || this.mode === exports.DEFLATERAW) {
203203
zlib_deflate.deflateEnd(this.strm);
204204
} else {
205205
zlib_inflate.inflateEnd(this.strm);
206206
}
207-
207+
208208
this.mode = exports.NONE;
209209
};
210210

@@ -219,15 +219,15 @@ Zlib.prototype.reset = function() {
219219
var status = zlib_inflate.inflateReset(this.strm);
220220
break;
221221
}
222-
222+
223223
if (status !== exports.Z_OK) {
224224
this._error(status);
225225
}
226226
};
227227

228228
Zlib.prototype._error = function(status) {
229229
this.onerror(msg[status] + ': ' + this.strm.msg, status);
230-
230+
231231
this.write_in_progress = false;
232232
if (this.pending_close)
233233
this.close();

0 commit comments

Comments
 (0)