Skip to content

Commit

Permalink
use alternative overload to work around GCC bug
Browse files Browse the repository at this point in the history
  • Loading branch information
zbjornson committed Jan 5, 2019
1 parent e76076e commit d9ac041
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
3 changes: 2 additions & 1 deletion packages/bindings/src/poller.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#include <nan.h>
#include "./poller.h"

Poller::Poller(int fd) : AsyncResource("node-serialport:poller") {
Poller::Poller(int fd) :
AsyncResource(Nan::New("node-serialport:poller").ToLocalChecked()) {
Nan::HandleScope scope;
this->fd = fd;
this->poll_handle = new uv_poll_t();
Expand Down
18 changes: 12 additions & 6 deletions packages/bindings/src/serialport.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ SerialPortParity ToParityEnum(const v8::Local<v8::String>& str);
SerialPortStopBits ToStopBitEnum(double stopBits);

struct OpenBaton : public Nan::AsyncResource {
OpenBaton() : AsyncResource("node-serialport:OpenBaton") {}
OpenBaton() :
AsyncResource(Nan::New("node-serialport:OpenBaton").ToLocalChecked()) {}
char errorString[ERROR_STRING_SIZE] = "";
Nan::Callback callback;
char path[1024] = "";
Expand All @@ -82,15 +83,17 @@ struct OpenBaton : public Nan::AsyncResource {
};

struct ConnectionOptionsBaton : public Nan::AsyncResource {
ConnectionOptionsBaton() : AsyncResource("node-serialport:ConnectionOptionsBaton") {}
ConnectionOptionsBaton() :
AsyncResource(Nan::New("node-serialport:ConnectionOptionsBaton").ToLocalChecked()) {}
char errorString[ERROR_STRING_SIZE] = "";
Nan::Callback callback;
int fd = 0;
int baudRate = 0;
};

struct SetBaton : public Nan::AsyncResource {
SetBaton() : AsyncResource("node-serialport:SetBaton") {}
SetBaton() :
AsyncResource(Nan::New("node-serialport:SetBaton").ToLocalChecked()) {}
int fd = 0;
Nan::Callback callback;
int result = 0;
Expand All @@ -103,7 +106,8 @@ struct SetBaton : public Nan::AsyncResource {
};

struct GetBaton : public Nan::AsyncResource {
GetBaton() : AsyncResource("node-serialport:GetBaton") {}
GetBaton() :
AsyncResource(Nan::New("node-serialport:GetBaton").ToLocalChecked()) {}
int fd = 0;
Nan::Callback callback;
char errorString[ERROR_STRING_SIZE] = "";
Expand All @@ -113,15 +117,17 @@ struct GetBaton : public Nan::AsyncResource {
};

struct GetBaudRateBaton : public Nan::AsyncResource {
GetBaudRateBaton() : AsyncResource("node-serialport:GetBaudRateBaton") {}
GetBaudRateBaton() :
AsyncResource(Nan::New("node-serialport:GetBaudRateBaton").ToLocalChecked()) {}
int fd = 0;
Nan::Callback callback;
char errorString[ERROR_STRING_SIZE] = "";
int baudRate = 0;
};

struct VoidBaton : public Nan::AsyncResource {
VoidBaton() : AsyncResource("node-serialport:VoidBaton") {}
VoidBaton() :
AsyncResource(Nan::New("node-serialport:VoidBaton").ToLocalChecked()) {}
int fd = 0;
Nan::Callback callback;
char errorString[ERROR_STRING_SIZE] = "";
Expand Down
9 changes: 6 additions & 3 deletions packages/bindings/src/serialport_win.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
#define ERROR_STRING_SIZE 1024

struct WriteBaton : public Nan::AsyncResource {
WriteBaton() : AsyncResource("node-serialport:WriteBaton") {}
WriteBaton() :
AsyncResource(Nan::New("node-serialport:WriteBaton").ToLocalChecked()) {}
int fd = 0;
char* bufferData = "";
size_t bufferLength = 0;
Expand All @@ -31,7 +32,8 @@ DWORD __stdcall WriteThread(LPVOID param);


struct ReadBaton : public Nan::AsyncResource {
ReadBaton() : AsyncResource("node-serialport:ReadBaton") {}
ReadBaton() :
AsyncResource(Nan::New("node-serialport:ReadBaton").ToLocalChecked()) {}
int fd = 0;
char* bufferData = "";
size_t bufferLength = 0;
Expand Down Expand Up @@ -65,7 +67,8 @@ struct ListResultItem {
};

struct ListBaton : public Nan::AsyncResource {
ListBaton() : AsyncResource("node-serialport:ListBaton") {}
ListBaton() :
AsyncResource(Nan::New("node-serialport:ListBaton").ToLocalChecked()) {}
Nan::Callback callback;
std::list<ListResultItem*> results;
char errorString[ERROR_STRING_SIZE] = "";
Expand Down

0 comments on commit d9ac041

Please sign in to comment.