src: fix OS X compilation issues
This commit is contained in:
@@ -167,7 +167,7 @@ NAN_METHOD(CardReader::Disconnect) {
|
|||||||
|
|
||||||
// This creates our work request, including the libuv struct.
|
// This creates our work request, including the libuv struct.
|
||||||
Baton* baton = new Baton();
|
Baton* baton = new Baton();
|
||||||
baton->input = reinterpret_cast<void*>(disposition);
|
baton->input = reinterpret_cast<void*>(new DWORD(disposition));
|
||||||
baton->request.data = baton;
|
baton->request.data = baton;
|
||||||
NanAssignPersistent(baton->callback, cb);
|
NanAssignPersistent(baton->callback, cb);
|
||||||
baton->reader = ObjectWrap::Unwrap<CardReader>(args.This());
|
baton->reader = ObjectWrap::Unwrap<CardReader>(args.This());
|
||||||
@@ -382,7 +382,7 @@ void CardReader::DoConnect(uv_work_t* req) {
|
|||||||
Baton* baton = static_cast<Baton*>(req->data);
|
Baton* baton = static_cast<Baton*>(req->data);
|
||||||
ConnectInput *ci = static_cast<ConnectInput*>(baton->input);
|
ConnectInput *ci = static_cast<ConnectInput*>(baton->input);
|
||||||
|
|
||||||
unsigned long card_protocol;
|
DWORD card_protocol;
|
||||||
LONG result = SCARD_S_SUCCESS;
|
LONG result = SCARD_S_SUCCESS;
|
||||||
CardReader* obj = baton->reader;
|
CardReader* obj = baton->reader;
|
||||||
|
|
||||||
@@ -449,7 +449,7 @@ void CardReader::AfterConnect(uv_work_t* req, int status) {
|
|||||||
void CardReader::DoDisconnect(uv_work_t* req) {
|
void CardReader::DoDisconnect(uv_work_t* req) {
|
||||||
|
|
||||||
Baton* baton = static_cast<Baton*>(req->data);
|
Baton* baton = static_cast<Baton*>(req->data);
|
||||||
DWORD disposition = reinterpret_cast<DWORD>(baton->input);
|
DWORD& disposition = reinterpret_cast<DWORD&>(*baton->input);
|
||||||
|
|
||||||
LONG result = SCARD_S_SUCCESS;
|
LONG result = SCARD_S_SUCCESS;
|
||||||
CardReader* obj = baton->reader;
|
CardReader* obj = baton->reader;
|
||||||
@@ -467,17 +467,17 @@ void CardReader::DoDisconnect(uv_work_t* req) {
|
|||||||
/* Unlock the mutex */
|
/* Unlock the mutex */
|
||||||
pthread_mutex_unlock(&obj->m_mutex);
|
pthread_mutex_unlock(&obj->m_mutex);
|
||||||
|
|
||||||
baton->result = reinterpret_cast<void*>(result);
|
baton->result = reinterpret_cast<void*>(new LONG(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardReader::AfterDisconnect(uv_work_t* req, int status) {
|
void CardReader::AfterDisconnect(uv_work_t* req, int status) {
|
||||||
|
|
||||||
NanScope();
|
NanScope();
|
||||||
Baton* baton = static_cast<Baton*>(req->data);
|
Baton* baton = static_cast<Baton*>(req->data);
|
||||||
LONG result = reinterpret_cast<LONG>(baton->result);
|
LONG* result = reinterpret_cast<LONG*>(baton->result);
|
||||||
|
|
||||||
if (result) {
|
if (*result) {
|
||||||
Local<Value> err = NanError(pcsc_stringify_error(result));
|
Local<Value> err = NanError(pcsc_stringify_error(*result));
|
||||||
|
|
||||||
// Prepare the parameters for the callback function.
|
// Prepare the parameters for the callback function.
|
||||||
const unsigned argc = 1;
|
const unsigned argc = 1;
|
||||||
@@ -495,7 +495,9 @@ void CardReader::AfterDisconnect(uv_work_t* req, int status) {
|
|||||||
|
|
||||||
// The callback is a permanent handle, so we have to dispose of it manually.
|
// The callback is a permanent handle, so we have to dispose of it manually.
|
||||||
NanDisposePersistent(baton->callback);
|
NanDisposePersistent(baton->callback);
|
||||||
|
DWORD* disposition = reinterpret_cast<DWORD*>(baton->input);
|
||||||
|
delete disposition;
|
||||||
|
delete result;
|
||||||
delete baton;
|
delete baton;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ LONG PCSCLite::get_card_readers(PCSCLite* pcsclite, AsyncResult* async_result) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Find out ReaderNameLength */
|
/* Find out ReaderNameLength */
|
||||||
unsigned long readers_name_length;
|
DWORD readers_name_length;
|
||||||
result = SCardListReaders(pcsclite->m_card_context, NULL, NULL, &readers_name_length);
|
result = SCardListReaders(pcsclite->m_card_context, NULL, NULL, &readers_name_length);
|
||||||
if (result != SCARD_S_SUCCESS) {
|
if (result != SCARD_S_SUCCESS) {
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
Reference in New Issue
Block a user