From f6d60a9a8fcf06629812da886e3a5de592624b61 Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Mon, 1 Feb 2010 19:26:13 +0000 Subject: [PATCH] Switched to standard int pointer type for windows 64-bit compat On 64-bit Windows a pointer is 64 bit, but long is still 32 bit for backwards compatibility. uintptr_t nicely hides this difference and also works on Linux. [dsd: add appropriate include] --- libusb/descriptor.c | 3 ++- libusb/libusbi.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libusb/descriptor.c b/libusb/descriptor.c index 4384e3a..041c39d 100644 --- a/libusb/descriptor.c +++ b/libusb/descriptor.c @@ -19,6 +19,7 @@ */ #include +#include #include #include @@ -51,7 +52,7 @@ int usbi_parse_descriptor(unsigned char *source, char *descriptor, void *dest, *dp++ = *sp++; break; case 'w': /* 16-bit word, convert from little endian to CPU */ - dp += ((unsigned long)dp & 1); /* Align to word boundary */ + dp += ((uintptr_t)dp & 1); /* Align to word boundary */ if (host_endian) { memcpy(dp, sp, 2); diff --git a/libusb/libusbi.h b/libusb/libusbi.h index 1a7731f..14996cf 100644 --- a/libusb/libusbi.h +++ b/libusb/libusbi.h @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -45,7 +46,7 @@ struct list_head { * member - the list_head element in "type" */ #define list_entry(ptr, type, member) \ - ((type *)((char *)(ptr) - (unsigned long)(&((type *)0L)->member))) + ((type *)((uintptr_t)(ptr) - (uintptr_t)(&((type *)0L)->member))) /* Get each entry from a list * pos - A structure pointer has a "member" element -- 2.7.4