libusbx v1.0.9-rc4 is now available
Sean McBride
sean at rogue-research.com
Fri Mar 30 10:33:18 EDT 2012
On Fri, 30 Mar 2012 13:49:04 +0100, Pete Batard said:
>---
> libusb/os/darwin_usb.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
>diff --git a/libusb/os/darwin_usb.c b/libusb/os/darwin_usb.c
>index e112cf5..c51557a 100644
>--- a/libusb/os/darwin_usb.c
>+++ b/libusb/os/darwin_usb.c
>@@ -1547,7 +1547,7 @@ static void darwin_async_io_callback (void
>*refcon, IOReturn result, void *arg0)
>
> usbi_info (ITRANSFER_CTX (itransfer), "an async io operation has
>completed");
>
>- size = (UInt32) arg0;
>+ size = (UInt32) (intptr_t) arg0;
>
> /* send a completion message to the device's file descriptor */
> message = MESSAGE_ASYNC_IO_COMPLETE;
>--
Please do not merge this change!
You're not fixing anything, you're just tricking the compiler into not warning you about a real problem. You're still throwing away half the bits of arg0 and now you've also discarded the automated TODO the compiler was giving us.
This is bug #117:
<http://www.libusb.org/ticket/117>
That warning was deliberately introduced:
<http://www.libusb.org/attachment/ticket/117/0089-conversative-partial-fix-for-ticket-117.patch>
Unfortunately the big fat warning comment I added in my patch was apparently removed. Blah!
IMNSHO:
- the warning should stay
- a TODO comment should be added referencing bug #117
- an assert should check that size is < UINT32_MAX
(I'd submit a patch, but I consider libusb a waste of my time at this point. I hope libusbx will change that, but am not yet convinced.)
--
____________________________________________________________
Sean McBride, B. Eng sean at rogue-research.com
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
More information about the libusbx
mailing list