diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/btree/bt_put.c | 4 | ||||
-rw-r--r-- | db/btree/bt_split.c | 3 | ||||
-rw-r--r-- | db/hash/hash.c | 7 | ||||
-rw-r--r-- | db/hash/hash_bigkey.c | 6 | ||||
-rw-r--r-- | db/mpool/mpool.c | 11 | ||||
-rw-r--r-- | db/recno/rec_close.c | 4 | ||||
-rw-r--r-- | db/recno/rec_put.c | 4 |
7 files changed, 21 insertions, 18 deletions
diff --git a/db/btree/bt_put.c b/db/btree/bt_put.c index 952be09..e624115 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 1646d82..d01db4a 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 1f26c7e..db6fd69 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 578314a..d2a7dfd 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 a61041e..9956aca 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 16fb0b4..977493f 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 1afae0d..5454c40 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; |