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 uid_t/gid_t casts #44914

Merged
merged 1 commit into from Oct 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/node_credentials.cc
Expand Up @@ -215,7 +215,8 @@ static const char* name_by_gid(gid_t gid) {

static uid_t uid_by_name(Isolate* isolate, Local<Value> value) {
if (value->IsUint32()) {
return static_cast<uid_t>(value.As<Uint32>()->Value());
static_assert(std::is_same<uid_t, uint32_t>::value);
return value.As<Uint32>()->Value();
} else {
Utf8Value name(isolate, value);
return uid_by_name(*name);
Expand All @@ -224,7 +225,8 @@ static uid_t uid_by_name(Isolate* isolate, Local<Value> value) {

static gid_t gid_by_name(Isolate* isolate, Local<Value> value) {
if (value->IsUint32()) {
return static_cast<gid_t>(value.As<Uint32>()->Value());
static_assert(std::is_same<gid_t, uint32_t>::value);
return value.As<Uint32>()->Value();
} else {
Utf8Value name(isolate, value);
return gid_by_name(*name);
Expand Down