fix sign-compare issues

This commit is contained in:
lukem 2009-04-11 06:48:36 +00:00
parent e4c34b0c5f
commit cefb0777de
7 changed files with 30 additions and 28 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: partutil.c,v 1.3 2008/04/28 20:23:08 martin Exp $ */
/* $NetBSD: partutil.c,v 1.4 2009/04/11 06:48:36 lukem Exp $ */
/*-
* Copyright (c) 2006 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: partutil.c,v 1.3 2008/04/28 20:23:08 martin Exp $");
__RCSID("$NetBSD: partutil.c,v 1.4 2009/04/11 06:48:36 lukem Exp $");
#include <sys/types.h>
#include <sys/disklabel.h>
@ -75,7 +75,8 @@ part2wedge(struct dkwedge_info *dkw, const struct disklabel *lp, const char *s)
return;
ptn = strchr(s, '\0')[-1] - 'a';
if (ptn >= lp->d_npartitions || ptn != DISKPART(sb.st_rdev))
if ((unsigned)ptn >= lp->d_npartitions ||
(devminor_t)ptn != DISKPART(sb.st_rdev))
return;
pp = &lp->d_partitions[ptn];

View File

@ -1,4 +1,4 @@
/* $NetBSD: progress.c,v 1.4 2008/04/28 20:23:08 martin Exp $ */
/* $NetBSD: progress.c,v 1.5 2009/04/11 06:48:36 lukem Exp $ */
/*-
* Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#ifndef SMALL
#include <sys/cdefs.h>
__RCSID("$NetBSD: progress.c,v 1.4 2008/04/28 20:23:08 martin Exp $");
__RCSID("$NetBSD: progress.c,v 1.5 2009/04/11 06:48:36 lukem Exp $");
/*
* File system independent fsck progress bar routines.
@ -47,7 +47,7 @@ __RCSID("$NetBSD: progress.c,v 1.4 2008/04/28 20:23:08 martin Exp $");
#include "progress.h"
static int ttywidth = 80;
static size_t ttywidth = 80;
static int progress_onoff;
static int progress_lowlim;

View File

@ -1,4 +1,4 @@
/* $NetBSD: fsdb.c,v 1.38 2008/08/30 10:46:16 bouyer Exp $ */
/* $NetBSD: fsdb.c,v 1.39 2009/04/11 06:53:53 lukem Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: fsdb.c,v 1.38 2008/08/30 10:46:16 bouyer Exp $");
__RCSID("$NetBSD: fsdb.c,v 1.39 2009/04/11 06:53:53 lukem Exp $");
#endif /* not lint */
#include <sys/types.h>
@ -566,7 +566,7 @@ CMDFUNCSTART(findblk)
{
uint64_t size = iswap64(DIP(curinode, size));
if (size > 0 &&
size < sblock->fs_maxsymlinklen &&
size < (uint64_t)sblock->fs_maxsymlinklen &&
DIP(curinode, blocks) == 0)
continue;
else
@ -672,7 +672,7 @@ find_indirblks32(uint32_t blk, int ind_level, uint32_t *wantedblk)
{
#define MAXNINDIR (MAXBSIZE / sizeof(uint32_t))
uint32_t idblk[MAXNINDIR];
int i;
size_t i;
bread(fsreadfd, (char *)idblk, fsbtodb(sblock, blk),
(int)sblock->fs_bsize);
@ -718,7 +718,7 @@ find_indirblks64(uint64_t blk, int ind_level, uint64_t *wantedblk)
{
#define MAXNINDIR (MAXBSIZE / sizeof(uint64_t))
uint64_t idblk[MAXNINDIR];
int i;
size_t i;
bread(fsreadfd, (char *)idblk, fsbtodb(sblock, blk),
(int)sblock->fs_bsize);

View File

@ -1,4 +1,4 @@
/* $NetBSD: fsdb.h,v 1.10 2008/04/28 20:23:08 martin Exp $ */
/* $NetBSD: fsdb.h,v 1.11 2009/04/11 06:53:53 lukem Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -42,8 +42,8 @@ extern int markclean;
struct cmdtable {
const char *cmd;
const char *helptxt;
unsigned int minargc;
unsigned int maxargc;
int minargc;
int maxargc;
int (*handler)(int argc, char *argv[]);
};
extern union dinode *curinode;

View File

@ -1,4 +1,4 @@
/* $NetBSD: fsdbutil.c,v 1.21 2008/12/29 20:02:30 mlelstv Exp $ */
/* $NetBSD: fsdbutil.c,v 1.22 2009/04/11 06:53:53 lukem Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: fsdbutil.c,v 1.21 2008/12/29 20:02:30 mlelstv Exp $");
__RCSID("$NetBSD: fsdbutil.c,v 1.22 2009/04/11 06:53:53 lukem Exp $");
#endif /* not lint */
#include <sys/types.h>
@ -124,7 +124,7 @@ printstat(const char *cp, ino_t inum, union dinode *dp)
break;
case IFLNK:
fputs("symlink", stdout);
if (size > 0 && size < sblock->fs_maxsymlinklen &&
if (size > 0 && size < (uint64_t)sblock->fs_maxsymlinklen &&
DIP(dp, blocks) == 0) {
p = is_ufs2 ? (char *)dp->dp2.di_db :
(char *)dp->dp1.di_db;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ping.c,v 1.88 2009/03/31 19:51:11 christos Exp $ */
/* $NetBSD: ping.c,v 1.89 2009/04/11 06:49:50 lukem Exp $ */
/*
* Copyright (c) 1989, 1993
@ -58,7 +58,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: ping.c,v 1.88 2009/03/31 19:51:11 christos Exp $");
__RCSID("$NetBSD: ping.c,v 1.89 2009/04/11 06:49:50 lukem Exp $");
#endif
#include <stdio.h>
@ -344,11 +344,12 @@ main(int argc, char *argv[])
options |= SO_DONTROUTE;
break;
case 's': /* size of packet to send */
datalen = strtol(optarg, &p, 0);
if (*p != '\0' || datalen < 0)
l = strtol(optarg, &p, 0);
if (*p != '\0' || l < 0)
errx(1, "Bad/invalid packet size %s", optarg);
if (datalen > MAXPACKET)
if (l > MAXPACKET)
errx(1, "packet size is too large");
datalen = (int)l;
break;
case 'v':
pingflags |= F_VERBOSE;
@ -453,7 +454,7 @@ main(int argc, char *argv[])
loc_addr.sin_len = sizeof(struct sockaddr_in);
loc_addr.sin_addr.s_addr = htonl((127<<24)+1);
if (datalen >= PHDR_LEN) /* can we time them? */
if (datalen >= (int)PHDR_LEN) /* can we time them? */
pingflags |= F_TIMING;
packlen = datalen + 60 + 76; /* MAXIP + MAXICMP */
if ((packet = (u_char *)malloc(packlen)) == NULL)
@ -1070,7 +1071,7 @@ pr_pack(u_char *buf,
PR_PACK_SUB();
/* check the data */
if (datalen > PHDR_LEN
if (datalen > (int)PHDR_LEN
&& !(pingflags & F_PING_RANDOM)
&& memcmp(&icp->icmp_data[PHDR_LEN],
&opack_icmp.icmp_data[PHDR_LEN],

View File

@ -1,4 +1,4 @@
/* $NetBSD: scan_ffs.c,v 1.20 2007/12/15 19:44:47 perry Exp $ */
/* $NetBSD: scan_ffs.c,v 1.21 2009/04/11 06:52:59 lukem Exp $ */
/*
* Copyright (c) 2005-2007 Juan Romero Pardines
@ -33,7 +33,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: scan_ffs.c,v 1.20 2007/12/15 19:44:47 perry Exp $");
__RCSID("$NetBSD: scan_ffs.c,v 1.21 2009/04/11 06:52:59 lukem Exp $");
#endif /* not lint */
#include <sys/types.h>
@ -273,7 +273,7 @@ ffs_scan(struct sblockinfo *sbi, int n)
* Really enough for now.
*/
for (i = 1; i < 16; i <<= 1)
if ((BLK_CNT - lastblk) == (i * SBLOCKSIZE / 512)) {
if ((BLK_CNT - lastblk) == (daddr_t)(i * SBLOCKSIZE / 512)) {
if (flags & LABELS)
ffs_printpart(sbi, LABELS, i, n);
else
@ -348,7 +348,7 @@ lfs_scan(struct sblockinfo *sbi, int n)
*/
case FIRST_SBLOCK_ADDRESS:
/* copy partition offset */
if (sbi->lfs_off != lastblk)
if ((daddr_t)sbi->lfs_off != lastblk)
sbi->lfs_off = BLK_CNT - (LFS_LABELPAD / 512);
break;
case SECOND_SBLOCK_ADDRESS: