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: prefer false instead of bool zero #20218

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
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
14 changes: 7 additions & 7 deletions src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5170,7 +5170,7 @@ void GetCurves(const FunctionCallbackInfo<Value>& args) {


bool VerifySpkac(const char* data, unsigned int len) {
bool i = 0;
bool verify_result = false;
EVP_PKEY* pkey = nullptr;
NETSCAPE_SPKI* spki = nullptr;

Expand All @@ -5182,7 +5182,7 @@ bool VerifySpkac(const char* data, unsigned int len) {
if (pkey == nullptr)
goto exit;

i = NETSCAPE_SPKI_verify(spki, pkey) > 0;
verify_result = NETSCAPE_SPKI_verify(spki, pkey) > 0;

exit:
if (pkey != nullptr)
Expand All @@ -5191,23 +5191,23 @@ bool VerifySpkac(const char* data, unsigned int len) {
if (spki != nullptr)
NETSCAPE_SPKI_free(spki);

return i;
return verify_result;
}


void VerifySpkac(const FunctionCallbackInfo<Value>& args) {
bool i = false;
bool verify_result = false;

size_t length = Buffer::Length(args[0]);
if (length == 0)
return args.GetReturnValue().Set(i);
return args.GetReturnValue().Set(verify_result);

char* data = Buffer::Data(args[0]);
CHECK_NE(data, nullptr);

i = VerifySpkac(data, length);
verify_result = VerifySpkac(data, length);

args.GetReturnValue().Set(i);
args.GetReturnValue().Set(verify_result);
}


Expand Down