Skip to content
This repository was archived by the owner on Oct 18, 2023. It is now read-only.

Commit 50abad2

Browse files
update nan and fix some deprecated value conversions
1 parent 8124347 commit 50abad2

File tree

21 files changed

+79
-79
lines changed

21 files changed

+79
-79
lines changed

cc/core/Mat.cc

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ NAN_METHOD(Mat::New) {
153153
/* data array, type */
154154
else if (info.Length() == 2 && info[0]->IsArray() && info[1]->IsInt32()) {
155155
FF_ARR rowArray = FF_ARR::Cast(info[0]);
156-
int type = info[1]->Int32Value();
156+
int type = info[1]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value();
157157

158158
long numCols = -1;
159159
for (uint i = 0; i < rowArray->Length(); i++) {
@@ -173,8 +173,8 @@ NAN_METHOD(Mat::New) {
173173
}
174174
/* row, col, type */
175175
else if (info[0]->IsNumber() && info[1]->IsNumber() && info[2]->IsInt32()) {
176-
int type = info[2]->Int32Value();
177-
cv::Mat mat(info[0]->Int32Value(), info[1]->Int32Value(), type);
176+
int type = info[2]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value();
177+
cv::Mat mat(info[0]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value(), info[1]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value(), type);
178178
/* fill vector */
179179
// TODO by Vec
180180
if (info[3]->IsArray()) {
@@ -194,9 +194,9 @@ NAN_METHOD(Mat::New) {
194194
}
195195
/* raw data, row, col, type */
196196
else if (info.Length() == 4 && info[1]->IsNumber() && info[2]->IsNumber() && info[3]->IsInt32()) {
197-
int type = info[3]->Int32Value();
197+
int type = info[3]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value();
198198
char *data = static_cast<char *>(node::Buffer::Data(info[0]->ToObject()));
199-
cv::Mat mat(info[1]->Int32Value(), info[2]->Int32Value(), type);
199+
cv::Mat mat(info[1]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value(), info[2]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value(), type);
200200
size_t size = mat.rows * mat.cols * mat.elemSize();
201201
memcpy(mat.data, data, size);
202202
self->setNativeProps(mat);
@@ -244,8 +244,8 @@ NAN_METHOD(Mat::At) {
244244
}
245245
FF_MAT_APPLY_TYPED_OPERATOR(matSelf, val, matSelf.type(), FF_MAT_AT_ARRAY, FF::matGet);
246246
} else {
247-
FF_ASSERT_INDEX_RANGE(info[0]->Int32Value(), matSelf.size[0] - 1, "Mat::At row");
248-
FF_ASSERT_INDEX_RANGE(info[1]->Int32Value(), matSelf.size[1] - 1, "Mat::At col");
247+
FF_ASSERT_INDEX_RANGE(info[0]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value(), matSelf.size[0] - 1, "Mat::At row");
248+
FF_ASSERT_INDEX_RANGE(info[1]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value(), matSelf.size[1] - 1, "Mat::At col");
249249
FF_MAT_APPLY_TYPED_OPERATOR(matSelf, val, matSelf.type(), FF_MAT_AT, FF::matGet);
250250
}
251251

@@ -254,15 +254,15 @@ NAN_METHOD(Mat::At) {
254254
FF_OBJ jsVec;
255255
if (vec->Length() == 2) {
256256
jsVec = FF_NEW_INSTANCE(Vec2::constructor);
257-
FF_UNWRAP_VEC2(jsVec)->vec = cv::Vec2d(vec->Get(0)->NumberValue(), vec->Get(1)->NumberValue());
257+
FF_UNWRAP_VEC2(jsVec)->vec = cv::Vec2d(vec->Get(0)->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value(), vec->Get(1)->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value());
258258
}
259259
else if (vec->Length() == 3) {
260260
jsVec = FF_NEW_INSTANCE(Vec3::constructor);
261-
FF_UNWRAP_VEC3(jsVec)->vec = cv::Vec3d(vec->Get(0)->NumberValue(), vec->Get(1)->NumberValue(), vec->Get(2)->NumberValue());
261+
FF_UNWRAP_VEC3(jsVec)->vec = cv::Vec3d(vec->Get(0)->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value(), vec->Get(1)->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value(), vec->Get(2)->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value());
262262
}
263263
else {
264264
jsVec = FF_NEW_INSTANCE(Vec4::constructor);
265-
FF_UNWRAP_VEC4(jsVec)->vec = cv::Vec4d(vec->Get(0)->NumberValue(), vec->Get(1)->NumberValue(), vec->Get(2)->NumberValue(), vec->Get(3)->NumberValue());
265+
FF_UNWRAP_VEC4(jsVec)->vec = cv::Vec4d(vec->Get(0)->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value(), vec->Get(1)->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value(), vec->Get(2)->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value(), vec->Get(3)->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value());
266266
}
267267
jsVal = jsVec;
268268
}
@@ -275,8 +275,8 @@ NAN_METHOD(Mat::At) {
275275
NAN_METHOD(Mat::AtRaw) {
276276
FF_METHOD_CONTEXT("Mat::AtRaw");
277277
cv::Mat matSelf = FF_UNWRAP_MAT_AND_GET(info.This());
278-
FF_ASSERT_INDEX_RANGE(info[0]->Int32Value(), matSelf.size[0] - 1, "Mat::At row");
279-
FF_ASSERT_INDEX_RANGE(info[1]->Int32Value(), matSelf.size[1] - 1, "Mat::At col");
278+
FF_ASSERT_INDEX_RANGE(info[0]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value(), matSelf.size[0] - 1, "Mat::At row");
279+
FF_ASSERT_INDEX_RANGE(info[1]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value(), matSelf.size[1] - 1, "Mat::At col");
280280
v8::Local<v8::Value> val;
281281
FF_MAT_APPLY_TYPED_OPERATOR(matSelf, val, matSelf.type(), FF_MAT_AT, FF::matGet);
282282
FF_RETURN(val);
@@ -285,8 +285,8 @@ NAN_METHOD(Mat::AtRaw) {
285285
NAN_METHOD(Mat::Set) {
286286
FF_METHOD_CONTEXT("Mat::Set");
287287
cv::Mat matSelf = FF_UNWRAP_MAT_AND_GET(info.This());
288-
FF_ASSERT_INDEX_RANGE(info[0]->Int32Value(), matSelf.size[0] - 1, "Mat::At row");
289-
FF_ASSERT_INDEX_RANGE(info[1]->Int32Value(), matSelf.size[1] - 1, "Mat::At col");
288+
FF_ASSERT_INDEX_RANGE(info[0]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value(), matSelf.size[0] - 1, "Mat::At row");
289+
FF_ASSERT_INDEX_RANGE(info[1]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value(), matSelf.size[1] - 1, "Mat::At col");
290290

291291
int cn = matSelf.channels();
292292
if (info[2]->IsArray()) {
@@ -406,7 +406,7 @@ NAN_METHOD(Mat::Row) {
406406
if (!info[0]->IsNumber()) {
407407
return Nan::ThrowError("usage: row(int r)");
408408
}
409-
int r = (int)info[0]->NumberValue();
409+
int r = (int)info[0]->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value();
410410
cv::Mat mat = Nan::ObjectWrap::Unwrap<Mat>(info.This())->mat;
411411
FF_ARR row = FF_NEW_ARRAY(mat.cols);
412412
try {

cc/core/Point.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ NAN_METHOD(Point::New) {
3838
if (info.Length() < 2) {
3939
return Nan::ThrowError("Point::New - expected arguments x, y, (z)");
4040
}
41-
double x = info[0]->NumberValue();
42-
double y = info[1]->NumberValue();
41+
double x = info[0]->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value();
42+
double y = info[1]->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value();
4343
v8::Local<v8::Object> jsPoint;
4444
if (info.Length() == 3) {
45-
double z = info[2]->NumberValue();
45+
double z = info[2]->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value();
4646
jsPoint = Nan::NewInstance(Nan::New(Point3::constructor)->GetFunction()).ToLocalChecked();
4747
Nan::ObjectWrap::Unwrap<Point3>(jsPoint)->pt = cv::Point3d(x, y, z);
4848
}

cc/core/Point2.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ class Point2 : public Nan::ObjectWrap {
3131

3232
static NAN_METHOD(At) {
3333
FF_METHOD_CONTEXT("Point2::At");
34-
FF_ASSERT_INDEX_RANGE(info[0]->Int32Value(), 1, "Point2");
34+
FF_ASSERT_INDEX_RANGE(info[0]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value(), 1, "Point2");
3535
cv::Point2d ptSelf = FF_UNWRAP_PT2_AND_GET(info.This());
3636
const double coords[] = { ptSelf.x, ptSelf.y };
37-
info.GetReturnValue().Set(coords[info[0]->Uint32Value()]);
37+
info.GetReturnValue().Set(coords[info[0]->ToUint32(Nan::GetCurrentContext()).ToLocalChecked()->Value()]);
3838
}
3939

4040
static Nan::Persistent<v8::FunctionTemplate> constructor;

cc/core/Point3.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ class Point3 : public Nan::ObjectWrap {
3232

3333
static NAN_METHOD(At) {
3434
FF_METHOD_CONTEXT("Point3::At");
35-
FF_ASSERT_INDEX_RANGE(info[0]->Int32Value(), 2, "Point3");
35+
FF_ASSERT_INDEX_RANGE(info[0]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value(), 2, "Point3");
3636
cv::Point3d ptSelf = FF_UNWRAP_PT3_AND_GET(info.This());
3737
const double coords[] = { ptSelf.x, ptSelf.y, ptSelf.z };
38-
info.GetReturnValue().Set(coords[info[0]->Int32Value()]);
38+
info.GetReturnValue().Set(coords[info[0]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value()]);
3939
}
4040

4141
static Nan::Persistent<v8::FunctionTemplate> constructor;

cc/core/Rect.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ NAN_METHOD(Rect::New) {
3434
if (info.Length() < 4) {
3535
return Nan::ThrowError("Rect::New - expected arguments x, y, width, height");
3636
}
37-
double x = info[0]->NumberValue();
38-
double y = info[1]->NumberValue();
39-
double width = info[2]->NumberValue();
40-
double height = info[3]->NumberValue();
37+
double x = info[0]->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value();
38+
double y = info[1]->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value();
39+
double width = info[2]->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value();
40+
double height = info[3]->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value();
4141
self->rect = cv::Rect2d(x, y, width, height);
4242
}
4343
self->Wrap(info.Holder());

cc/core/RotatedRect.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ NAN_METHOD(RotatedRect::New) {
3131
if (!FF_IS_INSTANCE(Size::constructor, info[1])) {
3232
return Nan::ThrowError("RotatedRect::New - expected arg1 to be an instance of Size");
3333
}
34-
double angle = info[2]->NumberValue();
34+
double angle = info[2]->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value();
3535

3636
self->rect = cv::RotatedRect(
3737
FF_UNWRAP_PT2_AND_GET(info[0]->ToObject()),

cc/core/Size.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ NAN_METHOD(Size::New) {
2020
if (info.Length() < 2) {
2121
return Nan::ThrowError("Size::New - expected arguments width, height");
2222
}
23-
double width = info[0]->NumberValue();
24-
double height = info[1]->NumberValue();
23+
double width = info[0]->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value();
24+
double height = info[1]->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value();
2525
self->size = cv::Size2d(width, height);
2626
}
2727
self->Wrap(info.Holder());

cc/core/Vec.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,16 @@ NAN_METHOD(Vec::New) {
5858
v8::Local<v8::Function> ct = Nan::New(Vec4::constructor)->GetFunction();
5959
jsVec = Nan::NewInstance(ct).ToLocalChecked();
6060
Nan::ObjectWrap::Unwrap<Vec4>(jsVec)->vec = cv::Vec4d(
61-
info[0]->NumberValue(),
62-
info[1]->NumberValue(),
63-
info[2]->NumberValue(),
64-
info[3]->NumberValue()
61+
info[0]->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value(),
62+
info[1]->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value(),
63+
info[2]->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value(),
64+
info[3]->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value()
6565
);
6666
} else {
67-
double x = info[0]->NumberValue();
68-
double y = info[1]->NumberValue();
67+
double x = info[0]->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value();
68+
double y = info[1]->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value();
6969
if (info.Length() == 3) {
70-
double z = info[2]->NumberValue();
70+
double z = info[2]->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value();
7171
jsVec = Nan::NewInstance(Nan::New(Vec3::constructor)->GetFunction()).ToLocalChecked();
7272
Nan::ObjectWrap::Unwrap<Vec3>(jsVec)->vec = cv::Vec3d(x, y, z);
7373
}

cc/core/Vec2.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ class Vec2 : public Nan::ObjectWrap {
3333

3434
static NAN_METHOD(At) {
3535
FF_METHOD_CONTEXT("Vec2::At");
36-
FF_ASSERT_INDEX_RANGE(info[0]->Int32Value(), 1, "Vec2");
36+
FF_ASSERT_INDEX_RANGE(info[0]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value(), 1, "Vec2");
3737
cv::Vec2d vecSelf = FF_UNWRAP_VEC2_AND_GET(info.This());
38-
info.GetReturnValue().Set(vecSelf[info[0]->Uint32Value()]);
38+
info.GetReturnValue().Set(vecSelf[info[0]->ToUint32(Nan::GetCurrentContext()).ToLocalChecked()->Value()]);
3939
}
4040

4141
static Nan::Persistent<v8::FunctionTemplate> constructor;

cc/core/Vec3.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ class Vec3 : public Nan::ObjectWrap {
3737

3838
static NAN_METHOD(At) {
3939
FF_METHOD_CONTEXT("Vec3::At");
40-
FF_ASSERT_INDEX_RANGE(info[0]->Int32Value(), 2, "Vec3");
40+
FF_ASSERT_INDEX_RANGE(info[0]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value(), 2, "Vec3");
4141
cv::Vec3d vecSelf = FF_UNWRAP_VEC3_AND_GET(info.This());
42-
info.GetReturnValue().Set(vecSelf[info[0]->Int32Value()]);
42+
info.GetReturnValue().Set(vecSelf[info[0]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value()]);
4343
}
4444

4545
static Nan::Persistent<v8::FunctionTemplate> constructor;

cc/core/Vec4.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ class Vec4 : public Nan::ObjectWrap {
3535

3636
static NAN_METHOD(At) {
3737
FF_METHOD_CONTEXT("Vec4::At");
38-
FF_ASSERT_INDEX_RANGE(info[0]->Int32Value(), 3, "Vec4");
38+
FF_ASSERT_INDEX_RANGE(info[0]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value(), 3, "Vec4");
3939
cv::Vec4d vecSelf = FF_UNWRAP_VEC4_AND_GET(info.This());
40-
info.GetReturnValue().Set(vecSelf[info[0]->Int32Value()]);
40+
info.GetReturnValue().Set(vecSelf[info[0]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value()]);
4141
}
4242

4343
static Nan::Persistent<v8::FunctionTemplate> constructor;

cc/core/coreUtils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
applyFunc( \
3838
func, \
3939
unwrapper(info.This()), \
40-
info[0]->NumberValue(), \
40+
info[0]->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value(), \
4141
unwrapper(jsObj) \
4242
); \
4343
return info.GetReturnValue().Set(jsObj);

cc/core/matUtils.h

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
#define FF_MAT_AT(mat, val, get) \
88
if (mat.dims > 2) \
9-
val = get(mat, info[0]->Int32Value(), info[1]->Int32Value(), info[2]->Int32Value()); \
9+
val = get(mat, info[0]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value(), info[1]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value(), info[2]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value()); \
1010
else \
11-
val = get(mat, info[0]->Int32Value(), info[1]->Int32Value());
11+
val = get(mat, info[0]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value(), info[1]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value());
1212

1313
#define FF_MAT_AT_ARRAY(mat, val, get) \
1414
{ \
@@ -19,9 +19,9 @@
1919

2020
#define FF_MAT_SET(mat, val, put) \
2121
if (mat.dims > 2) \
22-
put(mat, val, info[0]->Int32Value(), info[1]->Int32Value(), info[2]->Int32Value()); \
22+
put(mat, val, info[0]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value(), info[1]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value(), info[2]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value()); \
2323
else \
24-
put(mat, val, info[0]->Int32Value(), info[1]->Int32Value());
24+
put(mat, val, info[0]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value(), info[1]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value());
2525

2626
#define FF_MAT_FILL(mat, vec, put) \
2727
for (int r = 0; r < mat.rows; r++) { \
@@ -161,71 +161,71 @@
161161
namespace FF {
162162
template<typename type>
163163
static inline void matPutVal(cv::Mat mat, v8::Local<v8::Value> value, int r, int c) {
164-
mat.at<type>(r, c) = (type)value->NumberValue();
164+
mat.at<type>(r, c) = (type)value->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value();
165165
}
166166

167167
template<typename type>
168168
static inline void matPutVal(cv::Mat mat, v8::Local<v8::Value> value, int r, int c, int z) {
169-
mat.at<type>(r, c, z) = (type)value->NumberValue();
169+
mat.at<type>(r, c, z) = (type)value->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value();
170170
}
171171

172172
template<typename type>
173173
static inline void matPutVec2(cv::Mat mat, v8::Local<v8::Value> vector, int r, int c) {
174174
v8::Local<v8::Array> vec = v8::Local<v8::Array>::Cast(vector);
175175
mat.at< cv::Vec<type, 2> >(r, c) = cv::Vec<type, 2>(
176-
(type)vec->Get(0)->NumberValue(),
177-
(type)vec->Get(1)->NumberValue()
176+
(type)vec->Get(0)->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value(),
177+
(type)vec->Get(1)->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value()
178178
);
179179
}
180180

181181
template<typename type>
182182
static inline void matPutVec2(cv::Mat mat, v8::Local<v8::Value> vector, int r, int c, int z) {
183183
v8::Local<v8::Array> vec = v8::Local<v8::Array>::Cast(vector);
184184
mat.at< cv::Vec<type, 2> >(r, c, z) = cv::Vec<type, 2>(
185-
(type)vec->Get(0)->NumberValue(),
186-
(type)vec->Get(1)->NumberValue()
185+
(type)vec->Get(0)->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value(),
186+
(type)vec->Get(1)->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value()
187187
);
188188
}
189189

190190
template<typename type>
191191
static inline void matPutVec3(cv::Mat mat, v8::Local<v8::Value> vector, int r, int c) {
192192
v8::Local<v8::Array> vec = v8::Local<v8::Array>::Cast(vector);
193193
mat.at< cv::Vec<type, 3> >(r, c) = cv::Vec<type, 3>(
194-
(type)vec->Get(0)->NumberValue(),
195-
(type)vec->Get(1)->NumberValue(),
196-
(type)vec->Get(2)->NumberValue()
194+
(type)vec->Get(0)->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value(),
195+
(type)vec->Get(1)->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value(),
196+
(type)vec->Get(2)->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value()
197197
);
198198
}
199199

200200
template<typename type>
201201
static inline void matPutVec3(cv::Mat mat, v8::Local<v8::Value> vector, int r, int c, int z) {
202202
v8::Local<v8::Array> vec = v8::Local<v8::Array>::Cast(vector);
203203
mat.at< cv::Vec<type, 3> >(r, c, z) = cv::Vec<type, 3>(
204-
(type)vec->Get(0)->NumberValue(),
205-
(type)vec->Get(1)->NumberValue(),
206-
(type)vec->Get(2)->NumberValue()
204+
(type)vec->Get(0)->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value(),
205+
(type)vec->Get(1)->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value(),
206+
(type)vec->Get(2)->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value()
207207
);
208208
}
209209

210210
template<typename type>
211211
static inline void matPutVec4(cv::Mat mat, v8::Local<v8::Value> vector, int r, int c) {
212212
v8::Local<v8::Array> vec = v8::Local<v8::Array>::Cast(vector);
213213
mat.at< cv::Vec<type, 4> >(r, c) = cv::Vec<type, 4>(
214-
(type)vec->Get(0)->NumberValue(),
215-
(type)vec->Get(1)->NumberValue(),
216-
(type)vec->Get(2)->NumberValue(),
217-
(type)vec->Get(3)->NumberValue()
214+
(type)vec->Get(0)->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value(),
215+
(type)vec->Get(1)->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value(),
216+
(type)vec->Get(2)->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value(),
217+
(type)vec->Get(3)->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value()
218218
);
219219
}
220220

221221
template<typename type>
222222
static inline void matPutVec4(cv::Mat mat, v8::Local<v8::Value> vector, int r, int c, int z) {
223223
v8::Local<v8::Array> vec = v8::Local<v8::Array>::Cast(vector);
224224
mat.at< cv::Vec<type, 4> >(r, c, z) = cv::Vec<type, 4>(
225-
(type)vec->Get(0)->NumberValue(),
226-
(type)vec->Get(1)->NumberValue(),
227-
(type)vec->Get(2)->NumberValue(),
228-
(type)vec->Get(3)->NumberValue()
225+
(type)vec->Get(0)->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value(),
226+
(type)vec->Get(1)->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value(),
227+
(type)vec->Get(2)->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value(),
228+
(type)vec->Get(3)->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value()
229229
);
230230
}
231231

cc/modules/features2d/KeyPointMatch.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ NAN_METHOD(KeyPointMatch::New) {
2323
keyPointMatch->setNativeProps(
2424
Nan::ObjectWrap::Unwrap<KeyPoint>(info[0]->ToObject()),
2525
Nan::ObjectWrap::Unwrap<KeyPoint>(info[1]->ToObject()),
26-
(float)info[2]->NumberValue()
26+
(float)info[2]->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value()
2727
);
2828
keyPointMatch->Wrap(info.Holder());
2929
} else {

cc/modules/imgproc/Contour.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ NAN_METHOD(Contour::New) {
5757
FF_ARR jsObj = FF_ARR::Cast(jsPt);
5858
if (jsObj->Length() != 2)
5959
return Nan::ThrowError("Contour::New - expected arg0 to consist of only Point2 or array of length 2");
60-
double x = jsObj->Get(0)->NumberValue();
61-
double y = jsObj->Get(1)->NumberValue();
60+
double x = jsObj->Get(0)->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value();
61+
double y = jsObj->Get(1)->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value();
6262
cv_pt = cv::Point2d(x, y);
6363
}
6464
else if (FF_IS_INSTANCE(Point2::constructor, jsPt)) {

0 commit comments

Comments
 (0)