diff options
author | Josh Blum <josh@joshknows.com> | 2011-04-05 20:37:29 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-04-05 20:37:29 -0700 |
commit | d07870f698e314a516939ca91de3d7307c9bade7 (patch) | |
tree | 9d7d43b5bd6ba8693f4e8e4b075092dc7bede6ee /host | |
parent | af2ab1c688d641e82060016aa772432de6445633 (diff) | |
download | uhd-d07870f698e314a516939ca91de3d7307c9bade7.tar.gz uhd-d07870f698e314a516939ca91de3d7307c9bade7.tar.bz2 uhd-d07870f698e314a516939ca91de3d7307c9bade7.zip |
usb: mark libusb callbacks with LIBUSB_CALL to ensure correct calling convention
Diffstat (limited to 'host')
-rw-r--r-- | host/lib/transport/libusb1_zero_copy.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/host/lib/transport/libusb1_zero_copy.cpp b/host/lib/transport/libusb1_zero_copy.cpp index fe6936c7e..e42cab1d1 100644 --- a/host/lib/transport/libusb1_zero_copy.cpp +++ b/host/lib/transport/libusb1_zero_copy.cpp @@ -34,13 +34,23 @@ using namespace uhd::transport; static const size_t DEFAULT_NUM_XFERS = 16; //num xfers static const size_t DEFAULT_XFER_SIZE = 32*512; //bytes +//! Define LIBUSB_CALL when its missing (non-windows) +#ifndef LIBUSB_CALL + #define LIBUSB_CALL +#endif /*LIBUSB_CALL*/ + +/*! + * All libusb callback functions should be marked with the LIBUSB_CALL macro + * to ensure that they are compiled with the same calling convention as libusb. + */ + //! helper function: handles all async callbacks -static void libusb_async_cb(libusb_transfer *lut){ +static void LIBUSB_CALL libusb_async_cb(libusb_transfer *lut){ (*static_cast<boost::function<void()> *>(lut->user_data))(); } //! callback to free transfer upon cancellation -static void cancel_transfer_cb(libusb_transfer *lut){ +static void LIBUSB_CALL cancel_transfer_cb(libusb_transfer *lut){ if (lut->status == LIBUSB_TRANSFER_CANCELLED) libusb_free_transfer(lut); else std::cout << "libusb cancel_transfer unexpected status " << lut->status << std::endl; } |