fix sign-compare issues

This commit is contained in:
lukem 2009-03-16 12:56:19 +00:00
parent f0b5e260c9
commit 07f7688506
7 changed files with 31 additions and 30 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: brconfig.c,v 1.11 2006/03/20 01:06:07 christos Exp $ */
/* $NetBSD: brconfig.c,v 1.12 2009/03/16 12:56:19 lukem Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@ -43,7 +43,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: brconfig.c,v 1.11 2006/03/20 01:06:07 christos Exp $");
__RCSID("$NetBSD: brconfig.c,v 1.12 2009/03/16 12:56:19 lukem Exp $");
#endif
@ -421,7 +421,7 @@ show_interfaces(int sock, const char *bridge, const char *prefix)
struct ifbifconf bifc;
struct ifbreq *req;
char *inbuf = NULL, *ninbuf;
int i, len = 8192;
uint32_t i, len = 8192;
for (;;) {
ninbuf = realloc(inbuf, len);
@ -465,7 +465,7 @@ show_addresses(int sock, const char *bridge, const char *prefix)
struct ifbaconf ifbac;
struct ifbareq *ifba;
char *inbuf = NULL, *ninbuf;
int i, len = 8192;
uint32_t i, len = 8192;
struct ether_addr ea;
for (;;) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: clri.c,v 1.20 2008/07/20 01:20:21 lukem Exp $ */
/* $NetBSD: clri.c,v 1.21 2009/03/16 13:01:21 lukem Exp $ */
/*
* Copyright (c) 1990, 1993
@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1990, 1993\
#if 0
static char sccsid[] = "@(#)clri.c 8.3 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: clri.c,v 1.20 2008/07/20 01:20:21 lukem Exp $");
__RCSID("$NetBSD: clri.c,v 1.21 2009/03/16 13:01:21 lukem Exp $");
#endif
#endif /* not lint */
@ -122,7 +122,7 @@ main(int argc, char *argv[])
/* check we haven't found an alternate */
if (is_ufs2 || sbp->fs_old_flags & FS_FLAGS_UPDATED) {
if (sblockloc != ufs_rw64(sbp->fs_sblockloc, needswap))
if ((uint64_t)sblockloc != ufs_rw64(sbp->fs_sblockloc, needswap))
continue;
} else {
if (sblockloc == SBLOCK_UFS2)
@ -166,7 +166,7 @@ main(int argc, char *argv[])
/* seek and read the block */
if (lseek(fd, offset, SEEK_SET) < 0)
err(1, "%s", fs);
if (read(fd, ibuf, bsize) != bsize)
if ((size_t)read(fd, ibuf, bsize) != bsize)
err(1, "%s", fs);
/* get the inode within the block. */
@ -189,7 +189,7 @@ main(int argc, char *argv[])
/* backup and write the block */
if (lseek(fd, offset, SEEK_SET) < 0)
err(1, "%s", fs);
if (write(fd, ibuf, bsize) != bsize)
if ((size_t)write(fd, ibuf, bsize) != bsize)
err(1, "%s", fs);
(void)fsync(fd);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: interact.c,v 1.30 2006/11/26 16:16:31 jmmv Exp $ */
/* $NetBSD: interact.c,v 1.31 2009/03/16 13:33:36 lukem Exp $ */
/*
* Copyright (c) 1997 Christos Zoulas. All rights reserved.
@ -35,7 +35,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: interact.c,v 1.30 2006/11/26 16:16:31 jmmv Exp $");
__RCSID("$NetBSD: interact.c,v 1.31 2009/03/16 13:33:36 lukem Exp $");
#endif /* lint */
#include <sys/param.h>
@ -508,10 +508,10 @@ cmd_part(struct disklabel *lp, char *s, int fd)
cp[line[0] - 'a'].p_size;
}
} else {
if ((i = getnum(lp, line, 0)) == -1) {
if ((i = getnum(lp, line, 0)) == -1 || i < 0) {
printf("Bad offset `%s'\n", line);
continue;
} else if (i > lp->d_secperunit) {
} else if ((uint32_t)i > lp->d_secperunit) {
printf("Offset `%s' out of range\n", line);
continue;
}
@ -547,7 +547,7 @@ cmd_part(struct disklabel *lp, char *s, int fd)
struct partition *cp = lp->d_partitions;
for (i = 0; i < lp->d_npartitions; i++) {
if (cp[i].p_fstype != FS_UNUSED) {
if (offs != -1 && cp[i].p_offset != offs) {
if (offs != -1 && cp[i].p_offset != (uint32_t)offs) {
cp[i].p_offset = offs;
showpartition(stdout, lp, i, Cflag);
}
@ -650,9 +650,9 @@ alphacmp(const void *a, const void *b)
static void
dumpnames(const char *prompt, const char * const *olist, size_t numentries)
{
int i, w;
int entry;
int columns, width, lines;
int w;
size_t i, entry, lines;
int columns, width;
const char *p;
const char **list;

View File

@ -1,4 +1,4 @@
/* $NetBSD: drvctl.c,v 1.6 2008/01/27 01:38:33 dyoung Exp $ */
/* $NetBSD: drvctl.c,v 1.7 2009/03/16 13:35:37 lukem Exp $ */
/*
* Copyright (c) 2004
@ -149,7 +149,7 @@ main(int argc, char **argv)
if (laa.l_children > children)
err(6, "DRVLISTDEV: number of children grew");
for (i = 0; i < laa.l_children; i++)
for (i = 0; i < (int)laa.l_children; i++)
printf("%s %s\n", laa.l_devname, laa.l_childname[i]);
break;
case 'r':

View File

@ -1,4 +1,4 @@
/* $NetBSD: veriexecctl.c,v 1.33 2008/08/31 23:37:45 dholland Exp $ */
/* $NetBSD: veriexecctl.c,v 1.34 2009/03/16 13:38:09 lukem Exp $ */
/*-
* Copyright 2005 Elad Efrat <elad@NetBSD.org>
@ -124,7 +124,7 @@ print_query(prop_dictionary_t qp, char *file)
{
struct statvfs sv;
const char *v;
int i;
size_t i;
uint8_t u8;
char buf[64];

View File

@ -1,5 +1,5 @@
%{
/* $NetBSD: veriexecctl_parse.y,v 1.25 2008/08/31 23:37:45 dholland Exp $ */
/* $NetBSD: veriexecctl_parse.y,v 1.26 2009/03/16 13:38:09 lukem Exp $ */
/*-
* Copyright 2005 Elad Efrat <elad@NetBSD.org>
@ -135,7 +135,7 @@ fingerprint : STRING {
err(1, "Cannot allocate memory for fingerprint");
n = convert($1, fp);
if (n == -1) {
if (n == (size_t)-1) {
free(fp);
if (verbose)
warnx("Bad fingerprint `%s' in line %zu", $1, line);
@ -212,7 +212,7 @@ convert(char *fp, u_char *out)
* not an integral number of bytes in the fingerprint.
*/
if ((count % 2) != 0)
return -1;
return (size_t)-1;
count /= 2;
@ -222,7 +222,7 @@ convert(char *fp, u_char *out)
else if (isxdigit((unsigned char) cv)) \
value += 10 + tolower((unsigned char) cv) - 'a'; \
else \
return -1
return (size_t)-1
for (i = 0; i < count; i++) {
value = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: wdogctl.c,v 1.17 2006/08/13 23:24:53 wiz Exp $ */
/* $NetBSD: wdogctl.c,v 1.18 2009/03/16 13:37:45 lukem Exp $ */
/*-
* Copyright (c) 2000 Zembu Labs, Inc.
@ -35,7 +35,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: wdogctl.c,v 1.17 2006/08/13 23:24:53 wiz Exp $");
__RCSID("$NetBSD: wdogctl.c,v 1.18 2009/03/16 13:37:45 lukem Exp $");
#endif
@ -84,7 +84,7 @@ main(int argc, char *argv[])
{
enum cmd command = CMD_NONE;
int period_flag = 0;
int ch;
int ch, tmp;
u_int period = WDOG_PERIOD_DEFAULT;
while ((ch = getopt(argc, argv, "Adekp:utx")) != -1) {
@ -119,9 +119,10 @@ main(int argc, char *argv[])
case 'p':
period_flag = 1;
period = atoi(optarg);
if (period == -1)
tmp = atoi(optarg);
if (tmp < 0)
usage();
period = (unsigned int)tmp;
break;
case 'x':