From fc670d2ac06a84351fff89d6868e398e6cac8d18 Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Wed, 17 Mar 2010 15:25:50 +0000 Subject: merged -> r211 --- libusb/os/poll_windows.c | 11 ++++++----- libusb/os/windows_usb.c | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/libusb/os/poll_windows.c b/libusb/os/poll_windows.c index 7922fd4..1064457 100644 --- a/libusb/os/poll_windows.c +++ b/libusb/os/poll_windows.c @@ -143,6 +143,7 @@ static volatile LONG compat_spinlock = 0; // a single transfer (OVERLAPPED) when used. As it may not be part of any of the // platform headers, we hook into the Kernel32 system DLL directly to seek it. static BOOL (__stdcall *pCancelIoEx)(HANDLE, LPOVERLAPPED) = NULL; +#define CancelIoEx_Available (pCancelIoEx != NULL) __inline BOOL cancel_io(int index) { if ((index < 0) || (index >= MAX_FDS)) { @@ -153,7 +154,7 @@ __inline BOOL cancel_io(int index) || (poll_fd[index].handle == 0) || (poll_fd[index].overlapped == NULL) ) { return TRUE; } - if (pCancelIoEx != NULL) { + if (CancelIoEx_Available) { return (*pCancelIoEx)(poll_fd[index].handle, poll_fd[index].overlapped); } if (_poll_fd[index].thread_id == GetCurrentThreadId()) { @@ -175,7 +176,7 @@ void init_polling(void) pCancelIoEx = (BOOL (__stdcall *)(HANDLE,LPOVERLAPPED)) GetProcAddress(GetModuleHandle("KERNEL32"), "CancelIoEx"); usbi_dbg("Will use CancelIo%s for I/O cancellation", - (pCancelIoEx != NULL)?"Ex":""); + CancelIoEx_Available?"Ex":""); for (i=0; iflags | USBI_TRANSFER_TIMED_OUT) { + if (itransfer->flags & USBI_TRANSFER_TIMED_OUT) { transfer_priv->pollable_fd.overlapped->Internal &= ~STATUS_PENDING; } #endif @@ -2008,7 +2008,7 @@ static void windows_transfer_callback(struct usbi_transfer *itransfer, uint32_t status = LIBUSB_TRANSFER_TIMED_OUT; break; case ERROR_OPERATION_ABORTED: - if (itransfer->flags | USBI_TRANSFER_TIMED_OUT) { + if (itransfer->flags & USBI_TRANSFER_TIMED_OUT) { usbi_dbg("detected timeout"); status = LIBUSB_TRANSFER_TIMED_OUT; } else { -- cgit v1.2.1