Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecated Int32Value for node12 #5

Merged
merged 2 commits into from
Sep 25, 2019
Merged
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
24 changes: 12 additions & 12 deletions src/functions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ class ReceiveMessageWorker : public AsyncWorker {
};

NAN_METHOD(GetMessageQueue) {
key_t key = (key_t) info[0]->Int32Value();
int flags = info[1]->Int32Value();
key_t key = (key_t) Nan::To<int32_t>(info[0]).FromJust();
int flags = Nan::To<int32_t>(info[1]).FromJust();

int queue = msgget(key, flags);

Expand All @@ -133,8 +133,8 @@ NAN_METHOD(GetMessageQueue) {
}

NAN_METHOD(ControlMessageQueue) {
int id = info[0]->Int32Value();
int cmd = info[1]->Int32Value();
int id = Nan::To<int32_t>(info[0]).FromJust();
int cmd = Nan::To<int32_t>(info[1]).FromJust();

msqid_ds *buf;

Expand Down Expand Up @@ -164,7 +164,7 @@ NAN_METHOD(ControlMessageQueue) {
}

NAN_METHOD(CloseMessageQueue) {
int id = info[0]->Int32Value();
int id = Nan::To<int32_t>(info[0]).FromJust();

int ret = msgctl(id, IPC_RMID, nullptr);

Expand All @@ -176,21 +176,21 @@ NAN_METHOD(CloseMessageQueue) {
}

NAN_METHOD(SendMessage) {
int id = info[0]->Int32Value();
int id = Nan::To<int32_t>(info[0]).FromJust();
char* bufferData = node::Buffer::Data(info[1]);
size_t bufferLength = (size_t) node::Buffer::Length(info[1]);
long type = (long) info[2]->Int32Value();
int flags = info[3]->Int32Value();
long type = (long) Nan::To<int32_t>(info[2]).FromJust();
int flags = Nan::To<int32_t>(info[3]).FromJust();
Callback *callback = new Callback(info[4].As<Function>());

AsyncQueueWorker(new SendMessageWorker(callback, id, bufferData, bufferLength, type, flags));
}

NAN_METHOD(ReceiveMessage) {
int id = info[0]->Int32Value();
size_t bufferLength = (size_t) info[1]->Int32Value();
long type = (long) info[2]->Int32Value();
int flags = info[3]->Int32Value();
int id = Nan::To<int32_t>(info[0]).FromJust();
size_t bufferLength = (size_t) Nan::To<int32_t>(info[1]).FromJust();
long type = (long) Nan::To<int32_t>(info[2]).FromJust();
int flags = Nan::To<int32_t>(info[3]).FromJust();
Callback *callback = new Callback(info[4].As<Function>());

AsyncQueueWorker(new ReceiveMessageWorker(callback, id, bufferLength, type, flags));
Expand Down