Skip to content

Commit

Permalink
Various: reconcile formatting strings and int-ish casting
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Klimov <[email protected]>
  • Loading branch information
jimklimov committed Jan 28, 2025
1 parent c8927a5 commit 05e7131
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions drivers/libusb1.c
Original file line number Diff line number Diff line change
Expand Up @@ -730,8 +730,8 @@ static int nut_libusb_open(libusb_device_handle **udevp,
#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE) )
# pragma GCC diagnostic pop
#endif
upsdebugx(2, "HID descriptor too long %d (max %d)",
rdlen, UINT16_MAX);
upsdebugx(2, "HID descriptor too long %d (max %" PRIuMAX ")",
rdlen, (uintmax_t)UINT16_MAX);
goto next_device;
}

Expand Down
6 changes: 3 additions & 3 deletions drivers/nut-libfreeipmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ int nut_ipmi_open(int ipmi_id, IPMIDevice_t *ipmi_dev)
if (area_length > (int)UINT8_MAX) {
libfreeipmi_cleanup();
fatal_with_errno(EXIT_FAILURE,
"nut_ipmi_open: got area_length %d is too large for libfreeipmi",
"nut_ipmi_open: got area_length %u is too large for libfreeipmi",
area_length);
}

Expand Down Expand Up @@ -794,7 +794,7 @@ static int libfreeipmi_get_sensors_info (IPMIDevice_t *ipmi_dev)
if (tmp_entity_id == entity_id
&& tmp_entity_instance == entity_instance)
{
upsdebugx (1, "Found record id = %u for device id %u",
upsdebugx (1, "Found record id = %u for device id %i",
record_id, ipmi_dev->ipmi_id);

/* Add it to the tracked list */
Expand All @@ -817,7 +817,7 @@ static int libfreeipmi_get_sensors_info (IPMIDevice_t *ipmi_dev)
#endif /* HAVE_FREEIPMI_11X_12X */

if (ipmi_dev->sensors_count > INT_MAX) {
upsdebugx(1, "%s: Found %i sensors which is too many",
upsdebugx(1, "%s: Found %u sensors which is too many",
__func__, ipmi_dev->sensors_count);
}
return (int)ipmi_dev->sensors_count;
Expand Down
6 changes: 3 additions & 3 deletions tools/nut-scanner/scan_ipmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -617,13 +617,13 @@ nutscan_device_t * nutscan_scan_ipmi_device(const char * IPaddr, nutscan_ipmi_t
nut_dev->type = TYPE_IPMI;
nut_dev->driver = strdup(NUT_IPMI_DRV_NAME);
if (IPaddr == NULL) {
sprintf(port_id, "id%x", ipmi_id);
sprintf(port_id, "id%x", (unsigned int)ipmi_id);
}
else {
/* FIXME: also check against "localhost" and its IPv{4,6} */
/* FIXME: Should the IPv6 address here be bracketed?
* Does our driver support the notation? */
sprintf(port_id, "id%x@%s", ipmi_id, IPaddr);
sprintf(port_id, "id%x@%s", (unsigned int)ipmi_id, IPaddr);
}
nut_dev->port = strdup(port_id);
/* FIXME: also dump device.serial?
Expand Down Expand Up @@ -845,7 +845,7 @@ nutscan_device_t * nutscan_scan_ip_range_ipmi(nutscan_ip_range_list_t * irl, nut
upsdebugx(4, "%s: max_threads_scantype=%" PRIuSIZE
" curr_threads=%" PRIuSIZE
" thread_count=%" PRIuSIZE
" stwST=%d stwS=%d pass=%d",
" stwST=%d stwS=%d pass=%u",
__func__, max_threads_scantype,
curr_threads, thread_count,
stwST, stwS, pass
Expand Down

0 comments on commit 05e7131

Please sign in to comment.