fix -Wsign-compare issues

This commit is contained in:
lukem 2009-01-18 12:14:16 +00:00
parent 53ff085f8b
commit a06595c27b
7 changed files with 26 additions and 26 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: hmac.c,v 1.1 2006/10/27 18:22:56 drochner Exp $ */
/* $NetBSD: hmac.c,v 1.2 2009/01/18 12:15:27 lukem Exp $ */
/*
* Copyright (c) 2004, Juniper Networks, Inc.
@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
#if !defined(lint)
__RCSID("$NetBSD: hmac.c,v 1.1 2006/10/27 18:22:56 drochner Exp $");
__RCSID("$NetBSD: hmac.c,v 1.2 2009/01/18 12:15:27 lukem Exp $");
#endif /* not lint */
#include <stdlib.h>
@ -75,7 +75,7 @@ HMAC_FUNC (const unsigned char *text, size_t text_len,
unsigned char k_opad[HMAC_BLOCKSZ + 1];
/* HASH(key) if needed */
unsigned char tk[HASH_LENGTH];
int i;
size_t i;
/*
* If key is longer than HMAC_BLOCKSZ bytes

View File

@ -1,4 +1,4 @@
/* $NetBSD: pw_gensalt.c,v 1.6 2007/01/17 23:24:22 hubertf Exp $ */
/* $NetBSD: pw_gensalt.c,v 1.7 2009/01/18 12:15:27 lukem Exp $ */
/*
* Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
@ -34,7 +34,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: pw_gensalt.c,v 1.6 2007/01/17 23:24:22 hubertf Exp $");
__RCSID("$NetBSD: pw_gensalt.c,v 1.7 2009/01/18 12:15:27 lukem Exp $");
#endif /* not lint */
#include <sys/syslimits.h>
@ -162,7 +162,7 @@ __gensalt_sha1(char *salt, size_t saltsiz, const char *option)
* The salt can be up to 64 bytes, but 8
* is considered enough for now.
*/
if (n + 9 >= saltsiz)
if ((size_t)n + 9 >= saltsiz)
return 0;
__crypt_to64(&salt[n], arc4random(), 4);
__crypt_to64(&salt[n + 4], arc4random(), 4);

View File

@ -1,4 +1,4 @@
/* $NetBSD: el.c,v 1.46 2008/09/10 15:45:37 christos Exp $ */
/* $NetBSD: el.c,v 1.47 2009/01/18 12:17:24 lukem Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)el.c 8.2 (Berkeley) 1/3/94";
#else
__RCSID("$NetBSD: el.c,v 1.46 2008/09/10 15:45:37 christos Exp $");
__RCSID("$NetBSD: el.c,v 1.47 2009/01/18 12:17:24 lukem Exp $");
#endif
#endif /* not lint && not SCCSID */
@ -369,7 +369,7 @@ el_get(EditLine *el, int op, ...)
char *argv[20];
int i;
for (i = 1; i < sizeof(argv) / sizeof(argv[0]); i++)
for (i = 1; i < (int)(sizeof(argv) / sizeof(argv[0])); i++)
if ((argv[i] = va_arg(ap, char *)) == NULL)
break;

View File

@ -1,4 +1,4 @@
/* $NetBSD: read.c,v 1.41 2008/09/10 15:45:37 christos Exp $ */
/* $NetBSD: read.c,v 1.42 2009/01/18 12:17:24 lukem Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)read.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: read.c,v 1.41 2008/09/10 15:45:37 christos Exp $");
__RCSID("$NetBSD: read.c,v 1.42 2009/01/18 12:17:24 lukem Exp $");
#endif
#endif /* not lint && not SCCSID */
@ -501,7 +501,7 @@ el_gets(EditLine *el, int *nread)
#endif /* DEBUG_READ */
break;
}
if ((unsigned int)cmdnum >= el->el_map.nfunc) { /* BUG CHECK command */
if ((unsigned int)cmdnum >= (unsigned int)el->el_map.nfunc) { /* BUG CHECK command */
#ifdef DEBUG_EDIT
(void) fprintf(el->el_errfile,
"ERROR: illegal command from key 0%o\r\n", ch);

View File

@ -1,4 +1,4 @@
/* $NetBSD: readline.c,v 1.76 2009/01/11 15:00:23 christos Exp $ */
/* $NetBSD: readline.c,v 1.77 2009/01/18 12:17:24 lukem Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include "config.h"
#if !defined(lint) && !defined(SCCSID)
__RCSID("$NetBSD: readline.c,v 1.76 2009/01/11 15:00:23 christos Exp $");
__RCSID("$NetBSD: readline.c,v 1.77 2009/01/18 12:17:24 lukem Exp $");
#endif /* not lint && not SCCSID */
#include <sys/types.h>
@ -691,7 +691,7 @@ _history_expand_command(const char *command, size_t offs, size_t cmdlen,
if (aptr)
free(aptr);
if (*cmd == '\0' || (cmd - (command + offs) >= cmdlen)) {
if (*cmd == '\0' || ((size_t)(cmd - (command + offs)) >= cmdlen)) {
*result = tmp;
return(1);
}
@ -986,20 +986,20 @@ history_arg_extract(int start, int end, const char *str)
if (start < 0)
start = end;
if (start < 0 || end < 0 || start > max || end > max || start > end)
if (start < 0 || end < 0 || (size_t)start > max || (size_t)end > max || start > end)
return(NULL);
for (i = start, len = 0; i <= end; i++)
for (i = start, len = 0; i <= (size_t)end; i++)
len += strlen(arr[i]) + 1;
len++;
result = malloc(len);
if (result == NULL)
return NULL;
for (i = start, len = 0; i <= end; i++) {
for (i = start, len = 0; i <= (size_t)end; i++) {
(void)strcpy(result + len, arr[i]);
len += strlen(arr[i]);
if (i < end)
if (i < (size_t)end)
result[len++] = ' ';
}
result[len] = '\0';
@ -1639,7 +1639,7 @@ int
rl_add_defun(const char *name, Function *fun, int c)
{
char dest[8];
if (c >= sizeof(map) / sizeof(map[0]) || c < 0)
if ((size_t)c >= sizeof(map) / sizeof(map[0]) || c < 0)
return -1;
map[(unsigned char)c] = fun;
el_set(e, EL_ADDFN, name, name, rl_bind_wrapper);

View File

@ -1,4 +1,4 @@
/* $NetBSD: pthread_attr.c,v 1.11 2008/10/10 09:13:20 ad Exp $ */
/* $NetBSD: pthread_attr.c,v 1.12 2009/01/18 12:14:16 lukem Exp $ */
/*-
* Copyright (c) 2001, 2002, 2003, 2008 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: pthread_attr.c,v 1.11 2008/10/10 09:13:20 ad Exp $");
__RCSID("$NetBSD: pthread_attr.c,v 1.12 2009/01/18 12:14:16 lukem Exp $");
#include <errno.h>
#include <stdio.h>
@ -355,7 +355,7 @@ pthread_attr_setstacksize(pthread_attr_t *attr, size_t size)
{
struct pthread_attr_private *p;
if (size < sysconf(_SC_THREAD_STACK_MIN))
if (size < (size_t)sysconf(_SC_THREAD_STACK_MIN))
return EINVAL;
p = pthread__attr_init_private(attr);

View File

@ -1,4 +1,4 @@
/* $NetBSD: pthread_cond.c,v 1.53 2008/10/25 14:14:11 yamt Exp $ */
/* $NetBSD: pthread_cond.c,v 1.54 2009/01/18 12:14:17 lukem Exp $ */
/*-
* Copyright (c) 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: pthread_cond.c,v 1.53 2008/10/25 14:14:11 yamt Exp $");
__RCSID("$NetBSD: pthread_cond.c,v 1.54 2009/01/18 12:14:17 lukem Exp $");
#include <errno.h>
#include <sys/time.h>
@ -239,7 +239,7 @@ pthread__cond_wake_one(pthread_cond_t *cond)
* deferred wakeup list. The waiter will be set running when the
* caller (this thread) releases the mutex.
*/
if (__predict_false(self->pt_nwaiters == pthread__unpark_max)) {
if (__predict_false(self->pt_nwaiters == (size_t)pthread__unpark_max)) {
(void)_lwp_unpark_all(self->pt_waiters, self->pt_nwaiters,
__UNVOLATILE(&mutex->ptm_waiters));
self->pt_nwaiters = 0;