Fix _sleep warning on MinGW
[libftdi] / examples / serial_test.c
index afdc07c..6a9d8ff 100644 (file)
@@ -8,6 +8,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
+#ifdef __WIN32__
+#define sleep(x) Sleep(x)
+#endif
 #include <getopt.h>
 #include <signal.h>
 #include <ftdi.h>
@@ -28,7 +31,7 @@ int main(int argc, char **argv)
 {
     struct ftdi_context *ftdi;
     unsigned char buf[1024];
-    int f, i;
+    int f = 0, i;
     int vid = 0x403;
     int pid = 0;
     int baudrate = 115200;