diff options
author | Michaƫl Zasso <targos@protonmail.com> | 2018-09-02 18:49:11 +0300 |
---|---|---|
committer | Daniel Bevenius <daniel.bevenius@gmail.com> | 2018-09-05 13:59:25 +0300 |
commit | 594a84d8f2cb3c630744487d02dbcff05675d6cf (patch) | |
tree | ae066c7a853f3a42ee0febc3d9027c2cdc9bc013 /src/node_zlib.cc | |
parent | d6a43438d6ed3f262cc87fe2ebd0c46a87c1ff57 (diff) |
src: remove calls to deprecated V8 functions (Int32Value)
Remove all calls to deprecated V8 functions (here: Value::Int32Value)
inside the code.
PR-URL: https://github.com/nodejs/node/pull/22662
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Diffstat (limited to 'src/node_zlib.cc')
-rw-r--r-- | src/node_zlib.cc | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/node_zlib.cc b/src/node_zlib.cc index 482375cd616..cd15603f0b0 100644 --- a/src/node_zlib.cc +++ b/src/node_zlib.cc @@ -45,6 +45,7 @@ using v8::Function; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; using v8::HandleScope; +using v8::Int32; using v8::Local; using v8::Number; using v8::Object; @@ -419,7 +420,8 @@ class ZCtx : public AsyncWrap, public ThreadPoolWork { static void New(const FunctionCallbackInfo<Value>& args) { Environment* env = Environment::GetCurrent(args); CHECK(args[0]->IsInt32()); - node_zlib_mode mode = static_cast<node_zlib_mode>(args[0]->Int32Value()); + node_zlib_mode mode = + static_cast<node_zlib_mode>(args[0].As<Int32>()->Value()); new ZCtx(env, args.This(), mode); } @@ -459,7 +461,8 @@ class ZCtx : public AsyncWrap, public ThreadPoolWork { "invalid windowBits"); } - int level = args[1]->Int32Value(); + int level; + if (!args[1]->Int32Value(context).To(&level)) return; CHECK((level >= Z_MIN_LEVEL && level <= Z_MAX_LEVEL) && "invalid compression level"); @@ -506,7 +509,12 @@ class ZCtx : public AsyncWrap, public ThreadPoolWork { CHECK(args.Length() == 2 && "params(level, strategy)"); ZCtx* ctx; ASSIGN_OR_RETURN_UNWRAP(&ctx, args.Holder()); - ctx->Params(args[0]->Int32Value(), args[1]->Int32Value()); + Environment* env = ctx->env(); + int level; + if (!args[0]->Int32Value(env->context()).To(&level)) return; + int strategy; + if (!args[1]->Int32Value(env->context()).To(&strategy)) return; + ctx->Params(level, strategy); } static void Reset(const FunctionCallbackInfo<Value> &args) { |