From 5480ff59a9116839a0df98ee726a8c8644b555ce Mon Sep 17 00:00:00 2001 From: krw Date: Sat, 24 May 2014 14:54:49 +0000 Subject: [PATCH] Use consistent format specifiers (%lld) and casts (long long) when printing out block numbers and sector numbers. Make output verbiage consistent. -Wall happier. Original diff and ok chl@ --- sbin/fsck_ext2fs/utilities.c | 19 +++++++++++++------ sbin/fsck_ffs/utilities.c | 20 +++++++++----------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/sbin/fsck_ext2fs/utilities.c b/sbin/fsck_ext2fs/utilities.c index 81ec619edf3..a23ae0ca3b2 100644 --- a/sbin/fsck_ext2fs/utilities.c +++ b/sbin/fsck_ext2fs/utilities.c @@ -1,4 +1,4 @@ -/* $OpenBSD: utilities.c,v 1.21 2014/05/22 14:04:41 krw Exp $ */ +/* $OpenBSD: utilities.c,v 1.22 2014/05/24 14:54:49 krw Exp $ */ /* $NetBSD: utilities.c,v 1.6 2001/02/04 21:19:34 christos Exp $ */ /* @@ -295,11 +295,12 @@ bread(int fd, char *buf, daddr32_t blk, long size) for (cp = buf, i = 0; i < size; i += secsize, cp += secsize) { if (pread(fd, cp, secsize, offset + i) != secsize) { if (secsize != DEV_BSIZE) - printf(" %ld (%ld),", - (blk * DEV_BSIZE + i) / secsize, - blk + i / DEV_BSIZE); + printf(" %lld (%lld),", + (long long)(offset + i) / secsize, + (long long)blk + i / DEV_BSIZE); else - printf(" %ld,", blk + i / DEV_BSIZE); + printf(" %lld,", (long long)blk + + i / DEV_BSIZE); errs++; } } @@ -326,7 +327,13 @@ bwrite(int fd, char *buf, daddr32_t blk, long size) printf("THE FOLLOWING SECTORS COULD NOT BE WRITTEN:"); for (cp = buf, i = 0; i < size; i += secsize, cp += secsize) if (pwrite(fd, cp, secsize, offset + i) != secsize) { - printf(" %ld,", blk + i / DEV_BSIZE); + if (secsize != DEV_BSIZE) + printf(" %lld (%lld),", + (long long)(offset + i) / secsize, + (long long)blk + i / DEV_BSIZE); + else + printf(" %lld,", (long long)blk + + i / DEV_BSIZE); } printf("\n"); return; diff --git a/sbin/fsck_ffs/utilities.c b/sbin/fsck_ffs/utilities.c index 55f51e3527f..a1d292684d8 100644 --- a/sbin/fsck_ffs/utilities.c +++ b/sbin/fsck_ffs/utilities.c @@ -1,4 +1,4 @@ -/* $OpenBSD: utilities.c,v 1.45 2014/05/21 18:53:05 krw Exp $ */ +/* $OpenBSD: utilities.c,v 1.46 2014/05/24 14:54:49 krw Exp $ */ /* $NetBSD: utilities.c,v 1.18 1996/09/27 22:45:20 christos Exp $ */ /* @@ -349,12 +349,11 @@ bread(int fd, char *buf, daddr_t blk, long size) if (pread(fd, cp, secsize, offset + i) != secsize) { if (secsize != DEV_BSIZE) printf(" %lld (%lld),", - (long long)((blk * DEV_BSIZE + i) / - secsize), - (long long)(blk + i / DEV_BSIZE)); + (long long)(offset + i) / secsize, + (long long)blk + i / DEV_BSIZE); else - printf(" %lld,", - (long long)(blk + i / DEV_BSIZE)); + printf(" %lld,", (long long)blk + + i / DEV_BSIZE); errs++; } } @@ -383,12 +382,11 @@ bwrite(int fd, char *buf, daddr_t blk, long size) if (pwrite(fd, cp, secsize, offset + i) != secsize) { if (secsize != DEV_BSIZE) printf(" %lld (%lld),", - (long long)((blk * DEV_BSIZE + i) / - secsize), - (long long)(blk + i / DEV_BSIZE)); + (long long)(offset + i) / secsize, + (long long)blk + i / DEV_BSIZE); else - printf(" %lld,", - (long long)(blk + i / DEV_BSIZE)); + printf(" %lld,", (long long)blk + + i / DEV_BSIZE); } printf("\n"); return; -- 2.20.1