From 29bff59c2a30b215a2bf82ee72892161a0ff9568 Mon Sep 17 00:00:00 2001 From: johan Date: Thu, 13 Nov 2003 19:08:43 +0000 Subject: [PATCH] Make this WARNS=2 clean by - #include for _time_to_time32 et al - use (uintmax_t) and %j - remove unused variable 'j' (from PR 39866) PR: 39866 Submitted by: Dan Lukes Tested by: make universe --- sbin/fsdb/Makefile | 1 - sbin/fsdb/fsdb.c | 1 + sbin/fsdb/fsdbutil.c | 16 +++++++++------- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/sbin/fsdb/Makefile b/sbin/fsdb/Makefile index d12f7e6f2ee..5e1591b22ce 100644 --- a/sbin/fsdb/Makefile +++ b/sbin/fsdb/Makefile @@ -8,7 +8,6 @@ SRCS= fsdb.c fsdbutil.c \ dir.c ea.c fsutil.c inode.c pass1.c pass1b.c pass2.c pass3.c pass4.c \ pass5.c setup.c utilities.c ffs_subr.c ffs_tables.c CFLAGS+= -I${.CURDIR}/../fsck_ffs -WARNS= 0 LDADD+= -ledit -ltermcap DPADD+= ${LIBEDIT} ${LIBTERMCAP} .PATH: ${.CURDIR}/../fsck_ffs ${.CURDIR}/../../sys/ufs/ffs diff --git a/sbin/fsdb/fsdb.c b/sbin/fsdb/fsdb.c index 1e91d22fca4..f60f50c9852 100644 --- a/sbin/fsdb/fsdb.c +++ b/sbin/fsdb/fsdb.c @@ -41,6 +41,7 @@ static const char rcsid[] = #include #include #include +#include #include #include diff --git a/sbin/fsdb/fsdbutil.c b/sbin/fsdb/fsdbutil.c index b0d4c124482..b00061941e0 100644 --- a/sbin/fsdb/fsdbutil.c +++ b/sbin/fsdb/fsdbutil.c @@ -38,8 +38,10 @@ static const char rcsid[] = #include #include #include +#include #include #include +#include #include #include @@ -152,8 +154,8 @@ printstat(const char *cp, ino_t inum, union dinode *dp) puts("fifo"); break; } - printf("I=%lu MODE=%o SIZE=%qu", (u_long)inum, DIP(dp, di_mode), - DIP(dp, di_size)); + printf("I=%lu MODE=%o SIZE=%ju", (u_long)inum, DIP(dp, di_mode), + (uintmax_t)DIP(dp, di_size)); if (sblock.fs_magic == FS_UFS1_MAGIC) t = _time32_to_time(dp->dp1.di_mtime); else @@ -187,8 +189,8 @@ printstat(const char *cp, ino_t inum, union dinode *dp) blocks = DIP(dp, di_blocks); gen = DIP(dp, di_gen); - printf("LINKCNT=%hd FLAGS=%#x BLKCNT=%qx GEN=%qx\n", DIP(dp, di_nlink), - DIP(dp, di_flags), blocks, gen); + printf("LINKCNT=%hd FLAGS=%#x BLKCNT=%jx GEN=%jx\n", DIP(dp, di_nlink), + DIP(dp, di_flags), (intmax_t)blocks, (intmax_t)gen); } @@ -248,7 +250,7 @@ printindir(ufs2_daddr_t blk, int level, char *bufp) putchar('\n'); return 0; } - j = sprintf(tempbuf, "%qd", blkno); + j = sprintf(tempbuf, "%jd", (intmax_t)blkno); if (level == 0) { charssofar += j; if (charssofar >= cpl - 2) { @@ -279,7 +281,7 @@ static void printblocks(ino_t inum, union dinode *dp) { char *bufp; - int i, j, nfrags; + int i, nfrags; long ndb, offset; ufs2_daddr_t blkno; @@ -294,7 +296,7 @@ printblocks(ino_t inum, union dinode *dp) if (i > 0) printf(", "); blkno = DIP(dp, di_db[i]); - printf("%qd", blkno); + printf("%jd", (intmax_t)blkno); if (--ndb == 0 && (offset = blkoff(&sblock, DIP(dp, di_size))) != 0) { nfrags = numfrags(&sblock, fragroundup(&sblock, offset)); printf(" (%d frag%s)", nfrags, nfrags > 1? "s": ""); -- 2.45.2