From 157fee080c1fb5aa70bc20806706b10eca341d79 Mon Sep 17 00:00:00 2001 From: Kenvin Davies Date: Mon, 12 Mar 2018 20:59:38 -0700 Subject: [PATCH] test: fix MSVC warning C4244 in tests Fixes `warning C4244: 'argument': conversion from '::size_t' to 'double', possible loss of data` issues in `number` and `dataview` tests. PR-URL: https://github.com/nodejs/node-addon-api/pull/236 Reviewed-By: Michael Dawson --- test/basic_types/number.cc | 3 ++- test/dataview/dataview.cc | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/test/basic_types/number.cc b/test/basic_types/number.cc index b156749..2884603 100644 --- a/test/basic_types/number.cc +++ b/test/basic_types/number.cc @@ -13,7 +13,8 @@ Value ToUint32(const CallbackInfo& info) { } Value ToInt64(const CallbackInfo& info) { - return Number::New(info.Env(), info[0].As().Int64Value()); + return Number::New(info.Env(), + static_cast(info[0].As().Int64Value())); } Value ToFloat(const CallbackInfo& info) { diff --git a/test/dataview/dataview.cc b/test/dataview/dataview.cc index fced805..f055d95 100644 --- a/test/dataview/dataview.cc +++ b/test/dataview/dataview.cc @@ -25,11 +25,13 @@ static Value GetArrayBuffer(const CallbackInfo& info) { } static Value GetByteOffset(const CallbackInfo& info) { - return Number::New(info.Env(), info[0].As().ByteOffset()); + return Number::New(info.Env(), + static_cast(info[0].As().ByteOffset())); } static Value GetByteLength(const CallbackInfo& info) { - return Number::New(info.Env(), info[0].As().ByteLength()); + return Number::New(info.Env(), + static_cast(info[0].As().ByteLength())); } Object InitDataView(Env env) {