diff options
author | delphij <delphij@FreeBSD.org> | 2009-03-28 05:45:29 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2009-03-28 05:45:29 +0000 |
commit | 21b00fc42b2ab16bc19a270792a72971dc10973f (patch) | |
tree | 2886e758aa8188bda68aeabd1e440992d0ed0637 | |
parent | 64850243010a49e44236d9a5a79333f37746f169 (diff) | |
download | FreeBSD-src-21b00fc42b2ab16bc19a270792a72971dc10973f.zip FreeBSD-src-21b00fc42b2ab16bc19a270792a72971dc10973f.tar.gz |
Several signed/unsigned warning fixes.
-rw-r--r-- | lib/libc/db/btree/bt_put.c | 4 | ||||
-rw-r--r-- | lib/libc/db/btree/bt_split.c | 2 | ||||
-rw-r--r-- | lib/libc/db/hash/hash.c | 6 | ||||
-rw-r--r-- | lib/libc/db/hash/hash.h | 8 | ||||
-rw-r--r-- | lib/libc/db/hash/hash_bigkey.c | 3 | ||||
-rw-r--r-- | lib/libc/db/hash/hash_log2.c | 5 | ||||
-rw-r--r-- | lib/libc/db/recno/rec_close.c | 4 | ||||
-rw-r--r-- | lib/libc/db/recno/rec_put.c | 2 |
8 files changed, 18 insertions, 16 deletions
diff --git a/lib/libc/db/btree/bt_put.c b/lib/libc/db/btree/bt_put.c index 31931dc..e4016c0 100644 --- a/lib/libc/db/btree/bt_put.c +++ b/lib/libc/db/btree/bt_put.c @@ -197,7 +197,7 @@ delete: if (__bt_dleaf(t, key, h, 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 ((u_int32_t)(h->upper - h->lower) < nbytes + sizeof(indx_t)) { if ((status = __bt_split(t, h, key, data, dflags, nbytes, idx)) != RET_SUCCESS) return (status); @@ -278,7 +278,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 ((u_int32_t)(h->upper - h->lower) < nbytes + sizeof(indx_t)) goto miss; if (t->bt_order == FORWARD) { diff --git a/lib/libc/db/btree/bt_split.c b/lib/libc/db/btree/bt_split.c index 6ae3ce4..18cd0ed 100644 --- a/lib/libc/db/btree/bt_split.c +++ b/lib/libc/db/btree/bt_split.c @@ -205,7 +205,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 ((u_int32_t)(h->upper - h->lower) < nbytes + sizeof(indx_t)) { sp = h; h = h->pgno == P_ROOT ? bt_root(t, h, &l, &r, &skip, nbytes) : diff --git a/lib/libc/db/hash/hash.c b/lib/libc/db/hash/hash.c index 3013f68..263c1b0 100644 --- a/lib/libc/db/hash/hash.c +++ b/lib/libc/db/hash/hash.c @@ -164,7 +164,7 @@ __hash_open(const char *file, int flags, int mode, if (hashp->VERSION != HASHVERSION && hashp->VERSION != OLDHASHVERSION) RETURN_ERROR(EFTYPE, error1); - if (hashp->hash(CHARKEY, sizeof(CHARKEY)) != hashp->H_CHARKEY) + if ((int32_t)hashp->hash(CHARKEY, sizeof(CHARKEY)) != hashp->H_CHARKEY) RETURN_ERROR(EFTYPE, error1); /* * Figure out how many segments we need. Max_Bucket is the @@ -736,7 +736,7 @@ hash_seq(const DB *dbp, DBT *key, DBT *data, u_int32_t flag) break; } hashp->cbucket = bucket; - if (hashp->cbucket > hashp->MAX_BUCKET) { + if ((u_int32_t)hashp->cbucket > hashp->MAX_BUCKET) { hashp->cbucket = -1; return (ABNORMAL); } @@ -858,7 +858,7 @@ hash_realloc(SEGMENT **p_ptr, int oldsize, int newsize) u_int32_t __call_hash(HTAB *hashp, char *k, int len) { - int n, bucket; + unsigned int n, bucket; n = hashp->hash(k, len); bucket = n & hashp->HIGH_MASK; diff --git a/lib/libc/db/hash/hash.h b/lib/libc/db/hash/hash.h index f35fb4e..8329413 100644 --- a/lib/libc/db/hash/hash.h +++ b/lib/libc/db/hash/hash.h @@ -71,11 +71,11 @@ typedef struct hashhdr { /* Disk resident portion */ int32_t ovfl_point; /* Where overflow pages are being * allocated */ int32_t last_freed; /* Last overflow page freed */ - int32_t max_bucket; /* ID of Maximum bucket in use */ - int32_t high_mask; /* Mask to modulo into entire table */ - int32_t low_mask; /* Mask to modulo into lower half of + u_int32_t max_bucket; /* ID of Maximum bucket in use */ + u_int32_t high_mask; /* Mask to modulo into entire table */ + u_int32_t low_mask; /* Mask to modulo into lower half of * table */ - int32_t ffactor; /* Fill factor */ + u_int32_t ffactor; /* Fill factor */ int32_t nkeys; /* Number of keys in hash table */ int32_t hdrpages; /* Size of table header */ int32_t h_charkey; /* value of hash(CHARKEY) */ diff --git a/lib/libc/db/hash/hash_bigkey.c b/lib/libc/db/hash/hash_bigkey.c index c2a1e03..32db064 100644 --- a/lib/libc/db/hash/hash_bigkey.c +++ b/lib/libc/db/hash/hash_bigkey.c @@ -86,7 +86,8 @@ int __big_insert(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val) { u_int16_t *p; - int key_size, n, val_size; + int key_size, n; + unsigned int val_size; u_int16_t space, move_bytes, off; char *cp, *key_data, *val_data; diff --git a/lib/libc/db/hash/hash_log2.c b/lib/libc/db/hash/hash_log2.c index 33e0515..0586aa7 100644 --- a/lib/libc/db/hash/hash_log2.c +++ b/lib/libc/db/hash/hash_log2.c @@ -36,9 +36,10 @@ static char sccsid[] = "@(#)hash_log2.c 8.2 (Berkeley) 5/31/94"; #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -#include <sys/types.h> - #include <db.h> +#include "hash.h" +#include "page.h" +#include "extern.h" u_int32_t __log2(u_int32_t num) diff --git a/lib/libc/db/recno/rec_close.c b/lib/libc/db/recno/rec_close.c index 8520c85..2d1ff84 100644 --- a/lib/libc/db/recno/rec_close.c +++ b/lib/libc/db/recno/rec_close.c @@ -150,7 +150,7 @@ __rec_sync(const DB *dbp, u_int flags) status = (dbp->seq)(dbp, &key, &data, R_FIRST); while (status == RET_SUCCESS) { if (_write(t->bt_rfd, data.data, data.size) != - data.size) + (ssize_t)data.size) return (RET_ERROR); status = (dbp->seq)(dbp, &key, &data, R_NEXT); } @@ -162,7 +162,7 @@ __rec_sync(const DB *dbp, u_int flags) while (status == RET_SUCCESS) { iov[0].iov_base = data.data; iov[0].iov_len = data.size; - if (_writev(t->bt_rfd, iov, 2) != data.size + 1) + if (_writev(t->bt_rfd, iov, 2) != (ssize_t)(data.size + 1)) return (RET_ERROR); status = (dbp->seq)(dbp, &key, &data, R_NEXT); } diff --git a/lib/libc/db/recno/rec_put.c b/lib/libc/db/recno/rec_put.c index a6defc9..441cced 100644 --- a/lib/libc/db/recno/rec_put.c +++ b/lib/libc/db/recno/rec_put.c @@ -251,7 +251,7 @@ __rec_iput(BTREE *t, recno_t nrec, const DBT *data, u_int flags) * the offset array, shift the pointers up. */ nbytes = NRLEAFDBT(data->size); - if (h->upper - h->lower < nbytes + sizeof(indx_t)) { + if ((u_int32_t)(h->upper - h->lower) < nbytes + sizeof(indx_t)) { status = __bt_split(t, h, NULL, data, dflags, nbytes, idx); if (status == RET_SUCCESS) ++t->bt_nrecs; |