nbdkit/0004-xz-Fix-various-printf-...

50 lines
2.0 KiB
Diff

From 0759d15aa3649d088eeae91fcd174d0b37e1ccde Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 11 Jan 2016 19:02:53 +0000
Subject: [PATCH 04/10] xz: Fix various printf warnings on 32 bit.
xzfile.c: In function 'xzfile_read_block':
xzfile.c:456:19: warning: format '%zu' expects argument of type 'size_t', but argument 2 has type 'uint64_t {aka long long unsigned int}' [-Wformat=]
nbdkit_error ("malloc (%zu bytes): %m\n"
^
xz.c: In function 'xz_close':
xz.c:191:17: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 2 has type 'size_t {aka unsigned int}' [-Wformat=]
nbdkit_debug ("cache: hits = %" PRIu64 ", misses = %" PRIu64,
^
xz.c:191:17: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 3 has type 'size_t {aka unsigned int}' [-Wformat=]
---
plugins/xz/xz.c | 3 +--
plugins/xz/xzfile.c | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/plugins/xz/xz.c b/plugins/xz/xz.c
index 9a1f5e5..437f798 100644
--- a/plugins/xz/xz.c
+++ b/plugins/xz/xz.c
@@ -188,8 +188,7 @@ xz_close (void *handle)
blkcache_get_stats (h->c, &stats);
- nbdkit_debug ("cache: hits = %" PRIu64 ", misses = %" PRIu64,
- stats.hits, stats.misses);
+ nbdkit_debug ("cache: hits = %zu, misses = %zu", stats.hits, stats.misses);
xzfile_close (h->xz);
free_blkcache (h->c);
diff --git a/plugins/xz/xzfile.c b/plugins/xz/xzfile.c
index fcc2937..3633099 100644
--- a/plugins/xz/xzfile.c
+++ b/plugins/xz/xzfile.c
@@ -453,7 +453,7 @@ xzfile_read_block (xzfile *xz, uint64_t offset,
data = malloc (*size_rtn);
if (data == NULL) {
- nbdkit_error ("malloc (%zu bytes): %m\n"
+ nbdkit_error ("malloc (%" PRIu64 " bytes): %m\n"
"NOTE: If this error occurs, you need to recompress your xz files with a smaller block size. Use: 'xz --block-size=16777216 ...'.",
*size_rtn);
goto err1;
--
2.7.4