Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichaƫl Zasso <targos@protonmail.com>2021-01-30 18:59:54 +0300
committerRich Trott <rtrott@gmail.com>2021-02-08 04:51:41 +0300
commitb346cd1760dfad560d89cb797be2cf6f9f77bb77 (patch)
treed5a8ab6889d72e8090cd5198905db8635fe37008 /src/node_dir.cc
parent907d6b6b40a62c5ae831bbd7551e7c57c3a27b6b (diff)
src: avoid implicit type conversions
This fixes a bunch of C4244 ('conversion' conversion from 'type1' to 'type2', possible loss of data) MSVC warnings in the code base. PR-URL: https://github.com/nodejs/node/pull/37149 Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_dir.cc')
-rw-r--r--src/node_dir.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/node_dir.cc b/src/node_dir.cc
index a8bb2a7083c..d94d78f560b 100644
--- a/src/node_dir.cc
+++ b/src/node_dir.cc
@@ -217,9 +217,10 @@ static void AfterDirRead(uv_fs_t* req) {
Local<Array> js_array;
if (!DirentListToArray(env,
dir->dirents,
- req->result,
+ static_cast<int>(req->result),
req_wrap->encoding(),
- &error).ToLocal(&js_array)) {
+ &error)
+ .ToLocal(&js_array)) {
// Clear libuv resources *before* delivering results to JS land because
// that can schedule another operation on the same uv_dir_t. Ditto below.
after.Clear();
@@ -244,7 +245,7 @@ void DirHandle::Read(const FunctionCallbackInfo<Value>& args) {
ASSIGN_OR_RETURN_UNWRAP(&dir, args.Holder());
CHECK(args[1]->IsNumber());
- uint64_t buffer_size = args[1].As<Number>()->Value();
+ uint64_t buffer_size = static_cast<uint64_t>(args[1].As<Number>()->Value());
if (buffer_size != dir->dirents_.size()) {
dir->dirents_.resize(buffer_size);
@@ -280,9 +281,10 @@ void DirHandle::Read(const FunctionCallbackInfo<Value>& args) {
Local<Array> js_array;
if (!DirentListToArray(env,
dir->dir()->dirents,
- req_wrap_sync.req.result,
+ static_cast<int>(req_wrap_sync.req.result),
encoding,
- &error).ToLocal(&js_array)) {
+ &error)
+ .ToLocal(&js_array)) {
Local<Object> ctx = args[2].As<Object>();
USE(ctx->Set(env->context(), env->error_string(), error));
return;