diff options
author | Pete Batard <pbatard@gmail.com> | 2010-01-28 23:18:52 +0000 |
---|---|---|
committer | Pete Batard <pbatard@gmail.com> | 2010-01-28 23:18:52 +0000 |
commit | 47c83183c080c866c54bcf886e535ff7db907bb8 (patch) | |
tree | bdc1368e54dd601ec679f392e843a6700c4684f9 /libusb/os | |
parent | 37b685c3558513e32b30418c9fbc057d83a7ff53 (diff) | |
download | libusb-47c83183c080c866c54bcf886e535ff7db907bb8.tar.gz |
r122: fixed poll conflict on cygwin (all compat functions renamed to _libusb_####)
- fixed sscanf_s undefined for non MS compilers
- fixed cygiwn warnings in windows_usb.c
Diffstat (limited to 'libusb/os')
-rw-r--r-- | libusb/os/windows_compat.c | 10 | ||||
-rw-r--r-- | libusb/os/windows_compat.h | 10 | ||||
-rw-r--r-- | libusb/os/windows_usb.c | 7 |
3 files changed, 12 insertions, 15 deletions
diff --git a/libusb/os/windows_compat.c b/libusb/os/windows_compat.c index 180ff0c..58b91d3 100644 --- a/libusb/os/windows_compat.c +++ b/libusb/os/windows_compat.c @@ -268,7 +268,7 @@ __inline void _init_read_marker(int index) /* * Create an async I/O anonymous pipe (that can be used for sync as well) */ -int pipe_for_poll(int filedes[2]) +int _libusb_pipe(int filedes[2]) { int i, j; HANDLE handle[2]; @@ -526,7 +526,7 @@ struct winfd overlapped_to_winfd(OVERLAPPED* overlapped) * Currently, this function only accepts one of POLLIN or POLLOUT per fd * (but you can create multiple fds from the same handle for read and write) */ -int poll(struct pollfd *fds, unsigned int nfds, int timeout) +int _libusb_poll(struct pollfd *fds, unsigned int nfds, int timeout) { unsigned i, triggered = 0; int index, object_index; @@ -635,7 +635,7 @@ int poll(struct pollfd *fds, unsigned int nfds, int timeout) * * Note that this function will also close the associated handle */ -int close_for_poll(int fd) +int _libusb_close(int fd) { int index; HANDLE handle; @@ -667,7 +667,7 @@ int close_for_poll(int fd) * - binary mode only * - no append mode */ -ssize_t write_for_poll(int fd, const void *buf, size_t count) +ssize_t _libusb_write(int fd, const void *buf, size_t count) { int index; DWORD wr_count; @@ -743,7 +743,7 @@ out: * synchronous read for custom poll (works on Windows file handles that * have been opened with the FILE_FLAG_OVERLAPPED flag) */ -ssize_t read_for_poll(int fd, void *buf, size_t count) +ssize_t _libusb_read(int fd, void *buf, size_t count) { int index; DWORD rd_count; diff --git a/libusb/os/windows_compat.h b/libusb/os/windows_compat.h index f40f5de..5192a3e 100644 --- a/libusb/os/windows_compat.h +++ b/libusb/os/windows_compat.h @@ -62,11 +62,11 @@ struct winfd { }; extern const struct winfd INVALID_WINFD; -int pipe_for_poll(int pipefd[2]); -int poll(struct pollfd *fds, unsigned int nfds, int timeout); -ssize_t write_for_poll(int fd, const void *buf, size_t count); -ssize_t read_for_poll(int fd, void *buf, size_t count); -int close_for_poll(int fd); +int _libusb_pipe(int pipefd[2]); +int _libusb_poll(struct pollfd *fds, unsigned int nfds, int timeout); +ssize_t _libusb_write(int fd, const void *buf, size_t count); +ssize_t _libusb_read(int fd, void *buf, size_t count); +int _libusb_close(int fd); void init_polling(void); void exit_polling(void); diff --git a/libusb/os/windows_usb.c b/libusb/os/windows_usb.c index 42d88da..d33fbc9 100644 --- a/libusb/os/windows_usb.c +++ b/libusb/os/windows_usb.c @@ -160,6 +160,7 @@ static inline BOOLEAN guid_eq(const GUID *guid1, const GUID *guid2) { return false; } +#if 0 static char* guid_to_string(const GUID guid) { static char guid_string[GUID_STRING_LENGTH]; @@ -170,6 +171,7 @@ static char guid_string[GUID_STRING_LENGTH]; guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]); return guid_string; } +#endif /* * Converts a windows error to human readable string @@ -3236,7 +3238,6 @@ static int hid_submit_bulk_transfer(struct usbi_transfer *itransfer) { bool direction_in, ret; int current_interface; DWORD size; - int r = LIBUSB_ERROR_INVALID_PARAM; CHECK_HID_AVAILABLE; @@ -3284,9 +3285,7 @@ static int hid_abort_transfers(struct usbi_transfer *itransfer) { struct libusb_transfer *transfer = __USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer); struct windows_transfer_priv *transfer_priv = usbi_transfer_get_os_priv(itransfer); - struct libusb_context *ctx = DEVICE_CTX(transfer->dev_handle->dev); struct windows_device_handle_priv *handle_priv = (struct windows_device_handle_priv *)transfer->dev_handle->os_priv; - struct windows_device_priv *priv = __device_priv(transfer->dev_handle->dev); HANDLE hid_handle; int current_interface; @@ -3301,9 +3300,7 @@ static int hid_abort_transfers(struct usbi_transfer *itransfer) static int hid_reset_device(struct libusb_device_handle *dev_handle) { - struct libusb_context *ctx = DEVICE_CTX(dev_handle->dev); struct windows_device_handle_priv *handle_priv = (struct windows_device_handle_priv *)dev_handle->os_priv; - struct windows_device_priv *priv = __device_priv(dev_handle->dev); HANDLE hid_handle; int current_interface; |