Skip to content

Commit 7d63e97

Browse files
committed
Merge branch '68ec020-node.js-12' into develop
2 parents 5dcf90a + 705011d commit 7d63e97

File tree

5 files changed

+24
-16
lines changed

5 files changed

+24
-16
lines changed

src/ibdev.cc

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
#include "ibdev.h"
22

33
NAN_METHOD( ibdev ) {
4+
v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext();
45

5-
int board = info[0]->ToInteger()->Value();
6-
int pad = info[1]->ToInteger()->Value();
7-
int sad = info[2]->ToInteger()->Value();
8-
int timeout = info[3]->ToInteger()->Value();
9-
int send_eoi = info[4]->ToInteger()->Value();
10-
int eos = info[5]->ToInteger()->Value();
6+
int board = info[0]->Int32Value(context).FromJust();
7+
int pad = info[1]->Int32Value(context).FromJust();
8+
int sad = info[2]->Int32Value(context).FromJust();
9+
int timeout = info[3]->Int32Value(context).FromJust();
10+
int send_eoi = info[4]->Int32Value(context).FromJust();
11+
int eos = info[5]->Int32Value(context).FromJust();
1112

1213
int ret = ibdev( board, pad, sad, timeout, send_eoi, eos );
1314

src/ibloc.cc

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
NAN_METHOD( ibloc ) {
44

5-
int ud = info[0]->ToInteger()->Value();
5+
v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext();
6+
7+
int ud = info[0]->Int32Value(context).FromJust();
68

79
int ret = ibloc( ud );
810

src/ibonl.cc

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
NAN_METHOD( ibonl ) {
44

5-
int ud = info[0]->ToInteger()->Value();
5+
v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext();
6+
7+
int ud = info[0]->Int32Value(context).FromJust();
68

79
int ret = ibonl( ud, 0 );
810

src/ibrd.cc

+4-2
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,16 @@ class ibrdWorker : public Nan::AsyncWorker {
6868

6969
free( buffer );
7070

71-
callback->Call( 3, argv );
71+
callback->Call( 3, argv, async_resource );
7272

7373
}
7474
};
7575

7676
NAN_METHOD( ibrd ) {
7777

78-
int ud = info[0]->ToInteger()->Value();
78+
v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext();
79+
80+
int ud = info[0]->Int32Value(context).FromJust();
7981

8082
Nan::Callback *callback = new Nan::Callback( info[1].As<v8::Function>() );
8183

src/ibwrt.cc

+7-6
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,20 @@ class ibwrtWorker : public Nan::AsyncWorker {
3232
Nan::New<v8::Number>( bytesWritten )
3333
};
3434

35-
callback->Call( 3, argv );
35+
callback->Call( 3, argv, async_resource );
3636

3737
}
3838
};
3939

4040
NAN_METHOD( ibwrt ) {
41+
v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext();
4142

42-
int ud = info[0]->ToInteger()->Value();
43+
int ud = info[0]->Int32Value(context).FromJust();
4344

44-
v8::Local<v8::String> tmp = info[1]->ToString();
45-
int len = tmp->Length();
46-
char *data = (char *) malloc( tmp->Length() + 1 );
47-
tmp->WriteUtf8( data, len );
45+
v8::Local<v8::String> dataLocal = info[1]->ToString(context).ToLocalChecked();
46+
Nan::Utf8String dataStr(dataLocal);
47+
int len = dataStr.length();
48+
char *data = strdup( *dataStr );
4849

4950
Nan::Callback *callback = new Nan::Callback( info[2].As<v8::Function>() );
5051

0 commit comments

Comments
 (0)