diff --git a/src/platform.h b/src/platform.h index f1d8155..877e320 100644 --- a/src/platform.h +++ b/src/platform.h @@ -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 diff --git a/src/suunto_eonsteel.c b/src/suunto_eonsteel.c index 09f21a9..07cd85c 100644 --- a/src/suunto_eonsteel.c +++ b/src/suunto_eonsteel.c @@ -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) { diff --git a/src/uwatec_g2.c b/src/uwatec_g2.c index 6e35104..f6b0b02 100644 --- a/src/uwatec_g2.c +++ b/src/uwatec_g2.c @@ -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];