| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 8582f99 commit cde3755
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,7 +16,6 @@ using v8::Int32; | |||
| 16 | 16 | using v8::Just; | |
| 17 | 17 | using v8::Local; | |
| 18 | 18 | using v8::Maybe; | |
| 19 | - using v8::Nothing; | ||
| 20 | 19 | using v8::Object; | |
| 21 | 20 | using v8::Uint32; | |
| 22 | 21 | using v8::Value; | |
@@ -63,15 +62,11 @@ Maybe<bool> SecretKeyGenTraits::AdditionalConfig( | |||
| 63 | 62 | const FunctionCallbackInfo<Value>& args, | |
| 64 | 63 | unsigned int* offset, | |
| 65 | 64 | SecretKeyGenConfig* params) { | |
| 66 | - Environment* env = Environment::GetCurrent(args); | ||
| 67 | 65 | CHECK(args[*offset]->IsUint32()); | |
| 68 | - params->length = args[*offset].As<Uint32>()->Value() / CHAR_BIT; | ||
| 69 | - if (params->length > INT_MAX) { | ||
| 70 | - THROW_ERR_OUT_OF_RANGE(env, | ||
| 71 | - "length must be less than or equal to %u bits", | ||
| 72 | - static_cast<uint64_t>(INT_MAX) * CHAR_BIT); | ||
| 73 | - return Nothing<bool>(); | ||
| 74 | - } | ||
| 66 | + uint32_t bits = args[*offset].As<Uint32>()->Value(); | ||
| 67 | + static_assert(std::numeric_limits<decltype(bits)>::max() / CHAR_BIT <= | ||
| 68 | + INT_MAX); | ||
| 69 | + params->length = bits / CHAR_BIT; | ||
| 75 | 70 | *offset += 1; | |
| 76 | 71 | return Just(true); | |
| 77 | 72 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments