sign-compare fix

This commit is contained in:
lukem 2009-01-30 23:35:35 +00:00
parent 397f5192b2
commit 8a09e86085
3 changed files with 10 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: misc.c,v 1.4 2008/03/21 23:13:48 christos Exp $ */
/* $NetBSD: misc.c,v 1.5 2009/01/30 23:35:35 lukem Exp $ */
/****************************************************************
@ -67,7 +67,7 @@ Balloc
#else
len = (sizeof(Bigint) + (x-1)*sizeof(ULong) + sizeof(double) - 1)
/sizeof(double);
if (pmem_next - private_mem + len <= PRIVATE_mem) {
if ((double *)(pmem_next - private_mem + len) <= (double *)PRIVATE_mem) {
rv = (Bigint*)(void *)pmem_next;
pmem_next += len;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip6opt.c,v 1.11 2006/05/05 00:03:21 rpaulo Exp $ */
/* $NetBSD: ip6opt.c,v 1.12 2009/01/30 23:43:30 lukem Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: ip6opt.c,v 1.11 2006/05/05 00:03:21 rpaulo Exp $");
__RCSID("$NetBSD: ip6opt.c,v 1.12 2009/01/30 23:43:30 lukem Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -498,7 +498,7 @@ inet6_opt_append(void *extbuf, socklen_t extlen, int offset, u_int8_t type,
/* The option must fit in the extension header buffer. */
currentlen += padlen;
if (extlen && /* XXX: right? */
currentlen > extlen)
(socklen_t)currentlen > extlen)
return (-1);
if (extbuf) {
@ -528,13 +528,13 @@ inet6_opt_append(void *extbuf, socklen_t extlen, int offset, u_int8_t type,
int
inet6_opt_finish(void *extbuf, socklen_t extlen, int offset)
{
int updatelen = offset > 0 ? (1 + ((offset - 1) | 7)) : 0;;
int updatelen = offset > 0 ? (1 + ((offset - 1) | 7)) : 0;
if (extbuf) {
u_int8_t *padp;
size_t padlen = updatelen - offset;
if (updatelen > extlen)
if ((socklen_t)updatelen > extlen)
return (-1);
padp = (u_int8_t *)extbuf + offset;

View File

@ -1,4 +1,4 @@
/* $NetBSD: qsort.c,v 1.18 2009/01/11 02:46:30 christos Exp $ */
/* $NetBSD: qsort.c,v 1.19 2009/01/30 23:38:44 lukem Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)qsort.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: qsort.c,v 1.18 2009/01/11 02:46:30 christos Exp $");
__RCSID("$NetBSD: qsort.c,v 1.19 2009/01/30 23:38:44 lukem Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -168,7 +168,7 @@ loop: SWAPINIT(a, es);
pn = (char *) a + n * es;
r = min(pa - (char *) a, pb - pa);
vecswap(a, pb - r, r);
r = min(pd - pc, pn - pd - es);
r = min((size_t)(pd - pc), pn - pd - es);
vecswap(pb, pn - r, r);
if ((r = pb - pa) > es)
qsort(a, r / es, es, cmp);