From de6068450094783b9ed68ec9553ea59d02a208ff Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Fri, 5 Jul 2024 13:49:26 +0900 Subject: [PATCH] Fix printing size_t and off_t value for LLP64 Windows. * src/debug.h (_trace_sysres_off_t): Use 'z' length specifier. * src/w32-io.c (_gpgme_io_read): Likewise. (writer, _gpgme_io_write): Likewise. -- GnuPG-bug-id: 7187 Signed-off-by: NIIBE Yutaka --- src/debug.h | 2 +- src/w32-io.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/debug.h b/src/debug.h index 37d58e95..64e049a5 100644 --- a/src/debug.h +++ b/src/debug.h @@ -164,7 +164,7 @@ static inline gpgme_off_t _trace_sysres_off_t (gpgme_off_t res, int lvl, const char *func, int line) { if (res >= 0) - _gpgme_debug (NULL, lvl, 3, func, NULL, NULL, "result=%ld", res); + _gpgme_debug (NULL, lvl, 3, func, NULL, NULL, "result=%zd", (size_t)res); else _gpgme_debug (NULL, lvl, -1, NULL, NULL, NULL, "%s:%d: error: %s (%d)\n", diff --git a/src/w32-io.c b/src/w32-io.c index a403a73a..fdcb7aa1 100644 --- a/src/w32-io.c +++ b/src/w32-io.c @@ -680,7 +680,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count) int nread; struct reader_context_s *ctx; TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_read", fd, - "buffer=%p, count=%u", buffer, count); + "buffer=%p, count=%zd", buffer, count); ctx = find_reader (fd); if (!ctx) @@ -793,7 +793,7 @@ writer (void *arg) } UNLOCK (ctx->mutex); - TRACE_LOG ("%s %d bytes", sock?"sending":"writing", ctx->nbytes); + TRACE_LOG ("%s %zd bytes", sock?"sending":"writing", ctx->nbytes); /* Note that CTX->nbytes is not zero at this point, because _gpgme_io_write always writes at least 1 byte before waking @@ -846,7 +846,7 @@ writer (void *arg) wait_for_single_object (ctx->close_ev, INFINITE); if (ctx->nbytes) - TRACE_LOG ("still %d bytes in buffer at close time", ctx->nbytes); + TRACE_LOG ("still %zd bytes in buffer at close time", ctx->nbytes); release_hddesc (ctx->hdd); close_handle (ctx->close_ev); @@ -1013,7 +1013,7 @@ _gpgme_io_write (int fd, const void *buffer, size_t count) { struct writer_context_s *ctx; TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_write", fd, - "buffer=%p, count=%u", buffer, count); + "buffer=%p, count=%zd", buffer, count); TRACE_LOGBUFX (buffer, count); if (count == 0)