fix -Wsign-compare issues
This commit is contained in:
parent
9050ab5cfa
commit
990d25a96c
14
bin/ls/ls.c
14
bin/ls/ls.c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ls.c,v 1.65 2008/09/25 23:44:05 lukem Exp $ */
|
||||
/* $NetBSD: ls.c,v 1.66 2009/02/14 08:02:04 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993, 1994
|
||||
@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993, 1994\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)ls.c 8.7 (Berkeley) 8/5/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: ls.c,v 1.65 2008/09/25 23:44:05 lukem Exp $");
|
||||
__RCSID("$NetBSD: ls.c,v 1.66 2009/02/14 08:02:04 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -461,10 +461,14 @@ display(FTSENT *p, FTSENT *list)
|
||||
DISPLAY d;
|
||||
FTSENT *cur;
|
||||
NAMES *np;
|
||||
u_int64_t btotal, stotal, maxblock, maxsize;
|
||||
u_int64_t btotal, stotal;
|
||||
off_t maxsize;
|
||||
blkcnt_t maxblock;
|
||||
ino_t maxinode;
|
||||
int maxnlink, maxmajor, maxminor;
|
||||
int bcfile, entries, flen, glen, ulen, maxflags, maxgroup, maxlen;
|
||||
int maxmajor, maxminor;
|
||||
uint32_t maxnlink;
|
||||
int bcfile, entries, flen, glen, ulen, maxflags, maxgroup;
|
||||
unsigned int maxlen;
|
||||
int maxuser, needstats;
|
||||
const char *user, *group;
|
||||
char buf[21]; /* 64 bits == 20 digits, +1 for NUL */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ls.h,v 1.16 2003/12/26 06:19:19 grant Exp $ */
|
||||
/* $NetBSD: ls.h,v 1.17 2009/02/14 08:02:04 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -58,7 +58,7 @@ typedef struct {
|
||||
u_int64_t btotal;
|
||||
u_int64_t stotal;
|
||||
int entries;
|
||||
int maxlen;
|
||||
unsigned int maxlen;
|
||||
int s_block;
|
||||
int s_flags;
|
||||
int s_group;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: print.c,v 1.44 2008/12/28 19:30:33 christos Exp $ */
|
||||
/* $NetBSD: print.c,v 1.45 2009/02/14 08:02:04 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993, 1994
|
||||
@ -37,7 +37,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)print.c 8.5 (Berkeley) 7/28/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: print.c,v 1.44 2008/12/28 19:30:33 christos Exp $");
|
||||
__RCSID("$NetBSD: print.c,v 1.45 2009/02/14 08:02:04 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -300,7 +300,7 @@ printstream(DISPLAY *dp)
|
||||
continue;
|
||||
if (col > 0) {
|
||||
(void)putchar(','), col++;
|
||||
if (col + 1 + extwidth + p->fts_namelen >= termwidth)
|
||||
if (col + 1 + extwidth + (int)p->fts_namelen >= termwidth)
|
||||
(void)putchar('\n'), col = 0;
|
||||
else
|
||||
(void)putchar(' '), col++;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ar_subs.c,v 1.54 2007/05/04 21:19:36 christos Exp $ */
|
||||
/* $NetBSD: ar_subs.c,v 1.55 2009/02/14 08:10:06 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992 Keith Muller.
|
||||
@ -42,7 +42,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)ar_subs.c 8.2 (Berkeley) 4/18/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: ar_subs.c,v 1.54 2007/05/04 21:19:36 christos Exp $");
|
||||
__RCSID("$NetBSD: ar_subs.c,v 1.55 2009/02/14 08:10:06 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -930,8 +930,8 @@ copy(void)
|
||||
int res;
|
||||
int fddest;
|
||||
char *dest_pt;
|
||||
int dlen;
|
||||
int drem;
|
||||
size_t dlen;
|
||||
size_t drem;
|
||||
int fdsrc = -1;
|
||||
struct stat sb;
|
||||
char dirbuf[PAXPATHLEN+1];
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cpio.c,v 1.19 2006/02/11 10:43:18 dsl Exp $ */
|
||||
/* $NetBSD: cpio.c,v 1.20 2009/02/14 08:10:06 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992 Keith Muller.
|
||||
@ -42,7 +42,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)cpio.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: cpio.c,v 1.19 2006/02/11 10:43:18 dsl Exp $");
|
||||
__RCSID("$NetBSD: cpio.c,v 1.20 2009/02/14 08:10:06 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -192,7 +192,7 @@ rd_nm(ARCHD *arcn, int nsz)
|
||||
/*
|
||||
* do not even try bogus values
|
||||
*/
|
||||
if ((nsz == 0) || (nsz > sizeof(arcn->name))) {
|
||||
if ((nsz <= 0) || (nsz > (int)sizeof(arcn->name))) {
|
||||
tty_warn(1, "Cpio file name length %d is out of range", nsz);
|
||||
return -1;
|
||||
}
|
||||
@ -223,7 +223,7 @@ rd_ln_nm(ARCHD *arcn)
|
||||
* check the length specified for bogus values
|
||||
*/
|
||||
if ((arcn->sb.st_size == 0) ||
|
||||
(arcn->sb.st_size >= sizeof(arcn->ln_name))) {
|
||||
(arcn->sb.st_size >= (off_t)sizeof(arcn->ln_name))) {
|
||||
tty_warn(1, "Cpio link name length is invalid: " OFFT_F,
|
||||
(OFFT_T) arcn->sb.st_size);
|
||||
return -1;
|
||||
@ -265,7 +265,7 @@ rd_ln_nm(ARCHD *arcn)
|
||||
int
|
||||
cpio_id(char *blk, int size)
|
||||
{
|
||||
if ((size < sizeof(HD_CPIO)) ||
|
||||
if ((size < (int)sizeof(HD_CPIO)) ||
|
||||
(strncmp(blk, AMAGIC, sizeof(AMAGIC) - 1) != 0))
|
||||
return -1;
|
||||
return 0;
|
||||
@ -507,7 +507,7 @@ cpio_wr(ARCHD *arcn)
|
||||
int
|
||||
vcpio_id(char *blk, int size)
|
||||
{
|
||||
if ((size < sizeof(HD_VCPIO)) ||
|
||||
if ((size < (int)sizeof(HD_VCPIO)) ||
|
||||
(strncmp(blk, AVMAGIC, sizeof(AVMAGIC) - 1) != 0))
|
||||
return -1;
|
||||
return 0;
|
||||
@ -524,7 +524,7 @@ vcpio_id(char *blk, int size)
|
||||
int
|
||||
crc_id(char *blk, int size)
|
||||
{
|
||||
if ((size < sizeof(HD_VCPIO)) ||
|
||||
if ((size < (int)sizeof(HD_VCPIO)) ||
|
||||
(strncmp(blk, AVCMAGIC, sizeof(AVCMAGIC) - 1) != 0))
|
||||
return -1;
|
||||
return 0;
|
||||
@ -833,7 +833,7 @@ vcpio_wr(ARCHD *arcn)
|
||||
int
|
||||
bcpio_id(char *blk, int size)
|
||||
{
|
||||
if (size < sizeof(HD_BCPIO))
|
||||
if (size < (int)sizeof(HD_BCPIO))
|
||||
return -1;
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ftree.c,v 1.39 2008/04/28 20:22:51 martin Exp $ */
|
||||
/* $NetBSD: ftree.c,v 1.40 2009/02/14 08:10:06 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992 Keith Muller.
|
||||
@ -71,7 +71,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)ftree.c 8.2 (Berkeley) 4/18/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: ftree.c,v 1.39 2008/04/28 20:22:51 martin Exp $");
|
||||
__RCSID("$NetBSD: ftree.c,v 1.40 2009/02/14 08:10:06 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -435,7 +435,7 @@ next_file(ARCHD *arcn)
|
||||
/* get current name */
|
||||
if (snprintf(curpath, sizeof(curpath), "%s%s%s",
|
||||
curdir, curdirlen ? "/" : "", ftnode->name)
|
||||
>= sizeof(curpath)) {
|
||||
>= (int)sizeof(curpath)) {
|
||||
tty_warn(1, "line %lu: %s: %s", (u_long)ftnode->lineno,
|
||||
curdir, strerror(ENAMETOOLONG));
|
||||
return (-1);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: options.c,v 1.102 2008/11/23 10:08:50 dholland Exp $ */
|
||||
/* $NetBSD: options.c,v 1.103 2009/02/14 08:10:06 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992 Keith Muller.
|
||||
@ -42,7 +42,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)options.c 8.2 (Berkeley) 4/18/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: options.c,v 1.102 2008/11/23 10:08:50 dholland Exp $");
|
||||
__RCSID("$NetBSD: options.c,v 1.103 2009/02/14 08:10:06 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -254,7 +254,7 @@ static void
|
||||
pax_options(int argc, char **argv)
|
||||
{
|
||||
int c;
|
||||
int i;
|
||||
size_t i;
|
||||
u_int64_t flg = 0;
|
||||
u_int64_t bflg = 0;
|
||||
char *pt;
|
||||
@ -1473,7 +1473,8 @@ cpio_options(int argc, char **argv)
|
||||
FSUB tmp;
|
||||
u_int64_t flg = 0;
|
||||
u_int64_t bflg = 0;
|
||||
int c, i;
|
||||
int c;
|
||||
size_t i;
|
||||
FILE *fp;
|
||||
char *str;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pax.h,v 1.28 2008/02/24 20:42:46 joerg Exp $ */
|
||||
/* $NetBSD: pax.h,v 1.29 2009/02/14 08:10:06 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992 Keith Muller.
|
||||
@ -285,5 +285,5 @@ typedef struct oplist {
|
||||
#define OFFT_ASC(w,x,y,z) ull_asc((unsigned long long)w,x,y,z)
|
||||
#define OFFT_OCT(w,x,y,z) ull_oct((unsigned long long)w,x,y,z)
|
||||
#define STRTOOFFT(x,y,z) strtoll(x,y,z)
|
||||
#define OFFT_MAX ULLONG_MAX
|
||||
#define OFFT_MAX LLONG_MAX
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: tar.c,v 1.66 2008/02/24 20:42:46 joerg Exp $ */
|
||||
/* $NetBSD: tar.c,v 1.67 2009/02/14 08:10:06 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992 Keith Muller.
|
||||
@ -42,7 +42,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)tar.c 8.2 (Berkeley) 4/18/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: tar.c,v 1.66 2008/02/24 20:42:46 joerg Exp $");
|
||||
__RCSID("$NetBSD: tar.c,v 1.67 2009/02/14 08:10:06 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -614,7 +614,7 @@ tar_wr(ARCHD *arcn)
|
||||
case PAX_SLK:
|
||||
case PAX_HLK:
|
||||
case PAX_HRG:
|
||||
if (arcn->ln_nlen > sizeof(hd->linkname)) {
|
||||
if (arcn->ln_nlen > (int)sizeof(hd->linkname)) {
|
||||
tty_warn(1,"Link name too long for tar %s",
|
||||
arcn->ln_name);
|
||||
return 1;
|
||||
@ -632,7 +632,7 @@ tar_wr(ARCHD *arcn)
|
||||
len = arcn->nlen;
|
||||
if (arcn->type == PAX_DIR)
|
||||
++len;
|
||||
if (len >= sizeof(hd->name)) {
|
||||
if (len >= (int)sizeof(hd->name)) {
|
||||
tty_warn(1, "File name too long for tar %s", arcn->name);
|
||||
return 1;
|
||||
}
|
||||
@ -1055,7 +1055,7 @@ ustar_wr(ARCHD *arcn)
|
||||
/*
|
||||
* check the length of the linkname
|
||||
*/
|
||||
if (arcn->ln_nlen >= sizeof(hd->linkname)) {
|
||||
if (arcn->ln_nlen >= (int)sizeof(hd->linkname)) {
|
||||
if (is_gnutar) {
|
||||
longlink(arcn, PAX_GLL);
|
||||
} else {
|
||||
@ -1318,7 +1318,8 @@ tar_gnutar_exclude_one(const char *line, size_t len)
|
||||
char sbuf[MAXPATHLEN * 2 + 1];
|
||||
/* + / + // + .*""/\/ + \/.* */
|
||||
char rabuf[MAXPATHLEN * 2 + 1 + 1 + 2 + 4 + 4];
|
||||
int i, j = 0;
|
||||
size_t i;
|
||||
int j = 0;
|
||||
|
||||
if (line[len - 1] == '\n')
|
||||
len--;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: print.c,v 1.109 2009/02/03 17:37:02 drochner Exp $ */
|
||||
/* $NetBSD: print.c,v 1.110 2009/02/14 08:04:09 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000, 2007 The NetBSD Foundation, Inc.
|
||||
@ -63,7 +63,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)print.c 8.6 (Berkeley) 4/16/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: print.c,v 1.109 2009/02/03 17:37:02 drochner Exp $");
|
||||
__RCSID("$NetBSD: print.c,v 1.110 2009/02/14 08:04:09 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -491,7 +491,7 @@ state(void *arg, VARENT *ve, int mode)
|
||||
|
||||
case LSSLEEP:
|
||||
if (flag & L_SINTR) /* interruptable (long) */
|
||||
*cp = k->p_slptime >= maxslp ? 'I' : 'S';
|
||||
*cp = (int)k->p_slptime >= maxslp ? 'I' : 'S';
|
||||
else
|
||||
*cp = 'D';
|
||||
break;
|
||||
@ -571,7 +571,7 @@ lstate(void *arg, VARENT *ve, int mode)
|
||||
|
||||
case LSSLEEP:
|
||||
if (flag & L_SINTR) /* interruptible (long) */
|
||||
*cp = k->l_slptime >= maxslp ? 'I' : 'S';
|
||||
*cp = (int)k->l_slptime >= maxslp ? 'I' : 'S';
|
||||
else
|
||||
*cp = 'D';
|
||||
break;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ps.c,v 1.72 2008/12/28 19:50:22 christos Exp $ */
|
||||
/* $NetBSD: ps.c,v 1.73 2009/02/14 08:04:10 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000-2008 The NetBSD Foundation, Inc.
|
||||
@ -68,7 +68,7 @@ __COPYRIGHT("@(#) Copyright (c) 1990, 1993, 1994\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)ps.c 8.4 (Berkeley) 4/2/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: ps.c,v 1.72 2008/12/28 19:50:22 christos Exp $");
|
||||
__RCSID("$NetBSD: ps.c,v 1.73 2009/02/14 08:04:10 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -631,7 +631,7 @@ pscomp(const void *a, const void *b)
|
||||
if (sa->__bits[i] < sb->__bits[i])
|
||||
return -1;
|
||||
i++;
|
||||
} while (i < sizeof sa->__bits / sizeof sa->__bits[0]);
|
||||
} while (i < (int)__arraycount(sa->__bits));
|
||||
continue;
|
||||
case INT64:
|
||||
RDIFF(int64_t);
|
||||
|
16
bin/rm/rm.c
16
bin/rm/rm.c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: rm.c,v 1.48 2008/07/20 00:52:40 lukem Exp $ */
|
||||
/* $NetBSD: rm.c,v 1.49 2009/02/14 08:05:04 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993, 1994, 2003
|
||||
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1990, 1993, 1994\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)rm.c 8.8 (Berkeley) 4/27/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: rm.c,v 1.48 2008/07/20 00:52:40 lukem Exp $");
|
||||
__RCSID("$NetBSD: rm.c,v 1.49 2009/02/14 08:05:04 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -396,7 +396,7 @@ rm_overwrite(char *file, struct stat *sbp)
|
||||
|
||||
#define WRITE_PASS(mode, byte) do { \
|
||||
off_t len; \
|
||||
int wlen, i; \
|
||||
size_t wlen, i; \
|
||||
char buf[8 * 1024]; \
|
||||
\
|
||||
if (fsync(fd) || lseek(fd, (off_t)0, SEEK_SET)) \
|
||||
@ -410,8 +410,8 @@ rm_overwrite(char *file, struct stat *sbp)
|
||||
i+= sizeof(u_int32_t)) \
|
||||
*(int *)(buf + i) = arc4random(); \
|
||||
} \
|
||||
wlen = len < sizeof(buf) ? len : sizeof(buf); \
|
||||
if (write(fd, buf, wlen) != wlen) \
|
||||
wlen = len < (off_t)sizeof(buf) ? (size_t)len : sizeof(buf); \
|
||||
if ((size_t)write(fd, buf, wlen) != wlen) \
|
||||
goto err; \
|
||||
} \
|
||||
sync(); /* another poke at hidden caches */ \
|
||||
@ -419,7 +419,7 @@ rm_overwrite(char *file, struct stat *sbp)
|
||||
|
||||
#define READ_PASS(byte) do { \
|
||||
off_t len; \
|
||||
int rlen; \
|
||||
size_t rlen; \
|
||||
char pattern[8 * 1024]; \
|
||||
char buf[8 * 1024]; \
|
||||
\
|
||||
@ -428,8 +428,8 @@ rm_overwrite(char *file, struct stat *sbp)
|
||||
\
|
||||
memset(pattern, byte, sizeof(pattern)); \
|
||||
for(len = sbp->st_size; len > 0; len -= rlen) { \
|
||||
rlen = len < sizeof(buf) ? len : sizeof(buf); \
|
||||
if(read(fd, buf, rlen) != rlen) \
|
||||
rlen = len < (off_t)sizeof(buf) ? (size_t)len : sizeof(buf); \
|
||||
if((size_t)read(fd, buf, rlen) != rlen) \
|
||||
goto err; \
|
||||
if(memcmp(buf, pattern, rlen)) \
|
||||
goto err; \
|
||||
|
Loading…
Reference in New Issue
Block a user