summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPete Batard <pete@akeo.ie>2012-08-07 13:36:16 +0100
committerPete Batard <pete@akeo.ie>2012-08-12 22:13:04 +0100
commit2d7d3beccccb87a6f705a5c31b6aca0a07d2f494 (patch)
tree4b8cbfbb9a2be65d770282d40d69b30fae6822d4
parent636ed66d2639f7610dba792ffe998dc636625f01 (diff)
downloadlibusb-2d7d3beccccb87a6f705a5c31b6aca0a07d2f494.tar.gz
Core: Fix a Clang warning in io.c
* Using sizeof() in the UNUSED() macro didn't silence all unused variable warnings. * Also fix an "unused ctx" warning when ENABLE_DEBUG_LOGGING is on * Also improve debug output on libusb_open() failure
-rw-r--r--libusb/core.c3
-rw-r--r--libusb/libusbi.h2
-rw-r--r--libusb/version_nano.h2
3 files changed, 4 insertions, 3 deletions
diff --git a/libusb/core.c b/libusb/core.c
index eccc216..7c2f4d7 100644
--- a/libusb/core.c
+++ b/libusb/core.c
@@ -1000,7 +1000,7 @@ int API_EXPORTED libusb_open(libusb_device *dev,
r = usbi_backend->open(_handle);
if (r < 0) {
- usbi_dbg("open %d.%d returns %d", dev->bus_number, dev->device_address, r);
+ usbi_dbg("could not open device: %s", libusb_error_name(r));
libusb_unref_device(dev);
usbi_mutex_destroy(&_handle->lock);
free(_handle);
@@ -1802,6 +1802,7 @@ void usbi_log_v(struct libusb_context *ctx, enum libusb_log_level level,
#ifdef ENABLE_DEBUG_LOGGING
global_debug = 1;
+ UNUSED(ctx);
#else
USBI_GET_CONTEXT(ctx);
if (ctx == NULL)
diff --git a/libusb/libusbi.h b/libusb/libusbi.h
index dd5cede..5ec0761 100644
--- a/libusb/libusbi.h
+++ b/libusb/libusbi.h
@@ -50,7 +50,7 @@
#define USB_MAXCONFIG 8
/* The following is used to silence warnings for unused variables */
-#define UNUSED(var) (void)sizeof(var)
+#define UNUSED(var) (void)(var)
struct list_head {
struct list_head *prev, *next;
diff --git a/libusb/version_nano.h b/libusb/version_nano.h
index 1b7c3e7..c52db03 100644
--- a/libusb/version_nano.h
+++ b/libusb/version_nano.h
@@ -1 +1 @@
-#define LIBUSB_NANO 10545
+#define LIBUSB_NANO 10546