Browse Source

Fix trivial libusbx warnings.

nfactor-troky
Con Kolivas 11 years ago
parent
commit
fb955af7a9
  1. 4
      compat/libusb-1.0/libusb/core.c
  2. 2
      compat/libusb-1.0/libusb/os/linux_udev.c
  3. 6
      compat/libusb-1.0/libusb/os/linux_usbfs.c

4
compat/libusb-1.0/libusb/core.c

@ -2138,7 +2138,7 @@ void usbi_log_v(struct libusb_context *ctx, enum libusb_log_level level,
"libusbx: %s [%s] ", prefix, function); "libusbx: %s [%s] ", prefix, function);
} }
if (header_len < 0 || header_len >= sizeof(buf)) { if (header_len < 0 || (size_t)header_len >= sizeof(buf)) {
/* Somehow snprintf failed to write to the buffer, /* Somehow snprintf failed to write to the buffer,
* remove the header so something useful is output. */ * remove the header so something useful is output. */
header_len = 0; header_len = 0;
@ -2147,7 +2147,7 @@ void usbi_log_v(struct libusb_context *ctx, enum libusb_log_level level,
buf[header_len] = '\0'; buf[header_len] = '\0';
text_len = vsnprintf(buf + header_len, sizeof(buf) - header_len, text_len = vsnprintf(buf + header_len, sizeof(buf) - header_len,
format, args); format, args);
if (text_len < 0 || text_len + header_len >= sizeof(buf)) { if (text_len < 0 || text_len + (size_t)header_len >= sizeof(buf)) {
/* Truncated log output. On some platforms a -1 return value means /* Truncated log output. On some platforms a -1 return value means
* that the output was truncated. */ * that the output was truncated. */
text_len = sizeof(buf) - header_len; text_len = sizeof(buf) - header_len;

2
compat/libusb-1.0/libusb/os/linux_udev.c

@ -158,7 +158,7 @@ int linux_udev_stop_event_monitor(void)
return LIBUSB_SUCCESS; return LIBUSB_SUCCESS;
} }
static void *linux_udev_event_thread_main(void *arg) static void *linux_udev_event_thread_main(void __attribute__((unused)) *arg)
{ {
char dummy; char dummy;
int r; int r;

6
compat/libusb-1.0/libusb/os/linux_usbfs.c

@ -784,7 +784,7 @@ static int op_get_active_config_descriptor(struct libusb_device *dev,
if (r < 0) if (r < 0)
return r; return r;
len = MIN(len, r); len = MIN(len, (size_t)r);
memcpy(buffer, config_desc, len); memcpy(buffer, config_desc, len);
return len; return len;
} }
@ -814,7 +814,7 @@ static int op_get_config_descriptor(struct libusb_device *dev,
descriptors += r; descriptors += r;
} }
len = MIN(len, r); len = MIN(len, (size_t)r);
memcpy(buffer, descriptors, len); memcpy(buffer, descriptors, len);
return len; return len;
} }
@ -1090,7 +1090,7 @@ void linux_hotplug_enumerate(uint8_t busnum, uint8_t devaddr, const char *sys_na
usbi_mutex_static_unlock(&active_contexts_lock); usbi_mutex_static_unlock(&active_contexts_lock);
} }
void linux_device_disconnected(uint8_t busnum, uint8_t devaddr, const char *sys_name) void linux_device_disconnected(uint8_t busnum, uint8_t devaddr, const char __attribute__((unused)) *sys_name)
{ {
struct libusb_context *ctx; struct libusb_context *ctx;
struct libusb_device *dev; struct libusb_device *dev;

Loading…
Cancel
Save