| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent be86ddb commit c637d41
6 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2394,11 +2394,10 @@ void DebugProcess(const FunctionCallbackInfo<Value>& args) { | |||
| 2394 | 2394 | return env->ThrowError("Invalid number of arguments."); | |
| 2395 | 2395 | } | |
| 2396 | 2396 | ||
| 2397 | - pid_t pid; | ||
| 2398 | - int r; | ||
| 2397 | + CHECK(args[0]->IsNumber()); | ||
| 2398 | + pid_t pid = args[0].As<Integer>()->Value(); | ||
| 2399 | + int r = kill(pid, SIGUSR1); | ||
| 2399 | 2400 | ||
| 2400 | - pid = args[0]->IntegerValue(); | ||
| 2401 | - r = kill(pid, SIGUSR1); | ||
| 2402 | 2401 | if (r != 0) { | |
| 2403 | 2402 | return env->ThrowErrnoException(errno, "kill"); | |
| 2404 | 2403 | } | |
@@ -2416,7 +2415,6 @@ static int GetDebugSignalHandlerMappingName(DWORD pid, wchar_t* buf, | |||
| 2416 | 2415 | static void DebugProcess(const FunctionCallbackInfo<Value>& args) { | |
| 2417 | 2416 | Environment* env = Environment::GetCurrent(args); | |
| 2418 | 2417 | Isolate* isolate = args.GetIsolate(); | |
| 2419 | - DWORD pid; | ||
| 2420 | 2418 | HANDLE process = nullptr; | |
| 2421 | 2419 | HANDLE thread = nullptr; | |
| 2422 | 2420 | HANDLE mapping = nullptr; | |
@@ -2428,7 +2426,8 @@ static void DebugProcess(const FunctionCallbackInfo<Value>& args) { | |||
| 2428 | 2426 | goto out; | |
| 2429 | 2427 | } | |
| 2430 | 2428 | ||
| 2431 | - pid = (DWORD) args[0]->IntegerValue(); | ||
| 2429 | + CHECK(args[0]->IsNumber()); | ||
| 2430 | + DWORD pid = args[0].As<Integer>()->Value(); | ||
| 2432 | 2431 | ||
| 2433 | 2432 | process = OpenProcess(PROCESS_CREATE_THREAD | PROCESS_QUERY_INFORMATION | | |
| 2434 | 2433 | PROCESS_VM_OPERATION | PROCESS_VM_WRITE | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -173,7 +173,8 @@ inline MUST_USE_RESULT bool ParseArrayIndex(Local<Value> arg, | |||
| 173 | 173 | return true; | |
| 174 | 174 | } | |
| 175 | 175 | ||
| 176 | - int64_t tmp_i = arg->IntegerValue(); | ||
| 176 | + CHECK(arg->IsNumber()); | ||
| 177 | + int64_t tmp_i = arg.As<Integer>()->Value(); | ||
| 177 | 178 | ||
| 178 | 179 | if (tmp_i < 0) | |
| 179 | 180 | return false; | |
@@ -769,7 +770,7 @@ void IndexOfString(const FunctionCallbackInfo<Value>& args) { | |||
| 769 | 770 | SPREAD_BUFFER_ARG(args[0], ts_obj); | |
| 770 | 771 | ||
| 771 | 772 | Local<String> needle = args[1].As<String>(); | |
| 772 | - int64_t offset_i64 = args[2]->IntegerValue(); | ||
| 773 | + int64_t offset_i64 = args[2].As<Integer>()->Value(); | ||
| 773 | 774 | bool is_forward = args[4]->IsTrue(); | |
| 774 | 775 | ||
| 775 | 776 | const char* haystack = ts_obj_data; | |
@@ -885,7 +886,7 @@ void IndexOfBuffer(const FunctionCallbackInfo<Value>& args) { | |||
| 885 | 886 | THROW_AND_RETURN_UNLESS_BUFFER(Environment::GetCurrent(args), args[1]); | |
| 886 | 887 | SPREAD_BUFFER_ARG(args[0], ts_obj); | |
| 887 | 888 | SPREAD_BUFFER_ARG(args[1], buf); | |
| 888 | - int64_t offset_i64 = args[2]->IntegerValue(); | ||
| 889 | + int64_t offset_i64 = args[2].As<Integer>()->Value(); | ||
| 889 | 890 | bool is_forward = args[4]->IsTrue(); | |
| 890 | 891 | ||
| 891 | 892 | const char* haystack = ts_obj_data; | |
@@ -955,7 +956,7 @@ void IndexOfNumber(const FunctionCallbackInfo<Value>& args) { | |||
| 955 | 956 | SPREAD_BUFFER_ARG(args[0], ts_obj); | |
| 956 | 957 | ||
| 957 | 958 | uint32_t needle = args[1].As<Uint32>()->Value(); | |
| 958 | - int64_t offset_i64 = args[2]->IntegerValue(); | ||
| 959 | + int64_t offset_i64 = args[2].As<Integer>()->Value(); | ||
| 959 | 960 | bool is_forward = args[3]->IsTrue(); | |
| 960 | 961 | ||
| 961 | 962 | int64_t opt_offset = IndexOfOffset(ts_obj_length, offset_i64, 1, is_forward); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -979,15 +979,16 @@ void SecureContext::SetDHParam(const FunctionCallbackInfo<Value>& args) { | |||
| 979 | 979 | void SecureContext::SetOptions(const FunctionCallbackInfo<Value>& args) { | |
| 980 | 980 | SecureContext* sc; | |
| 981 | 981 | ASSIGN_OR_RETURN_UNWRAP(&sc, args.Holder()); | |
| 982 | + int64_t val; | ||
| 982 | 983 | ||
| 983 | - if (args.Length() != 1 || !args[0]->IntegerValue()) { | ||
| 984 | + if (args.Length() != 1 || | ||
| 985 | + !args[0]->IntegerValue(args.GetIsolate()->GetCurrentContext()).To(&val)) { | ||
| 984 | 986 | return THROW_ERR_INVALID_ARG_TYPE( | |
| 985 | 987 | sc->env(), "Options must be an integer value"); | |
| 986 | 988 | } | |
| 987 | 989 | ||
| 988 | - SSL_CTX_set_options( | ||
| 989 | - sc->ctx_.get(), | ||
| 990 | - static_cast<long>(args[0]->IntegerValue())); // NOLINT(runtime/int) | ||
| 990 | + SSL_CTX_set_options(sc->ctx_.get(), | ||
| 991 | + static_cast<long>(val)); // NOLINT(runtime/int) | ||
| 991 | 992 | } | |
| 992 | 993 | ||
| 993 | 994 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -289,12 +289,16 @@ class Parser : public AsyncWrap, public StreamListener { | |||
| 289 | 289 | MaybeLocal<Value> head_response = | |
| 290 | 290 | MakeCallback(cb.As<Function>(), arraysize(argv), argv); | |
| 291 | 291 | ||
| 292 | - if (head_response.IsEmpty()) { | ||
| 292 | + int64_t val; | ||
| 293 | + | ||
| 294 | + if (head_response.IsEmpty() || !head_response.ToLocalChecked() | ||
| 295 | + ->IntegerValue(env()->context()) | ||
| 296 | + .To(&val)) { | ||
| 293 | 297 | got_exception_ = true; | |
| 294 | 298 | return -1; | |
| 295 | 299 | } | |
| 296 | 300 | ||
| 297 | - return head_response.ToLocalChecked()->IntegerValue(); | ||
| 301 | + return val; | ||
| 298 | 302 | } | |
| 299 | 303 | ||
| 300 | 304 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -132,8 +132,9 @@ class ProcessWrap : public HandleWrap { | |||
| 132 | 132 | options->stdio[i].data.stream = stream; | |
| 133 | 133 | } else { | |
| 134 | 134 | Local<String> fd_key = env->fd_string(); | |
| 135 | - int fd = static_cast<int>( | ||
| 136 | - stdio->Get(context, fd_key).ToLocalChecked()->IntegerValue()); | ||
| 135 | + Local<Value> fd_value = stdio->Get(context, fd_key).ToLocalChecked(); | ||
| 136 | + CHECK(fd_value->IsNumber()); | ||
| 137 | + int fd = static_cast<int>(fd_value.As<Integer>()->Value()); | ||
| 137 | 138 | options->stdio[i].flags = UV_INHERIT_FD; | |
| 138 | 139 | options->stdio[i].data.fd = fd; | |
| 139 | 140 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -207,7 +207,10 @@ void TCPWrap::Open(const FunctionCallbackInfo<Value>& args) { | |||
| 207 | 207 | ASSIGN_OR_RETURN_UNWRAP(&wrap, | |
| 208 | 208 | args.Holder(), | |
| 209 | 209 | args.GetReturnValue().Set(UV_EBADF)); | |
| 210 | - int fd = static_cast<int>(args[0]->IntegerValue()); | ||
| 210 | + int64_t val; | ||
| 211 | + if (!args[0]->IntegerValue(args.GetIsolate()->GetCurrentContext()).To(&val)) | ||
| 212 | + return; | ||
| 213 | + int fd = static_cast<int>(val); | ||
| 211 | 214 | int err = uv_tcp_open(&wrap->handle_, fd); | |
| 212 | 215 | ||
| 213 | 216 | if (err == 0) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments