diff options
author | Daniel Bevenius <daniel.bevenius@gmail.com> | 2018-11-08 09:22:13 +0300 |
---|---|---|
committer | Daniel Bevenius <daniel.bevenius@gmail.com> | 2018-11-11 10:02:30 +0300 |
commit | 344d33eef110486bc094ba8d97a483379bf62752 (patch) | |
tree | 9d929c9fc5a77665f6a5b13defc2b9e0c8c19af3 /src/stream_base.cc | |
parent | 19e5e78e9c65605eba43b8c506a8069f6f6d5ff9 (diff) |
src: fix v8 compiler warnings in src
This commit changes the code to use the maybe version.
PR-URL: https://github.com/nodejs/node/pull/24246
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Diffstat (limited to 'src/stream_base.cc')
-rw-r--r-- | src/stream_base.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/stream_base.cc b/src/stream_base.cc index 670b3cbd509..26efa46ba02 100644 --- a/src/stream_base.cc +++ b/src/stream_base.cc @@ -83,7 +83,7 @@ int StreamBase::Writev(const FunctionCallbackInfo<Value>& args) { if (!all_buffers) { // Determine storage size first for (size_t i = 0; i < count; i++) { - Local<Value> chunk = chunks->Get(i * 2); + Local<Value> chunk = chunks->Get(env->context(), i * 2).ToLocalChecked(); if (Buffer::HasInstance(chunk)) continue; @@ -92,7 +92,7 @@ int StreamBase::Writev(const FunctionCallbackInfo<Value>& args) { // String chunk Local<String> string = chunk->ToString(env->context()).ToLocalChecked(); enum encoding encoding = ParseEncoding(env->isolate(), - chunks->Get(i * 2 + 1)); + chunks->Get(env->context(), i * 2 + 1).ToLocalChecked()); size_t chunk_size; if (encoding == UTF8 && string->Length() > 65535 && !StringBytes::Size(env->isolate(), string, encoding).To(&chunk_size)) @@ -107,7 +107,7 @@ int StreamBase::Writev(const FunctionCallbackInfo<Value>& args) { return UV_ENOBUFS; } else { for (size_t i = 0; i < count; i++) { - Local<Value> chunk = chunks->Get(i); + Local<Value> chunk = chunks->Get(env->context(), i).ToLocalChecked(); bufs[i].base = Buffer::Data(chunk); bufs[i].len = Buffer::Length(chunk); } @@ -120,7 +120,7 @@ int StreamBase::Writev(const FunctionCallbackInfo<Value>& args) { offset = 0; if (!all_buffers) { for (size_t i = 0; i < count; i++) { - Local<Value> chunk = chunks->Get(i * 2); + Local<Value> chunk = chunks->Get(env->context(), i * 2).ToLocalChecked(); // Write buffer if (Buffer::HasInstance(chunk)) { @@ -136,7 +136,7 @@ int StreamBase::Writev(const FunctionCallbackInfo<Value>& args) { Local<String> string = chunk->ToString(env->context()).ToLocalChecked(); enum encoding encoding = ParseEncoding(env->isolate(), - chunks->Get(i * 2 + 1)); + chunks->Get(env->context(), i * 2 + 1).ToLocalChecked()); str_size = StringBytes::Write(env->isolate(), str_storage, str_size, @@ -270,7 +270,9 @@ int StreamBase::WriteString(const FunctionCallbackInfo<Value>& args) { send_handle = reinterpret_cast<uv_stream_t*>(wrap->GetHandle()); // Reference LibuvStreamWrap instance to prevent it from being garbage // collected before `AfterWrite` is called. - req_wrap_obj->Set(env->handle_string(), send_handle_obj); + req_wrap_obj->Set(env->context(), + env->handle_string(), + send_handle_obj).FromJust(); } StreamWriteResult res = Write(&buf, 1, send_handle, req_wrap_obj); |