raspberrypi / usbboot

Raspberry Pi USB booting code, moved from tools repository
Apache License 2.0
910 stars 229 forks source link

Type fix for 64-bit compilation #5

Closed lurch closed 7 years ago

lurch commented 7 years ago

Without this fix, I get an error saying

main.c: In function ‘open_device_with_vid’:
main.c:52:4: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘size_t’ [-Wformat=]
    printf("Found device %d idVendor=0x%04x idProduct=0x%04x\n", i, desc.idVendor, desc.idProduct);
    ^

when compiling on a x64 Ubuntu 14.04 host.

Given that it's only iterating the results from libusb_get_device_list, I suspect that an int is still more than sufficient ;-)

ED6E0F17 commented 7 years ago

I used an uint32_t when I fixed that. Don`t use signed ints for array offsets.

I also have a missing "/n" in the help text on line 28.

lurch commented 7 years ago

Thanks @ED6E0F17 , I force-updated the PR.

ghollingworth commented 7 years ago

This code is being updated significantly in the next week so will have to have a look at this afterwards...

Gordon

On Wed, Jan 18, 2017 at 6:28 PM Andrew Scheller notifications@github.com wrote:

Thanks @ED6E0F17 https://github.com/ED6E0F17 , I force-updated the PR.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/raspberrypi/usbboot/pull/5#issuecomment-273559024, or mute the thread https://github.com/notifications/unsubscribe-auth/AB9CHB2Rc2swLgjgMuVPkoakabmFAmymks5rTlnegaJpZM4LnCEQ .

--

Director of Software Engineering, Raspberry Pi (Trading) Limited t: +44 (0) 1223 322633 m: +44 (0) 7450 946289 e: gordon@raspberrypi.org w: www.raspberrypi.org

ghollingworth commented 7 years ago

OK, added this to my push... Thanks