diff options
-rw-r--r-- | libusb/os/windows_usb.c | 4 | ||||
-rw-r--r-- | libusb/os/windows_usb.h | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/libusb/os/windows_usb.c b/libusb/os/windows_usb.c index 1b71c42..7719d01 100644 --- a/libusb/os/windows_usb.c +++ b/libusb/os/windows_usb.c @@ -363,7 +363,7 @@ static int windows_init(struct libusb_context *ctx) struct windows_hcd_priv** _hcd_cur; TCHAR sem_name[11+1+8]; // strlen(libusb_init)+'\0'+(32-bit hex PID) - sprintf(sem_name, "libusb_init%08X", GetCurrentProcessId()&0xFFFFFFFF); + sprintf(sem_name, "libusb_init%08X", (unsigned int)GetCurrentProcessId()&0xFFFFFFFF); semaphore = CreateSemaphore(NULL, 1, 1, sem_name); if (semaphore == NULL) { usbi_err(ctx, "could not create semaphore: %s", windows_error_str(0)); @@ -1403,7 +1403,7 @@ static void windows_exit(void) HANDLE semaphore; TCHAR sem_name[11+1+8]; // strlen(libusb_init)+'\0'+(32-bit hex PID) - sprintf(sem_name, "libusb_init%08X", GetCurrentProcessId()&0xFFFFFFFF); + sprintf(sem_name, "libusb_init%08X", (unsigned int)GetCurrentProcessId()&0xFFFFFFFF); semaphore = CreateSemaphore(NULL, 1, 1, sem_name); if (semaphore == NULL) { return; diff --git a/libusb/os/windows_usb.h b/libusb/os/windows_usb.h index e2801db..3f1d121 100644 --- a/libusb/os/windows_usb.h +++ b/libusb/os/windows_usb.h @@ -49,6 +49,8 @@ // cygwin produces a warning unless these prototypes are defined extern int _snprintf(char *buffer, size_t count, const char *format, ...); extern char *_strdup(const char *strSource); +// _beginthreadex is MSVCRT => unavailable for cygwin. Fallback to using CreateThread +#define _beginthreadex(a, b, c, d, e, f) CreateThread(a, b, (LPTHREAD_START_ROUTINE)c, d, e, f) #endif #define safe_free(p) do {if (p != NULL) {free(p); p = NULL;}} while(0) #define safe_closehandle(h) do {if (h != INVALID_HANDLE_VALUE) {CloseHandle(h); h = INVALID_HANDLE_VALUE;}} while(0) |