fix sign-compare issues

This commit is contained in:
lukem 2009-03-16 12:52:07 +00:00
parent 38357705f9
commit c1237301b3
3 changed files with 22 additions and 21 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: atactl.c,v 1.52 2008/08/25 00:45:56 dholland Exp $ */
/* $NetBSD: atactl.c,v 1.53 2009/03/16 12:52:32 lukem Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -35,7 +35,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: atactl.c,v 1.52 2008/08/25 00:45:56 dholland Exp $");
__RCSID("$NetBSD: atactl.c,v 1.53 2009/03/16 12:52:32 lukem Exp $");
#endif
@ -683,7 +683,7 @@ void
print_selftest_entry(int num, struct ata_smart_selftest *le)
{
unsigned char *p;
int i;
size_t i;
/* check if all zero */
for (p = (void *)le, i = 0; i < sizeof(*le); i++)

View File

@ -1,4 +1,4 @@
/* $NetBSD: badsect.c,v 1.31 2008/12/29 16:03:57 christos Exp $ */
/* $NetBSD: badsect.c,v 1.32 2009/03/16 12:53:30 lukem Exp $ */
/*
* Copyright (c) 1981, 1983, 1993
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1981, 1983, 1993\
#if 0
static char sccsid[] = "@(#)badsect.c 8.2 (Berkeley) 5/4/95";
#else
__RCSID("$NetBSD: badsect.c,v 1.31 2008/12/29 16:03:57 christos Exp $");
__RCSID("$NetBSD: badsect.c,v 1.32 2009/03/16 12:53:30 lukem Exp $");
#endif
#endif /* not lint */
@ -250,7 +250,7 @@ chkuse(off_t blkno, int cnt)
static void
rdfs(off_t bno, size_t size, void *bf)
{
int n;
ssize_t n;
if (lseek(fsi, bno * dev_bsize, SEEK_SET) == -1)
err(1, "seek error at block %lld", (long long)bno);
@ -261,7 +261,7 @@ rdfs(off_t bno, size_t size, void *bf)
break;
default:
if (n == size)
if ((size_t)n == size)
return;
errx(1, "incomplete read at block %lld", (long long)bno);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ccdconfig.c,v 1.48 2008/07/20 01:20:21 lukem Exp $ */
/* $NetBSD: ccdconfig.c,v 1.49 2009/03/16 12:52:07 lukem Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -33,7 +33,7 @@
#ifndef lint
__COPYRIGHT("@(#) Copyright (c) 1996, 1997\
The NetBSD Foundation, Inc. All rights reserved.");
__RCSID("$NetBSD: ccdconfig.c,v 1.48 2008/07/20 01:20:21 lukem Exp $");
__RCSID("$NetBSD: ccdconfig.c,v 1.49 2009/03/16 12:52:07 lukem Exp $");
#endif
#include <sys/param.h>
@ -199,6 +199,7 @@ do_single(int argc, char **argv, int action)
struct ccd_ioctl ccio;
char *ccd, *cp, *cp2, **disks;
int noflags = 0, i, ileave, flags, j;
unsigned int ui;
flags = 0;
memset(&ccio, 0, sizeof(ccio));
@ -273,10 +274,10 @@ do_single(int argc, char **argv, int action)
free(ccd);
return (1);
}
for (i = 0; argc != 0; ) {
for (ui = 0; argc != 0; ) {
cp = *argv++; --argc;
if ((j = checkdev(cp)) == 0)
disks[i++] = cp;
disks[ui++] = cp;
else {
warnx("%s: %s", cp, strerror(j));
free(ccd);
@ -287,7 +288,7 @@ do_single(int argc, char **argv, int action)
/* Fill in the ccio. */
ccio.ccio_disks = disks;
ccio.ccio_ndisks = i;
ccio.ccio_ndisks = ui;
ccio.ccio_ileave = ileave;
ccio.ccio_flags = flags;
@ -300,14 +301,14 @@ do_single(int argc, char **argv, int action)
if (verbose) {
printf("ccd%d: %d components ", ccio.ccio_unit,
ccio.ccio_ndisks);
for (i = 0; i < ccio.ccio_ndisks; ++i) {
if ((cp2 = strrchr(disks[i], '/')) != NULL)
for (ui = 0; ui < ccio.ccio_ndisks; ++ui) {
if ((cp2 = strrchr(disks[ui], '/')) != NULL)
++cp2;
else
cp2 = disks[i];
cp2 = disks[ui];
printf("%c%s%c",
i == 0 ? '(' : ' ', cp2,
i == ccio.ccio_ndisks - 1 ? ')' : ',');
ui == 0 ? '(' : ' ', cp2,
ui == ccio.ccio_ndisks - 1 ? ')' : ',');
}
printf(", %ld blocks ", (long)ccio.ccio_size);
if (ccio.ccio_ileave != 0)
@ -543,7 +544,7 @@ dump_ccd(int argc, char **argv, int action)
free(vcs);
KVM_ABORT(kd, "can't find pointer to configuration data");
}
if (kvm_read(kd, (u_long)kcs, vcs, readsize) != readsize) {
if ((size_t)kvm_read(kd, (u_long)kcs, vcs, readsize) != readsize) {
free(vcs);
KVM_ABORT(kd, "can't read configuration data");
}
@ -612,7 +613,7 @@ print_ccd_info(struct ccd_softc *cs, kvm_t *kd)
struct ccdcinfo *cip;
size_t readsize;
char path[MAXPATHLEN];
int i;
unsigned int i;
if (header_printed == 0 && verbose) {
printf("# ccd\t\tileave\tflags\tcompnent devices\n");
@ -633,7 +634,7 @@ print_ccd_info(struct ccd_softc *cs, kvm_t *kd)
fflush(stdout);
/* Read in the component info. */
if (kvm_read(kd, (u_long)cs->sc_cinfo, (void *)cip,
if ((size_t)kvm_read(kd, (u_long)cs->sc_cinfo, (void *)cip,
readsize) != readsize) {
printf("\n");
warnx("can't read component info");
@ -643,7 +644,7 @@ print_ccd_info(struct ccd_softc *cs, kvm_t *kd)
/* Read component pathname and display component info. */
for (i = 0; i < cs->sc_nccdisks; ++i) {
if (kvm_read(kd, (u_long)cip[i].ci_path, (void *)path,
if ((size_t)kvm_read(kd, (u_long)cip[i].ci_path, (void *)path,
cip[i].ci_pathlen) != cip[i].ci_pathlen) {
printf("\n");
warnx("can't read component pathname");