crypto: naming anonymous functions

Ref: https://github.com/nodejs/node/issues/8913
PR-URL: https://github.com/nodejs/node/pull/8993
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
solebox 2016-10-09 20:00:13 +03:00 committed by Anna Henningsen
parent 113c697ded
commit 6f05de4d89
No known key found for this signature in database
GPG Key ID: D8B9F5AEAE84E4CF

View File

@ -59,24 +59,24 @@ function Hash(algorithm, options) {
util.inherits(Hash, LazyTransform); util.inherits(Hash, LazyTransform);
Hash.prototype._transform = function(chunk, encoding, callback) { Hash.prototype._transform = function _transform(chunk, encoding, callback) {
this._handle.update(chunk, encoding); this._handle.update(chunk, encoding);
callback(); callback();
}; };
Hash.prototype._flush = function(callback) { Hash.prototype._flush = function _flush(callback) {
this.push(this._handle.digest()); this.push(this._handle.digest());
callback(); callback();
}; };
Hash.prototype.update = function(data, encoding) { Hash.prototype.update = function update(data, encoding) {
encoding = encoding || exports.DEFAULT_ENCODING; encoding = encoding || exports.DEFAULT_ENCODING;
this._handle.update(data, encoding); this._handle.update(data, encoding);
return this; return this;
}; };
Hash.prototype.digest = function(outputEncoding) { Hash.prototype.digest = function digest(outputEncoding) {
outputEncoding = outputEncoding || exports.DEFAULT_ENCODING; outputEncoding = outputEncoding || exports.DEFAULT_ENCODING;
return this._handle.digest(outputEncoding); return this._handle.digest(outputEncoding);
}; };
@ -122,12 +122,12 @@ function Cipher(cipher, password, options) {
util.inherits(Cipher, LazyTransform); util.inherits(Cipher, LazyTransform);
Cipher.prototype._transform = function(chunk, encoding, callback) { Cipher.prototype._transform = function _transform(chunk, encoding, callback) {
this.push(this._handle.update(chunk, encoding)); this.push(this._handle.update(chunk, encoding));
callback(); callback();
}; };
Cipher.prototype._flush = function(callback) { Cipher.prototype._flush = function _flush(callback) {
try { try {
this.push(this._handle.final()); this.push(this._handle.final());
} catch (e) { } catch (e) {
@ -137,7 +137,7 @@ Cipher.prototype._flush = function(callback) {
callback(); callback();
}; };
Cipher.prototype.update = function(data, inputEncoding, outputEncoding) { Cipher.prototype.update = function update(data, inputEncoding, outputEncoding) {
inputEncoding = inputEncoding || exports.DEFAULT_ENCODING; inputEncoding = inputEncoding || exports.DEFAULT_ENCODING;
outputEncoding = outputEncoding || exports.DEFAULT_ENCODING; outputEncoding = outputEncoding || exports.DEFAULT_ENCODING;
@ -152,7 +152,7 @@ Cipher.prototype.update = function(data, inputEncoding, outputEncoding) {
}; };
Cipher.prototype.final = function(outputEncoding) { Cipher.prototype.final = function final(outputEncoding) {
outputEncoding = outputEncoding || exports.DEFAULT_ENCODING; outputEncoding = outputEncoding || exports.DEFAULT_ENCODING;
var ret = this._handle.final(); var ret = this._handle.final();
@ -165,21 +165,21 @@ Cipher.prototype.final = function(outputEncoding) {
}; };
Cipher.prototype.setAutoPadding = function(ap) { Cipher.prototype.setAutoPadding = function setAutoPadding(ap) {
this._handle.setAutoPadding(ap); this._handle.setAutoPadding(ap);
return this; return this;
}; };
Cipher.prototype.getAuthTag = function() { Cipher.prototype.getAuthTag = function getAuthTag() {
return this._handle.getAuthTag(); return this._handle.getAuthTag();
}; };
Cipher.prototype.setAuthTag = function(tagbuf) { Cipher.prototype.setAuthTag = function setAuthTag(tagbuf) {
this._handle.setAuthTag(tagbuf); this._handle.setAuthTag(tagbuf);
}; };
Cipher.prototype.setAAD = function(aadbuf) { Cipher.prototype.setAAD = function setAAD(aadbuf) {
this._handle.setAAD(aadbuf); this._handle.setAAD(aadbuf);
}; };
@ -267,14 +267,14 @@ function Sign(algorithm, options) {
util.inherits(Sign, stream.Writable); util.inherits(Sign, stream.Writable);
Sign.prototype._write = function(chunk, encoding, callback) { Sign.prototype._write = function _write(chunk, encoding, callback) {
this._handle.update(chunk, encoding); this._handle.update(chunk, encoding);
callback(); callback();
}; };
Sign.prototype.update = Hash.prototype.update; Sign.prototype.update = Hash.prototype.update;
Sign.prototype.sign = function(options, encoding) { Sign.prototype.sign = function sign(options, encoding) {
if (!options) if (!options)
throw new Error('No key provided to sign'); throw new Error('No key provided to sign');
@ -306,7 +306,7 @@ util.inherits(Verify, stream.Writable);
Verify.prototype._write = Sign.prototype._write; Verify.prototype._write = Sign.prototype._write;
Verify.prototype.update = Sign.prototype.update; Verify.prototype.update = Sign.prototype.update;
Verify.prototype.verify = function(object, signature, sigEncoding) { Verify.prototype.verify = function verify(object, signature, sigEncoding) {
sigEncoding = sigEncoding || exports.DEFAULT_ENCODING; sigEncoding = sigEncoding || exports.DEFAULT_ENCODING;
return this._handle.verify(toBuf(object), toBuf(signature, sigEncoding)); return this._handle.verify(toBuf(object), toBuf(signature, sigEncoding));
}; };
@ -474,14 +474,14 @@ function dhGetPrivateKey(encoding) {
} }
DiffieHellman.prototype.setPublicKey = function(key, encoding) { DiffieHellman.prototype.setPublicKey = function setPublicKey(key, encoding) {
encoding = encoding || exports.DEFAULT_ENCODING; encoding = encoding || exports.DEFAULT_ENCODING;
this._handle.setPublicKey(toBuf(key, encoding)); this._handle.setPublicKey(toBuf(key, encoding));
return this; return this;
}; };
DiffieHellman.prototype.setPrivateKey = function(key, encoding) { DiffieHellman.prototype.setPrivateKey = function setPrivateKey(key, encoding) {
encoding = encoding || exports.DEFAULT_ENCODING; encoding = encoding || exports.DEFAULT_ENCODING;
this._handle.setPrivateKey(toBuf(key, encoding)); this._handle.setPrivateKey(toBuf(key, encoding));
return this; return this;
@ -599,19 +599,21 @@ function Certificate() {
} }
Certificate.prototype.verifySpkac = function(object) { Certificate.prototype.verifySpkac = function verifySpkac(object) {
return binding.certVerifySpkac(object); return binding.certVerifySpkac(object);
}; };
Certificate.prototype.exportPublicKey = function(object, encoding) { Certificate.prototype.exportPublicKey =
return binding.certExportPublicKey(toBuf(object, encoding)); function exportPublicKey(object, encoding) {
}; return binding.certExportPublicKey(toBuf(object, encoding));
};
Certificate.prototype.exportChallenge = function(object, encoding) { Certificate.prototype.exportChallenge =
return binding.certExportChallenge(toBuf(object, encoding)); function exportChallenge(object, encoding) {
}; return binding.certExportChallenge(toBuf(object, encoding));
};
exports.setEngine = function setEngine(id, flags) { exports.setEngine = function setEngine(id, flags) {