src: use non-deprecated Utf8LengthV2() method

PR-URL: https://github.com/nodejs/node/pull/58070
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
This commit is contained in:
Yagiz Nizipli 2025-04-17 10:57:40 -04:00 committed by Michaël Zasso
parent 9aa1afb527
commit 0e68481bf8
No known key found for this signature in database
GPG key ID: 770F7A9A5AE15600
5 changed files with 7 additions and 7 deletions

View file

@ -21,7 +21,7 @@ void CallWithString(const FunctionCallbackInfo<Value>& args) {
assert(args.Length() == 1 && args[0]->IsString());
if (args.Length() == 1 && args[0]->IsString()) {
Local<String> str = args[0].As<String>();
const int32_t length = str->Utf8Length(args.GetIsolate()) + 1;
const size_t length = str->Utf8LengthV2(args.GetIsolate()) + 1;
char* buf = new char[length];
str->WriteUtf8(args.GetIsolate(), buf, length);
delete[] buf;