From cd68d86c3283af2f4b3c349c2081c609e3978b9b Mon Sep 17 00:00:00 2001 From: isaacs Date: Sun, 3 Mar 2013 19:05:44 -0800 Subject: stream: Remove output function from _transform Just use stream.push(outputChunk) instead. --- lib/zlib.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'lib/zlib.js') diff --git a/lib/zlib.js b/lib/zlib.js index 409286bc1..d3aa858fb 100644 --- a/lib/zlib.js +++ b/lib/zlib.js @@ -308,8 +308,8 @@ Zlib.prototype.reset = function reset() { return this._binding.reset(); }; -Zlib.prototype._flush = function(output, callback) { - this._transform(null, output, callback); +Zlib.prototype._flush = function(callback) { + this._transform(null, callback); }; Zlib.prototype.flush = function(callback) { @@ -320,12 +320,10 @@ Zlib.prototype.flush = function(callback) { ws.needDrain = true; var self = this; this.once('drain', function() { - self._flush(ts.output, callback); + self._flush(callback); }); - return; - } - - this._flush(ts.output, callback || function() {}); + } else + this._flush(callback || function() {}); }; Zlib.prototype.close = function(callback) { @@ -345,7 +343,7 @@ Zlib.prototype.close = function(callback) { }); }; -Zlib.prototype._transform = function(chunk, output, cb) { +Zlib.prototype._transform = function(chunk, cb) { var flushFlag; var ws = this._writableState; var ending = ws.ending || ws.ended; @@ -392,7 +390,7 @@ Zlib.prototype._transform = function(chunk, output, cb) { var out = self._buffer.slice(self._offset, self._offset + have); self._offset += have; // serve some output to the consumer. - output(out); + self.push(out); } // exhausted the output buffer, or used all the input create a new one. -- cgit v1.2.1