Several signed/unsigned warning fixes.

This commit is contained in:
Xin LI 2009-03-28 05:45:29 +00:00
parent 669697b4ea
commit f60486b3ce
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=190484
8 changed files with 18 additions and 16 deletions

View file

@ -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) {

View file

@ -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) :

View file

@ -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;

View file

@ -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) */

View file

@ -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;

View file

@ -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)

View file

@ -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);
}

View file

@ -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;