Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
19d6eb9
test: fix flaky test-fs-promises-file-handle-read
Trott Feb 14, 2021
01773ab
crypto: use BoringSSL compatible errors
codebytere Feb 9, 2021
daad7bb
src: adjust THP sysfs config token retrieval and file closure
jayaddison Jan 28, 2021
0d564ce
buffer: make Blob's slice method more spec-compliant
targos Feb 13, 2021
458a410
buffer: make Blob's constructor more spec-compliant
targos Feb 13, 2021
4b54c10
doc: use **Default:** more consistently
cjihrig Feb 15, 2021
d141fce
fs: use createDeferredPromise() in promises.watch()
cjihrig Feb 15, 2021
6675342
doc: clarify that async_hook callbacks cannot be async
jasnell Feb 15, 2021
429dffd
stream: add AbortSignal to promisified pipeline
Feb 13, 2021
df538eb
test: fix flaky test-webcrypto-encrypt-decrypt-aes
RaisinTen Feb 15, 2021
856d20b
lib: add URI handling functions to primordials
aduh95 Feb 16, 2021
a1ed78c
module: improve support of data: URLs
aduh95 Feb 16, 2021
27816ea
node-api: force env shutdown deferring behavior
Feb 10, 2021
dc3c299
lib: remove outdated todo comment
aduh95 Feb 16, 2021
e400f8c
src: support serialization of binding data
joyeecheung Feb 8, 2021
59861ba
bootstrap: include fs module into the builtin snapshot
joyeecheung Feb 8, 2021
d2e5529
bootstrap: include v8 module into the builtin snapshot
joyeecheung Feb 8, 2021
b634469
crypto: refactor to avoid unsafe array iteration
aduh95 Feb 12, 2021
6205e29
doc,lib: prepare for stricter multi-line array linting
Trott Feb 6, 2021
49013fc
tools: make comma-dangle ESLint rule more stringent …
Trott Feb 6, 2021
b3bf3d9
doc: use HEAD in links where possible
mhdawson Feb 17, 2021
c75f5f3
src: avoid implicit type conversions (take 2)
targos Feb 12, 2021
96bcd52
src: disable unfixable MSVC warnings
targos Feb 12, 2021
5ea2ed6
src: fix ETW_WRITE_EMPTY_EVENT macro
targos Feb 12, 2021
d5c311e
test: fix flaky test-worker-prof
Trott Feb 14, 2021
9a454af
doc: fix typo in esm.md
tailorswift Feb 17, 2021
4f41900
test: update upload.zip to be uncorrupted
Feb 9, 2021
f20ce47
doc,child_process: `pid` can be `undefined` when `ENOENT`
dr-js Jan 25, 2021
c554aa1
test,child_process: add check for `subProcess.pid`
dr-js Jan 25, 2021
9ac8c74
doc: document x509 error codes
dcermak Jan 27, 2021
d039e6f
assert: refactor to avoid unsafe array iteration
aduh95 Feb 12, 2021
b569105
test: clarify usage of tmpdir.refresh()
RaisinTen Feb 15, 2021
c3d236d
doc: fix "referred to" in fs docs
tniessen Feb 16, 2021
5c27fd7
tools: run doctool tests on GitHub Actions CI
aduh95 Feb 16, 2021
f3559a9
doc: fix typo in doc/api/esm.md
marsonya Feb 16, 2021
549d24b
doc: fix alignment of parameters
mhdawson Feb 18, 2021
54b6f1b
doc: use HEAD for links in api docs
mhdawson Feb 18, 2021
a193d7c
doc: alphabetize crypto Cipher class entries
Trott Feb 20, 2021
4ad7a78
doc: alphabetize vm Module class properties
Trott Feb 20, 2021
9ba5c0f
errors: remove experimental from --enable-source-maps
Feb 13, 2021
b38404e
test: remove FLAKY designation for test-http2-client-upload-reject
Trott Feb 20, 2021
f1381f7
src: fix alloc-dealloc-mismatch in node_snapshotable.h
RaisinTen Feb 19, 2021
7ac0820
doc: fix typo in doc/api/http2/md
marsonya Feb 22, 2021
834f637
doc: apply sentence case to headers in doc/guides
marsonya Feb 22, 2021
dfa0440
test: validate no debug info for http2
mhdawson Feb 19, 2021
ba319f0
test: remove FLAKY for test-http2-compat-client-upload-reject
Trott Feb 20, 2021
ce7fbbf
test: fix typo in test_node_crypto.cc
eltociear Feb 22, 2021
1408de7
deps: cherry-pick 8957d4677aa794c230577f234071af0 from V8 upstream
aduh95 Jan 4, 2021
f2aa305
test: fix incorrect timers-promisified case
ttzztztz Feb 18, 2021
80d3c11
deps: V8: cherry-pick 373f4ae739ee
richardlau Feb 24, 2021
e1045f1
deps: upgrade npm to 7.5.6
ruyadorno Feb 23, 2021
4a40759
doc: recommend queueMicrotask over process.nextTick
jasnell Feb 22, 2021
6b42e65
fs: fixup negative length in fs.truncate
jasnell Feb 22, 2021
a3e3156
crypto: make FIPS related options always awailable
voxik Aug 25, 2020
bb81acc
lib: use <array>.push and <array>.unshift instead of <array>.concat
aduh95 Feb 5, 2021
291d9e9
crypto: check ed/x webcrypto key import algorithm names
panva Feb 10, 2021
617819e
doc: update CI requirements for landing pull requests
aduh95 Feb 10, 2021
3d3df0c
stream: add AbortSignal support to finished
Feb 13, 2021
2228f44
doc: apply sentence case to guides headers
marsonya Feb 24, 2021
e8b1e2c
fs: fix pre-aborted writeFile AbortSignal file leak
Feb 16, 2021
c0cdb83
fs: fix writeFile signal does not close file
Feb 16, 2021
b1e188d
crypto: refactor hasAnyNotIn to avoid unsafe array iteration
aduh95 Feb 18, 2021
0fac27d
doc: add url.resolve replacement example
aduh95 Feb 24, 2021
3b7cb75
doc: document the NO_COLOR and FORCE_COLOR env vars
jasnell Feb 22, 2021
ddae112
child_process: fix spawn and fork abort behavior
Feb 11, 2021
31f4600
worker: fix interaction of terminate() with messaging port
addaleax Feb 11, 2021
fb5e5be
doc: fix typo in webcrypto.md
marsonya Feb 24, 2021
3b737e6
doc: apply sentence case to headers in doc/guides
marsonya Feb 24, 2021
46af567
doc: change links to use HEAD in top level docs
mhdawson Feb 23, 2021
4cc7645
stream: move duplicated code to an internal module
Trott Feb 24, 2021
bc86208
doc: revise premature disclosure text in collaborator guide
Trott Feb 26, 2021
1285b90
doc: revise objections section of collaborator guide
Trott Feb 26, 2021
7529a97
doc: revise CI text in collaborator guide
Trott Feb 26, 2021
ba81e7c
doc: revise LTS text in collaborator guide
Trott Feb 26, 2021
dd7a04d
doc: fix typo "director" instead of "directory"
humanwebpl Feb 26, 2021
cbfc6b1
doc: document how to register external bindings for snapshot
joyeecheung Feb 21, 2021
d93137b
workers: fix spawning from preload scripts
jasnell Feb 22, 2021
00b3446
test: account for pending deprecations in esm test
Trott Feb 27, 2021
4531139
test: make status file names consistent
Trott Feb 27, 2021
9696cf7
test: remove FLAKY status for test-http2-multistream-destroy-on-read-tls
Trott Feb 27, 2021
5d939b7
doc: fix typo in doc/api/packages.md
marsonya Feb 27, 2021
725d48a
doc: remove experimental from --enable-source-maps
cjihrig Feb 27, 2021
f3d6700
deps: upgrade npm to 7.6.0
ruyadorno Mar 1, 2021
d816b24
2021-03-03, Version 15.11.0 (Current)
targos Mar 2, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
src: avoid implicit type conversions (take 2)
This fixes more C4244 MSVC warnings in the code base.

Refs: #37149

PR-URL: #37334
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
targos committed Feb 28, 2021
commit c75f5f372db052cd8a190645b169b640c845bec5
34 changes: 15 additions & 19 deletions src/base64-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,17 @@ bool base64_decode_group_slow(char* const dst, const size_t dstlen,
size_t* const i, size_t* const k) {
uint8_t hi;
uint8_t lo;
#define V(expr) \
for (;;) { \
const uint8_t c = src[*i]; \
lo = unbase64(c); \
*i += 1; \
if (lo < 64) \
break; /* Legal character. */ \
if (c == '=' || *i >= srclen) \
return false; /* Stop decoding. */ \
} \
expr; \
if (*i >= srclen) \
return false; \
if (*k >= dstlen) \
return false; \
#define V(expr) \
for (;;) { \
const uint8_t c = static_cast<uint8_t>(src[*i]); \
lo = unbase64(c); \
*i += 1; \
if (lo < 64) break; /* Legal character. */ \
if (c == '=' || *i >= srclen) return false; /* Stop decoding. */ \
} \
expr; \
if (*i >= srclen) return false; \
if (*k >= dstlen) return false; \
hi = lo;
V(/* Nothing. */);
V(dst[(*k)++] = ((hi & 0x3F) << 2) | ((lo & 0x30) >> 4));
Expand All @@ -66,10 +62,10 @@ size_t base64_decode_fast(char* const dst, const size_t dstlen,
size_t k = 0;
while (i < max_i && k < max_k) {
const unsigned char txt[] = {
static_cast<unsigned char>(unbase64(src[i + 0])),
static_cast<unsigned char>(unbase64(src[i + 1])),
static_cast<unsigned char>(unbase64(src[i + 2])),
static_cast<unsigned char>(unbase64(src[i + 3])),
static_cast<unsigned char>(unbase64(static_cast<uint8_t>(src[i + 0]))),
static_cast<unsigned char>(unbase64(static_cast<uint8_t>(src[i + 1]))),
static_cast<unsigned char>(unbase64(static_cast<uint8_t>(src[i + 2]))),
static_cast<unsigned char>(unbase64(static_cast<uint8_t>(src[i + 3]))),
};

const uint32_t v = ReadUint32BE(txt);
Expand Down
20 changes: 12 additions & 8 deletions src/crypto/crypto_dsa.cc
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,18 @@ Maybe<bool> GetDsaKeyDetail(
size_t modulus_length = BN_num_bytes(p) * CHAR_BIT;
size_t divisor_length = BN_num_bytes(q) * CHAR_BIT;

if (target->Set(
env->context(),
env->modulus_length_string(),
Number::New(env->isolate(), modulus_length)).IsNothing() ||
target->Set(
env->context(),
env->divisor_length_string(),
Number::New(env->isolate(), divisor_length)).IsNothing()) {
if (target
->Set(
env->context(),
env->modulus_length_string(),
Number::New(env->isolate(), static_cast<double>(modulus_length)))
.IsNothing() ||
target
->Set(
env->context(),
env->divisor_length_string(),
Number::New(env->isolate(), static_cast<double>(divisor_length)))
.IsNothing()) {
return Nothing<bool>();
}

Expand Down
3 changes: 2 additions & 1 deletion src/crypto/crypto_keygen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ Maybe<bool> SecretKeyGenTraits::AdditionalConfig(
SecretKeyGenConfig* params) {
Environment* env = Environment::GetCurrent(args);
CHECK(args[*offset]->IsUint32());
params->length = std::trunc(args[*offset].As<Uint32>()->Value() / CHAR_BIT);
params->length = static_cast<size_t>(
std::trunc(args[*offset].As<Uint32>()->Value() / CHAR_BIT));
if (params->length > INT_MAX) {
const std::string msg{
SPrintF("length must be less than or equal to %s bits",
Expand Down
7 changes: 3 additions & 4 deletions src/crypto/crypto_keys.cc
Original file line number Diff line number Diff line change
Expand Up @@ -529,10 +529,9 @@ Maybe<bool> GetSecretKeyDetail(
// converted to bits.

size_t length = key->GetSymmetricKeySize() * CHAR_BIT;
return target->Set(
env->context(),
env->length_string(),
Number::New(env->isolate(), length));
return target->Set(env->context(),
env->length_string(),
Number::New(env->isolate(), static_cast<double>(length)));
}

Maybe<bool> GetAsymmetricKeyDetail(
Expand Down
10 changes: 6 additions & 4 deletions src/crypto/crypto_rsa.cc
Original file line number Diff line number Diff line change
Expand Up @@ -532,10 +532,12 @@ Maybe<bool> GetRsaKeyDetail(

size_t modulus_length = BN_num_bytes(n) * CHAR_BIT;

if (target->Set(
env->context(),
env->modulus_length_string(),
Number::New(env->isolate(), modulus_length)).IsNothing()) {
if (target
->Set(
env->context(),
env->modulus_length_string(),
Number::New(env->isolate(), static_cast<double>(modulus_length)))
.IsNothing()) {
return Nothing<bool>();
}

Expand Down
27 changes: 15 additions & 12 deletions src/inspector/worker_inspector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace {
class WorkerStartedRequest : public Request {
public:
WorkerStartedRequest(
int id,
uint64_t id,
const std::string& url,
std::shared_ptr<node::inspector::MainThreadHandle> worker_thread,
bool waiting)
Expand All @@ -28,7 +28,7 @@ class WorkerStartedRequest : public Request {
return "Worker " + std::to_string(id);
}

int id_;
uint64_t id_;
WorkerInfo info_;
bool waiting_;
};
Expand All @@ -42,22 +42,25 @@ void Report(const std::unique_ptr<WorkerDelegate>& delegate,

class WorkerFinishedRequest : public Request {
public:
explicit WorkerFinishedRequest(int worker_id) : worker_id_(worker_id) {}
explicit WorkerFinishedRequest(uint64_t worker_id) : worker_id_(worker_id) {}

void Call(MainThreadInterface* thread) override {
thread->inspector_agent()->GetWorkerManager()->WorkerFinished(worker_id_);
}

private:
int worker_id_;
uint64_t worker_id_;
};
} // namespace


ParentInspectorHandle::ParentInspectorHandle(
int id, const std::string& url,
std::shared_ptr<MainThreadHandle> parent_thread, bool wait_for_connect)
: id_(id), url_(url), parent_thread_(parent_thread),
uint64_t id,
const std::string& url,
std::shared_ptr<MainThreadHandle> parent_thread,
bool wait_for_connect)
: id_(id),
url_(url),
parent_thread_(parent_thread),
wait_(wait_for_connect) {}

ParentInspectorHandle::~ParentInspectorHandle() {
Expand All @@ -78,11 +81,11 @@ std::unique_ptr<inspector::InspectorSession> ParentInspectorHandle::Connect(
return parent_thread_->Connect(std::move(delegate), prevent_shutdown);
}

void WorkerManager::WorkerFinished(int session_id) {
void WorkerManager::WorkerFinished(uint64_t session_id) {
children_.erase(session_id);
}

void WorkerManager::WorkerStarted(int session_id,
void WorkerManager::WorkerStarted(uint64_t session_id,
const WorkerInfo& info,
bool waiting) {
if (info.worker_thread->Expired())
Expand All @@ -93,8 +96,8 @@ void WorkerManager::WorkerStarted(int session_id,
}
}

std::unique_ptr<ParentInspectorHandle>
WorkerManager::NewParentHandle(int thread_id, const std::string& url) {
std::unique_ptr<ParentInspectorHandle> WorkerManager::NewParentHandle(
uint64_t thread_id, const std::string& url) {
bool wait = !delegates_waiting_on_start_.empty();
return std::make_unique<ParentInspectorHandle>(thread_id, url, thread_, wait);
}
Expand Down
15 changes: 8 additions & 7 deletions src/inspector/worker_inspector.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@ struct WorkerInfo {

class ParentInspectorHandle {
public:
ParentInspectorHandle(int id, const std::string& url,
ParentInspectorHandle(uint64_t id,
const std::string& url,
std::shared_ptr<MainThreadHandle> parent_thread,
bool wait_for_connect);
~ParentInspectorHandle();
std::unique_ptr<ParentInspectorHandle> NewParentInspectorHandle(
int thread_id, const std::string& url) {
uint64_t thread_id, const std::string& url) {
return std::make_unique<ParentInspectorHandle>(thread_id,
url,
parent_thread_,
Expand All @@ -75,7 +76,7 @@ class ParentInspectorHandle {
bool prevent_shutdown);

private:
int id_;
uint64_t id_;
std::string url_;
std::shared_ptr<MainThreadHandle> parent_thread_;
bool wait_;
Expand All @@ -87,9 +88,9 @@ class WorkerManager : public std::enable_shared_from_this<WorkerManager> {
: thread_(thread) {}

std::unique_ptr<ParentInspectorHandle> NewParentHandle(
int thread_id, const std::string& url);
void WorkerStarted(int session_id, const WorkerInfo& info, bool waiting);
void WorkerFinished(int session_id);
uint64_t thread_id, const std::string& url);
void WorkerStarted(uint64_t session_id, const WorkerInfo& info, bool waiting);
void WorkerFinished(uint64_t session_id);
std::unique_ptr<WorkerManagerEventHandle> SetAutoAttach(
std::unique_ptr<WorkerDelegate> attach_delegate);
void SetWaitOnStartForDelegate(int id, bool wait);
Expand All @@ -100,7 +101,7 @@ class WorkerManager : public std::enable_shared_from_this<WorkerManager> {

private:
std::shared_ptr<MainThreadHandle> thread_;
std::unordered_map<int, WorkerInfo> children_;
std::unordered_map<uint64_t, WorkerInfo> children_;
std::unordered_map<int, std::unique_ptr<WorkerDelegate>> delegates_;
// If any one needs it, workers stop for all
std::unordered_set<int> delegates_waiting_on_start_;
Expand Down
4 changes: 2 additions & 2 deletions src/inspector_agent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ class NodeInspectorClient : public V8InspectorClient {
timers_.emplace(std::piecewise_construct, std::make_tuple(data),
std::make_tuple(env_, [=]() { callback(data); }));
CHECK(result.second);
uint64_t interval = 1000 * interval_s;
uint64_t interval = static_cast<uint64_t>(1000 * interval_s);
result.first->second.Update(interval, interval);
}

Expand Down Expand Up @@ -917,7 +917,7 @@ void Agent::SetParentHandle(
}

std::unique_ptr<ParentInspectorHandle> Agent::GetParentHandle(
int thread_id, const std::string& url) {
uint64_t thread_id, const std::string& url) {
if (!parent_handle_) {
return client_->getWorkerManager()->NewParentHandle(thread_id, url);
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/inspector_agent.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class Agent {

void SetParentHandle(std::unique_ptr<ParentInspectorHandle> parent_handle);
std::unique_ptr<ParentInspectorHandle> GetParentHandle(
int thread_id, const std::string& url);
uint64_t thread_id, const std::string& url);

// Called to create inspector sessions that can be used from the same thread.
// The inspector responds by using the delegate to send messages back.
Expand Down
2 changes: 1 addition & 1 deletion src/node_serdes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ void DeserializerContext::ReadRawBytes(
CHECK_GE(position, ctx->data_);
CHECK_LE(position + length, ctx->data_ + ctx->length_);

const uint32_t offset = position - ctx->data_;
const uint32_t offset = static_cast<uint32_t>(position - ctx->data_);
CHECK_EQ(ctx->data_ + offset, position);

args.GetReturnValue().Set(offset);
Expand Down
9 changes: 5 additions & 4 deletions src/node_url.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 4 additions & 2 deletions src/node_wasi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,8 @@ void WASI::ArgsGet(const FunctionCallbackInfo<Value>& args) {

if (err == UVWASI_ESUCCESS) {
for (size_t i = 0; i < wasi->uvw_.argc; i++) {
uint32_t offset = argv_buf_offset + (argv[i] - argv[0]);
uint32_t offset =
static_cast<uint32_t>(argv_buf_offset + (argv[i] - argv[0]));
uvwasi_serdes_write_uint32_t(memory,
argv_offset +
(i * UVWASI_SERDES_SIZE_uint32_t),
Expand Down Expand Up @@ -410,7 +411,8 @@ void WASI::EnvironGet(const FunctionCallbackInfo<Value>& args) {

if (err == UVWASI_ESUCCESS) {
for (size_t i = 0; i < wasi->uvw_.envc; i++) {
uint32_t offset = environ_buf_offset + (environment[i] - environment[0]);
uint32_t offset = static_cast<uint32_t>(
environ_buf_offset + (environment[i] - environment[0]));

uvwasi_serdes_write_uint32_t(memory,
environ_offset +
Expand Down
2 changes: 1 addition & 1 deletion src/signal_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class SignalWrap : public HandleWrap {

void DecreaseSignalHandlerCount(int signum) {
Mutex::ScopedLock lock(handled_signals_mutex);
int new_handler_count = --handled_signals[signum];
int64_t new_handler_count = --handled_signals[signum];
CHECK_GE(new_handler_count, 0);
if (new_handler_count == 0)
handled_signals.erase(signum);
Expand Down
2 changes: 1 addition & 1 deletion src/stream_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ MaybeLocal<Value> StreamBase::CallJSOnreadMethod(ssize_t nread,
}
}

env->stream_base_state()[kReadBytesOrError] = nread;
env->stream_base_state()[kReadBytesOrError] = static_cast<int32_t>(nread);
env->stream_base_state()[kArrayBufferOffset] = offset;

Local<Value> argv[] = {
Expand Down
4 changes: 2 additions & 2 deletions src/string_bytes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ static size_t hex_decode(char* buf,
const size_t srcLen) {
size_t i;
for (i = 0; i < len && i * 2 + 1 < srcLen; ++i) {
unsigned a = unhex(src[i * 2 + 0]);
unsigned b = unhex(src[i * 2 + 1]);
unsigned a = unhex(static_cast<uint8_t>(src[i * 2 + 0]));
unsigned b = unhex(static_cast<uint8_t>(src[i * 2 + 1]));
if (!~a || !~b)
return i;
buf[i] = (a << 4) | b;
Expand Down
11 changes: 5 additions & 6 deletions src/udp_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ void UDPWrap::DoSend(const FunctionCallbackInfo<Value>& args, int family) {
wrap->current_send_has_callback_ =
sendto ? args[5]->IsTrue() : args[3]->IsTrue();

err = wrap->Send(*bufs, count, addr);
err = static_cast<int>(wrap->Send(*bufs, count, addr));

wrap->current_send_req_wrap_.Clear();
wrap->current_send_has_callback_ = false;
Expand Down Expand Up @@ -705,11 +705,10 @@ void UDPWrap::OnRecv(ssize_t nread,
Context::Scope context_scope(env->context());

Local<Value> argv[] = {
Integer::New(env->isolate(), nread),
object(),
Undefined(env->isolate()),
Undefined(env->isolate())
};
Integer::New(env->isolate(), static_cast<int32_t>(nread)),
object(),
Undefined(env->isolate()),
Undefined(env->isolate())};

if (nread < 0) {
MakeCallback(env->onmessage_string(), arraysize(argv), argv);
Expand Down