fix -Wsign-compare issues

This commit is contained in:
lukem 2009-02-12 06:35:54 +00:00
parent 85716c44d5
commit c7201a0f39
3 changed files with 15 additions and 14 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: bt_put.c,v 1.18 2008/09/11 12:58:00 joerg Exp $ */
/* $NetBSD: bt_put.c,v 1.19 2009/02/12 06:40:14 lukem Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@ -37,7 +37,7 @@
#endif
#include <sys/cdefs.h>
__RCSID("$NetBSD: bt_put.c,v 1.18 2008/09/11 12:58:00 joerg Exp $");
__RCSID("$NetBSD: bt_put.c,v 1.19 2009/02/12 06:40:14 lukem Exp $");
#include "namespace.h"
#include <sys/types.h>
@ -202,7 +202,7 @@ delete: if (__bt_dleaf(t, key, h, (u_int)idx) == RET_ERROR) {
* into the offset array, shift the pointers up.
*/
nbytes = NBLEAFDBT(key->size, data->size);
if (h->upper - h->lower < nbytes + sizeof(indx_t)) {
if ((uint32_t)h->upper - (uint32_t)h->lower < nbytes + sizeof(indx_t)) {
if ((status = __bt_split(t, h, key,
data, dflags, nbytes, (u_int)idx)) != RET_SUCCESS)
return (status);
@ -283,7 +283,7 @@ bt_fast(BTREE *t, const DBT *key, const DBT *data, int *exactp)
* have to search to get split stack.
*/
nbytes = NBLEAFDBT(key->size, data->size);
if (h->upper - h->lower < nbytes + sizeof(indx_t))
if ((uint32_t)h->upper - (uint32_t)h->lower < nbytes + sizeof(indx_t))
goto miss;
if (t->bt_order == FORWARD) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: bt_split.c,v 1.17 2008/09/11 12:58:00 joerg Exp $ */
/* $NetBSD: bt_split.c,v 1.18 2009/02/12 06:41:40 lukem Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@ -37,7 +37,7 @@
#endif
#include <sys/cdefs.h>
__RCSID("$NetBSD: bt_split.c,v 1.17 2008/09/11 12:58:00 joerg Exp $");
__RCSID("$NetBSD: bt_split.c,v 1.18 2009/02/12 06:41:40 lukem Exp $");
#include "namespace.h"
#include <sys/types.h>
@ -215,7 +215,7 @@ __bt_split(BTREE *t, PAGE *sp, const DBT *key, const DBT *data, int flags,
}
/* Split the parent page if necessary or shift the indices. */
if (h->upper - h->lower < nbytes + sizeof(indx_t)) {
if ((uint32_t)h->upper - (uint32_t)h->lower < nbytes + sizeof(indx_t)) {
sp = h;
h = h->pgno == P_ROOT ?
bt_root(t, h, &l, &r, &skip, nbytes) :

View File

@ -1,4 +1,4 @@
/* $NetBSD: hash.c,v 1.30 2008/09/11 12:58:00 joerg Exp $ */
/* $NetBSD: hash.c,v 1.31 2009/02/12 06:35:54 lukem Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@ -37,7 +37,7 @@
#endif
#include <sys/cdefs.h>
__RCSID("$NetBSD: hash.c,v 1.30 2008/09/11 12:58:00 joerg Exp $");
__RCSID("$NetBSD: hash.c,v 1.31 2009/02/12 06:35:54 lukem Exp $");
#include "namespace.h"
#include <sys/param.h>
@ -161,7 +161,8 @@ __hash_open(const char *file, int flags, mode_t mode, const HASHINFO *info,
if (hashp->VERSION != HASHVERSION &&
hashp->VERSION != OLDHASHVERSION)
RETURN_ERROR(EFTYPE, error1);
if (hashp->hash(CHARKEY, sizeof(CHARKEY)) != hashp->H_CHARKEY)
if (hashp->hash(CHARKEY, sizeof(CHARKEY)) !=
(uint32_t)hashp->H_CHARKEY)
RETURN_ERROR(EFTYPE, error1);
/*
* Figure out how many segments we need. Max_Bucket is the
@ -377,7 +378,7 @@ init_htab(HTAB *hashp, size_t nelem)
nsegs = (nbuckets - 1) / hashp->SGSIZE + 1;
nsegs = 1 << __log2(nsegs);
if (nsegs > hashp->DSIZE)
if (nsegs > (uint32_t)hashp->DSIZE)
hashp->DSIZE = nsegs;
return (alloc_segs(hashp, (int)nsegs));
}
@ -601,7 +602,7 @@ hash_access(HTAB *hashp, ACTION action, DBT *key, DBT *val)
for (bp = (uint16_t *)(void *)rbufp->page, n = *bp++, ndx = 1; ndx < n;)
if (bp[1] >= REAL_KEY) {
/* Real key/data pair */
if (size == off - *bp &&
if (size == (size_t)(off - *bp) &&
memcmp(kp, rbufp->page + *bp, size) == 0)
goto found;
off = bp[1];
@ -726,7 +727,7 @@ hash_seq(const DB *dbp, DBT *key, DBT *data, uint32_t flag)
for (bp = NULL; !bp || !bp[0]; ) {
if (!(bufp = hashp->cpage)) {
for (bucket = hashp->cbucket;
bucket <= hashp->MAX_BUCKET;
bucket <= (uint32_t)hashp->MAX_BUCKET;
bucket++, hashp->cndx = 1) {
bufp = __get_buf(hashp, bucket, NULL, 0);
if (!bufp)
@ -831,7 +832,7 @@ __expand_table(HTAB *hashp)
hashp->OVFL_POINT = spare_ndx;
}
if (new_bucket > hashp->HIGH_MASK) {
if (new_bucket > (uint32_t)hashp->HIGH_MASK) {
/* Starting a new doubling */
hashp->LOW_MASK = hashp->HIGH_MASK;
hashp->HIGH_MASK = new_bucket | hashp->LOW_MASK;