Hi,
Attached is a patch for a few minor faults detected by the Microsoft C++
compiler:
1. Variables must be defined at the beginning of a block; GCC enforces
this only when in -pedantic mode.
2. The callback functions were lacking LIBUSB_CALL qualifier.
best regards,
Andrei Errapart
--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [email protected]
diff --git a/src/ftdi.c b/src/ftdi.c
index ff26166..756c10b 100644
--- a/src/ftdi.c
+++ b/src/ftdi.c
@@ -1018,8 +1018,8 @@ static int ftdi_to_clkbits_AM(int baudrate, unsigned long
*encoded_divisor)
static const char am_adjust_up[8] = {0, 0, 0, 1, 0, 3, 2, 1};
static const char am_adjust_dn[8] = {0, 0, 0, 1, 0, 1, 2, 3};
int divisor, best_divisor, best_baud, best_baud_diff;
- divisor = 24000000 / baudrate;
int i;
+ divisor = 24000000 / baudrate;
// Round down to supported fraction (AM only)
divisor -= am_adjust_dn[divisor & 7];
@@ -1393,7 +1393,7 @@ int ftdi_write_data(struct ftdi_context *ftdi, const
unsigned char *buf, int siz
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 *)
transfer->user_data;
struct ftdi_context *ftdi = tc->ftdi;
@@ -1475,7 +1475,7 @@ static void ftdi_read_data_cb(struct libusb_transfer
*transfer)
}
-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 *)
transfer->user_data;
struct ftdi_context *ftdi = tc->ftdi;
diff --git a/src/ftdi_stream.c b/src/ftdi_stream.c
index 2180672..d295a02 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;