diff options
author | Chris Dickens <christopher.a.dickens@gmail.com> | 2020-01-21 16:43:32 -0800 |
---|---|---|
committer | Chris Dickens <christopher.a.dickens@gmail.com> | 2020-01-21 16:43:32 -0800 |
commit | e4e905700327f9f85791b23f09185ba84baa7549 (patch) | |
tree | ae7091ad5b6223a3214789af5108b2ff4e475c98 | |
parent | 96e0af79b383fa805dd4bff1e4f8bebe3c6fdb46 (diff) | |
download | libusb-e4e905700327f9f85791b23f09185ba84baa7549.tar.gz |
Windows: Fix some MinGW build warnings and printf format specifiers
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
-rw-r--r-- | libusb/os/poll_windows.c | 2 | ||||
-rw-r--r-- | libusb/os/windows_common.c | 14 | ||||
-rw-r--r-- | libusb/os/windows_winusb.c | 6 | ||||
-rw-r--r-- | libusb/version_nano.h | 2 |
4 files changed, 12 insertions, 12 deletions
diff --git a/libusb/os/poll_windows.c b/libusb/os/poll_windows.c index 2a3734a..b256d69 100644 --- a/libusb/os/poll_windows.c +++ b/libusb/os/poll_windows.c @@ -60,7 +60,7 @@ static size_t fd_count; static size_t fd_size; #define INC_FDS_EACH 256 -static void usbi_dec_fd_table() +static void usbi_dec_fd_table(void) { fd_count--; if (fd_count == 0) { diff --git a/libusb/os/windows_common.c b/libusb/os/windows_common.c index e69d0b0..c170f43 100644 --- a/libusb/os/windows_common.c +++ b/libusb/os/windows_common.c @@ -81,7 +81,7 @@ const char *windows_error_str(DWORD error_code) if (error_code == 0) error_code = GetLastError(); - len = sprintf(err_string, "[%u] ", (unsigned int)error_code); + len = sprintf(err_string, "[%lu] ", error_code); // Translate codes returned by SetupAPI. The ones we are dealing with are either // in 0x0000xxxx or 0xE000xxxx and can be distinguished from standard error codes. @@ -104,10 +104,10 @@ const char *windows_error_str(DWORD error_code) DWORD format_error = GetLastError(); if (format_error) snprintf(err_string, sizeof(err_string), - "Windows error code %u (FormatMessage error code %u)", - (unsigned int)error_code, (unsigned int)format_error); + "Windows error code %lu (FormatMessage error code %lu)", + error_code, format_error); else - snprintf(err_string, sizeof(err_string), "Unknown error code %u", (unsigned int)error_code); + snprintf(err_string, sizeof(err_string), "Unknown error code %lu", error_code); } else { // Remove CRLF from end of message, if present size_t pos = len + size - 2; @@ -527,7 +527,7 @@ static void windows_transfer_callback(const struct windows_backend *backend, { int status, istatus; - usbi_dbg("handling I/O completion with errcode %u, size %u", (unsigned int)io_result, (unsigned int)io_size); + usbi_dbg("handling I/O completion with errcode %lu, size %lu", io_result, io_size); switch (io_result) { case NO_ERROR: @@ -555,7 +555,7 @@ static void windows_transfer_callback(const struct windows_backend *backend, status = LIBUSB_TRANSFER_NO_DEVICE; break; default: - usbi_err(ITRANSFER_CTX(itransfer), "detected I/O error %u: %s", (unsigned int)io_result, windows_error_str(io_result)); + usbi_err(ITRANSFER_CTX(itransfer), "detected I/O error %lu: %s", io_result, windows_error_str(io_result)); status = LIBUSB_TRANSFER_ERROR; break; } @@ -674,7 +674,7 @@ static void windows_exit(struct libusb_context *ctx) char sem_name[11 + 8 + 1]; // strlen("libusb_init") + (32-bit hex PID) + '\0' UNUSED(ctx); - sprintf(sem_name, "libusb_init%08X", (unsigned int)(GetCurrentProcessId() & 0xFFFFFFFF)); + sprintf(sem_name, "libusb_init%08lX", (GetCurrentProcessId() & 0xFFFFFFFFUL)); semaphore = CreateSemaphoreA(NULL, 1, 1, sem_name); if (semaphore == NULL) return; diff --git a/libusb/os/windows_winusb.c b/libusb/os/windows_winusb.c index 9fd188f..dcb33d2 100644 --- a/libusb/os/windows_winusb.c +++ b/libusb/os/windows_winusb.c @@ -3354,7 +3354,7 @@ static int _hid_get_report(struct hid_device_priv *dev, HANDLE hid_handle, int i usbi_dbg("program assertion failed: hid_buffer is not NULL"); if ((*size == 0) || (*size > MAX_HID_REPORT_SIZE)) { - usbi_dbg("invalid size (%zu)", *size); + usbi_dbg("invalid size ("PRIuPTR")", (uintptr_t)*size); return LIBUSB_ERROR_INVALID_PARAM; } @@ -3433,7 +3433,7 @@ static int _hid_set_report(struct hid_device_priv *dev, HANDLE hid_handle, int i usbi_dbg("program assertion failed: hid_buffer is not NULL"); if ((*size == 0) || (*size > max_report_size)) { - usbi_dbg("invalid size (%zu)", *size); + usbi_dbg("invalid size ("PRIuPTR")", (uintptr_t)*size); return LIBUSB_ERROR_INVALID_PARAM; } @@ -3633,7 +3633,7 @@ static int hid_open(int sub_api, struct libusb_device_handle *dev_handle) size[1] = capabilities.NumberOutputValueCaps; size[2] = capabilities.NumberFeatureValueCaps; for (j = HidP_Input; j <= HidP_Feature; j++) { - usbi_dbg("%u HID %s report value(s) found", (unsigned int)size[j], type[j]); + usbi_dbg("%lu HID %s report value(s) found", size[j], type[j]); priv->hid->uses_report_ids[j] = false; if (size[j] > 0) { value_caps = calloc(size[j], sizeof(HIDP_VALUE_CAPS)); diff --git a/libusb/version_nano.h b/libusb/version_nano.h index a8f90d9..b05b0f4 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 11433 +#define LIBUSB_NANO 11434 |