From 594a84d8f2cb3c630744487d02dbcff05675d6cf Mon Sep 17 00:00:00 2001 From: Michaƫl Zasso Date: Sun, 2 Sep 2018 17:49:11 +0200 Subject: 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 Reviewed-By: Minwoo Jung Reviewed-By: James M Snell Reviewed-By: Ujjwal Sharma --- src/node_zlib.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/node_zlib.cc') 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& args) { Environment* env = Environment::GetCurrent(args); CHECK(args[0]->IsInt32()); - node_zlib_mode mode = static_cast(args[0]->Int32Value()); + node_zlib_mode mode = + static_cast(args[0].As()->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 &args) { -- cgit v1.2.3