Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc Fix signed/unsigned comparison warnings.
details: https://anonhg.NetBSD.org/src/rev/4c5332986e5b
branches: trunk
changeset: 539220:4c5332986e5b
user: thorpej <thorpej%NetBSD.org@localhost>
date: Mon Nov 11 16:50:34 2002 +0000
description:
Fix signed/unsigned comparison warnings.
diffstat:
lib/libc/gen/getloadavg.c | 7 ++++---
lib/libc/net/gethnamaddr.c | 8 ++++----
2 files changed, 8 insertions(+), 7 deletions(-)
diffs (71 lines):
diff -r 20625748f5de -r 4c5332986e5b lib/libc/gen/getloadavg.c
--- a/lib/libc/gen/getloadavg.c Mon Nov 11 16:39:18 2002 +0000
+++ b/lib/libc/gen/getloadavg.c Mon Nov 11 16:50:34 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: getloadavg.c,v 1.11 2000/06/26 15:37:28 mrg Exp $ */
+/* $NetBSD: getloadavg.c,v 1.12 2002/11/11 16:58:42 thorpej Exp $ */
/*-
* Copyright (c) 1989, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)getloadavg.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: getloadavg.c,v 1.11 2000/06/26 15:37:28 mrg Exp $");
+__RCSID("$NetBSD: getloadavg.c,v 1.12 2002/11/11 16:58:42 thorpej Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -73,6 +73,7 @@
size_t size;
_DIAGASSERT(loadavg != NULL);
+ _DIAGASSERT(nelem >= 0);
mib[0] = CTL_VM;
mib[1] = VM_LOADAVG;
@@ -80,7 +81,7 @@
if (sysctl(mib, 2, &loadinfo, &size, NULL, 0) < 0)
return (-1);
- nelem = MIN(nelem, sizeof(loadinfo.ldavg) / sizeof(fixpt_t));
+ nelem = MIN((size_t) nelem, sizeof(loadinfo.ldavg) / sizeof(fixpt_t));
for (i = 0; i < nelem; i++)
loadavg[i] = (double) loadinfo.ldavg[i] / loadinfo.fscale;
return (nelem);
diff -r 20625748f5de -r 4c5332986e5b lib/libc/net/gethnamaddr.c
--- a/lib/libc/net/gethnamaddr.c Mon Nov 11 16:39:18 2002 +0000
+++ b/lib/libc/net/gethnamaddr.c Mon Nov 11 16:50:34 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gethnamaddr.c,v 1.52 2002/08/27 08:50:49 itojun Exp $ */
+/* $NetBSD: gethnamaddr.c,v 1.53 2002/11/11 16:50:34 thorpej Exp $ */
/*
* ++Copyright++ 1985, 1988, 1993
@@ -61,7 +61,7 @@
static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93";
static char rcsid[] = "Id: gethnamaddr.c,v 8.21 1997/06/01 20:34:37 vixie Exp ";
#else
-__RCSID("$NetBSD: gethnamaddr.c,v 1.52 2002/08/27 08:50:49 itojun Exp $");
+__RCSID("$NetBSD: gethnamaddr.c,v 1.53 2002/11/11 16:50:34 thorpej Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -659,7 +659,7 @@
int af;
{
const u_char *uaddr = (const u_char *)addr;
- int size;
+ socklen_t size;
struct hostent *hp;
static const ns_dtab dtab[] = {
NS_FILES_CB(_gethtbyaddr, NULL)
@@ -1280,7 +1280,7 @@
char **hap;
int addrok;
int more;
- int naddrs;
+ size_t naddrs;
_DIAGASSERT(line != NULL);
Home |
Main Index |
Thread Index |
Old Index