Minor fixes for MSVC++
authorAndrei Errapart <a.errapart@trenz-electronic.de>
Fri, 16 May 2014 15:05:06 +0000 (17:05 +0200)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Fri, 16 May 2014 15:05:06 +0000 (17:05 +0200)
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.

src/ftdi.c
src/ftdi_stream.c

index 03a10be..b6caf6c 100644 (file)
@@ -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;
index 2180672..d295a02 100644 (file)
@@ -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;