From c77c43d47a8ac54d16aef8e72d981bdc7baeeb74 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Mon, 23 Apr 2018 09:14:32 +0200 Subject: [PATCH 1/2] src: prefer false instead of bool zero This commit updates node_crypto.cc VerifySpkac function to use false instead of 0 for its return bool value i. --- src/node_crypto.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 255dc6e2d42e64..ddf895ea3e304d 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -5170,7 +5170,7 @@ void GetCurves(const FunctionCallbackInfo& args) { bool VerifySpkac(const char* data, unsigned int len) { - bool i = 0; + bool i = false; EVP_PKEY* pkey = nullptr; NETSCAPE_SPKI* spki = nullptr; From 7274a5a193391f87009ba7f8bc4e61c9d7debe32 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Mon, 23 Apr 2018 11:16:45 +0200 Subject: [PATCH 2/2] src: rename return var in VerifySpkac functions This commit renames the verification result variable, that is currently named i, to verify_result. --- src/node_crypto.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index ddf895ea3e304d..9af6263b2561f3 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -5170,7 +5170,7 @@ void GetCurves(const FunctionCallbackInfo& args) { bool VerifySpkac(const char* data, unsigned int len) { - bool i = false; + bool verify_result = false; EVP_PKEY* pkey = nullptr; NETSCAPE_SPKI* spki = nullptr; @@ -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) @@ -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& 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); }