Skip to content

Commit 9ca4b46

Browse files
tniessentargos
authored andcommitted
src: use String::WriteV2() in TwoByteValue
Since `String::Write()` is deprecated, use `String::WriteV2()` instead. PR-URL: #58164 Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Daeyeon Jeong <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 7715722 commit 9ca4b46

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/util.cc

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,10 @@ TwoByteValue::TwoByteValue(Isolate* isolate, Local<Value> value) {
146146
Local<String> string;
147147
if (!value->ToString(isolate->GetCurrentContext()).ToLocal(&string)) return;
148148

149-
// Allocate enough space to include the null terminator
150-
const size_t storage = string->Length() + 1;
151-
AllocateSufficientStorage(storage);
152-
153-
const int flags = String::NO_NULL_TERMINATION;
154-
const int length = string->Write(isolate, out(), 0, storage, flags);
149+
// Allocate enough space to include the null terminator.
150+
const size_t length = string->Length();
151+
AllocateSufficientStorage(length + 1);
152+
string->WriteV2(isolate, 0, length, out());
155153
SetLengthAndZeroTerminate(length);
156154
}
157155

0 commit comments

Comments
 (0)