Replace the use of %qd with intmax_t/%jd and fix a number of -Wall

and -Wformat warnings:
 o Include timeconv.h for the time conversion functions.
 o Remove unused variables.
 o Correct a few cases where %d was used when printing longs.
This commit is contained in:
Ian Dowse 2002-07-08 00:29:23 +00:00
parent 64ca701084
commit 617dbd3c84
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=99562
4 changed files with 24 additions and 21 deletions

View file

@ -52,6 +52,7 @@ static const char rcsid[] =
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <timeconv.h>
#include "dump.h" #include "dump.h"

View file

@ -59,10 +59,12 @@ static const char rcsid[] =
#include <err.h> #include <err.h>
#include <fcntl.h> #include <fcntl.h>
#include <fstab.h> #include <fstab.h>
#include <inttypes.h>
#include <signal.h> #include <signal.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <timeconv.h>
#include <unistd.h> #include <unistd.h>
#include "dump.h" #include "dump.h"
@ -102,7 +104,6 @@ main(int argc, char *argv[])
int just_estimate = 0; int just_estimate = 0;
ino_t maxino; ino_t maxino;
char *tmsg; char *tmsg;
time_t t;
spcl.c_date = _time_to_time64(time(NULL)); spcl.c_date = _time_to_time64(time(NULL));
@ -359,7 +360,7 @@ main(int argc, char *argv[])
dev_bsize = sblock->fs_fsize / fsbtodb(sblock, 1); dev_bsize = sblock->fs_fsize / fsbtodb(sblock, 1);
dev_bshift = ffs(dev_bsize) - 1; dev_bshift = ffs(dev_bsize) - 1;
if (dev_bsize != (1 << dev_bshift)) if (dev_bsize != (1 << dev_bshift))
quit("dev_bsize (%d) is not a power of 2", dev_bsize); quit("dev_bsize (%ld) is not a power of 2", dev_bsize);
tp_bshift = ffs(TP_BSIZE) - 1; tp_bshift = ffs(TP_BSIZE) - 1;
if (TP_BSIZE != (1 << tp_bshift)) if (TP_BSIZE != (1 << tp_bshift))
quit("TP_BSIZE (%d) is not a power of 2", TP_BSIZE); quit("TP_BSIZE (%d) is not a power of 2", TP_BSIZE);
@ -492,19 +493,19 @@ main(int argc, char *argv[])
for (i = 0; i < ntrec; i++) for (i = 0; i < ntrec; i++)
writeheader(maxino - 1); writeheader(maxino - 1);
if (pipeout) if (pipeout)
msg("DUMP: %qd tape blocks\n", spcl.c_tapea); msg("DUMP: %jd tape blocks\n", (intmax_t)spcl.c_tapea);
else else
msg("DUMP: %qd tape blocks on %d volume%s\n", msg("DUMP: %jd tape blocks on %d volume%s\n",
spcl.c_tapea, spcl.c_volume, (intmax_t)spcl.c_tapea, spcl.c_volume,
(spcl.c_volume == 1) ? "" : "s"); (spcl.c_volume == 1) ? "" : "s");
/* report dump performance, avoid division through zero */ /* report dump performance, avoid division through zero */
if (tend_writing - tstart_writing == 0) if (tend_writing - tstart_writing == 0)
msg("finished in less than a second\n"); msg("finished in less than a second\n");
else else
msg("finished in %d seconds, throughput %qd KBytes/sec\n", msg("finished in %d seconds, throughput %jd KBytes/sec\n",
tend_writing - tstart_writing, tend_writing - tstart_writing, (intmax_t)(spcl.c_tapea /
spcl.c_tapea / (tend_writing - tstart_writing)); (tend_writing - tstart_writing)));
putdumptime(); putdumptime();
trewind(); trewind();

View file

@ -781,6 +781,7 @@ doslave(int cmd, int slave_number)
eot_count = 0; eot_count = 0;
size = 0; size = 0;
wrote = 0;
while (eot_count < 10 && size < writesize) { while (eot_count < 10 && size < writesize) {
#ifdef RDUMP #ifdef RDUMP
if (host) if (host)

View file

@ -49,11 +49,13 @@ static const char rcsid[] =
#include <protocols/dumprestore.h> #include <protocols/dumprestore.h>
#include <ctype.h> #include <ctype.h>
#include <stdio.h>
#include <errno.h> #include <errno.h>
#include <string.h> #include <inttypes.h>
#include <unistd.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include <timeconv.h>
#include <unistd.h>
#include "dump.h" #include "dump.h"
@ -388,8 +390,6 @@ searchdir(
void void
dumpino(union dinode *dp, ino_t ino) dumpino(union dinode *dp, ino_t ino)
{ {
struct ufs1_dinode *dp1;
struct ufs2_dinode *dp2;
int ind_level, cnt; int ind_level, cnt;
off_t size; off_t size;
char buf[TP_BSIZE]; char buf[TP_BSIZE];
@ -705,11 +705,11 @@ bread(ufs2_daddr_t blkno, char *buf, int size)
goto loop; goto loop;
} }
if (cnt == -1) if (cnt == -1)
msg("read error from %s: %s: [block %qd]: count=%d\n", msg("read error from %s: %s: [block %jd]: count=%d\n",
disk, strerror(errno), blkno, size); disk, strerror(errno), (intmax_t)blkno, size);
else else
msg("short read error from %s: [block %qd]: count=%d, got=%d\n", msg("short read error from %s: [block %jd]: count=%d, got=%d\n",
disk, blkno, size, cnt); disk, (intmax_t)blkno, size, cnt);
if (++breaderrors > BREADEMAX) { if (++breaderrors > BREADEMAX) {
msg("More than %d block read errors from %s\n", msg("More than %d block read errors from %s\n",
BREADEMAX, disk); BREADEMAX, disk);
@ -730,11 +730,11 @@ bread(ufs2_daddr_t blkno, char *buf, int size)
((off_t)blkno << dev_bshift))) == dev_bsize) ((off_t)blkno << dev_bshift))) == dev_bsize)
continue; continue;
if (cnt == -1) { if (cnt == -1) {
msg("read error from %s: %s: [sector %qd]: count=%d\n", msg("read error from %s: %s: [sector %jd]: count=%ld\n",
disk, strerror(errno), blkno, dev_bsize); disk, strerror(errno), (intmax_t)blkno, dev_bsize);
continue; continue;
} }
msg("short read error from %s: [sector %qd]: count=%d, got=%d\n", msg("short read from %s: [sector %jd]: count=%ld, got=%d\n",
disk, blkno, dev_bsize, cnt); disk, (intmax_t)blkno, dev_bsize, cnt);
} }
} }