core: fix 2 compiler warnings
authorLudovic Rousseau <ludovic.rousseau@free.fr>
Sat, 27 Feb 2016 16:37:49 +0000 (17:37 +0100)
committerLudovic Rousseau <ludovic.rousseau@free.fr>
Wed, 2 Mar 2016 15:03:03 +0000 (16:03 +0100)
core.c:2361:35: warning: comparison of integers of different signs: 'int' and
      'unsigned long' [-Wsign-compare]
        if (header_len < 0 || header_len >= sizeof(buf)) {
                              ~~~~~~~~~~ ^  ~~~~~~~~~~~
core.c:2370:44: warning: comparison of integers of different signs: 'int' and
      'unsigned long' [-Wsign-compare]
        if (text_len < 0 || text_len + header_len >= sizeof(buf)) {
                            ~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~

Signed-off-by: Ludovic Rousseau <ludovic.rousseau@free.fr>
libusb/core.c
libusb/version_nano.h

index 31f3d28..5317d26 100644 (file)
@@ -2358,7 +2358,7 @@ void usbi_log_v(struct libusb_context *ctx, enum libusb_log_level level,
                        "libusb: %s [%s] ", prefix, function);
        }
 
-       if (header_len < 0 || header_len >= sizeof(buf)) {
+       if (header_len < 0 || header_len >= (int)sizeof(buf)) {
                /* Somehow snprintf failed to write to the buffer,
                 * remove the header so something useful is output. */
                header_len = 0;
@@ -2367,7 +2367,7 @@ void usbi_log_v(struct libusb_context *ctx, enum libusb_log_level level,
        buf[header_len] = '\0';
        text_len = vsnprintf(buf + header_len, sizeof(buf) - header_len,
                format, args);
-       if (text_len < 0 || text_len + header_len >= sizeof(buf)) {
+       if (text_len < 0 || text_len + header_len >= (int)sizeof(buf)) {
                /* Truncated log output. On some platforms a -1 return value means
                 * that the output was truncated. */
                text_len = sizeof(buf) - header_len;
index 1f35b5b..2847bad 100644 (file)
@@ -1 +1 @@
-#define LIBUSB_NANO 11081
+#define LIBUSB_NANO 11083