libftdi Archives

Subject: Patch: fix MinGW GCC compiler warning

From: Xiaofan Chen <xiaofanc@xxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Thu, 28 Feb 2013 22:01:30 +0800
>From 6cdf5d8087f1bfcb200ed95bae3b3657edb9d6e2 Mon Sep 17 00:00:00 2001
From: Xiaofan Chen <xiaofanc@xxxxxxxxx>
Date: Thu, 28 Feb 2013 21:42:35 +0800
Subject: [PATCH] Fix MinGW GCC Compiler warning because of the transfer
 callback function

The compiler will generate such warning messages.

  expected 'libusb_transfer_cb_fn' but argument is of
  type 'void (*)(struct libusb_transfer*)'

modified:   src/ftdi.c
modified:   src/ftdi_stream.c
---
 src/ftdi.c        |    4 ++--
 src/ftdi_stream.c |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/ftdi.c b/src/ftdi.c
index 5570bd4..31bda9d 100644
--- a/src/ftdi.c
+++ b/src/ftdi.c
@@ -1392,7 +1392,7 @@ int ftdi_write_data(struct ftdi_context *ftdi, unsigned ch
ar *buf, int size)
     return offset;
 }

-static void ftdi_read_data_cb(struct libusb_transfer *transfer)
+static void LIBUSB_CALL ftdi_read_data_cb(struct libusb_transfer *transfer)
 {
     struct ftdi_transfer_control *tc = (struct ftdi_transfer_control *) transfe
r->user_data;
     struct ftdi_context *ftdi = tc->ftdi;
@@ -1474,7 +1474,7 @@ static void ftdi_read_data_cb(struct libusb_transfer *tran
sfer)
 }


-static void ftdi_write_data_cb(struct libusb_transfer *transfer)
+static void LIBUSB_CALL ftdi_write_data_cb(struct libusb_transfer *transfer)
 {
     struct ftdi_transfer_control *tc = (struct ftdi_transfer_control *) transfe
r->user_data;
     struct ftdi_context *ftdi = tc->ftdi;
diff --git a/src/ftdi_stream.c b/src/ftdi_stream.c
index cf3acf5..2dbd5bc 100644
--- a/src/ftdi_stream.c
+++ b/src/ftdi_stream.c
@@ -61,7 +61,7 @@ typedef struct
  *
  * state->result is only set when some error happens
  */
-static void
+static void LIBUSB_CALL
 ftdi_readstream_cb(struct libusb_transfer *transfer)
 {
    FTDIStreamState *state = transfer->user_data;
--
1.7.9.msysgit.0


-- 
Xiaofan


--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Attachment: fix_mingw_warning.patch
Description: Binary data

Current Thread
  • Patch: fix MinGW GCC compiler warning, Xiaofan Chen <=