From a18d599791e977f3e3d26123031e6ed4e64d6d08 Mon Sep 17 00:00:00 2001 From: Stelian Pop Date: Fri, 19 Jul 2002 14:57:38 +0000 Subject: [PATCH] Fixed a lot of warnings in the code thanks to 'gcc -W' --- CHANGES | 8 +++++-- THANKS | 5 +++-- common/dumprmt.c | 8 +++---- compat/include/bsdcompat.h | 3 ++- dump/main.c | 6 ++--- dump/optr.c | 6 ++--- dump/tape.c | 45 ++++++++++++++++++++++++-------------- dump/traverse.c | 38 ++++++++++++++++++-------------- restore/dirs.c | 8 +++---- restore/interactive.c | 14 ++++++------ restore/main.c | 6 ++--- restore/restore.c | 8 +++---- restore/symtab.c | 4 ++-- restore/tape.c | 34 ++++++++++++++-------------- 14 files changed, 108 insertions(+), 85 deletions(-) diff --git a/CHANGES b/CHANGES index 0b2d3e1..a8dde3a 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,4 @@ -$Id: CHANGES,v 1.185 2002/07/17 10:18:52 stelian Exp $ +$Id: CHANGES,v 1.186 2002/07/19 14:57:38 stelian Exp $ Changes between versions 0.4b29 and 0.4b30 (released ????????????????) ====================================================================== @@ -28,7 +28,11 @@ Changes between versions 0.4b29 and 0.4b30 (released ????????????????) transparently support both inode formats, the change should have no side effects. Thanks to John Yu for reporting the bug. - + +6. Fixed a lot of warnings in the code shown when compiling + with 'gcc -W'. Thanks to Matthias Andree + for reporting this. + Changes between versions 0.4b28 and 0.4b29 (released June 8, 2002) ================================================================== diff --git a/THANKS b/THANKS index 88da77f..34ed573 100644 --- a/THANKS +++ b/THANKS @@ -1,4 +1,4 @@ -$Id: THANKS,v 1.62 2002/07/01 11:54:39 stelian Exp $ +$Id: THANKS,v 1.63 2002/07/19 14:57:39 stelian Exp $ Dump and restore were written by the people of the CSRG at the University of California, Berkeley. @@ -20,8 +20,9 @@ Stelian Pop is now the current maintainer (since dump-0.4b5 Thanks to people who reported problems with the port, sent patches, and suggested various improvements. Here is a partial list of them (if I have forgotten someone, please complain): -Eros Albertazzi eros@lamel.bo.cnr.it John Adams johna@onevista.com +Eros Albertazzi eros@lamel.bo.cnr.it +Matthias Andree matthias.andree@stud.uni-dortmund.de Andrea Arcangeli andrea@suse.de Stephen Atwell satwell@urbana.css.mot.com Gerd Bavendiek bav@epost.de diff --git a/common/dumprmt.c b/common/dumprmt.c index 129ce20..69ada17 100644 --- a/common/dumprmt.c +++ b/common/dumprmt.c @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: dumprmt.c,v 1.21 2002/05/21 15:48:46 stelian Exp $"; + "$Id: dumprmt.c,v 1.22 2002/07/19 14:57:39 stelian Exp $"; #endif /* not lint */ #include @@ -132,7 +132,7 @@ rmthost(const char *host) } static void -rmtconnaborted(int signo) +rmtconnaborted(UNUSED(int signo)) { msg("Lost connection to remote host.\n"); if (errfd != -1) { @@ -343,7 +343,7 @@ rmtstatus(void) if (rmtstate != TS_OPEN) return (NULL); rmtcall("status", "S\n"); - for (i = 0, cp = (char *)&mts; i < sizeof(mts); i++) + for (i = 0, cp = (char *)&mts; i < (int)sizeof(mts); i++) *cp++ = rmtgetb(); return (&mts); } @@ -363,7 +363,7 @@ static int rmtcall(const char *cmd, const char *buf) { - if (write(tormtape, buf, strlen(buf)) != strlen(buf)) + if (write(tormtape, buf, strlen(buf)) != (ssize_t)strlen(buf)) rmtconnaborted(0); return (rmtreply(cmd)); } diff --git a/compat/include/bsdcompat.h b/compat/include/bsdcompat.h index 8b87378..ecb102f 100644 --- a/compat/include/bsdcompat.h +++ b/compat/include/bsdcompat.h @@ -5,7 +5,7 @@ * Stelian Pop , 1999-2000 * Stelian Pop - AlcĂ´ve , 2000-2002 * - * $Id: bsdcompat.h,v 1.18 2002/07/17 10:18:52 stelian Exp $ + * $Id: bsdcompat.h,v 1.19 2002/07/19 14:57:39 stelian Exp $ */ #include @@ -13,6 +13,7 @@ #include #define __dead volatile +#define UNUSED(x) x __attribute__ ((unused)) #ifndef NBBY #define NBBY 8 diff --git a/dump/main.c b/dump/main.c index 3ef7bc1..d06c2fd 100644 --- a/dump/main.c +++ b/dump/main.c @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: main.c,v 1.73 2002/07/17 10:18:52 stelian Exp $"; + "$Id: main.c,v 1.74 2002/07/19 14:57:39 stelian Exp $"; #endif /* not lint */ #include @@ -879,10 +879,10 @@ main(int argc, char *argv[]) /* print QFA-file header */ snprintf(gTps, sizeof(gTps), "%s\n%s\n%ld\n\n", QFA_MAGIC, QFA_VERSION, (unsigned long)spcl.c_date); gTps[sizeof(gTps) - 1] = '\0'; - if (write(gTapeposfd, gTps, strlen(gTps)) != strlen(gTps)) + if (write(gTapeposfd, gTps, strlen(gTps)) != (ssize_t)strlen(gTps)) quit("can't write tapeposfile\n"); sprintf(gTps, "ino\ttapeno\ttapepos\n"); - if (write(gTapeposfd, gTps, strlen(gTps)) != strlen(gTps)) + if (write(gTapeposfd, gTps, strlen(gTps)) != (ssize_t)strlen(gTps)) quit("can't write tapeposfile\n"); } #endif /* USE_QFA */ diff --git a/dump/optr.c b/dump/optr.c index a79462b..81823a7 100644 --- a/dump/optr.c +++ b/dump/optr.c @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: optr.c,v 1.31 2002/02/04 11:18:45 stelian Exp $"; + "$Id: optr.c,v 1.32 2002/07/19 14:57:39 stelian Exp $"; #endif /* not lint */ #include @@ -161,7 +161,7 @@ char lastmsg[BUFSIZ]; * sleep for 2 minutes in case nobody comes to satisfy dump */ static void -alarmcatch(int signo) +alarmcatch(UNUSED(int signo)) { int save_errno = errno; if (notify == 0) { @@ -189,7 +189,7 @@ alarmcatch(int signo) * Here if an inquisitive operator interrupts the dump program */ void -interrupt(int signo) +interrupt(UNUSED(int signo)) { msg("Interrupt received.\n"); if (query("Do you want to abort dump?")) diff --git a/dump/tape.c b/dump/tape.c index c6161be..70c1d1d 100644 --- a/dump/tape.c +++ b/dump/tape.c @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: tape.c,v 1.69 2002/07/01 11:54:40 stelian Exp $"; + "$Id: tape.c,v 1.70 2002/07/19 14:57:39 stelian Exp $"; #endif /* not lint */ #include @@ -116,7 +116,11 @@ static int magtapeout; /* output is really a tape */ static ssize_t dump_atomic_read __P((int, void *, size_t)); static ssize_t dump_atomic_write __P((int, const void *, size_t)); +#ifdef WRITEDEBUG static void doslave __P((int, int, int)); +#else +static void doslave __P((int, int)); +#endif static void enslave __P((void)); static void flushtape __P((void)); static void killall __P((void)); @@ -311,7 +315,7 @@ tperror(int errnum) } static void -sigpipe(int signo) +sigpipe(UNUSED(int signo)) { quit("Broken pipe\n"); @@ -914,13 +918,13 @@ restore_check_point: if (tapeno > 1) msg("Volume %d begins with blocks from inode %d\n", tapeno, slp->inode); - if (tapeno < TP_NINOS) + if (tapeno < (int)TP_NINOS) volinfo[tapeno] = slp->inode; } } void -dumpabort(int signo) +dumpabort(UNUSED(int signo)) { if (master != 0 && master != getpid()) @@ -950,7 +954,7 @@ Exit(int status) * proceed - handler for SIGUSR2, used to synchronize IO between the slaves. */ static void -proceed(int signo) +proceed(UNUSED(int signo)) { if (ready) siglongjmp(jmpbuf, 1); @@ -1011,7 +1015,11 @@ enslave(void) != sizeof i) quit("master/slave protocol botched 3\n"); #endif - doslave(cmd[0], i, (slaves[i].pid == slp->pid)); + doslave(cmd[0], +#ifdef WRITEDEBUG + i, +#endif + (slaves[i].pid == slp->pid)); Exit(X_FINOK); } else @@ -1057,15 +1065,20 @@ killall(void) * slaves. */ static void -doslave(int cmd, int slave_number, int first) +doslave(int cmd, +#ifdef WRITEDEBUG + int slave_number, +#endif + int first) { int nread; - int nextslave, size, eot_count, bufsize; - volatile int wrote = 0; - char *buffer; + int nextslave; + volatile int wrote = 0, size, eot_count, bufsize; + char * volatile buffer; #if defined(HAVE_ZLIB) || defined(HAVE_BZLIB) - struct tapebuf *comp_buf = NULL; - int compresult, do_compress = !first; + struct tapebuf * volatile comp_buf = NULL; + int compresult; + volatile int do_compress = !first; unsigned long worklen; #ifdef HAVE_BZLIB unsigned int worklen2; @@ -1200,7 +1213,7 @@ doslave(int cmd, int slave_number, int first) } #endif /* HAVE_BZLIB */ - if (compresult && worklen <= (writesize - 16)) { + if (compresult && worklen <= ((unsigned long)writesize - 16)) { /* write the compressed buffer */ comp_buf->length = worklen; comp_buf->compressed = 1; @@ -1323,7 +1336,7 @@ dump_atomic_read(int fd, void *buf, size_t count) while ((got = read(fd, buf, need)) > 0 && (need -= got) > 0) (char *)buf += got; } while (got == -1 && errno == EINTR); - return (got < 0 ? got : count - need); + return (got < 0 ? got : (ssize_t)count - need); } /* @@ -1340,7 +1353,7 @@ dump_atomic_write(int fd, const void *buf, size_t count) while ((got = write(fd, buf, need)) > 0 && (need -= got) > 0) (char *)buf += got; } while (got == -1 && errno == EINTR); - return (got < 0 ? got : count - need); + return (got < 0 ? got : (ssize_t)count - need); } @@ -1393,7 +1406,7 @@ MkTapeString(struct s_spcl *spclptr, long long curtapepos) { tapeno, curtapepos); gTps[sizeof(gTps) - 1] = '\0'; - if (write(gTapeposfd, gTps, strlen(gTps)) != strlen(gTps)) { + if (write(gTapeposfd, gTps, strlen(gTps)) != (ssize_t)strlen(gTps)) { warn("error writing tapepos file.\n"); } } diff --git a/dump/traverse.c b/dump/traverse.c index bd16f9b..6d4f00b 100644 --- a/dump/traverse.c +++ b/dump/traverse.c @@ -41,12 +41,13 @@ #ifndef lint static const char rcsid[] = - "$Id: traverse.c,v 1.48 2002/07/17 10:18:52 stelian Exp $"; + "$Id: traverse.c,v 1.49 2002/07/19 14:57:39 stelian Exp $"; #endif /* not lint */ #include #include #include +#include #ifdef __STDC__ #include #include @@ -107,7 +108,7 @@ static void mapfileino __P((dump_ino_t ino, struct dinode const *dp, long *tapes #ifdef HAVE_EXT2_JOURNAL_INUM #define ext2_journal_ino(sb) (sb->s_journal_inum) #else -#define ext2_journal_ino(sb) (*((__u32 *)sb + 0x38)) +#define ext2_journal_ino(sb) (*((u_int32_t *)sb + 0x38)) #endif #ifndef HAVE_EXT2_INO_T typedef ino_t ext2_ino_t; @@ -200,7 +201,7 @@ blockest(struct dinode const *dp) if (blkest > sizeest) blkest = sizeest; #ifdef __linux__ - if (i_size > fs->blocksize * NDADDR) { + if (i_size > (u_quad_t)fs->blocksize * NDADDR) { /* calculate the number of indirect blocks on the dump tape */ blkest += howmany(sizeest - NDADDR * fs->blocksize / TP_BSIZE, @@ -234,7 +235,7 @@ blockest(struct dinode const *dp) /* The WANTTODUMP macro decides whether a file should be dumped. */ #define WANTTODUMP(dp, ino) \ - (CHANGEDSINCE(dp, spcl.c_ddate) && \ + (CHANGEDSINCE(dp, ((u_int32_t)spcl.c_ddate)) && \ (!NODUMP_FLAG(dp)) && \ (!exclude_ino(ino))) @@ -271,7 +272,7 @@ mapfileino(dump_ino_t ino, struct dinode const *dp, long *tapesize, int *dirskip SETINO(ino, dumpdirmap); if (WANTTODUMP(dp, ino)) { SETINO(ino, dumpinomap); - if (!MSINCE(dp, spcl.c_ddate)) + if (!MSINCE(dp, (u_int32_t)spcl.c_ddate)) SETINO(ino, metainomap); if (mode != IFREG && mode != IFDIR && mode != IFLNK) *tapesize += 1; @@ -295,7 +296,7 @@ mapfileino(dump_ino_t ino, struct dinode const *dp, long *tapesize, int *dirskip */ #ifdef __linux__ int -mapfiles(dump_ino_t maxino, long *tapesize) +mapfiles(UNUSED(dump_ino_t maxino), long *tapesize) { ext2_ino_t ino; int anydirskipped = 0; @@ -358,7 +359,7 @@ mapfiles(dump_ino_t maxino, long *tapesize) #ifdef __linux__ int -maponefile(dump_ino_t maxino, long *tapesize, char *directory) +maponefile(UNUSED(dump_ino_t maxino), long *tapesize, char *directory) { errcode_t retval; ext2_ino_t dir_ino; @@ -368,7 +369,7 @@ maponefile(dump_ino_t maxino, long *tapesize, char *directory) /* * Mark every directory in the path as being dumped */ - for (i = 0; i < strlen (directory); i++) { + for (i = 0; i < (int)strlen (directory); i++) { if (directory[i] == '/') { strncpy (dir_name, directory, i); dir_name[i] = '\0'; @@ -411,7 +412,8 @@ struct mapfile_context { }; static int -mapfilesindir(struct ext2_dir_entry *dirent, int offset, int blocksize, char *buf, void *private) +mapfilesindir(struct ext2_dir_entry *dirent, UNUSED(int offset), + UNUSED(int blocksize), UNUSED(char *buf), void *private) { struct dinode const *dp; int mode; @@ -447,7 +449,7 @@ mapfilesindir(struct ext2_dir_entry *dirent, int offset, int blocksize, char *bu * the directories in the filesystem. */ int -mapfilesfromdir(dump_ino_t maxino, long *tapesize, char *directory) +mapfilesfromdir(UNUSED(dump_ino_t maxino), long *tapesize, char *directory) { errcode_t retval; struct mapfile_context mfc; @@ -458,7 +460,7 @@ mapfilesfromdir(dump_ino_t maxino, long *tapesize, char *directory) /* * Mark every directory in the path as being dumped */ - for (i = 0; i < strlen (directory); i++) { + for (i = 0; i < (int)strlen (directory); i++) { if (directory[i] == '/') { strncpy (dir_name, directory, i); dir_name[i] = '\0'; @@ -646,7 +648,8 @@ dirindir(dump_ino_t ino, daddr_t blkno, int ind_level, long *filesize) */ #ifdef __linux__ static int -searchdir(struct ext2_dir_entry *dp, int offset, int blocksize, char *buf, void *private) +searchdir(struct ext2_dir_entry *dp, UNUSED(int offset), + UNUSED(int blocksize), UNUSED(char *buf), void *private) { struct mapdirs_context *mdc; int *ret; @@ -749,8 +752,8 @@ struct block_context { * Dump a block to the tape */ static int -dumponeblock(ext2_filsys fs, blk_t *blocknr, e2_blkcnt_t blockcnt, - blk_t ref_block, int ref_offset, void * private) +dumponeblock(UNUSED(ext2_filsys fs), blk_t *blocknr, e2_blkcnt_t blockcnt, + UNUSED(blk_t ref_block), UNUSED(int ref_offset), void * private) { struct block_context *p; int i; @@ -901,7 +904,7 @@ dumpino(struct dinode *dp, dump_ino_t ino, int metaonly) msg("Warning: undefined file type 0%o\n", dp->di_mode & IFMT); return; } - if (i_size > NDADDR * sblock->fs_bsize) + if (i_size > (u_quad_t)NDADDR * sblock->fs_bsize) #ifdef __linux__ cnt = NDADDR * EXT2_FRAGS_PER_BLOCK(fs->super); #else @@ -923,7 +926,7 @@ dumpino(struct dinode *dp, dump_ino_t ino, int metaonly) /* deal with holes at the end of the inode */ if (i_size > ((u_quad_t)bc.next_block) * sblock->fs_fsize) { remaining = i_size - ((u_quad_t)bc.next_block) * sblock->fs_fsize; - for (i = 0; i < howmany(remaining, sblock->fs_fsize); i++) { + for (i = 0; i < (int)howmany(remaining, sblock->fs_fsize); i++) { bc.buf[bc.cnt++] = 0; if (bc.cnt == bc.max) { blksout (bc.buf, bc.cnt, bc.ino); @@ -960,7 +963,8 @@ struct convert_dir_context { * size of the entry, and creates it in a temporary buffer */ static int -convert_dir(struct ext2_dir_entry *dirent, int offset, int blocksize, char *buf, void *private) +convert_dir(struct ext2_dir_entry *dirent, UNUSED(int offset), + UNUSED(int blocksize), UNUSED(char *buf), void *private) { struct convert_dir_context *p; struct direct *dp; diff --git a/restore/dirs.c b/restore/dirs.c index bf1583b..2288777 100644 --- a/restore/dirs.c +++ b/restore/dirs.c @@ -46,7 +46,7 @@ #ifndef lint static const char rcsid[] = - "$Id: dirs.c,v 1.20 2002/06/25 19:00:38 stelian Exp $"; + "$Id: dirs.c,v 1.21 2002/07/19 14:57:39 stelian Exp $"; #endif /* not lint */ #include @@ -276,7 +276,7 @@ treescan(char *pname, dump_ino_t ino, long (*todo) __P((char *, dump_ino_t, int) * skipping over "." and ".." */ namelen = snprintf(locname, sizeof(locname), "%s/", pname); - if (namelen >= sizeof(locname)) + if (namelen >= (int)sizeof(locname)) namelen = sizeof(locname) - 1; rst_seekdir(dirp, itp->t_seekpt, itp->t_seekpt); dp = rst_readdir(dirp); /* "." */ @@ -296,7 +296,7 @@ treescan(char *pname, dump_ino_t ino, long (*todo) __P((char *, dump_ino_t, int) */ while (dp != NULL) { locname[namelen] = '\0'; - if (namelen + dp->d_namlen >= sizeof(locname)) { + if (namelen + dp->d_namlen >= (int)sizeof(locname)) { fprintf(stderr, "%s%s: name exceeds %ld char\n", locname, dp->d_name, (long)sizeof(locname) - 1); } else { @@ -381,7 +381,7 @@ putdir(char *buf, size_t size) putent(&cvtbuf); } } else { - for (loc = 0; loc < size; ) { + for (loc = 0; loc < (long)size; ) { dp = (struct direct *)(buf + loc); #ifdef DIRDEBUG printf ("reclen = %d, namlen = %d, type = %d\n", diff --git a/restore/interactive.c b/restore/interactive.c index 1f00b2a..c1b8aa2 100644 --- a/restore/interactive.c +++ b/restore/interactive.c @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: interactive.c,v 1.24 2002/06/08 07:10:37 stelian Exp $"; + "$Id: interactive.c,v 1.25 2002/07/19 14:57:39 stelian Exp $"; #endif /* not lint */ #include @@ -510,7 +510,7 @@ canon(char *rawname, char *canonname, int len) (void) strcpy(canonname, "."); else (void) strcpy(canonname, "./"); - if (strlen(canonname) + strlen(rawname) >= len) + if (strlen(canonname) + strlen(rawname) >= (unsigned)len) errx(1, "canonname: not enough buffer space"); (void) strcat(canonname, rawname); @@ -570,7 +570,7 @@ printlist(char *name, char *basename) list = &single; mkentry(name, dp, list); len = strlen(basename) + 1; - if (strlen(name) - len > single.len) { + if (strlen(name) - len > (unsigned)single.len) { freename(single.fname); single.fname = savename(&name[len]); single.len = strlen(single.fname); @@ -591,7 +591,7 @@ printlist(char *name, char *basename) entries = 0; listp = list; namelen = snprintf(locname, sizeof(locname), "%s/", name); - if (namelen >= sizeof(locname)) + if (namelen >= (int)sizeof(locname)) namelen = sizeof(locname) - 1; while ((dp = rst_readdir(dirp))) { if (dp == NULL) @@ -709,7 +709,7 @@ formatf(struct afile *list, int nentry) bigino = ROOTINO; endlist = &list[nentry]; for (fp = &list[0]; fp < endlist; fp++) { - if (bigino < fp->fnum) + if (bigino < (int)fp->fnum) bigino = fp->fnum; if (width < fp->len) width = fp->len; @@ -822,7 +822,7 @@ fcmp(const void *f1, const void *f2) * respond to interrupts */ void -onintr(int signo) +onintr(UNUSED(int signo)) { int save_errno = errno; @@ -1010,7 +1010,7 @@ filename_generator(const char *text, int state) } static char ** -restore_completion (const char *text, int start, int end) +restore_completion (const char *text, int start, UNUSED(int end)) { char **matches; diff --git a/restore/main.c b/restore/main.c index 2f2db7a..723a88f 100644 --- a/restore/main.c +++ b/restore/main.c @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: main.c,v 1.40 2002/06/08 07:10:37 stelian Exp $"; + "$Id: main.c,v 1.41 2002/07/19 14:57:39 stelian Exp $"; #endif /* not lint */ #include @@ -554,10 +554,10 @@ main(int argc, char *argv[]) errx(1, "can't create tapeposfile\n"); /* print QFA-file header */ sprintf(gTps, "%s\n%s\n%ld\n\n", QFA_MAGIC, QFA_VERSION,(unsigned long)spcl.c_date); - if (write(gTapeposfd, gTps, strlen(gTps)) != strlen(gTps)) + if (write(gTapeposfd, gTps, strlen(gTps)) != (ssize_t)strlen(gTps)) errx(1, "can't write tapeposfile\n"); sprintf(gTps, "ino\ttapeno\ttapepos\n"); - if (write(gTapeposfd, gTps, strlen(gTps)) != strlen(gTps)) + if (write(gTapeposfd, gTps, strlen(gTps)) != (ssize_t)strlen(gTps)) errx(1, "can't write tapeposfile\n"); extractdirs(1); diff --git a/restore/restore.c b/restore/restore.c index 854c3fc..7c897ec 100644 --- a/restore/restore.c +++ b/restore/restore.c @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: restore.c,v 1.29 2002/04/04 08:20:23 stelian Exp $"; + "$Id: restore.c,v 1.30 2002/07/19 14:57:40 stelian Exp $"; #endif /* not lint */ #include @@ -159,7 +159,7 @@ addfile(char *name, dump_ino_t ino, int type) */ /* ARGSUSED */ long -deletefile(char *name, dump_ino_t ino, int type) +deletefile(char *name, dump_ino_t ino, UNUSED(int type)) { long descend = hflag ? GOOD : FAIL; struct entry *ep; @@ -951,7 +951,7 @@ createfiles(void) if (volinfo[1] == ROOTINO) { int i, goodvol = 1; - for (i = 1; i < TP_NINOS && volinfo[i] != 0; ++i) + for (i = 1; i < (int)TP_NINOS && volinfo[i] != 0; ++i) if (volinfo[i] < next) goodvol = i; @@ -1023,7 +1023,7 @@ createfiles(void) msg("inode %ld at tapepos %ld\n", curfile.ino, curtapepos); #endif sprintf(gTps, "%ld\t%ld\t%lld\n", (unsigned long)curfile.ino, volno, curtapepos); - if (write(gTapeposfd, gTps, strlen(gTps)) != strlen(gTps)) + if (write(gTapeposfd, gTps, strlen(gTps)) != (ssize_t)strlen(gTps)) warn("error writing tapepos file.\n"); skipfile(); } diff --git a/restore/symtab.c b/restore/symtab.c index 99312ac..96dee35 100644 --- a/restore/symtab.c +++ b/restore/symtab.c @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: symtab.c,v 1.18 2002/01/25 15:09:00 stelian Exp $"; + "$Id: symtab.c,v 1.19 2002/07/19 14:57:40 stelian Exp $"; #endif /* not lint */ /* @@ -518,7 +518,7 @@ dumpsymtable(char *filename, long checkpt) /* * Convert entry pointers to indexes, and output */ - for (i = 0; i < entrytblsize; i++) { + for (i = 0; (long)i < entrytblsize; i++) { if (entry[i] == NULL) tentry = NULL; else diff --git a/restore/tape.c b/restore/tape.c index 558e8f3..b9d0b02 100644 --- a/restore/tape.c +++ b/restore/tape.c @@ -46,7 +46,7 @@ #ifndef lint static const char rcsid[] = - "$Id: tape.c,v 1.62 2002/05/21 15:48:46 stelian Exp $"; + "$Id: tape.c,v 1.63 2002/07/19 14:57:40 stelian Exp $"; #endif /* not lint */ #include @@ -334,7 +334,7 @@ setup(void) if (vflag || command == 't' || command == 'C') printdumpinfo(); #ifdef USE_QFA - if (tapeposflag && spcl.c_date != qfadumpdate) + if (tapeposflag && (unsigned long)spcl.c_date != qfadumpdate) errx(1, "different QFA/dumpdates detected\n"); #endif if (filesys[0] == '\0') { @@ -705,7 +705,7 @@ printvolinfo(void) if (volinfo[1] == ROOTINO) { printf("Starting inode numbers by volume:\n"); - for (i = 1; i < TP_NINOS && volinfo[i] != 0; ++i) + for (i = 1; i < (int)TP_NINOS && volinfo[i] != 0; ++i) printf("\tVolume %d: %lu\n", i, (unsigned long)volinfo[i]); } } @@ -1020,7 +1020,7 @@ xtrfile(char *buf, size_t size) */ /* ARGSUSED */ static void -xtrskip(char *buf, size_t size) +xtrskip(UNUSED(char *buf), size_t size) { if (LSEEK(ofile, (off_t)size, SEEK_CUR) == -1) @@ -1047,7 +1047,7 @@ xtrlnkfile(char *buf, size_t size) */ /* ARGSUSED */ static void -xtrlnkskip(char *buf, size_t size) +xtrlnkskip(UNUSED(char *buf), UNUSED(size_t size)) { errx(1, "unallocated block in symbolic link %s", curfile.name); @@ -1069,7 +1069,7 @@ xtrmap(char *buf, size_t size) */ /* ARGSUSED */ static void -xtrmapskip(char *buf, size_t size) +xtrmapskip(UNUSED(char *buf), size_t size) { panic("hole in map\n"); @@ -1081,7 +1081,7 @@ xtrmapskip(char *buf, size_t size) */ /* ARGSUSED */ void -xtrnull(char *buf, size_t size) +xtrnull(UNUSED(char *buf), UNUSED(size_t size)) { return; @@ -1099,7 +1099,7 @@ xtrcmpfile(char *buf, size_t size) if (cmperror) return; - if (read(ifile, cmpbuf, size) != size) { + if (read(ifile, cmpbuf, size) != (ssize_t)size) { fprintf(stderr, "%s: size has changed.\n", curfile.name); cmperror = 1; @@ -1118,7 +1118,7 @@ xtrcmpfile(char *buf, size_t size) * Skip over a hole in a file. */ static void -xtrcmpskip(char *buf, size_t size) +xtrcmpskip(UNUSED(char *buf), size_t size) { static char cmpbuf[MAXBSIZE]; int i; @@ -1126,14 +1126,14 @@ xtrcmpskip(char *buf, size_t size) if (cmperror) return; - if (read(ifile, cmpbuf, size) != size) { + if (read(ifile, cmpbuf, size) != (ssize_t)size) { fprintf(stderr, "%s: size has changed.\n", curfile.name); cmperror = 1; return; } - for (i = 0; i < size; ++i) + for (i = 0; i < (int)size; ++i) if (cmpbuf[i] != '\0') { fprintf(stderr, "%s: tape and disk copies are different\n", curfile.name); @@ -1262,7 +1262,7 @@ static char tmpfilename[MAXPATHLEN]; void comparefile(char *name) { - int mode; + unsigned int mode; struct STAT sb; int r; #if !COMPARE_ONTHEFLY @@ -1352,7 +1352,7 @@ comparefile(char *name) return; } - if (sb.st_rdev != (int)curfile.dip->di_rdev) { + if (sb.st_rdev != (dev_t)curfile.dip->di_rdev) { fprintf(stderr, "%s: device changed from %d,%d to %d,%d.\n", name, @@ -1614,7 +1614,7 @@ readtape_comprfile(char *buf) /* read the block prefix */ ret = read_a_block(mt, tapebuf, PREFIXSIZE, &rl); - if (Vflag && (ret == 0 || rl < PREFIXSIZE || tpb->length == 0)) + if (Vflag && (ret == 0 || rl < (int)PREFIXSIZE || tpb->length == 0)) ret = 0; if (ret <= 0) goto readerr; @@ -1781,10 +1781,10 @@ decompress_tapebuf(struct tapebuf *tpbin, int readsize) /* build a length error message */ blocklen = tpbin->length; - if (readsize < blocklen + PREFIXSIZE) + if (readsize < blocklen + (int)PREFIXSIZE) lengtherr = "short"; else - if (readsize > blocklen + PREFIXSIZE) + if (readsize > blocklen + (int)PREFIXSIZE) lengtherr = "long"; worklen = comprlen; @@ -1954,7 +1954,7 @@ findtapeblksize(void) len = bufsize - TP_BSIZE; } if (read_a_block(mt, tapebuf+TP_BSIZE, len, &i) < 0 - || (i != len && i % TP_BSIZE != 0)) + || (i != (long)len && i % TP_BSIZE != 0)) errx(1,"Error reading dump file header"); tbufptr = tapebuf; numtrec = ntrec; -- 2.39.5