Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: remove calls to deprecated v8 functions (NewFromUtf8) #21926

Closed
wants to merge 13 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/cares_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1926,7 +1926,9 @@ void CanonicalizeIP(const FunctionCallbackInfo<Value>& args) {
char canonical_ip[INET6_ADDRSTRLEN];
const int af = (rc == 4 ? AF_INET : AF_INET6);
CHECK_EQ(0, uv_inet_ntop(af, &result, canonical_ip, sizeof(canonical_ip)));
args.GetReturnValue().Set(String::NewFromUtf8(isolate, canonical_ip));
v8::NewStringType type = v8::NewStringType::kNormal;
v8::MaybeLocal<String> val = String::NewFromUtf8(isolate, canonical_ip, type);
args.GetReturnValue().Set(val.ToLocalChecked());
}

void GetAddrInfo(const FunctionCallbackInfo<Value>& args) {
Expand Down
6 changes: 4 additions & 2 deletions src/exceptions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ Local<Value> ErrnoException(Isolate* isolate,
Local<String> path_string;
if (path != nullptr) {
// FIXME(bnoordhuis) It's questionable to interpret the file path as UTF-8.
path_string = String::NewFromUtf8(env->isolate(), path);
path_string = String::NewFromUtf8(
env->isolate(), path, v8::NewStringType::kNormal).ToLocalChecked();
}

if (path_string.IsEmpty() == false) {
Expand Down Expand Up @@ -67,14 +68,15 @@ Local<Value> ErrnoException(Isolate* isolate,
static Local<String> StringFromPath(Isolate* isolate, const char* path) {
#ifdef _WIN32
if (strncmp(path, "\\\\?\\UNC\\", 8) == 0) {
v8::NewStringType type = v8::NewStringType::kNormal;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn’t look like this is in the right place. There are two more instances of NewFromUtf8 below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooh, this one was unfinished. Thanks, will change this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is unused now? Either way, I think it makes sense to keep these inline in the code (i.e. not create separate variables)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, will make appropriate changes.

return String::Concat(FIXED_ONE_BYTE_STRING(isolate, "\\\\"),
String::NewFromUtf8(isolate, path + 8));
} else if (strncmp(path, "\\\\?\\", 4) == 0) {
return String::NewFromUtf8(isolate, path + 4);
}
#endif

return String::NewFromUtf8(isolate, path);
return String::NewFromUtf8(isolate, path, v8::NewStringType::kNormal).ToLocalChecked();
}


Expand Down