summaryrefslogtreecommitdiff
path: root/libusb/libusb.h
diff options
context:
space:
mode:
authorPete Batard <pbatard@gmail.com>2010-01-14 01:34:40 +0000
committerPete Batard <pbatard@gmail.com>2010-01-14 01:34:40 +0000
commit71613013b9e7329b4e49047abdee40fea718eb96 (patch)
treeb8181552af39d2bef19b73fe232da34912eac918 /libusb/libusb.h
parenta32c101a47825f3c523081137d972a619a359d34 (diff)
downloadlibusb-71613013b9e7329b4e49047abdee40fea718eb96.tar.gz
svn r54: - fixes missing config_msvc.h
Diffstat (limited to 'libusb/libusb.h')
-rw-r--r--libusb/libusb.h41
1 files changed, 23 insertions, 18 deletions
diff --git a/libusb/libusb.h b/libusb/libusb.h
index 2dbb9a5..7070898 100644
--- a/libusb/libusb.h
+++ b/libusb/libusb.h
@@ -22,7 +22,12 @@
#define __LIBUSB_H__
#include <stdint.h>
+#if defined(_MSC_VER)
+#define inline __inline
+#include <time.h>
+#else
#include <sys/time.h>
+#endif
#include <sys/types.h>
#include <time.h>
#include <limits.h>
@@ -31,24 +36,24 @@
extern "C" {
#endif
-/** \def libusb_cpu_to_le16
- * \ingroup misc
- * Convert a 16-bit value from host-endian to little-endian format. On
- * little endian systems, this function does nothing. On big endian systems,
- * the bytes are swapped.
- * \param x the host-endian value to convert
- * \returns the value in little-endian byte order
+/** \def libusb_cpu_to_le16
+ * \ingroup misc
+ * Convert a 16-bit value from host-endian to little-endian format. On
+ * little endian systems, this function does nothing. On big endian systems,
+ * the bytes are swapped.
+ * \param x the host-endian value to convert
+ * \returns the value in little-endian byte order
*/
-#define libusb_cpu_to_le16(x) ({ \
- union { \
- uint8_t b8[2]; \
- uint16_t b16; \
- } _tmp; \
- uint16_t _tmp2 = (uint16_t)(x); \
- _tmp.b8[1] = _tmp2 >> 8; \
- _tmp.b8[0] = _tmp2 & 0xff; \
- _tmp.b16; \
-})
+static inline uint16_t libusb_cpu_to_le16(uint16_t x) {
+ union {
+ uint8_t b8[2];
+ uint16_t b16;
+ } _tmp;
+ uint16_t _tmp2 = (uint16_t)(x);
+ _tmp.b8[1] = _tmp2 >> 8;
+ _tmp.b8[0] = _tmp2 & 0xff;
+ return _tmp.b16;
+}
/** \def libusb_le16_to_cpu
* \ingroup misc
@@ -769,7 +774,7 @@ int libusb_init(libusb_context **ctx);
void libusb_exit(libusb_context *ctx);
void libusb_set_debug(libusb_context *ctx, int level);
-ssize_t libusb_get_device_list(libusb_context *ctx,
+int libusb_get_device_list(libusb_context *ctx,
libusb_device ***list);
void libusb_free_device_list(libusb_device **list, int unref_devices);
libusb_device *libusb_ref_device(libusb_device *dev);