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

Clean up some code #66

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion includes/NativeInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#if defined(_WIN32)
#include "../includes/win32/Controller.h"
using NativeImplementation = Controller;
#elif defined(__APPLE_CC__)
#elif defined(__APPLE__)
#include "../includes/osx/FSEventsService.h"
using NativeImplementation = FSEventsService;
#elif defined(__linux__) || defined(__FreeBSD__)
Expand Down
18 changes: 9 additions & 9 deletions src/NSFW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void NSFW::fireErrorCallback(uv_async_t *handle) {
v8::Local<v8::Value> argv[] = {
New<v8::String>(baton->error).ToLocalChecked()
};
baton->nsfw->mErrorCallback->Call(1, argv);
baton->nsfw->mErrorCallback->Call(1, argv, nullptr);
delete baton;
}

Expand All @@ -59,7 +59,7 @@ void NSFW::fireEventCallback(uv_async_t *handle) {
uv_thread_t cleanup;
uv_thread_create(&cleanup, NSFW::cleanupEventCallback, baton);

#if defined(__APPLE_CC__) || defined(__linux__) || defined(__FreeBSD__)
#if defined(__unix__)
pthread_detach(cleanup);
#endif

Expand Down Expand Up @@ -90,12 +90,12 @@ void NSFW::fireEventCallback(uv_async_t *handle) {
eventArray
};

baton->nsfw->mEventCallback->Call(1, argv);
baton->nsfw->mEventCallback->Call(1, argv, nullptr);

uv_thread_t cleanup;
uv_thread_create(&cleanup, NSFW::cleanupEventCallback, baton);

#if defined(__APPLE_CC__) || defined(__linux__) || defined(__FreeBSD__)
#if defined(__unix__)
pthread_detach(cleanup);
#endif
}
Expand Down Expand Up @@ -206,7 +206,7 @@ NAN_METHOD(NSFW::Start) {
v8::Local<v8::Value> argv[1] = {
Nan::Error("This NSFW cannot be started, because it is already running.")
};
callback->Call(1, argv);
callback->Call(1, argv, nullptr);
delete callback;
return;
}
Expand Down Expand Up @@ -252,9 +252,9 @@ void NSFW::StartWorker::HandleOKCallback() {
v8::Local<v8::Value> argv[1] = {
Nan::Error("NSFW was unable to start watching that directory.")
};
callback->Call(1, argv);
callback->Call(1, argv, nullptr);
} else {
callback->Call(0, NULL);
callback->Call(0, nullptr, nullptr);
}
}

Expand All @@ -279,7 +279,7 @@ NAN_METHOD(NSFW::Stop) {
v8::Local<v8::Value> argv[1] = {
Nan::Error("This NSFW cannot be stopped, because it is not running.")
};
callback->Call(1, argv);
callback->Call(1, argv, nullptr);
delete callback;
return;
}
Expand Down Expand Up @@ -321,7 +321,7 @@ void NSFW::StopWorker::HandleOKCallback() {
uv_close(reinterpret_cast<uv_handle_t*>(&mNSFW->mErrorCallbackAsync), nullptr);
uv_close(reinterpret_cast<uv_handle_t*>(&mNSFW->mEventCallbackAsync), nullptr);

callback->Call(0, NULL);
callback->Call(0, nullptr, nullptr);
}

NODE_MODULE(nsfw, NSFW::Init)