src: remove calls to deprecated v8 functions (BooleanValue)
Remove all calls to deprecated v8 functions (here: Value::BooleanValue) inside the code (src directory only). PR-URL: https://github.com/nodejs/node/pull/22075 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
c8880ea276
commit
59e5a39d30
@ -182,7 +182,7 @@ Cipher.prototype.final = function final(outputEncoding) {
|
|||||||
|
|
||||||
|
|
||||||
Cipher.prototype.setAutoPadding = function setAutoPadding(ap) {
|
Cipher.prototype.setAutoPadding = function setAutoPadding(ap) {
|
||||||
if (!this._handle.setAutoPadding(ap))
|
if (!this._handle.setAutoPadding(!!ap))
|
||||||
throw new ERR_CRYPTO_INVALID_STATE('setAutoPadding');
|
throw new ERR_CRYPTO_INVALID_STATE('setAutoPadding');
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
@ -36,9 +36,11 @@ if (process.binding('config').hasIntl) {
|
|||||||
options = options || {};
|
options = options || {};
|
||||||
if (!Number.isInteger(str))
|
if (!Number.isInteger(str))
|
||||||
str = stripVTControlCharacters(String(str));
|
str = stripVTControlCharacters(String(str));
|
||||||
return icu.getStringWidth(str,
|
return icu.getStringWidth(
|
||||||
|
str,
|
||||||
Boolean(options.ambiguousAsFullWidth),
|
Boolean(options.ambiguousAsFullWidth),
|
||||||
Boolean(options.expandEmojiSequence));
|
Boolean(options.expandEmojiSequence)
|
||||||
|
);
|
||||||
};
|
};
|
||||||
isFullWidthCodePoint =
|
isFullWidthCodePoint =
|
||||||
function isFullWidthCodePoint(code, options) {
|
function isFullWidthCodePoint(code, options) {
|
||||||
|
@ -1724,7 +1724,7 @@ if (process.platform === 'win32') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (handle._simultaneousAccepts !== simultaneousAccepts) {
|
if (handle._simultaneousAccepts !== simultaneousAccepts) {
|
||||||
handle.setSimultaneousAccepts(simultaneousAccepts);
|
handle.setSimultaneousAccepts(!!simultaneousAccepts);
|
||||||
handle._simultaneousAccepts = simultaneousAccepts;
|
handle._simultaneousAccepts = simultaneousAccepts;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -3093,7 +3093,7 @@ void CipherBase::SetAutoPadding(const FunctionCallbackInfo<Value>& args) {
|
|||||||
CipherBase* cipher;
|
CipherBase* cipher;
|
||||||
ASSIGN_OR_RETURN_UNWRAP(&cipher, args.Holder());
|
ASSIGN_OR_RETURN_UNWRAP(&cipher, args.Holder());
|
||||||
|
|
||||||
bool b = cipher->SetAutoPadding(args.Length() < 1 || args[0]->BooleanValue());
|
bool b = cipher->SetAutoPadding(args.Length() < 1 || args[0]->IsTrue());
|
||||||
args.GetReturnValue().Set(b); // Possibly report invalid state failure
|
args.GetReturnValue().Set(b); // Possibly report invalid state failure
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5187,7 +5187,8 @@ void SetFipsCrypto(const FunctionCallbackInfo<Value>& args) {
|
|||||||
CHECK(!force_fips_crypto);
|
CHECK(!force_fips_crypto);
|
||||||
Environment* env = Environment::GetCurrent(args);
|
Environment* env = Environment::GetCurrent(args);
|
||||||
const bool enabled = FIPS_mode();
|
const bool enabled = FIPS_mode();
|
||||||
const bool enable = args[0]->BooleanValue();
|
bool enable;
|
||||||
|
if (!args[0]->BooleanValue(env->context()).To(&enable)) return;
|
||||||
if (enable == enabled)
|
if (enable == enabled)
|
||||||
return; // No action needed.
|
return; // No action needed.
|
||||||
if (!FIPS_mode_set(enable)) {
|
if (!FIPS_mode_set(enable)) {
|
||||||
|
@ -1460,7 +1460,7 @@ static void ReadDir(const FunctionCallbackInfo<Value>& args) {
|
|||||||
|
|
||||||
const enum encoding encoding = ParseEncoding(env->isolate(), args[1], UTF8);
|
const enum encoding encoding = ParseEncoding(env->isolate(), args[1], UTF8);
|
||||||
|
|
||||||
bool with_types = args[2]->BooleanValue();
|
bool with_types = args[2]->IsTrue();
|
||||||
|
|
||||||
FSReqBase* req_wrap_async = GetReqWrap(env, args[3]);
|
FSReqBase* req_wrap_async = GetReqWrap(env, args[3]);
|
||||||
if (req_wrap_async != nullptr) { // readdir(path, encoding, withTypes, req)
|
if (req_wrap_async != nullptr) { // readdir(path, encoding, withTypes, req)
|
||||||
|
@ -815,8 +815,8 @@ static void GetStringWidth(const FunctionCallbackInfo<Value>& args) {
|
|||||||
if (args.Length() < 1)
|
if (args.Length() < 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool ambiguous_as_full_width = args[1]->BooleanValue();
|
bool ambiguous_as_full_width = args[1]->IsTrue();
|
||||||
bool expand_emoji_sequence = args[2]->BooleanValue();
|
bool expand_emoji_sequence = args[2]->IsTrue();
|
||||||
|
|
||||||
if (args[0]->IsNumber()) {
|
if (args[0]->IsNumber()) {
|
||||||
args.GetReturnValue().Set(
|
args.GetReturnValue().Set(
|
||||||
|
@ -168,7 +168,7 @@ void TCPWrap::SetNoDelay(const FunctionCallbackInfo<Value>& args) {
|
|||||||
ASSIGN_OR_RETURN_UNWRAP(&wrap,
|
ASSIGN_OR_RETURN_UNWRAP(&wrap,
|
||||||
args.Holder(),
|
args.Holder(),
|
||||||
args.GetReturnValue().Set(UV_EBADF));
|
args.GetReturnValue().Set(UV_EBADF));
|
||||||
int enable = static_cast<int>(args[0]->BooleanValue());
|
int enable = static_cast<int>(args[0]->IsTrue());
|
||||||
int err = uv_tcp_nodelay(&wrap->handle_, enable);
|
int err = uv_tcp_nodelay(&wrap->handle_, enable);
|
||||||
args.GetReturnValue().Set(err);
|
args.GetReturnValue().Set(err);
|
||||||
}
|
}
|
||||||
@ -192,7 +192,7 @@ void TCPWrap::SetSimultaneousAccepts(const FunctionCallbackInfo<Value>& args) {
|
|||||||
ASSIGN_OR_RETURN_UNWRAP(&wrap,
|
ASSIGN_OR_RETURN_UNWRAP(&wrap,
|
||||||
args.Holder(),
|
args.Holder(),
|
||||||
args.GetReturnValue().Set(UV_EBADF));
|
args.GetReturnValue().Set(UV_EBADF));
|
||||||
bool enable = args[0]->BooleanValue();
|
bool enable = args[0]->IsTrue();
|
||||||
int err = uv_tcp_simultaneous_accepts(&wrap->handle_, enable);
|
int err = uv_tcp_simultaneous_accepts(&wrap->handle_, enable);
|
||||||
args.GetReturnValue().Set(err);
|
args.GetReturnValue().Set(err);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user