Skip to content

Commit

Permalink
src: refactor deprecated v8::String::NewFromTwoByte call
Browse files Browse the repository at this point in the history
  • Loading branch information
RomainLanz committed Oct 21, 2018
1 parent 517955a commit 5e5684b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/node_process.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ using v8::HeapStatistics;
using v8::Integer;
using v8::Isolate;
using v8::Local;
using v8::MaybeLocal;
using v8::Name;
using v8::NewStringType;
using v8::Number;
using v8::PropertyCallbackInfo;
using v8::String;
Expand Down Expand Up @@ -626,7 +628,8 @@ void EnvGetter(Local<Name> property,
if ((result > 0 || GetLastError() == ERROR_SUCCESS) &&
result < arraysize(buffer)) {
const uint16_t* two_byte_buffer = reinterpret_cast<const uint16_t*>(buffer);
Local<String> rc = String::NewFromTwoByte(isolate, two_byte_buffer);
MaybeLocal<String> rc = String::NewFromTwoByte(
isolate, two_byte_buffer, NewStringType::kNormal);
return info.GetReturnValue().Set(rc);
}
#endif
Expand Down Expand Up @@ -768,10 +771,8 @@ void EnvEnumerator(const PropertyCallbackInfo<Array>& info) {
}
const uint16_t* two_byte_buffer = reinterpret_cast<const uint16_t*>(p);
const size_t two_byte_buffer_len = s - p;
argv[idx] = String::NewFromTwoByte(isolate,
two_byte_buffer,
String::kNormalString,
two_byte_buffer_len);
argv[idx] = String::NewFromTwoByte(
isolate, two_byte_buffer, NewStringType::kNormal, two_byte_buffer_len);
if (++idx >= arraysize(argv)) {
fn->Call(ctx, envarr, idx, argv).ToLocalChecked();
idx = 0;
Expand Down

0 comments on commit 5e5684b

Please sign in to comment.