diff options
author | Michaƫl Zasso <targos@protonmail.com> | 2021-01-30 18:59:54 +0300 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2021-02-08 04:51:41 +0300 |
commit | b346cd1760dfad560d89cb797be2cf6f9f77bb77 (patch) | |
tree | d5a8ab6889d72e8090cd5198905db8635fe37008 /src/node_worker.cc | |
parent | 907d6b6b40a62c5ae831bbd7551e7c57c3a27b6b (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_worker.cc')
-rw-r--r-- | src/node_worker.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/node_worker.cc b/src/node_worker.cc index d163ec2461d..6f7ccc33ba5 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc @@ -99,7 +99,7 @@ void Worker::UpdateResourceConstraints(ResourceConstraints* constraints) { if (resource_limits_[kMaxYoungGenerationSizeMb] > 0) { constraints->set_max_young_generation_size_in_bytes( - resource_limits_[kMaxYoungGenerationSizeMb] * kMB); + static_cast<size_t>(resource_limits_[kMaxYoungGenerationSizeMb] * kMB)); } else { resource_limits_[kMaxYoungGenerationSizeMb] = constraints->max_young_generation_size_in_bytes() / kMB; @@ -107,7 +107,7 @@ void Worker::UpdateResourceConstraints(ResourceConstraints* constraints) { if (resource_limits_[kMaxOldGenerationSizeMb] > 0) { constraints->set_max_old_generation_size_in_bytes( - resource_limits_[kMaxOldGenerationSizeMb] * kMB); + static_cast<size_t>(resource_limits_[kMaxOldGenerationSizeMb] * kMB)); } else { resource_limits_[kMaxOldGenerationSizeMb] = constraints->max_old_generation_size_in_bytes() / kMB; @@ -115,7 +115,7 @@ void Worker::UpdateResourceConstraints(ResourceConstraints* constraints) { if (resource_limits_[kCodeRangeSizeMb] > 0) { constraints->set_code_range_size_in_bytes( - resource_limits_[kCodeRangeSizeMb] * kMB); + static_cast<size_t>(resource_limits_[kCodeRangeSizeMb] * kMB)); } else { resource_limits_[kCodeRangeSizeMb] = constraints->code_range_size_in_bytes() / kMB; @@ -575,7 +575,8 @@ void Worker::StartThread(const FunctionCallbackInfo<Value>& args) { w->resource_limits_[kStackSizeMb] = kStackBufferSize / kMB; w->stack_size_ = kStackBufferSize; } else { - w->stack_size_ = w->resource_limits_[kStackSizeMb] * kMB; + w->stack_size_ = + static_cast<size_t>(w->resource_limits_[kStackSizeMb] * kMB); } } else { w->resource_limits_[kStackSizeMb] = w->stack_size_ / kMB; |