diff options
author | Pete Batard <pbatard@gmail.com> | 2010-01-29 20:04:35 +0000 |
---|---|---|
committer | Pete Batard <pbatard@gmail.com> | 2010-01-29 20:04:35 +0000 |
commit | afe70cedf774436981defb900c5eb78d13ec13d0 (patch) | |
tree | 4e93bf005247dba8f5406c25c0d49c49ada4e99b /libusb/libusb.h | |
parent | 47c83183c080c866c54bcf886e535ff7db907bb8 (diff) | |
download | libusb-afe70cedf774436981defb900c5eb78d13ec13d0.tar.gz |
r123: reverted the use of usb_interface in core and forced interface to be undefined always on Windows
Diffstat (limited to 'libusb/libusb.h')
-rw-r--r-- | libusb/libusb.h | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/libusb/libusb.h b/libusb/libusb.h index d8b17de..277f040 100644 --- a/libusb/libusb.h +++ b/libusb/libusb.h @@ -32,12 +32,17 @@ #include <time.h> #include <limits.h> -// Work around for existing libusb 1.0 code that might have used "interface" -// instead of the newer "usb_interface", in libusb_config_descriptor. -// "interface" was changed to "usb_interface" to work around macro redefinition -// issues on Windows platforms. -#if !defined(OS_WINDOWS) && !defined(interface) -#define interface usb_interface +// 'interface' might be defined as a macro on Windows, so we need to undefine +// it so as not to break the current libusb API, because libusb_config_descriptor +// has an 'interface' member +// As this could still be problematic if you include windows.h after libusb.h in +// your sources, we attempt to detect that as well. +#if defined(OS_WINDOWS) +#if !defined(interface) && !defined(_WINDOWS_) +#error "Please make sure you include both windows.h and libusb.h in your source, in that order." +#elif defined(interface) +#undef interface +#endif #endif // MSVC doesn't know ssize_t @@ -513,7 +518,7 @@ struct libusb_config_descriptor { /** Array of interfaces supported by this configuration. The length of * this array is determined by the bNumInterfaces field. */ - const struct libusb_interface *usb_interface; + const struct libusb_interface *interface; /** Extra descriptors. If libusb encounters unknown configuration * descriptors, it will store them here, should you wish to parse them. */ |