src: multiple Windows fixes
- Cross platform implementations of sleep and snprintf.
This commit is contained in:
@@ -11,6 +11,10 @@
|
|||||||
#include <winscard.h>
|
#include <winscard.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define MAX_ATR_SIZE 33
|
||||||
|
#endif
|
||||||
|
|
||||||
static v8::Persistent<v8::String> name_symbol;
|
static v8::Persistent<v8::String> name_symbol;
|
||||||
static v8::Persistent<v8::String> connected_symbol;
|
static v8::Persistent<v8::String> connected_symbol;
|
||||||
|
|
||||||
|
|||||||
19
src/common.h
19
src/common.h
@@ -3,7 +3,26 @@
|
|||||||
|
|
||||||
#define ERR_MSG_MAX_LEN 512
|
#define ERR_MSG_MAX_LEN 512
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <windows.h>
|
||||||
|
#else
|
||||||
|
#include <unistd.h>
|
||||||
|
#define Sleep(x) usleep((x)*1000)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define snprintf _snprintf
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
|
||||||
|
const char *pcsc_stringify_error(const LONG) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
std::string error_msg(const char* method, LONG result) {
|
std::string error_msg(const char* method, LONG result) {
|
||||||
char msg[ERR_MSG_MAX_LEN];
|
char msg[ERR_MSG_MAX_LEN];
|
||||||
snprintf(msg,
|
snprintf(msg,
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#include <unistd.h>
|
|
||||||
#include "pcsclite.h"
|
#include "pcsclite.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
@@ -193,7 +192,7 @@ void PCSCLite::HandlerFunction(void* arg) {
|
|||||||
uv_mutex_unlock(&pcsclite->m_mutex);
|
uv_mutex_unlock(&pcsclite->m_mutex);
|
||||||
} else {
|
} else {
|
||||||
/* If PnP is not supported, just wait for 1 second */
|
/* If PnP is not supported, just wait for 1 second */
|
||||||
sleep(1);
|
Sleep(1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user