fix sign-compare issues

This commit is contained in:
lukem 2009-04-11 07:31:21 +00:00
parent 6978bdec0e
commit 8e2fe69844
4 changed files with 20 additions and 21 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: dir.c,v 1.51 2008/07/08 08:14:37 simonb Exp $ */
/* $NetBSD: dir.c,v 1.52 2009/04/11 07:31:21 lukem Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)dir.c 8.8 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: dir.c,v 1.51 2008/07/08 08:14:37 simonb Exp $");
__RCSID("$NetBSD: dir.c,v 1.52 2009/04/11 07:31:21 lukem Exp $");
#endif
#endif /* not lint */
@ -198,7 +198,7 @@ dirscan(struct inodesc *idesc)
idesc->id_loc = 0;
for (dp = fsck_readdir(idesc); dp != NULL; dp = fsck_readdir(idesc)) {
dsize = iswap16(dp->d_reclen);
if (dsize > sizeof dbuf)
if (dsize > (int)sizeof dbuf)
dsize = sizeof dbuf;
memmove(dbuf, dp, (size_t)dsize);
# if (BYTE_ORDER == LITTLE_ENDIAN)
@ -727,7 +727,7 @@ expanddir(union dinode *dp, char *name)
btodb(sblock->fs_bsize));
dirblk = iswap32(dp1->di_db[lastbn + 1]);
}
bp = getdirblk(dirblk, sblksize(sblock, DIP(dp, size), lastbn + 1));
bp = getdirblk(dirblk, sblksize(sblock, (daddr_t)DIP(dp, size), lastbn + 1));
if (bp->b_errs)
goto bad;
memmove(firstblk, bp->b_un.b_buf, dirblksiz);
@ -741,7 +741,7 @@ expanddir(union dinode *dp, char *name)
cp += dirblksiz)
memmove(cp, &emptydir, sizeof emptydir);
dirty(bp);
bp = getdirblk(dirblk, sblksize(sblock, DIP(dp, size), lastbn + 1));
bp = getdirblk(dirblk, sblksize(sblock, (daddr_t)DIP(dp, size), lastbn + 1));
if (bp->b_errs)
goto bad;
memmove(bp->b_un.b_buf, &emptydir, sizeof emptydir);

View File

@ -1,4 +1,4 @@
/* $NetBSD: inode.c,v 1.61 2008/10/09 16:56:23 christos Exp $ */
/* $NetBSD: inode.c,v 1.62 2009/04/11 07:32:42 lukem Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)inode.c 8.8 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: inode.c,v 1.61 2008/10/09 16:56:23 christos Exp $");
__RCSID("$NetBSD: inode.c,v 1.62 2009/04/11 07:32:42 lukem Exp $");
#endif
#endif /* not lint */
@ -192,7 +192,7 @@ iblock(struct inodesc *idesc, long ilevel, u_int64_t isize)
ilevel--;
for (sizepb = sblock->fs_bsize, i = 0; i < ilevel; i++)
sizepb *= NINDIR(sblock);
if (howmany(isize, sizepb) > NINDIR(sblock))
if (howmany(isize, sizepb) > (size_t)NINDIR(sblock))
nif = NINDIR(sblock);
else
nif = howmany(isize, sizepb);
@ -356,7 +356,7 @@ swap_dinode1(union dinode *dp, int n)
if (((iswap16(dp1->di_mode) & IFMT) != IFLNK) ||
doinglevel2 ||
(maxsymlinklen < 0) ||
(iswap64(dp1->di_size) > maxsymlinklen)) {
(iswap64(dp1->di_size) > (uint64_t)maxsymlinklen)) {
for (j = 0; j < (NDADDR + NIADDR); j++)
dp1->di_db[j] = bswap32(dp1->di_db[j]);
}
@ -477,8 +477,7 @@ cacheino(union dinode *dp, ino_t inumber)
{
struct inoinfo *inp;
struct inoinfo **inpp, **ninpsort;
unsigned int blks, extra;
int i;
unsigned int i, blks, extra;
int64_t size;
size = iswap64(DIP(dp, size));
@ -717,7 +716,7 @@ allocino(ino_t request, int type)
return (0);
cg = ino_to_cg(sblock, ino);
/* If necessary, extend the inoinfo array. grow exponentially */
if ((ino % sblock->fs_ipg) >= inostathead[cg].il_numalloced) {
if ((ino % sblock->fs_ipg) >= (uint64_t)inostathead[cg].il_numalloced) {
unsigned long newalloced, i;
newalloced = MIN(sblock->fs_ipg,
MAX(2 * inostathead[cg].il_numalloced, 10));

View File

@ -1,4 +1,4 @@
/* $NetBSD: activate.c,v 1.14 2007/07/02 18:07:44 pooka Exp $ */
/* $NetBSD: activate.c,v 1.15 2009/04/11 07:36:43 lukem Exp $ */
/*
* Copyright (c) 1992, 1993
@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: activate.c,v 1.14 2007/07/02 18:07:44 pooka Exp $");
__RCSID("$NetBSD: activate.c,v 1.15 2009/04/11 07:36:43 lukem Exp $");
#endif /* not lint */
#include <stdio.h>
@ -55,7 +55,7 @@ __RCSID("$NetBSD: activate.c,v 1.14 2007/07/02 18:07:44 pooka Exp $");
#include "portald.h"
static int get_request(int, struct portal_cred *, char *, int);
static int get_request(int, struct portal_cred *, char *, size_t);
static void send_reply(int, int, int);
/*
@ -75,11 +75,11 @@ activate_argv(struct portal_cred *pcr, char *key, char **v, int *fdp)
}
static int
get_request(int so, struct portal_cred *pcr, char *key, int klen)
get_request(int so, struct portal_cred *pcr, char *key, size_t klen)
{
struct iovec iov[2];
struct msghdr msg;
int n;
ssize_t n;
iov[0].iov_base = (caddr_t) pcr;
iov[0].iov_len = sizeof(*pcr);
@ -94,7 +94,7 @@ get_request(int so, struct portal_cred *pcr, char *key, int klen)
if (n < 0)
return (errno);
if (n <= sizeof(*pcr))
if (n <= (ssize_t)sizeof(*pcr))
return (EINVAL);
n -= sizeof(*pcr);

View File

@ -1,4 +1,4 @@
/* $NetBSD: pt_tcp.c,v 1.20 2007/07/02 18:07:45 pooka Exp $ */
/* $NetBSD: pt_tcp.c,v 1.21 2009/04/11 07:36:43 lukem Exp $ */
/*
* Copyright (c) 1992, 1993, 1994
@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: pt_tcp.c,v 1.20 2007/07/02 18:07:45 pooka Exp $");
__RCSID("$NetBSD: pt_tcp.c,v 1.21 2009/04/11 07:36:43 lukem Exp $");
#endif /* not lint */
#include <stdio.h>
@ -75,7 +75,7 @@ portal_tcp(struct portal_cred *pcr, char *key, char **v, int *fdp)
const char *cause = "unknown";
q = strchr(p, '/');
if (q == 0 || q - p >= sizeof(host))
if (q == 0 || (size_t)(q - p) >= sizeof(host))
return (EINVAL);
*q = '\0';
if (strlcpy(host, p, sizeof(host)) >= sizeof(host))