Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

fix serialport build err under unix #730

Merged
merged 1 commit into from
Dec 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 5 additions & 1 deletion vendor/node-usb-native/src/serialport_poller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ NAN_METHOD(SerialportPoller::New) {
}

SerialportPoller* obj = new SerialportPoller();
obj->fd_ = info[0]->ToInt32()->Int32Value();
#if NODE_MAJOR_VERSION >= 10
obj->fd_ = info[0]->ToInt32(v8::Isolate::GetCurrent())->Int32Value();
#else
obj->fd_ = info[0]->ToInt32()->Int32Value();
#endif
obj->callback_ = new Nan::Callback(info[1].As<v8::Function>());
// obj->callCallback();

Expand Down
9 changes: 7 additions & 2 deletions vendor/node-usb-native/src/serialport_unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,13 @@ OpenBatonPlatformOptions* ParsePlatformOptions(const v8::Local<v8::Object>& opti
Nan::HandleScope scope;

UnixPlatformOptions* result = new UnixPlatformOptions();
result->vmin = Nan::Get(options, Nan::New<v8::String>("vmin").ToLocalChecked()).ToLocalChecked()->ToInt32()->Int32Value();
result->vtime = Nan::Get(options, Nan::New<v8::String>("vtime").ToLocalChecked()).ToLocalChecked()->ToInt32()->Int32Value();
#if NODE_MAJOR_VERSION >= 10
result->vmin = Nan::Get(options, Nan::New<v8::String>("vmin").ToLocalChecked()).ToLocalChecked()->ToInt32(v8::Isolate::GetCurrent())->Int32Value();
result->vtime = Nan::Get(options, Nan::New<v8::String>("vtime").ToLocalChecked()).ToLocalChecked()->ToInt32(v8::Isolate::GetCurrent())->Int32Value();
#else
result->vmin = Nan::Get(options, Nan::New<v8::String>("vmin").ToLocalChecked()).ToLocalChecked()->ToInt32()->Int32Value();
result->vtime = Nan::Get(options, Nan::New<v8::String>("vtime").ToLocalChecked()).ToLocalChecked()->ToInt32()->Int32Value();
#endif

return result;
}
Expand Down