From fdbd7bb94051bce49a40b0e055bfa21755de3b1c Mon Sep 17 00:00:00 2001 From: Ruediger Meier Date: Mon, 22 Feb 2016 11:58:05 +0100 Subject: misc: again fixing many printf format strings This is again a huge patch regarding printf format strings to fix compiler warnings seen on clang/OSX. I'm trying to follow these rules strictly: #type #format #cast uintmax_t %ju - intmax_t %jd - uint64_t PRIu64 - int64_t PRId64 - size_t %zu - ssize_t %zd - ino_t %ju (uintmax_t) off_t %jd (intmax_t) Signed-off-by: Ruediger Meier --- disk-utils/sfdisk.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'disk-utils/sfdisk.c') diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c index 14c7cc089..3dfdd9e9a 100644 --- a/disk-utils/sfdisk.c +++ b/disk-utils/sfdisk.c @@ -278,7 +278,7 @@ static void backup_sectors(struct sfdisk *sf, devfd = fdisk_get_devfd(sf->cxt); assert(devfd >= 0); - xasprintf(&fname, "%s0x%08jx.bak", tpl, offset); + xasprintf(&fname, "%s0x%08"PRIx64".bak", tpl, offset); fd = open(fname, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR); if (fd < 0) @@ -421,7 +421,7 @@ static int move_partition_data(struct sfdisk *sf, size_t partno, struct fdisk_pa step--; step_bytes = step * ss; - DBG(MISC, ul_debug(" step: %ju (%ju bytes)", step, step_bytes)); + DBG(MISC, ul_debug(" step: %ju (%zu bytes)", (uintmax_t)step, step_bytes)); #if defined(POSIX_FADV_SEQUENTIAL) && defined(HAVE_POSIX_FADVISE) if (!backward) @@ -437,7 +437,7 @@ static int move_partition_data(struct sfdisk *sf, size_t partno, struct fdisk_pa color_disable(); fdisk_info(sf->cxt, _(" typescript file: %s"), typescript); printf(_(" old start: %ju, new start: %ju (move %ju sectors)\n"), - (uintmax_t) from, (uintmax_t) to, nsectors); + (uintmax_t) from, (uintmax_t) to, (uintmax_t) nsectors); fflush(stdout); } @@ -459,12 +459,15 @@ static int move_partition_data(struct sfdisk *sf, size_t partno, struct fdisk_pa fprintf(f, "# Disk: %s\n", devname); fprintf(f, "# Partition: %zu\n", partno + 1); fprintf(f, "# Operation: move data\n"); - fprintf(f, "# Original start offset (sectors/bytes): %ju/%ju\n", from, from * ss); - fprintf(f, "# New start offset (sectors/bytes): %ju/%ju\n", to, to * ss); - fprintf(f, "# Area size (sectors/bytes): %ju/%ju\n", nsectors, nsectors * ss); + fprintf(f, "# Original start offset (sectors/bytes): %ju/%ju\n", + (uintmax_t)from, (uintmax_t)from * ss); + fprintf(f, "# New start offset (sectors/bytes): %ju/%ju\n", + (uintmax_t)to, (uintmax_t)to * ss); + fprintf(f, "# Area size (sectors/bytes): %ju/%ju\n", + (uintmax_t)nsectors, (uintmax_t)nsectors * ss); fprintf(f, "# Sector size: %zu\n", ss); fprintf(f, "# Step size (in bytes): %zu\n", step_bytes); - fprintf(f, "# Steps: %zu\n", nsectors / step); + fprintf(f, "# Steps: %ju\n", (uintmax_t)(nsectors / step)); fprintf(f, "#\n"); fprintf(f, "# : (step offsets in bytes)\n"); -- cgit v1.2.3-55-g7522