Use the correct printf format for the size_t type

This commit is contained in:
Jef Driesen 2017-09-27 19:53:18 +02:00
parent 52e03944c0
commit 5a00224c93
3 changed files with 9 additions and 2 deletions

View File

@ -26,6 +26,12 @@
extern "C" {
#endif /* __cplusplus */
#ifdef _WIN32
#define DC_PRINTF_SIZE "%Iu"
#else
#define DC_PRINTF_SIZE "%zu"
#endif
#ifdef _MSC_VER
#define snprintf _snprintf
#define strcasecmp _stricmp

View File

@ -137,7 +137,7 @@ static int receive_packet(suunto_eonsteel_device_t *eon, unsigned char *buffer,
return -1;
}
if (transferred != PACKET_SIZE) {
ERROR(eon->base.context, "incomplete read interrupt transfer (got %zu, expected %d)", transferred, PACKET_SIZE);
ERROR(eon->base.context, "incomplete read interrupt transfer (got " DC_PRINTF_SIZE ", expected %d)", transferred, PACKET_SIZE);
return -1;
}
if (buf[0] != 0x3f) {

View File

@ -28,6 +28,7 @@
#include "device-private.h"
#include "usbhid.h"
#include "array.h"
#include "platform.h"
#define ISINSTANCE(device) dc_device_isinstance((device), &uwatec_g2_device_vtable)
@ -76,7 +77,7 @@ receive_data (uwatec_g2_device_t *device, dc_event_progress_t *progress, unsigne
return rc;
}
if (transferred != PACKET_SIZE) {
ERROR (device->base.context, "incomplete read interrupt transfer (got %zu, expected %d)", transferred, PACKET_SIZE);
ERROR (device->base.context, "incomplete read interrupt transfer (got " DC_PRINTF_SIZE ", expected %d)", transferred, PACKET_SIZE);
return DC_STATUS_PROTOCOL;
}
len = buf[0];