mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
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:
parent
9aa1afb527
commit
0e68481bf8
5 changed files with 7 additions and 7 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue