There is nothing explicitly preventing the compiler from adding any sort
of padding to the libusb_control_transfer structure. It does not seem
that any sane compiler would do so, but there is library functionality
that depends on this not happening. Address this by explicitly
instructing the compiler to pack the structure.
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
PREDEFINED = API_EXPORTED= \
DEFAULT_VISIBILITY= \
- LIBUSB_CALL=
+ LIBUSB_CALL= \
+ LIBUSB_PACKED=
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
#define LIBUSB_DEPRECATED_FOR(f)
#endif /* __GNUC__ */
+#if defined(__GNUC__)
+#define LIBUSB_PACKED __attribute__ ((packed))
+#else
+#define LIBUSB_PACKED
+#endif /* __GNUC__ */
+
/** \def LIBUSB_CALL
* \ingroup libusb_misc
* libusb's Windows calling convention.
/** \ingroup libusb_asyncio
* Setup packet for control transfers. */
+#if defined(_MSC_VER)
+#pragma pack(push, 1)
+#endif
struct libusb_control_setup {
/** Request type. Bits 0:4 determine recipient, see
* \ref libusb_request_recipient. Bits 5:6 determine type, see
/** Number of bytes to transfer */
uint16_t wLength;
-};
+} LIBUSB_PACKED;
+#if defined(_MSC_VER)
+#pragma pack(pop)
+#endif
#define LIBUSB_CONTROL_SETUP_SIZE (sizeof(struct libusb_control_setup))
-#define LIBUSB_NANO 11496
+#define LIBUSB_NANO 11497