Core: Fix compiler warning
authorLudovic Rousseau <ludovic.rousseau@gmail.com>
Sat, 13 Oct 2012 18:22:49 +0000 (20:22 +0200)
committerLudovic Rousseau <ludovic.rousseau+github@gmail.com>
Fri, 15 Feb 2013 10:16:33 +0000 (11:16 +0100)
libusb/io.c:1877:35: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        timeout_ms = (tv->tv_sec * 1000) + (tv->tv_usec / 1000);
                   ~ ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~

On Mac OS X tv_sec is a __darwin_time_t which is a long, not an int.

libusb/io.c
libusb/version_nano.h

index 7631bed..58c077c 100644 (file)
@@ -1878,7 +1878,7 @@ static int handle_events(struct libusb_context *ctx, struct timeval *tv)
        }
        usbi_mutex_unlock(&ctx->pollfds_lock);
 
-       timeout_ms = (tv->tv_sec * 1000) + (tv->tv_usec / 1000);
+       timeout_ms = (int)(tv->tv_sec * 1000) + (tv->tv_usec / 1000);
 
        /* round up to next millisecond */
        if (tv->tv_usec % 1000)
index b5f9988..b92e4fe 100644 (file)
@@ -1 +1 @@
-#define LIBUSB_NANO 10605
+#define LIBUSB_NANO 10606