GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: avoid strcmp in ImportJWKAsymmetricKey · nodejs/node@fd0da6c

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src/crypto
    • crypto_keys.cc
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/crypto/crypto_keys.cc‎

Copy file name to clipboardExpand all lines: src/crypto/crypto_keys.cc
+5-4Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -509,16 +509,17 @@ Maybe<void> ExportJWKAsymmetricKey(Environment* env,
509509
std::shared_ptr<KeyObjectData> ImportJWKAsymmetricKey(
510510
Environment* env,
511511
Local<Object> jwk,
512-
const char* kty,
512+
std::string_view kty,
513513
const FunctionCallbackInfo<Value>& args,
514514
unsigned int offset) {
515-
if (strcmp(kty, "RSA") == 0) {
515+
if (kty == "RSA") {
516516
return ImportJWKRsaKey(env, jwk, args, offset);
517-
} else if (strcmp(kty, "EC") == 0) {
517+
} else if (kty == "EC") {
518518
return ImportJWKEcKey(env, jwk, args, offset);
519519
}
520520

521-
THROW_ERR_CRYPTO_INVALID_JWK(env, "%s is not a supported JWK key type", kty);
521+
THROW_ERR_CRYPTO_INVALID_JWK(
522+
env, "%s is not a supported JWK key type", kty.data());
522523
return std::shared_ptr<KeyObjectData>();
523524
}
524525

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.