diff options
author | Ruediger Meier | 2016-02-22 11:58:05 +0100 |
---|---|---|
committer | Ruediger Meier | 2016-03-07 23:16:04 +0100 |
commit | fdbd7bb94051bce49a40b0e055bfa21755de3b1c (patch) | |
tree | b4525048d811b8a7bf1d6574922995fa25fb8a9f /disk-utils/sfdisk.c | |
parent | wipefs, sfdisk: include libgen.h for basename(3p) (diff) | |
download | kernel-qcow2-util-linux-fdbd7bb94051bce49a40b0e055bfa21755de3b1c.tar.gz kernel-qcow2-util-linux-fdbd7bb94051bce49a40b0e055bfa21755de3b1c.tar.xz kernel-qcow2-util-linux-fdbd7bb94051bce49a40b0e055bfa21755de3b1c.zip |
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 <ruediger.meier@ga-group.nl>
Diffstat (limited to 'disk-utils/sfdisk.c')
-rw-r--r-- | disk-utils/sfdisk.c | 17 |
1 files changed, 10 insertions, 7 deletions
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>: <from> <to> (step offsets in bytes)\n"); |