From 0603c20bddfad34d654e021b882d21b5f74507ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20P=C3=B6schel?= Date: Sun, 9 Sep 2018 02:27:06 +0200 Subject: Add MinGW32 printf %zu workaround --- skypeweb/libskypeweb.h | 12 ++++++++++++ skypeweb/skypeweb_contacts.c | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/skypeweb/libskypeweb.h b/skypeweb/libskypeweb.h index e38739d..190a8c5 100644 --- a/skypeweb/libskypeweb.h +++ b/skypeweb/libskypeweb.h @@ -28,6 +28,7 @@ #include +#include #include #include #include @@ -45,6 +46,17 @@ # endif /* __GNUC__ >= 4 */ #endif /* G_GNUC_NULL_TERMINATED */ +// workaround for MinGW32 which doesn't support "%zu"; see also https://stackoverflow.com/a/44383330 +#ifdef _WIN32 +# ifdef _WIN64 +# define PRI_SIZET PRIu64 +# else +# define PRI_SIZET PRIu32 +# endif +#else +# define PRI_SIZET "zu" +#endif + #include "purplecompat.h" #ifdef _WIN32 diff --git a/skypeweb/skypeweb_contacts.c b/skypeweb/skypeweb_contacts.c index 36aa53f..eb0cbd2 100644 --- a/skypeweb/skypeweb_contacts.c +++ b/skypeweb/skypeweb_contacts.c @@ -616,7 +616,7 @@ skypeweb_xfer_send_contents_reader(PurpleHttpConnection *con, gchar *buf, size_t PurpleXfer *xfer = swft->xfer; gsize read; - purple_debug_info("skypeweb", "Asked %zu bytes from offset %zu\n", len, offset); + purple_debug_info("skypeweb", "Asked %" PRI_SIZET " bytes from offset %" PRI_SIZET "\n", len, offset); purple_xfer_set_bytes_sent(xfer, offset); read = purple_xfer_read_file(xfer, (guchar *)buf, len); purple_debug_info("skypeweb", "Read %" G_GSIZE_FORMAT " bytes\n", read); -- cgit v1.2.3