summaryrefslogtreecommitdiff
path: root/src/node_zlib.cc
diff options
context:
space:
mode:
authorMichaƫl Zasso <targos@protonmail.com>2018-09-02 17:49:11 +0200
committerDaniel Bevenius <daniel.bevenius@gmail.com>2018-09-05 12:59:25 +0200
commit594a84d8f2cb3c630744487d02dbcff05675d6cf (patch)
treeae066c7a853f3a42ee0febc3d9027c2cdc9bc013 /src/node_zlib.cc
parentd6a43438d6ed3f262cc87fe2ebd0c46a87c1ff57 (diff)
downloadandroid-node-v8-594a84d8f2cb3c630744487d02dbcff05675d6cf.tar.gz
android-node-v8-594a84d8f2cb3c630744487d02dbcff05675d6cf.tar.bz2
android-node-v8-594a84d8f2cb3c630744487d02dbcff05675d6cf.zip
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.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/node_zlib.cc b/src/node_zlib.cc
index 482375cd61..cd15603f0b 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) {