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.
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;
{
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:
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;
}
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;
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;
}
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;
}
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));