From a06595c27ba4f4ed85d2b4202f741dd344ceee2c Mon Sep 17 00:00:00 2001 From: lukem Date: Sun, 18 Jan 2009 12:14:16 +0000 Subject: [PATCH] fix -Wsign-compare issues --- lib/libcrypt/hmac.c | 6 +++--- lib/libcrypt/pw_gensalt.c | 6 +++--- lib/libedit/el.c | 6 +++--- lib/libedit/read.c | 6 +++--- lib/libedit/readline.c | 16 ++++++++-------- lib/libpthread/pthread_attr.c | 6 +++--- lib/libpthread/pthread_cond.c | 6 +++--- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/lib/libcrypt/hmac.c b/lib/libcrypt/hmac.c index 7db6d7a65b29..fe2559455cbb 100644 --- a/lib/libcrypt/hmac.c +++ b/lib/libcrypt/hmac.c @@ -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 #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 @@ -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 diff --git a/lib/libcrypt/pw_gensalt.c b/lib/libcrypt/pw_gensalt.c index dce5032fcaba..094f0cef128a 100644 --- a/lib/libcrypt/pw_gensalt.c +++ b/lib/libcrypt/pw_gensalt.c @@ -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 @@ -34,7 +34,7 @@ #include #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 @@ -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); diff --git a/lib/libedit/el.c b/lib/libedit/el.c index bbd7f1c9d60f..0acc2bbb21c3 100644 --- a/lib/libedit/el.c +++ b/lib/libedit/el.c @@ -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; diff --git a/lib/libedit/read.c b/lib/libedit/read.c index abac492df018..84f7d35534d9 100644 --- a/lib/libedit/read.c +++ b/lib/libedit/read.c @@ -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); diff --git a/lib/libedit/readline.c b/lib/libedit/readline.c index f7d2e6728c04..a8c5353779c0 100644 --- a/lib/libedit/readline.c +++ b/lib/libedit/readline.c @@ -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 @@ -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); diff --git a/lib/libpthread/pthread_attr.c b/lib/libpthread/pthread_attr.c index d9b17b53cf88..ad52f34c3766 100644 --- a/lib/libpthread/pthread_attr.c +++ b/lib/libpthread/pthread_attr.c @@ -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 -__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 #include @@ -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); diff --git a/lib/libpthread/pthread_cond.c b/lib/libpthread/pthread_cond.c index d8f000e680c0..0a7cd0439471 100644 --- a/lib/libpthread/pthread_cond.c +++ b/lib/libpthread/pthread_cond.c @@ -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 -__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 #include @@ -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;