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-02-12 22:57:53 +0300
committerMichaël Zasso <targos@protonmail.com>2021-02-20 12:50:28 +0300
commitd1f1fcfe0cea492152bcc8d008dc2ef59e2e0786 (patch)
treeee759f9140a3d9fe5b75f73d7fc57d86a918ff3c /src/node_url.cc
parent5421e15bdc6122420d90ec462c3622b57d59c9d6 (diff)
src: avoid implicit type conversions (take 2)
This fixes more C4244 MSVC warnings in the code base. Refs: https://github.com/nodejs/node/pull/37149 PR-URL: https://github.com/nodejs/node/pull/37334 Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_url.cc')
-rw-r--r--src/node_url.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/node_url.cc b/src/node_url.cc
index 82fe8078a8d..399c37638ad 100644
--- a/src/node_url.cc
+++ b/src/node_url.cc
@@ -896,7 +896,7 @@ void URLHost::ParseIPv6Host(const char* input, size_t length) {
}
if (compress_pointer != nullptr) {
- unsigned swaps = piece_pointer - compress_pointer;
+ int64_t swaps = piece_pointer - compress_pointer;
piece_pointer = buffer_end - 1;
while (piece_pointer != &value_.ipv6[0] && swaps > 0) {
uint16_t temp = *piece_pointer;
@@ -963,7 +963,7 @@ void URLHost::ParseIPv4Host(const char* input, size_t length, bool* is_ipv4) {
while (pointer <= end) {
const char ch = pointer < end ? pointer[0] : kEOL;
- int remaining = end - pointer - 1;
+ int64_t remaining = end - pointer - 1;
if (ch == '.' || ch == kEOL) {
if (++parts > static_cast<int>(arraysize(numbers)))
return;
@@ -996,10 +996,11 @@ void URLHost::ParseIPv4Host(const char* input, size_t length, bool* is_ipv4) {
}
type_ = HostType::H_IPV4;
- val = numbers[parts - 1];
+ val = static_cast<uint32_t>(numbers[parts - 1]);
for (int n = 0; n < parts - 1; n++) {
double b = 3 - n;
- val += numbers[n] * pow(256, b);
+ val +=
+ static_cast<uint32_t>(numbers[n]) * static_cast<uint32_t>(pow(256, b));
}
value_.ipv4 = val;