mirror of
https://github.com/mariusgreuel/avrdude.git
synced 2025-09-27 14:35:27 +00:00
Make the code compile warning-free:
- declare a dummy "struct timezone" for some Win32 systems (MinGW) - fix a few printf() argument types - get rid off the prevailing "all filedescriptors are of type int" attitude The last item required a large sweep across the code, in order to replace all "int fd"s by "struct filedescriptor *fd"s, and pass pointers (as we cannot pass a union directly). In return, the code is now supposed to be fully 64-bit safe, rather than relying on a 64-bit pointer being converted to a (32-bit) int and back to a pointer as we did previously. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@694 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
27
usb_libusb.c
27
usb_libusb.c
@@ -53,7 +53,7 @@ static int usb_interface;
|
||||
* The "baud" parameter is meaningless for USB devices, so we reuse it
|
||||
* to pass the desired USB device ID.
|
||||
*/
|
||||
static int usbdev_open(char * port, long baud)
|
||||
static void usbdev_open(char * port, long baud, union filedescriptor *fd)
|
||||
{
|
||||
char string[256];
|
||||
char product[256];
|
||||
@@ -189,7 +189,8 @@ static int usbdev_open(char * port, long baud)
|
||||
goto trynext;
|
||||
}
|
||||
|
||||
return (int)udev;
|
||||
fd->pfd = udev;
|
||||
return;
|
||||
}
|
||||
trynext:
|
||||
usb_close(udev);
|
||||
@@ -202,9 +203,9 @@ static int usbdev_open(char * port, long baud)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void usbdev_close(int fd)
|
||||
static void usbdev_close(union filedescriptor *fd)
|
||||
{
|
||||
usb_dev_handle *udev = (usb_dev_handle *)fd;
|
||||
usb_dev_handle *udev = (usb_dev_handle *)fd->pfd;
|
||||
|
||||
(void)usb_release_interface(udev, usb_interface);
|
||||
|
||||
@@ -218,10 +219,10 @@ static void usbdev_close(int fd)
|
||||
}
|
||||
|
||||
|
||||
static int usbdev_send(int fd, unsigned char *bp, size_t mlen)
|
||||
static int usbdev_send(union filedescriptor *fd, unsigned char *bp, size_t mlen)
|
||||
{
|
||||
usb_dev_handle *udev = (usb_dev_handle *)fd;
|
||||
size_t rv;
|
||||
usb_dev_handle *udev = (usb_dev_handle *)fd->pfd;
|
||||
int rv;
|
||||
int i = mlen;
|
||||
unsigned char * p = bp;
|
||||
int tx_size;
|
||||
@@ -296,9 +297,9 @@ usb_fill_buf(usb_dev_handle *udev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int usbdev_recv(int fd, unsigned char *buf, size_t nbytes)
|
||||
static int usbdev_recv(union filedescriptor *fd, unsigned char *buf, size_t nbytes)
|
||||
{
|
||||
usb_dev_handle *udev = (usb_dev_handle *)fd;
|
||||
usb_dev_handle *udev = (usb_dev_handle *)fd->pfd;
|
||||
int i, amnt;
|
||||
unsigned char * p = buf;
|
||||
|
||||
@@ -348,9 +349,9 @@ static int usbdev_recv(int fd, unsigned char *buf, size_t nbytes)
|
||||
*
|
||||
* This is used for the AVRISP mkII device.
|
||||
*/
|
||||
static int usbdev_recv_frame(int fd, unsigned char *buf, size_t nbytes)
|
||||
static int usbdev_recv_frame(union filedescriptor *fd, unsigned char *buf, size_t nbytes)
|
||||
{
|
||||
usb_dev_handle *udev = (usb_dev_handle *)fd;
|
||||
usb_dev_handle *udev = (usb_dev_handle *)fd->pfd;
|
||||
int rv, n;
|
||||
int i;
|
||||
unsigned char * p = buf;
|
||||
@@ -405,9 +406,9 @@ static int usbdev_recv_frame(int fd, unsigned char *buf, size_t nbytes)
|
||||
return n;
|
||||
}
|
||||
|
||||
static int usbdev_drain(int fd, int display)
|
||||
static int usbdev_drain(union filedescriptor *fd, int display)
|
||||
{
|
||||
usb_dev_handle *udev = (usb_dev_handle *)fd;
|
||||
usb_dev_handle *udev = (usb_dev_handle *)fd->pfd;
|
||||
int rv;
|
||||
|
||||
do {
|
||||
|
Reference in New Issue
Block a user