| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 312e10c commit 8307a4b
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; | |
@@ -62,15 +61,11 @@ Maybe<bool> SecretKeyGenTraits::AdditionalConfig( | |||
| 62 | 61 | const FunctionCallbackInfo<Value>& args, | |
| 63 | 62 | unsigned int* offset, | |
| 64 | 63 | SecretKeyGenConfig* params) { | |
| 65 | - Environment* env = Environment::GetCurrent(args); | ||
| 66 | 64 | CHECK(args[*offset]->IsUint32()); | |
| 67 | - params->length = args[*offset].As<Uint32>()->Value() / CHAR_BIT; | ||
| 68 | - if (params->length > INT_MAX) { | ||
| 69 | - THROW_ERR_OUT_OF_RANGE(env, | ||
| 70 | - "length must be less than or equal to %u bits", | ||
| 71 | - static_cast<uint64_t>(INT_MAX) * CHAR_BIT); | ||
| 72 | - return Nothing<bool>(); | ||
| 73 | - } | ||
| 65 | + uint32_t bits = args[*offset].As<Uint32>()->Value(); | ||
| 66 | + static_assert(std::numeric_limits<decltype(bits)>::max() / CHAR_BIT <= | ||
| 67 | + INT_MAX); | ||
| 68 | + params->length = bits / CHAR_BIT; | ||
| 74 | 69 | *offset += 1; | |
| 75 | 70 | return Just(true); | |
| 76 | 71 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments