From 54d79e995d5a6d0a393ed913b6e26dccc63de5b7 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 15 Nov 1996 04:08:00 +0000 Subject: update from main archive 961114 --- db/btree/bt_put.c | 4 ++-- db/btree/bt_split.c | 3 ++- db/hash/hash.c | 7 ++++--- db/hash/hash_bigkey.c | 6 +++--- db/mpool/mpool.c | 11 ++++++----- db/recno/rec_close.c | 4 ++-- db/recno/rec_put.c | 4 ++-- 7 files changed, 21 insertions(+), 18 deletions(-) (limited to 'db') diff --git a/db/btree/bt_put.c b/db/btree/bt_put.c index 952be09e55..e6241152f3 100644 --- a/db/btree/bt_put.c +++ b/db/btree/bt_put.c @@ -201,7 +201,7 @@ delete: if (__bt_dleaf(t, key, h, index) == 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, index)) != RET_SUCCESS) return (status); @@ -284,7 +284,7 @@ bt_fast(t, key, data, 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/db/btree/bt_split.c b/db/btree/bt_split.c index 1646d82159..d01db4ad9d 100644 --- a/db/btree/bt_split.c +++ b/db/btree/bt_split.c @@ -215,7 +215,8 @@ __bt_split(t, sp, key, data, flags, ilen, argskip) } /* 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/db/hash/hash.c b/db/hash/hash.c index 1f26c7e68a..db6fd69a4b 100644 --- a/db/hash/hash.c +++ b/db/hash/hash.c @@ -157,7 +157,8 @@ __hash_open(file, flags, mode, info, dflags) 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)) + != (u_int32_t) hashp->H_CHARKEY) RETURN_ERROR(EFTYPE, error1); /* * Figure out how many segments we need. Max_Bucket is the @@ -744,7 +745,7 @@ hash_seq(dbp, key, data, flag) for (bp = NULL; !bp || !bp[0]; ) { if (!(bufp = hashp->cpage)) { for (bucket = hashp->cbucket; - bucket <= hashp->MAX_BUCKET; + bucket <= (u_int32_t) hashp->MAX_BUCKET; bucket++, hashp->cndx = 1) { bufp = __get_buf(hashp, bucket, NULL, 0); if (!bufp) @@ -848,7 +849,7 @@ __expand_table(hashp) hashp->OVFL_POINT = spare_ndx; } - if (new_bucket > hashp->HIGH_MASK) { + if (new_bucket > (u_int32_t) hashp->HIGH_MASK) { /* Starting a new doubling */ hashp->LOW_MASK = hashp->HIGH_MASK; hashp->HIGH_MASK = new_bucket | hashp->LOW_MASK; diff --git a/db/hash/hash_bigkey.c b/db/hash/hash_bigkey.c index 578314a645..d2a7dfd597 100644 --- a/db/hash/hash_bigkey.c +++ b/db/hash/hash_bigkey.c @@ -147,7 +147,7 @@ __big_insert(hashp, bufp, key, val) * Here's the hack to make sure that if the data ends on the * same page as the key ends, FREESPACE is at least one. */ - if (space == val_size && val_size == val->size) + if ((int) space == val_size && (size_t) val_size == val->size) move_bytes--; off = OFFSET(p) - move_bytes; memmove(cp + off, val_data, move_bytes); @@ -431,7 +431,7 @@ __big_return(hashp, bufp, ndx, val, set_current) } val->size = collect_data(hashp, bufp, (int)len, set_current); - if (val->size == -1) + if (val->size == (size_t) -1) return (-1); if (save_p->addr != save_addr) { /* We are pretty short on buffers. */ @@ -510,7 +510,7 @@ __big_keydata(hashp, bufp, key, val, set) int set; { key->size = collect_key(hashp, bufp, 0, val, set); - if (key->size == -1) + if (key->size == (size_t) -1) return (-1); key->data = (u_char *)hashp->tmp_key; return (0); diff --git a/db/mpool/mpool.c b/db/mpool/mpool.c index a61041e091..9956aca87b 100644 --- a/db/mpool/mpool.c +++ b/db/mpool/mpool.c @@ -109,7 +109,7 @@ mpool_filter(mp, pgin, pgout, pgcookie) mp->pgout = pgout; mp->pgcookie = pgcookie; } - + /* * mpool_new -- * Get a new page of memory. @@ -205,7 +205,8 @@ mpool_get(mp, pgno, flags) off = mp->pagesize * pgno; if (lseek(mp->fd, off, SEEK_SET) != off) return (NULL); - if ((nr = read(mp->fd, bp->page, mp->pagesize)) != mp->pagesize) { + if ((u_long) (nr = read(mp->fd, bp->page, mp->pagesize)) + != mp->pagesize) { if (nr >= 0) errno = EFTYPE; return (NULL); @@ -380,7 +381,7 @@ mpool_write(mp, bp) off = mp->pagesize * bp->pgno; if (lseek(mp->fd, off, SEEK_SET) != off) return (RET_ERROR); - if (write(mp->fd, bp->page, mp->pagesize) != mp->pagesize) + if ((u_long) write(mp->fd, bp->page, mp->pagesize) != mp->pagesize) return (RET_ERROR); bp->flags &= ~MPOOL_DIRTY; @@ -436,7 +437,7 @@ mpool_stat(mp) mp->pagealloc, mp->pageflush); if (mp->cachehit + mp->cachemiss) (void)fprintf(stderr, - "%.0f%% cache hit rate (%lu hits, %lu misses)\n", + "%.0f%% cache hit rate (%lu hits, %lu misses)\n", ((double)mp->cachehit / (mp->cachehit + mp->cachemiss)) * 100, mp->cachehit, mp->cachemiss); (void)fprintf(stderr, "%lu page reads, %lu page writes\n", @@ -456,7 +457,7 @@ mpool_stat(mp) cnt = 0; } else sep = ", "; - + } (void)fprintf(stderr, "\n"); } diff --git a/db/recno/rec_close.c b/db/recno/rec_close.c index 16fb0b4eca..977493fe5b 100644 --- a/db/recno/rec_close.c +++ b/db/recno/rec_close.c @@ -150,7 +150,7 @@ __rec_sync(dbp, flags) */ status = (dbp->seq)(dbp, &key, &data, R_FIRST); while (status == RET_SUCCESS) { - if (write(t->bt_rfd, data.data, data.size) != data.size) + if ((size_t) write(t->bt_rfd, data.data, data.size) != data.size) return (RET_ERROR); status = (dbp->seq)(dbp, &key, &data, R_NEXT); } @@ -162,7 +162,7 @@ __rec_sync(dbp, 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 ((size_t) writev(t->bt_rfd, iov, 2) != data.size + 1) return (RET_ERROR); status = (dbp->seq)(dbp, &key, &data, R_NEXT); } diff --git a/db/recno/rec_put.c b/db/recno/rec_put.c index 1afae0d5a6..5454c40e8d 100644 --- a/db/recno/rec_put.c +++ b/db/recno/rec_put.c @@ -170,7 +170,7 @@ einval: errno = EINVAL; if (flags == R_SETCURSOR) t->bt_cursor.rcursor = nrec; - + F_SET(t, R_MODIFIED); return (__rec_ret(t, NULL, nrec, key, NULL)); } @@ -256,7 +256,7 @@ __rec_iput(t, nrec, data, 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, index); if (status == RET_SUCCESS) ++t->bt_nrecs; -- cgit v1.2.3