diff options
author | Daniel Bevenius <daniel.bevenius@gmail.com> | 2018-11-08 07:22:13 +0100 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2018-11-14 00:55:45 +0100 |
commit | e1c792919e174ff369d4c82457a1a58ea7c550f7 (patch) | |
tree | 58d72fd3213aab3cf5773025a03614b8f9b587d1 /src/stream_base.cc | |
parent | 70699ee09b645128d70080ed02aba14647519e68 (diff) | |
download | node-new-e1c792919e174ff369d4c82457a1a58ea7c550f7.tar.gz |
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 670b3cbd50..26efa46ba0 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); |