Skip to content

Commit 5e5684b

Browse files
committed
src: refactor deprecated v8::String::NewFromTwoByte call
1 parent 517955a commit 5e5684b

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/node_process.cc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ using v8::HeapStatistics;
5252
using v8::Integer;
5353
using v8::Isolate;
5454
using v8::Local;
55+
using v8::MaybeLocal;
5556
using v8::Name;
57+
using v8::NewStringType;
5658
using v8::Number;
5759
using v8::PropertyCallbackInfo;
5860
using v8::String;
@@ -626,7 +628,8 @@ void EnvGetter(Local<Name> property,
626628
if ((result > 0 || GetLastError() == ERROR_SUCCESS) &&
627629
result < arraysize(buffer)) {
628630
const uint16_t* two_byte_buffer = reinterpret_cast<const uint16_t*>(buffer);
629-
Local<String> rc = String::NewFromTwoByte(isolate, two_byte_buffer);
631+
MaybeLocal<String> rc = String::NewFromTwoByte(
632+
isolate, two_byte_buffer, NewStringType::kNormal);
630633
return info.GetReturnValue().Set(rc);
631634
}
632635
#endif
@@ -768,10 +771,8 @@ void EnvEnumerator(const PropertyCallbackInfo<Array>& info) {
768771
}
769772
const uint16_t* two_byte_buffer = reinterpret_cast<const uint16_t*>(p);
770773
const size_t two_byte_buffer_len = s - p;
771-
argv[idx] = String::NewFromTwoByte(isolate,
772-
two_byte_buffer,
773-
String::kNormalString,
774-
two_byte_buffer_len);
774+
argv[idx] = String::NewFromTwoByte(
775+
isolate, two_byte_buffer, NewStringType::kNormal, two_byte_buffer_len);
775776
if (++idx >= arraysize(argv)) {
776777
fn->Call(ctx, envarr, idx, argv).ToLocalChecked();
777778
idx = 0;

0 commit comments

Comments
 (0)