| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent eb0daae commit 3079a78
14 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,9 +36,9 @@ static inline const char* base64_select_table(Base64Mode mode) { | |||
| 36 | 36 | static inline constexpr size_t base64_encoded_size( | |
| 37 | 37 | size_t size, | |
| 38 | 38 | Base64Mode mode = Base64Mode::NORMAL) { | |
| 39 | - return mode == Base64Mode::NORMAL | ||
| 40 | - ? ((size + 2) / 3 * 4) | ||
| 41 | - : std::ceil(static_cast<double>(size * 4) / 3); | ||
| 39 | + return mode == Base64Mode::NORMAL ? ((size + 2) / 3 * 4) | ||
| 40 | + : static_cast<size_t>(std::ceil( | ||
| 41 | + static_cast<double>(size * 4) / 3)); | ||
| 42 | 42 | } | |
| 43 | 43 | ||
| 44 | 44 | // Doesn't check for padding at the end. Can be 1-2 bytes over. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1901,7 +1901,7 @@ void AfterGetAddrInfo(uv_getaddrinfo_t* req, int status, struct addrinfo* res) { | |||
| 1901 | 1901 | Null(env->isolate()) | |
| 1902 | 1902 | }; | |
| 1903 | 1903 | ||
| 1904 | - uint64_t n = 0; | ||
| 1904 | + uint32_t n = 0; | ||
| 1905 | 1905 | const bool verbatim = req_wrap->verbatim(); | |
| 1906 | 1906 | ||
| 1907 | 1907 | if (status == 0) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -118,16 +118,16 @@ class JSGraph : public EmbedderGraph { | |||
| 118 | 118 | name_str += " "; | |
| 119 | 119 | name_str += n->Name(); | |
| 120 | 120 | } | |
| 121 | - if (!String::NewFromUtf8(isolate_, name_str.c_str()) | ||
| 122 | - .ToLocal(&value) || | ||
| 121 | + if (!String::NewFromUtf8(isolate_, name_str.c_str()).ToLocal(&value) || | ||
| 123 | 122 | obj->Set(context, name_string, value).IsNothing() || | |
| 124 | 123 | obj->Set(context, | |
| 125 | 124 | is_root_string, | |
| 126 | 125 | Boolean::New(isolate_, n->IsRootNode())) | |
| 127 | 126 | .IsNothing() || | |
| 128 | - obj->Set(context, | ||
| 129 | - size_string, | ||
| 130 | - Number::New(isolate_, n->SizeInBytes())) | ||
| 127 | + obj->Set( | ||
| 128 | + context, | ||
| 129 | + size_string, | ||
| 130 | + Number::New(isolate_, static_cast<double>(n->SizeInBytes()))) | ||
| 131 | 131 | .IsNothing() || | |
| 132 | 132 | obj->Set(context, edges_string, Array::New(isolate_)).IsNothing()) { | |
| 133 | 133 | return MaybeLocal<Array>(); | |
@@ -172,7 +172,7 @@ class JSGraph : public EmbedderGraph { | |||
| 172 | 172 | return MaybeLocal<Array>(); | |
| 173 | 173 | } | |
| 174 | 174 | } else { | |
| 175 | - edge_name_value = Number::New(isolate_, j++); | ||
| 175 | + edge_name_value = Number::New(isolate_, static_cast<double>(j++)); | ||
| 176 | 176 | } | |
| 177 | 177 | if (edge_obj->Set(context, name_string, edge_name_value).IsNothing() || | |
| 178 | 178 | edge_obj->Set(context, to_string, to_object).IsNothing() || | |
@@ -262,7 +262,7 @@ class HeapSnapshotStream : public AsyncWrap, | |||
| 262 | 262 | avail = buf.len; | |
| 263 | 263 | memcpy(buf.base, data, avail); | |
| 264 | 264 | data += avail; | |
| 265 | - len -= avail; | ||
| 265 | + len -= static_cast<int>(avail); | ||
| 266 | 266 | EmitRead(size, buf); | |
| 267 | 267 | } | |
| 268 | 268 | return kContinue; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -178,7 +178,7 @@ void JSStream::ReadBuffer(const FunctionCallbackInfo<Value>& args) { | |||
| 178 | 178 | ||
| 179 | 179 | memcpy(buf.base, data, avail); | |
| 180 | 180 | data += avail; | |
| 181 | - len -= avail; | ||
| 181 | + len -= static_cast<int>(avail); | ||
| 182 | 182 | wrap->EmitRead(avail, buf); | |
| 183 | 183 | } | |
| 184 | 184 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -161,7 +161,7 @@ void JSUDPWrap::EmitReceived(const FunctionCallbackInfo<Value>& args) { | |||
| 161 | 161 | ssize_t avail = std::min<size_t>(buf.len, len); | |
| 162 | 162 | memcpy(buf.base, data, avail); | |
| 163 | 163 | data += avail; | |
| 164 | - len -= avail; | ||
| 164 | + len -= static_cast<int>(avail); | ||
| 165 | 165 | wrap->listener()->OnRecv( | |
| 166 | 166 | avail, buf, reinterpret_cast<sockaddr*>(&addr), flags); | |
| 167 | 167 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1068,7 +1068,7 @@ InitializationResult InitializeOncePerProcess(int argc, char** argv) { | |||
| 1068 | 1068 | #endif // HAVE_OPENSSL | |
| 1069 | 1069 | ||
| 1070 | 1070 | per_process::v8_platform.Initialize( | |
| 1071 | - per_process::cli_options->v8_thread_pool_size); | ||
| 1071 | + static_cast<int>(per_process::cli_options->v8_thread_pool_size)); | ||
| 1072 | 1072 | V8::Initialize(); | |
| 1073 | 1073 | performance::performance_v8_start = PERFORMANCE_NOW(); | |
| 1074 | 1074 | per_process::v8_initialized = true; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -217,9 +217,10 @@ static void AfterDirRead(uv_fs_t* req) { | |||
| 217 | 217 | Local<Array> js_array; | |
| 218 | 218 | if (!DirentListToArray(env, | |
| 219 | 219 | dir->dirents, | |
| 220 | - req->result, | ||
| 220 | + static_cast<int>(req->result), | ||
| 221 | 221 | req_wrap->encoding(), | |
| 222 | - &error).ToLocal(&js_array)) { | ||
| 222 | + &error) | ||
| 223 | + .ToLocal(&js_array)) { | ||
| 223 | 224 | // Clear libuv resources *before* delivering results to JS land because | |
| 224 | 225 | // that can schedule another operation on the same uv_dir_t. Ditto below. | |
| 225 | 226 | after.Clear(); | |
@@ -244,7 +245,7 @@ void DirHandle::Read(const FunctionCallbackInfo<Value>& args) { | |||
| 244 | 245 | ASSIGN_OR_RETURN_UNWRAP(&dir, args.Holder()); | |
| 245 | 246 | ||
| 246 | 247 | CHECK(args[1]->IsNumber()); | |
| 247 | - uint64_t buffer_size = args[1].As<Number>()->Value(); | ||
| 248 | + uint64_t buffer_size = static_cast<uint64_t>(args[1].As<Number>()->Value()); | ||
| 248 | 249 | ||
| 249 | 250 | if (buffer_size != dir->dirents_.size()) { | |
| 250 | 251 | dir->dirents_.resize(buffer_size); | |
@@ -280,9 +281,10 @@ void DirHandle::Read(const FunctionCallbackInfo<Value>& args) { | |||
| 280 | 281 | Local<Array> js_array; | |
| 281 | 282 | if (!DirentListToArray(env, | |
| 282 | 283 | dir->dir()->dirents, | |
| 283 | - req_wrap_sync.req.result, | ||
| 284 | + static_cast<int>(req_wrap_sync.req.result), | ||
| 284 | 285 | encoding, | |
| 285 | - &error).ToLocal(&js_array)) { | ||
| 286 | + &error) | ||
| 287 | + .ToLocal(&js_array)) { | ||
| 286 | 288 | Local<Object> ctx = args[2].As<Object>(); | |
| 287 | 289 | USE(ctx->Set(env->context(), env->error_string(), error)); | |
| 288 | 290 | return; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -367,7 +367,8 @@ MaybeLocal<Promise> FileHandle::ClosePromise() { | |||
| 367 | 367 | Isolate* isolate = close->env()->isolate(); | |
| 368 | 368 | if (req->result < 0) { | |
| 369 | 369 | HandleScope handle_scope(isolate); | |
| 370 | - close->Reject(UVException(isolate, req->result, "close")); | ||
| 370 | + close->Reject( | ||
| 371 | + UVException(isolate, static_cast<int>(req->result), "close")); | ||
| 371 | 372 | } else { | |
| 372 | 373 | close->Resolve(); | |
| 373 | 374 | } | |
@@ -491,7 +492,7 @@ int FileHandle::ReadStart() { | |||
| 491 | 492 | BaseObjectPtr<FileHandleReadWrap> read_wrap = | |
| 492 | 493 | std::move(handle->current_read_); | |
| 493 | 494 | ||
| 494 | - int result = req->result; | ||
| 495 | + ssize_t result = req->result; | ||
| 495 | 496 | uv_buf_t buffer = read_wrap->buffer_; | |
| 496 | 497 | ||
| 497 | 498 | uv_fs_req_cleanup(req); | |
@@ -555,7 +556,7 @@ int FileHandle::DoShutdown(ShutdownWrap* req_wrap) { | |||
| 555 | 556 | FileHandle* handle = static_cast<FileHandle*>(wrap->stream()); | |
| 556 | 557 | handle->AfterClose(); | |
| 557 | 558 | ||
| 558 | - int result = req->result; | ||
| 559 | + int result = static_cast<int>(req->result); | ||
| 559 | 560 | uv_fs_req_cleanup(req); | |
| 560 | 561 | wrap->Done(result); | |
| 561 | 562 | }}); | |
@@ -623,13 +624,12 @@ void FSReqAfterScope::Clear() { | |||
| 623 | 624 | // in JS for more flexibility. | |
| 624 | 625 | void FSReqAfterScope::Reject(uv_fs_t* req) { | |
| 625 | 626 | BaseObjectPtr<FSReqBase> wrap { wrap_ }; | |
| 626 | - Local<Value> exception = | ||
| 627 | - UVException(wrap_->env()->isolate(), | ||
| 628 | - req->result, | ||
| 629 | - wrap_->syscall(), | ||
| 630 | - nullptr, | ||
| 631 | - req->path, | ||
| 632 | - wrap_->data()); | ||
| 627 | + Local<Value> exception = UVException(wrap_->env()->isolate(), | ||
| 628 | + static_cast<int>(req->result), | ||
| 629 | + wrap_->syscall(), | ||
| 630 | + nullptr, | ||
| 631 | + req->path, | ||
| 632 | + wrap_->data()); | ||
| 633 | 633 | Clear(); | |
| 634 | 634 | wrap->Reject(exception); | |
| 635 | 635 | } | |
@@ -663,19 +663,21 @@ void AfterInteger(uv_fs_t* req) { | |||
| 663 | 663 | FSReqBase* req_wrap = FSReqBase::from_req(req); | |
| 664 | 664 | FSReqAfterScope after(req_wrap, req); | |
| 665 | 665 | ||
| 666 | - if (req->result >= 0 && req_wrap->is_plain_open()) | ||
| 667 | - req_wrap->env()->AddUnmanagedFd(req->result); | ||
| 666 | + int result = static_cast<int>(req->result); | ||
| 667 | + if (result >= 0 && req_wrap->is_plain_open()) | ||
| 668 | + req_wrap->env()->AddUnmanagedFd(result); | ||
| 668 | 669 | ||
| 669 | 670 | if (after.Proceed()) | |
| 670 | - req_wrap->Resolve(Integer::New(req_wrap->env()->isolate(), req->result)); | ||
| 671 | + req_wrap->Resolve(Integer::New(req_wrap->env()->isolate(), result)); | ||
| 671 | 672 | } | |
| 672 | 673 | ||
| 673 | 674 | void AfterOpenFileHandle(uv_fs_t* req) { | |
| 674 | 675 | FSReqBase* req_wrap = FSReqBase::from_req(req); | |
| 675 | 676 | FSReqAfterScope after(req_wrap, req); | |
| 676 | 677 | ||
| 677 | 678 | if (after.Proceed()) { | |
| 678 | - FileHandle* fd = FileHandle::New(req_wrap->binding_data(), req->result); | ||
| 679 | + FileHandle* fd = FileHandle::New(req_wrap->binding_data(), | ||
| 680 | + static_cast<int>(req->result)); | ||
| 679 | 681 | if (fd == nullptr) return; | |
| 680 | 682 | req_wrap->Resolve(fd->object()); | |
| 681 | 683 | } | |
@@ -1430,7 +1432,7 @@ int MKDirpAsync(uv_loop_t* loop, | |||
| 1430 | 1432 | Environment* env = req_wrap->env(); | |
| 1431 | 1433 | uv_loop_t* loop = env->event_loop(); | |
| 1432 | 1434 | std::string path = req->path; | |
| 1433 | - int err = req->result; | ||
| 1435 | + int err = static_cast<int>(req->result); | ||
| 1434 | 1436 | ||
| 1435 | 1437 | while (true) { | |
| 1436 | 1438 | switch (err) { | |
@@ -1476,7 +1478,7 @@ int MKDirpAsync(uv_loop_t* loop, | |||
| 1476 | 1478 | int err = uv_fs_stat(loop, req, path.c_str(), | |
| 1477 | 1479 | uv_fs_callback_t{[](uv_fs_t* req) { | |
| 1478 | 1480 | FSReqBase* req_wrap = FSReqBase::from_req(req); | |
| 1479 | - int err = req->result; | ||
| 1481 | + int err = static_cast<int>(req->result); | ||
| 1480 | 1482 | if (reinterpret_cast<intptr_t>(req->data) == UV_EEXIST && | |
| 1481 | 1483 | req_wrap->continuation_data()->paths().size() > 0) { | |
| 1482 | 1484 | if (err == 0 && S_ISDIR(req->statbuf.st_mode)) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -380,7 +380,7 @@ class Parser : public AsyncWrap, public StreamListener { | |||
| 380 | 380 | return -1; | |
| 381 | 381 | } | |
| 382 | 382 | ||
| 383 | - return val; | ||
| 383 | + return static_cast<int>(val); | ||
| 384 | 384 | } | |
| 385 | 385 | ||
| 386 | 386 | ||
@@ -403,10 +403,10 @@ class Parser : public AsyncWrap, public StreamListener { | |||
| 403 | 403 | } | |
| 404 | 404 | ||
| 405 | 405 | Local<Value> argv[3] = { | |
| 406 | - current_buffer_, | ||
| 407 | - Integer::NewFromUnsigned(env()->isolate(), at - current_buffer_data_), | ||
| 408 | - Integer::NewFromUnsigned(env()->isolate(), length) | ||
| 409 | - }; | ||
| 406 | + current_buffer_, | ||
| 407 | + Integer::NewFromUnsigned( | ||
| 408 | + env()->isolate(), static_cast<uint32_t>(at - current_buffer_data_)), | ||
| 409 | + Integer::NewFromUnsigned(env()->isolate(), length)}; | ||
| 410 | 410 | ||
| 411 | 411 | MaybeLocal<Value> r = MakeCallback(cb.As<Function>(), | |
| 412 | 412 | arraysize(argv), | |
@@ -549,15 +549,16 @@ class Parser : public AsyncWrap, public StreamListener { | |||
| 549 | 549 | ||
| 550 | 550 | if (args.Length() > 2) { | |
| 551 | 551 | CHECK(args[2]->IsNumber()); | |
| 552 | - max_http_header_size = args[2].As<Number>()->Value(); | ||
| 552 | + max_http_header_size = | ||
| 553 | + static_cast<uint64_t>(args[2].As<Number>()->Value()); | ||
| 553 | 554 | } | |
| 554 | 555 | if (max_http_header_size == 0) { | |
| 555 | 556 | max_http_header_size = env->options()->max_http_header_size; | |
| 556 | 557 | } | |
| 557 | 558 | ||
| 558 | 559 | if (args.Length() > 4) { | |
| 559 | 560 | CHECK(args[4]->IsInt32()); | |
| 560 | - headers_timeout = args[4].As<Number>()->Value(); | ||
| 561 | + headers_timeout = args[4].As<Int32>()->Value(); | ||
| 561 | 562 | } | |
| 562 | 563 | ||
| 563 | 564 | llhttp_type_t type = | |
@@ -683,7 +684,7 @@ class Parser : public AsyncWrap, public StreamListener { | |||
| 683 | 684 | // check header parsing time | |
| 684 | 685 | if (header_parsing_start_time_ != 0 && headers_timeout_ != 0) { | |
| 685 | 686 | uint64_t now = uv_hrtime(); | |
| 686 | - uint64_t parsing_time = (now - header_parsing_start_time_) / 1e6; | ||
| 687 | + uint64_t parsing_time = (now - header_parsing_start_time_) / 1000000; | ||
| 687 | 688 | ||
| 688 | 689 | if (parsing_time > headers_timeout_) { | |
| 689 | 690 | Local<Value> cb = | |
@@ -781,8 +782,9 @@ class Parser : public AsyncWrap, public StreamListener { | |||
| 781 | 782 | if (err == HPE_USER) { | |
| 782 | 783 | const char* colon = strchr(errno_reason, ':'); | |
| 783 | 784 | CHECK_NOT_NULL(colon); | |
| 784 | - code = OneByteString(env()->isolate(), errno_reason, | ||
| 785 | - colon - errno_reason); | ||
| 785 | + code = OneByteString(env()->isolate(), | ||
| 786 | + errno_reason, | ||
| 787 | + static_cast<int>(colon - errno_reason)); | ||
| 786 | 788 | reason = OneByteString(env()->isolate(), colon + 1); | |
| 787 | 789 | } else { | |
| 788 | 790 | code = OneByteString(env()->isolate(), llhttp_errno_name(err)); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -945,12 +945,14 @@ void GetOptions(const FunctionCallbackInfo<Value>& args) { | |||
| 945 | 945 | *_ppop_instance.Lookup<bool>(field, opts)); | |
| 946 | 946 | break; | |
| 947 | 947 | case kInteger: | |
| 948 | - value = Number::New(isolate, | ||
| 949 | - *_ppop_instance.Lookup<int64_t>(field, opts)); | ||
| 948 | + value = Number::New( | ||
| 949 | + isolate, | ||
| 950 | + static_cast<double>(*_ppop_instance.Lookup<int64_t>(field, opts))); | ||
| 950 | 951 | break; | |
| 951 | 952 | case kUInteger: | |
| 952 | - value = Number::New(isolate, | ||
| 953 | - *_ppop_instance.Lookup<uint64_t>(field, opts)); | ||
| 953 | + value = Number::New( | ||
| 954 | + isolate, | ||
| 955 | + static_cast<double>(*_ppop_instance.Lookup<uint64_t>(field, opts))); | ||
| 954 | 956 | break; | |
| 955 | 957 | case kString: | |
| 956 | 958 | if (!ToV8Value(context, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments