This commit is contained in:
christos 1998-12-09 12:42:46 +00:00
parent 22c22ae31b
commit 61238e7179
21 changed files with 356 additions and 329 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: bt_conv.c,v 1.7 1997/07/13 18:51:49 christos Exp $ */
/* $NetBSD: bt_conv.c,v 1.8 1998/12/09 12:42:46 christos Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)bt_conv.c 8.5 (Berkeley) 8/17/94";
#else
__RCSID("$NetBSD: bt_conv.c,v 1.7 1997/07/13 18:51:49 christos Exp $");
__RCSID("$NetBSD: bt_conv.c,v 1.8 1998/12/09 12:42:46 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -94,7 +94,7 @@ __bt_pgin(t, pg, pp)
if ((h->flags & P_TYPE) == P_BINTERNAL)
for (i = 0; i < top; i++) {
M_16_SWAP(h->linp[i]);
p = (char *)GETBINTERNAL(h, i);
p = (char *)(void *)GETBINTERNAL(h, i);
P_32_SWAP(p);
p += sizeof(u_int32_t);
P_32_SWAP(p);
@ -109,7 +109,7 @@ __bt_pgin(t, pg, pp)
else if ((h->flags & P_TYPE) == P_BLEAF)
for (i = 0; i < top; i++) {
M_16_SWAP(h->linp[i]);
p = (char *)GETBLEAF(h, i);
p = (char *)(void *)GETBLEAF(h, i);
P_32_SWAP(p);
p += sizeof(u_int32_t);
P_32_SWAP(p);
@ -154,7 +154,7 @@ __bt_pgout(t, pg, pp)
top = NEXTINDEX(h);
if ((h->flags & P_TYPE) == P_BINTERNAL)
for (i = 0; i < top; i++) {
p = (char *)GETBINTERNAL(h, i);
p = (char *)(void *)GETBINTERNAL(h, i);
P_32_SWAP(p);
p += sizeof(u_int32_t);
P_32_SWAP(p);
@ -169,7 +169,7 @@ __bt_pgout(t, pg, pp)
}
else if ((h->flags & P_TYPE) == P_BLEAF)
for (i = 0; i < top; i++) {
p = (char *)GETBLEAF(h, i);
p = (char *)(void *)GETBLEAF(h, i);
P_32_SWAP(p);
p += sizeof(u_int32_t);
P_32_SWAP(p);
@ -212,7 +212,7 @@ mswap(pg)
{
char *p;
p = (char *)pg;
p = (char *)(void *)pg;
P_32_SWAP(p); /* magic */
p += sizeof(u_int32_t);
P_32_SWAP(p); /* version */

View File

@ -1,4 +1,4 @@
/* $NetBSD: bt_delete.c,v 1.9 1997/07/21 14:06:31 jtc Exp $ */
/* $NetBSD: bt_delete.c,v 1.10 1998/12/09 12:42:46 christos Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)bt_delete.c 8.13 (Berkeley) 7/28/94";
#else
__RCSID("$NetBSD: bt_delete.c,v 1.9 1997/07/21 14:06:31 jtc Exp $");
__RCSID("$NetBSD: bt_delete.c,v 1.10 1998/12/09 12:42:46 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -116,14 +116,15 @@ __bt_delete(dbp, key, flags)
if (__bt_stkacq(t, &h, &t->bt_cursor))
return (RET_ERROR);
status = __bt_dleaf(t, NULL, h, c->pg.index);
status = __bt_dleaf(t, NULL, h, (u_int)c->pg.index);
if (NEXTINDEX(h) == 0 && status == RET_SUCCESS) {
if (__bt_pdelete(t, h))
return (RET_ERROR);
} else
mpool_put(t->bt_mp,
h, status == RET_SUCCESS ? MPOOL_DIRTY : 0);
mpool_put(t->bt_mp, h,
(u_int)(status == RET_SUCCESS ?
MPOOL_DIRTY : 0));
break;
}
/* FALLTHROUGH */
@ -158,7 +159,7 @@ __bt_stkacq(t, hp, c)
EPG *e;
EPGNO *parent;
PAGE *h;
indx_t index = 0; /* Pacify gcc */
indx_t idx = 0; /* Pacify gcc */
pgno_t pgno;
recno_t nextpg, prevpg;
int exact, level;
@ -196,8 +197,8 @@ __bt_stkacq(t, hp, c)
/* Move to the next index. */
if (parent->index != NEXTINDEX(h) - 1) {
index = parent->index + 1;
BT_PUSH(t, h->pgno, index);
idx = parent->index + 1;
BT_PUSH(t, h->pgno, idx);
break;
}
mpool_put(t->bt_mp, h, 0);
@ -206,7 +207,7 @@ __bt_stkacq(t, hp, c)
/* Restore the stack. */
while (level--) {
/* Push the next level down onto the stack. */
bi = GETBINTERNAL(h, index);
bi = GETBINTERNAL(h, idx);
pgno = bi->pgno;
BT_PUSH(t, pgno, 0);
@ -216,7 +217,7 @@ __bt_stkacq(t, hp, c)
/* Get the next level down. */
if ((h = mpool_get(t->bt_mp, pgno, 0)) == NULL)
return (1);
index = 0;
idx = 0;
}
mpool_put(t->bt_mp, h, 0);
if ((h = mpool_get(t->bt_mp, nextpg, 0)) == NULL)
@ -251,8 +252,8 @@ __bt_stkacq(t, hp, c)
/* Move to the next index. */
if (parent->index != 0) {
index = parent->index - 1;
BT_PUSH(t, h->pgno, index);
idx = parent->index - 1;
BT_PUSH(t, h->pgno, idx);
break;
}
mpool_put(t->bt_mp, h, 0);
@ -261,7 +262,7 @@ __bt_stkacq(t, hp, c)
/* Restore the stack. */
while (level--) {
/* Push the next level down onto the stack. */
bi = GETBINTERNAL(h, index);
bi = GETBINTERNAL(h, idx);
pgno = bi->pgno;
/* Lose the currently pinned page. */
@ -271,8 +272,8 @@ __bt_stkacq(t, hp, c)
if ((h = mpool_get(t->bt_mp, pgno, 0)) == NULL)
return (1);
index = NEXTINDEX(h) - 1;
BT_PUSH(t, pgno, index);
idx = NEXTINDEX(h) - 1;
BT_PUSH(t, pgno, idx);
}
mpool_put(t->bt_mp, h, 0);
if ((h = mpool_get(t->bt_mp, prevpg, 0)) == NULL)
@ -322,7 +323,7 @@ loop: if ((e = __bt_search(t, key, &exact)) == NULL)
redo = 0;
h = e->page;
do {
if (__bt_dleaf(t, key, h, e->index)) {
if (__bt_dleaf(t, key, h, (u_int)e->index)) {
mpool_put(t->bt_mp, h, 0);
return (RET_ERROR);
}
@ -345,7 +346,7 @@ loop: if ((e = __bt_search(t, key, &exact)) == NULL)
while (e->index-- > 0) {
if (__bt_cmp(t, key, e) != 0)
break;
if (__bt_dleaf(t, key, h, e->index) == RET_ERROR) {
if (__bt_dleaf(t, key, h, (u_int)e->index) == RET_ERROR) {
mpool_put(t->bt_mp, h, 0);
return (RET_ERROR);
}
@ -390,7 +391,7 @@ __bt_pdelete(t, h)
BINTERNAL *bi;
PAGE *pg;
EPGNO *parent;
indx_t cnt, index, *ip, offset;
indx_t cnt, idx, *ip, offset;
u_int32_t nksize;
char *from;
@ -411,8 +412,8 @@ __bt_pdelete(t, h)
if ((pg = mpool_get(t->bt_mp, parent->pgno, 0)) == NULL)
return (RET_ERROR);
index = parent->index;
bi = GETBINTERNAL(pg, index);
idx = parent->index;
bi = GETBINTERNAL(pg, idx);
/* Free any overflow pages. */
if (bi->flags & P_BIGKEY &&
@ -439,16 +440,17 @@ __bt_pdelete(t, h)
else {
/* Pack remaining key items at the end of the page. */
nksize = NBINTERNAL(bi->ksize);
from = (char *)pg + pg->upper;
memmove(from + nksize, from, (char *)bi - from);
from = (char *)(void *)pg + pg->upper;
memmove(from + nksize, from,
(size_t)((char *)(void *)bi - from));
pg->upper += nksize;
/* Adjust indices' offsets, shift the indices down. */
offset = pg->linp[index];
for (cnt = index, ip = &pg->linp[0]; cnt--; ++ip)
offset = pg->linp[idx];
for (cnt = idx, ip = &pg->linp[0]; cnt--; ++ip)
if (ip[0] < offset)
ip[0] += nksize;
for (cnt = NEXTINDEX(pg) - index; --cnt; ++ip)
for (cnt = NEXTINDEX(pg) - idx; --cnt; ++ip)
ip[0] = ip[1] < offset ? ip[1] + nksize : ip[1];
pg->lower -= sizeof(indx_t);
}
@ -473,17 +475,17 @@ __bt_pdelete(t, h)
* t: tree
* key: referenced key
* h: page
* index: index on page to delete
* idx: index on page to delete
*
* Returns:
* RET_SUCCESS, RET_ERROR.
*/
int
__bt_dleaf(t, key, h, index)
__bt_dleaf(t, key, h, idx)
BTREE *t;
const DBT *key;
PAGE *h;
u_int index;
u_int idx;
{
BLEAF *bl;
indx_t cnt, *ip, offset;
@ -494,12 +496,12 @@ __bt_dleaf(t, key, h, index)
/* If this record is referenced by the cursor, delete the cursor. */
if (F_ISSET(&t->bt_cursor, CURS_INIT) &&
!F_ISSET(&t->bt_cursor, CURS_ACQUIRE) &&
t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index == index &&
__bt_curdel(t, key, h, index))
t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index == idx &&
__bt_curdel(t, key, h, idx))
return (RET_ERROR);
/* If the entry uses overflow pages, make them available for reuse. */
to = bl = GETBLEAF(h, index);
to = bl = GETBLEAF(h, idx);
if (bl->flags & P_BIGKEY && __ovfl_delete(t, bl->bytes) == RET_ERROR)
return (RET_ERROR);
if (bl->flags & P_BIGDATA &&
@ -508,23 +510,23 @@ __bt_dleaf(t, key, h, index)
/* Pack the remaining key/data items at the end of the page. */
nbytes = NBLEAF(bl);
from = (char *)h + h->upper;
memmove(from + nbytes, from, (char *)to - from);
from = (char *)(void *)h + h->upper;
memmove(from + nbytes, from, (size_t)((char *)(void *)to - from));
h->upper += nbytes;
/* Adjust the indices' offsets, shift the indices down. */
offset = h->linp[index];
for (cnt = index, ip = &h->linp[0]; cnt--; ++ip)
offset = h->linp[idx];
for (cnt = idx, ip = &h->linp[0]; cnt--; ++ip)
if (ip[0] < offset)
ip[0] += nbytes;
for (cnt = NEXTINDEX(h) - index; --cnt; ++ip)
for (cnt = NEXTINDEX(h) - idx; --cnt; ++ip)
ip[0] = ip[1] < offset ? ip[1] + nbytes : ip[1];
h->lower -= sizeof(indx_t);
/* If the cursor is on this page, adjust it as necessary. */
if (F_ISSET(&t->bt_cursor, CURS_INIT) &&
!F_ISSET(&t->bt_cursor, CURS_ACQUIRE) &&
t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index > index)
t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index > idx)
--t->bt_cursor.pg.index;
return (RET_SUCCESS);
@ -538,17 +540,17 @@ __bt_dleaf(t, key, h, index)
* t: tree
* key: referenced key (or NULL)
* h: page
* index: index on page to delete
* idx: index on page to delete
*
* Returns:
* RET_SUCCESS, RET_ERROR.
*/
static int
__bt_curdel(t, key, h, index)
__bt_curdel(t, key, h, idx)
BTREE *t;
const DBT *key;
PAGE *h;
u_int index;
u_int idx;
{
CURSOR *c;
EPG e;
@ -571,7 +573,7 @@ __bt_curdel(t, key, h, index)
*/
if (key == NULL) {
e.page = h;
e.index = index;
e.index = idx;
if ((status = __bt_ret(t, &e,
&c->key, &c->key, NULL, NULL, 1)) != RET_SUCCESS)
return (status);
@ -579,25 +581,25 @@ __bt_curdel(t, key, h, index)
key = &c->key;
}
/* Check previous key, if not at the beginning of the page. */
if (index > 0) {
if (idx > 0) {
e.page = h;
e.index = index - 1;
e.index = idx - 1;
if (__bt_cmp(t, key, &e) == 0) {
F_SET(c, CURS_BEFORE);
goto dup2;
}
}
/* Check next key, if not at the end of the page. */
if (index < NEXTINDEX(h) - 1) {
if (idx < NEXTINDEX(h) - 1) {
e.page = h;
e.index = index + 1;
e.index = idx + 1;
if (__bt_cmp(t, key, &e) == 0) {
F_SET(c, CURS_AFTER);
goto dup2;
}
}
/* Check previous key if at the beginning of the page. */
if (index == 0 && h->prevpg != P_INVALID) {
if (idx == 0 && h->prevpg != P_INVALID) {
if ((pg = mpool_get(t->bt_mp, h->prevpg, 0)) == NULL)
return (RET_ERROR);
e.page = pg;
@ -609,7 +611,7 @@ __bt_curdel(t, key, h, index)
mpool_put(t->bt_mp, pg, 0);
}
/* Check next key if at the end of the page. */
if (index == NEXTINDEX(h) - 1 && h->nextpg != P_INVALID) {
if (idx == NEXTINDEX(h) - 1 && h->nextpg != P_INVALID) {
if ((pg = mpool_get(t->bt_mp, h->nextpg, 0)) == NULL)
return (RET_ERROR);
e.page = pg;
@ -625,7 +627,7 @@ dup2: c->pg.pgno = e.page->pgno;
}
}
e.page = h;
e.index = index;
e.index = idx;
if (curcopy || (status =
__bt_ret(t, &e, &c->key, &c->key, NULL, NULL, 1)) == RET_SUCCESS) {
F_SET(c, CURS_ACQUIRE);

View File

@ -1,4 +1,4 @@
/* $NetBSD: bt_open.c,v 1.12 1998/05/07 19:24:20 kleink Exp $ */
/* $NetBSD: bt_open.c,v 1.13 1998/12/09 12:42:46 christos Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)bt_open.c 8.10 (Berkeley) 8/17/94";
#else
__RCSID("$NetBSD: bt_open.c,v 1.12 1998/05/07 19:24:20 kleink Exp $");
__RCSID("$NetBSD: bt_open.c,v 1.13 1998/12/09 12:42:46 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -421,7 +421,7 @@ byteorder()
u_char *p;
x = 0x01020304;
p = (u_char *)&x;
p = (u_char *)(void *)&x;
switch (*p) {
case 1:
return (BIG_ENDIAN);

View File

@ -1,4 +1,4 @@
/* $NetBSD: bt_overflow.c,v 1.8 1997/07/21 14:06:33 jtc Exp $ */
/* $NetBSD: bt_overflow.c,v 1.9 1998/12/09 12:42:46 christos Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)bt_overflow.c 8.5 (Berkeley) 7/16/94";
#else
__RCSID("$NetBSD: bt_overflow.c,v 1.8 1997/07/21 14:06:33 jtc Exp $");
__RCSID("$NetBSD: bt_overflow.c,v 1.9 1998/12/09 12:42:46 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -123,7 +123,7 @@ __ovfl_get(t, p, ssz, buf, bufsz)
return (RET_ERROR);
nb = MIN(sz, plen);
memmove(p, (char *)h + BTDATAOFF, nb);
memmove(p, (char *)(void *)h + BTDATAOFF, nb);
mpool_put(t->bt_mp, h, 0);
if ((sz -= nb) == 0)
@ -171,7 +171,7 @@ __ovfl_put(t, dbt, pg)
h->lower = h->upper = 0;
nb = MIN(sz, plen);
memmove((char *)h + BTDATAOFF, p, nb);
memmove((char *)(void *)h + BTDATAOFF, p, nb);
if (last) {
last->nextpg = h->pgno;

View File

@ -1,4 +1,4 @@
/* $NetBSD: bt_put.c,v 1.11 1998/08/18 23:50:08 thorpej Exp $ */
/* $NetBSD: bt_put.c,v 1.12 1998/12/09 12:42:47 christos Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)bt_put.c 8.8 (Berkeley) 7/26/94";
#else
__RCSID("$NetBSD: bt_put.c,v 1.11 1998/08/18 23:50:08 thorpej Exp $");
__RCSID("$NetBSD: bt_put.c,v 1.12 1998/12/09 12:42:47 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -82,7 +82,7 @@ __bt_put(dbp, key, data, flags)
DBT tkey, tdata;
EPG *e = NULL; /* pacify gcc */
PAGE *h;
indx_t index, nxtindex;
indx_t idx, nxtindex;
pgno_t pg;
u_int32_t nbytes;
int dflags, exact, status;
@ -161,7 +161,7 @@ storekey: if (__ovfl_put(t, key, &pg) == RET_ERROR)
if (flags == R_CURSOR) {
if ((h = mpool_get(t->bt_mp, t->bt_cursor.pg.pgno, 0)) == NULL)
return (RET_ERROR);
index = t->bt_cursor.pg.index;
idx = t->bt_cursor.pg.index;
goto delete;
}
@ -173,7 +173,7 @@ storekey: if (__ovfl_put(t, key, &pg) == RET_ERROR)
if ((e = __bt_search(t, key, &exact)) == NULL)
return (RET_ERROR);
h = e->page;
index = e->index;
idx = e->index;
/*
* Add the key/data pair to the tree. If an identical key is already
@ -195,7 +195,7 @@ storekey: if (__ovfl_put(t, key, &pg) == RET_ERROR)
* Note, the delete may empty the page, so we need to put a
* new entry into the page immediately.
*/
delete: if (__bt_dleaf(t, key, h, index) == RET_ERROR) {
delete: if (__bt_dleaf(t, key, h, (u_int)idx) == RET_ERROR) {
mpool_put(t->bt_mp, h, 0);
return (RET_ERROR);
}
@ -211,35 +211,35 @@ delete: if (__bt_dleaf(t, key, h, index) == RET_ERROR) {
nbytes = NBLEAFDBT(key->size, data->size);
if (h->upper - h->lower < nbytes + sizeof(indx_t)) {
if ((status = __bt_split(t, h, key,
data, dflags, nbytes, index)) != RET_SUCCESS)
data, dflags, nbytes, (u_int)idx)) != RET_SUCCESS)
return (status);
goto success;
}
if (index < (nxtindex = NEXTINDEX(h)))
memmove(h->linp + index + 1, h->linp + index,
(nxtindex - index) * sizeof(indx_t));
if (idx < (nxtindex = NEXTINDEX(h)))
memmove(h->linp + idx + 1, h->linp + idx,
(nxtindex - idx) * sizeof(indx_t));
h->lower += sizeof(indx_t);
h->linp[index] = h->upper -= nbytes;
dest = (char *)h + h->upper;
h->linp[idx] = h->upper -= nbytes;
dest = (char *)(void *)h + h->upper;
WR_BLEAF(dest, key, data, dflags);
/* If the cursor is on this page, adjust it as necessary. */
if (F_ISSET(&t->bt_cursor, CURS_INIT) &&
!F_ISSET(&t->bt_cursor, CURS_ACQUIRE) &&
t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index >= index)
t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index >= idx)
++t->bt_cursor.pg.index;
if (t->bt_order == NOT) {
if (h->nextpg == P_INVALID) {
if (index == NEXTINDEX(h) - 1) {
if (idx == NEXTINDEX(h) - 1) {
t->bt_order = FORWARD;
t->bt_last.index = index;
t->bt_last.index = idx;
t->bt_last.pgno = h->pgno;
}
} else if (h->prevpg == P_INVALID) {
if (index == 0) {
if (idx == 0) {
t->bt_order = BACK;
t->bt_last.index = 0;
t->bt_last.pgno = h->pgno;
@ -251,7 +251,7 @@ delete: if (__bt_dleaf(t, key, h, index) == RET_ERROR) {
success:
if (flags == R_SETCURSOR)
__bt_setcur(t, e->page->pgno, e->index);
__bt_setcur(t, e->page->pgno, (u_int)e->index);
F_SET(t, B_MODIFIED);
return (RET_SUCCESS);

View File

@ -1,4 +1,4 @@
/* $NetBSD: bt_search.c,v 1.10 1997/07/21 14:06:36 jtc Exp $ */
/* $NetBSD: bt_search.c,v 1.11 1998/12/09 12:42:47 christos Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)bt_search.c 8.8 (Berkeley) 7/31/94";
#else
__RCSID("$NetBSD: bt_search.c,v 1.10 1997/07/21 14:06:36 jtc Exp $");
__RCSID("$NetBSD: bt_search.c,v 1.11 1998/12/09 12:42:47 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -89,7 +89,7 @@ __bt_search(t, key, exactp)
/* Do a binary search on the current page. */
t->bt_cur.page = h;
for (base = 0, lim = NEXTINDEX(h); lim; lim >>= 1) {
t->bt_cur.index = index = base + (lim >> 1);
t->bt_cur.index = index = base + ((u_int32_t)lim >> 1);
if ((cmp = __bt_cmp(t, key, &t->bt_cur)) == 0) {
if (h->flags & P_BLEAF) {
*exactp = 1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: bt_seq.c,v 1.10 1997/07/21 14:06:37 jtc Exp $ */
/* $NetBSD: bt_seq.c,v 1.11 1998/12/09 12:42:47 christos Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)bt_seq.c 8.7 (Berkeley) 7/20/94";
#else
__RCSID("$NetBSD: bt_seq.c,v 1.10 1997/07/21 14:06:37 jtc Exp $");
__RCSID("$NetBSD: bt_seq.c,v 1.11 1998/12/09 12:42:47 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -108,14 +108,14 @@ __bt_seq(dbp, key, data, flags)
case R_NEXT:
case R_PREV:
if (F_ISSET(&t->bt_cursor, CURS_INIT)) {
status = __bt_seqadv(t, &e, flags);
status = __bt_seqadv(t, &e, (int)flags);
break;
}
/* FALLTHROUGH */
case R_FIRST:
case R_LAST:
case R_CURSOR:
status = __bt_seqset(t, &e, key, flags);
status = __bt_seqset(t, &e, key, (int)flags);
break;
default:
errno = EINVAL;
@ -123,7 +123,7 @@ __bt_seq(dbp, key, data, flags)
}
if (status == RET_SUCCESS) {
__bt_setcur(t, e.page->pgno, e.index);
__bt_setcur(t, e.page->pgno, (u_int)e.index);
status =
__bt_ret(t, &e, key, &t->bt_rkey, data, &t->bt_rdata, 0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: bt_split.c,v 1.9 1997/10/10 21:08:55 is Exp $ */
/* $NetBSD: bt_split.c,v 1.10 1998/12/09 12:42:47 christos Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)bt_split.c 8.9 (Berkeley) 7/26/94";
#else
__RCSID("$NetBSD: bt_split.c,v 1.9 1997/10/10 21:08:55 is Exp $");
__RCSID("$NetBSD: bt_split.c,v 1.10 1998/12/09 12:42:47 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -124,7 +124,7 @@ __bt_split(t, sp, key, data, flags, ilen, argskip)
* always cause a leaf page to split first.)
*/
h->linp[skip] = h->upper -= ilen;
dest = (char *)h + h->upper;
dest = (char *)(void *)h + h->upper;
if (F_ISSET(t, R_RECNO))
WR_RLEAF(dest, data, flags)
else
@ -243,18 +243,19 @@ __bt_split(t, sp, key, data, flags, ilen, argskip)
switch (rchild->flags & P_TYPE) {
case P_BINTERNAL:
h->linp[skip] = h->upper -= nbytes;
dest = (char *)h + h->linp[skip];
dest = (char *)(void *)h + h->linp[skip];
memmove(dest, bi, nbytes);
((BINTERNAL *)dest)->pgno = rchild->pgno;
((BINTERNAL *)(void *)dest)->pgno = rchild->pgno;
break;
case P_BLEAF:
h->linp[skip] = h->upper -= nbytes;
dest = (char *)h + h->linp[skip];
dest = (char *)(void *)h + h->linp[skip];
WR_BINTERNAL(dest, nksize ? nksize : bl->ksize,
rchild->pgno, bl->flags & P_BIGKEY);
memmove(dest, bl->bytes, nksize ? nksize : bl->ksize);
if (bl->flags & P_BIGKEY &&
bt_preserve(t, *(pgno_t *)bl->bytes) == RET_ERROR)
bt_preserve(t, *(pgno_t *)(void *)bl->bytes) ==
RET_ERROR)
goto err1;
break;
case P_RINTERNAL:
@ -263,17 +264,17 @@ __bt_split(t, sp, key, data, flags, ilen, argskip)
* added at index 0, fix the correct page.
*/
if (skip > 0)
dest = (char *)h + h->linp[skip - 1];
dest = (char *)(void *)h + h->linp[skip - 1];
else
dest = (char *)l + l->linp[NEXTINDEX(l) - 1];
((RINTERNAL *)dest)->nrecs = rec_total(lchild);
((RINTERNAL *)dest)->pgno = lchild->pgno;
dest = (char *)(void *)l + l->linp[NEXTINDEX(l) - 1];
((RINTERNAL *)(void *)dest)->nrecs = rec_total(lchild);
((RINTERNAL *)(void *)dest)->pgno = lchild->pgno;
/* Update the right page count. */
h->linp[skip] = h->upper -= nbytes;
dest = (char *)h + h->linp[skip];
((RINTERNAL *)dest)->nrecs = rec_total(rchild);
((RINTERNAL *)dest)->pgno = rchild->pgno;
dest = (char *)(void *)h + h->linp[skip];
((RINTERNAL *)(void *)dest)->nrecs = rec_total(rchild);
((RINTERNAL *)(void *)dest)->pgno = rchild->pgno;
break;
case P_RLEAF:
/*
@ -281,17 +282,17 @@ __bt_split(t, sp, key, data, flags, ilen, argskip)
* added at index 0, fix the correct page.
*/
if (skip > 0)
dest = (char *)h + h->linp[skip - 1];
dest = (char *)(void *)h + h->linp[skip - 1];
else
dest = (char *)l + l->linp[NEXTINDEX(l) - 1];
((RINTERNAL *)dest)->nrecs = NEXTINDEX(lchild);
((RINTERNAL *)dest)->pgno = lchild->pgno;
dest = (char *)(void *)l + l->linp[NEXTINDEX(l) - 1];
((RINTERNAL *)(void *)dest)->nrecs = NEXTINDEX(lchild);
((RINTERNAL *)(void *)dest)->pgno = lchild->pgno;
/* Update the right page count. */
h->linp[skip] = h->upper -= nbytes;
dest = (char *)h + h->linp[skip];
((RINTERNAL *)dest)->nrecs = NEXTINDEX(rchild);
((RINTERNAL *)dest)->pgno = rchild->pgno;
dest = (char *)(void *)h + h->linp[skip];
((RINTERNAL *)(void *)dest)->nrecs = NEXTINDEX(rchild);
((RINTERNAL *)(void *)dest)->pgno = rchild->pgno;
break;
default:
abort();
@ -509,12 +510,12 @@ bt_rroot(t, h, l, r)
/* Insert the left and right keys, set the header information. */
h->linp[0] = h->upper = t->bt_psize - NRINTERNAL;
dest = (char *)h + h->upper;
dest = (char *)(void *)h + h->upper;
WR_RINTERNAL(dest,
l->flags & P_RLEAF ? NEXTINDEX(l) : rec_total(l), l->pgno);
h->linp[1] = h->upper -= NRINTERNAL;
dest = (char *)h + h->upper;
dest = (char *)(void *)h + h->upper;
WR_RINTERNAL(dest,
r->flags & P_RLEAF ? NEXTINDEX(r) : rec_total(r), r->pgno);
@ -560,7 +561,7 @@ bt_broot(t, h, l, r)
*/
nbytes = NBINTERNAL(0);
h->linp[0] = h->upper = t->bt_psize - nbytes;
dest = (char *)h + h->upper;
dest = (char *)(void *)h + h->upper;
WR_BINTERNAL(dest, 0, l->pgno, 0);
switch (h->flags & P_TYPE) {
@ -568,7 +569,7 @@ bt_broot(t, h, l, r)
bl = GETBLEAF(r, 0);
nbytes = NBINTERNAL(bl->ksize);
h->linp[1] = h->upper -= nbytes;
dest = (char *)h + h->upper;
dest = (char *)(void *)h + h->upper;
WR_BINTERNAL(dest, bl->ksize, r->pgno, 0);
memmove(dest, bl->bytes, bl->ksize);
@ -577,16 +578,16 @@ bt_broot(t, h, l, r)
* so it isn't deleted when the leaf copy of the key is deleted.
*/
if (bl->flags & P_BIGKEY &&
bt_preserve(t, *(pgno_t *)bl->bytes) == RET_ERROR)
bt_preserve(t, *(pgno_t *)(void *)bl->bytes) == RET_ERROR)
return (RET_ERROR);
break;
case P_BINTERNAL:
bi = GETBINTERNAL(r, 0);
nbytes = NBINTERNAL(bi->ksize);
h->linp[1] = h->upper -= nbytes;
dest = (char *)h + h->upper;
dest = (char *)(void *)h + h->upper;
memmove(dest, bi, nbytes);
((BINTERNAL *)dest)->pgno = r->pgno;
((BINTERNAL *)(void *)dest)->pgno = r->pgno;
break;
default:
abort();
@ -692,7 +693,7 @@ bt_psplit(t, h, l, r, pskip, ilen)
++nxt;
l->linp[off] = l->upper -= nbytes;
memmove((char *)l + l->upper, src, nbytes);
memmove((char *)(void *)l + l->upper, src, nbytes);
}
used += nbytes + sizeof(indx_t);
@ -769,7 +770,7 @@ bt_psplit(t, h, l, r, pskip, ilen)
}
++nxt;
r->linp[off] = r->upper -= nbytes;
memmove((char *)r + r->upper, src, nbytes);
memmove((char *)(void *)r + r->upper, src, nbytes);
}
r->lower += off * sizeof(indx_t);

View File

@ -1,4 +1,4 @@
/* $NetBSD: btree.h,v 1.10 1998/11/06 19:42:43 christos Exp $ */
/* $NetBSD: btree.h,v 1.11 1998/12/09 12:42:47 christos Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@ -130,7 +130,7 @@ typedef struct _binternal {
/* Get the page's BINTERNAL structure at index indx. */
#define GETBINTERNAL(pg, indx) \
((BINTERNAL *)((char *)(pg) + (pg)->linp[indx]))
((BINTERNAL *)(void *)((char *)(void *)(pg) + (pg)->linp[indx]))
/* Get the number of bytes in the entry. */
#define NBINTERNAL(len) \
@ -138,11 +138,11 @@ typedef struct _binternal {
/* Copy a BINTERNAL entry to the page. */
#define WR_BINTERNAL(p, size, pgno, flags) { \
*(u_int32_t *)p = size; \
*(u_int32_t *)(void *)p = size; \
p += sizeof(u_int32_t); \
*(pgno_t *)p = pgno; \
*(pgno_t *)(void *)p = pgno; \
p += sizeof(pgno_t); \
*(u_char *)p = flags; \
*(u_char *)(void *)p = flags; \
p += sizeof(u_char); \
}
@ -157,7 +157,7 @@ typedef struct _rinternal {
/* Get the page's RINTERNAL structure at index indx. */
#define GETRINTERNAL(pg, indx) \
((RINTERNAL *)((char *)(pg) + (pg)->linp[indx]))
((RINTERNAL *)(void *)((char *)(void *)(pg) + (pg)->linp[indx]))
/* Get the number of bytes in the entry. */
#define NRINTERNAL \
@ -165,9 +165,9 @@ typedef struct _rinternal {
/* Copy a RINTERAL entry to the page. */
#define WR_RINTERNAL(p, nrecs, pgno) { \
*(recno_t *)p = nrecs; \
*(recno_t *)(void *)p = nrecs; \
p += sizeof(recno_t); \
*(pgno_t *)p = pgno; \
*(pgno_t *)(void *)p = pgno; \
}
/* For the btree leaf pages, the item is a key and data pair. */
@ -180,7 +180,7 @@ typedef struct _bleaf {
/* Get the page's BLEAF structure at index indx. */
#define GETBLEAF(pg, indx) \
((BLEAF *)((char *)(pg) + (pg)->linp[indx]))
((BLEAF *)(void *)((char *)(void *)(pg) + (pg)->linp[indx]))
/* Get the number of bytes in the entry. */
#define NBLEAF(p) NBLEAFDBT((p)->ksize, (p)->dsize)
@ -192,11 +192,11 @@ typedef struct _bleaf {
/* Copy a BLEAF entry to the page. */
#define WR_BLEAF(p, key, data, flags) { \
*(u_int32_t *)p = key->size; \
*(u_int32_t *)(void *)p = key->size; \
p += sizeof(u_int32_t); \
*(u_int32_t *)p = data->size; \
*(u_int32_t *)(void *)p = data->size; \
p += sizeof(u_int32_t); \
*(u_char *)p = flags; \
*(u_char *)(void *)p = flags; \
p += sizeof(u_char); \
memmove(p, key->data, key->size); \
p += key->size; \
@ -212,7 +212,7 @@ typedef struct _rleaf {
/* Get the page's RLEAF structure at index indx. */
#define GETRLEAF(pg, indx) \
((RLEAF *)((char *)(pg) + (pg)->linp[indx]))
((RLEAF *)(void *)((char *)(void *)(pg) + (pg)->linp[indx]))
/* Get the number of bytes in the entry. */
#define NRLEAF(p) NRLEAFDBT((p)->dsize)
@ -223,9 +223,9 @@ typedef struct _rleaf {
/* Copy a RLEAF entry to the page. */
#define WR_RLEAF(p, data, flags) { \
*(u_int32_t *)p = data->size; \
*(u_int32_t *)(void *)p = data->size; \
p += sizeof(u_int32_t); \
*(u_char *)p = flags; \
*(u_char *)(void *)p = flags; \
p += sizeof(u_char); \
memmove(p, data->data, data->size); \
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: db.c,v 1.10 1998/05/07 19:24:21 kleink Exp $ */
/* $NetBSD: db.c,v 1.11 1998/12/09 12:42:48 christos Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)db.c 8.4 (Berkeley) 2/21/94";
#else
__RCSID("$NetBSD: db.c,v 1.10 1998/05/07 19:24:21 kleink Exp $");
__RCSID("$NetBSD: db.c,v 1.11 1998/12/09 12:42:48 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -75,13 +75,13 @@ dbopen(fname, flags, mode, type, openinfo)
switch (type) {
case DB_BTREE:
return (__bt_open(fname, flags & USE_OPEN_FLAGS,
mode, openinfo, flags & DB_FLAGS));
mode, openinfo, (int)(flags & DB_FLAGS)));
case DB_HASH:
return (__hash_open(fname, flags & USE_OPEN_FLAGS,
mode, openinfo, flags & DB_FLAGS));
mode, openinfo, (int)(flags & DB_FLAGS)));
case DB_RECNO:
return (__rec_open(fname, flags & USE_OPEN_FLAGS,
mode, openinfo, flags & DB_FLAGS));
mode, openinfo, (int)(flags & DB_FLAGS)));
}
errno = EINVAL;
return (NULL);

View File

@ -1,4 +1,4 @@
/* $NetBSD: extern.h,v 1.5 1996/05/03 21:43:45 cgd Exp $ */
/* $NetBSD: extern.h,v 1.6 1998/12/09 12:42:48 christos Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@ -44,7 +44,7 @@ int __big_return __P((HTAB *, BUFHEAD *, int, DBT *, int));
int __big_split __P((HTAB *, BUFHEAD *, BUFHEAD *, BUFHEAD *,
int, u_int32_t, SPLIT_RETURN *));
int __buf_free __P((HTAB *, int, int));
void __buf_init __P((HTAB *, int));
void __buf_init __P((HTAB *, u_int));
u_int32_t __call_hash __P((HTAB *, char *, int));
int __delpair __P((HTAB *, BUFHEAD *, int));
int __expand_table __P((HTAB *));

View File

@ -1,4 +1,4 @@
/* $NetBSD: hash.c,v 1.14 1998/10/14 12:09:14 kleink Exp $ */
/* $NetBSD: hash.c,v 1.15 1998/12/09 12:42:48 christos Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)hash.c 8.9 (Berkeley) 6/16/94";
#else
__RCSID("$NetBSD: hash.c,v 1.14 1998/10/14 12:09:14 kleink Exp $");
__RCSID("$NetBSD: hash.c,v 1.15 1998/12/09 12:42:48 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -76,8 +76,8 @@ static void *hash_realloc __P((SEGMENT **, int, int));
static int hash_seq __P((const DB *, DBT *, DBT *, u_int32_t));
static int hash_sync __P((const DB *, u_int32_t));
static int hdestroy __P((HTAB *));
static HTAB *init_hash __P((HTAB *, const char *, HASHINFO *));
static int init_htab __P((HTAB *, int));
static HTAB *init_hash __P((HTAB *, const char *, const HASHINFO *));
static int init_htab __P((HTAB *, size_t));
#if BYTE_ORDER == LITTLE_ENDIAN
static void swap_header __P((HTAB *));
static void swap_header_copy __P((HASHHDR *, HASHHDR *));
@ -100,6 +100,7 @@ int hash_accesses, hash_collisions, hash_expansions, hash_overflows;
/************************** INTERFACE ROUTINES ***************************/
/* OPEN/CLOSE */
/* ARGSUSED */
extern DB *
__hash_open(file, flags, mode, info, dflags)
const char *file;
@ -143,7 +144,7 @@ __hash_open(file, flags, mode, info, dflags)
(void)fcntl(hashp->fp, F_SETFD, 1);
}
if (new_table) {
if (!(hashp = init_hash(hashp, file, (HASHINFO *)info)))
if (!(hashp = init_hash(hashp, file, info)))
RETURN_ERROR(errno, error1);
} else {
/* Table already exists */
@ -185,7 +186,7 @@ __hash_open(file, flags, mode, info, dflags)
return (NULL);
/* Read in bitmaps */
bpages = (hashp->SPARES[hashp->OVFL_POINT] +
(hashp->BSIZE << BYTE_SHIFT) - 1) >>
(unsigned int)(hashp->BSIZE << BYTE_SHIFT) - 1) >>
(hashp->BSHIFT + BYTE_SHIFT);
hashp->nmaps = bpages;
@ -289,7 +290,7 @@ static HTAB *
init_hash(hashp, file, info)
HTAB *hashp;
const char *file;
HASHINFO *info;
const HASHINFO *info;
{
struct stat statbuf;
int nelem;
@ -312,7 +313,7 @@ init_hash(hashp, file, info)
if (stat(file, &statbuf))
return (NULL);
hashp->BSIZE = statbuf.st_blksize;
hashp->BSHIFT = __log2(hashp->BSIZE);
hashp->BSHIFT = __log2((u_int32_t)hashp->BSIZE);
}
if (info) {
@ -341,7 +342,7 @@ init_hash(hashp, file, info)
}
}
/* init_htab should destroy the table and set errno if it fails */
if (init_htab(hashp, nelem))
if (init_htab(hashp, (size_t)nelem))
return (NULL);
else
return (hashp);
@ -355,9 +356,10 @@ init_hash(hashp, file, info)
static int
init_htab(hashp, nelem)
HTAB *hashp;
int nelem;
size_t nelem;
{
register int nbuckets, nsegs;
register int nbuckets;
u_int32_t nsegs;
int l2;
/*
@ -376,11 +378,12 @@ init_htab(hashp, nelem)
hashp->LAST_FREED = 2;
/* First bitmap page is at: splitpoint l2 page offset 1 */
if (__ibitmap(hashp, OADDR_OF(l2, 1), l2 + 1, 0))
if (__ibitmap(hashp, (int)OADDR_OF(l2, 1), l2 + 1, 0))
return (-1);
hashp->MAX_BUCKET = hashp->LOW_MASK = nbuckets - 1;
hashp->HIGH_MASK = (nbuckets << 1) - 1;
/* LINTED constant in conditional context */
hashp->HDRPAGES = ((MAX(sizeof(HASHHDR), MINHDRSIZE) - 1) >>
hashp->BSHIFT) + 1;
@ -389,7 +392,7 @@ init_htab(hashp, nelem)
if (nsegs > hashp->DSIZE)
hashp->DSIZE = nsegs;
return (alloc_segs(hashp, nsegs));
return (alloc_segs(hashp, (int)nsegs));
}
/********************** DESTROY/CLOSE ROUTINES ************************/
@ -519,8 +522,8 @@ flush_meta(hashp)
}
for (i = 0; i < NCACHED; i++)
if (hashp->mapp[i])
if (__put_page(hashp, (char *)hashp->mapp[i],
hashp->BITMAPS[i], 0, 1))
if (__put_page(hashp, (char *)(void *)hashp->mapp[i],
(u_int)hashp->BITMAPS[i], 0, 1))
return (-1);
return (0);
}
@ -548,6 +551,7 @@ hash_get(dbp, key, data, flag)
hashp->err = errno = EINVAL;
return (ERROR);
}
/* LINTED const castaway */
return (hash_access(hashp, HASH_GET, (DBT *)key, data));
}
@ -569,6 +573,7 @@ hash_put(dbp, key, data, flag)
hashp->err = errno = EPERM;
return (ERROR);
}
/* LINTED const castaway */
return (hash_access(hashp, flag == R_NOOVERWRITE ?
HASH_PUTNEW : HASH_PUT, (DBT *)key, (DBT *)data));
}
@ -590,6 +595,7 @@ hash_delete(dbp, key, flag)
hashp->err = errno = EPERM;
return (ERROR);
}
/* LINTED const castaway */
return (hash_access(hashp, HASH_DELETE, (DBT *)key, NULL));
}
@ -605,7 +611,8 @@ hash_access(hashp, action, key, val)
register BUFHEAD *rbufp;
BUFHEAD *bufp, *save_bufp;
register u_int16_t *bp;
register int n, ndx, off, size;
register int n, ndx, off;
size_t size;
register char *kp;
u_int16_t pageno;
@ -616,14 +623,14 @@ hash_access(hashp, action, key, val)
off = hashp->BSIZE;
size = key->size;
kp = (char *)key->data;
rbufp = __get_buf(hashp, __call_hash(hashp, kp, size), NULL, 0);
rbufp = __get_buf(hashp, __call_hash(hashp, kp, (int)size), NULL, 0);
if (!rbufp)
return (ERROR);
save_bufp = rbufp;
/* Pin the bucket chain */
rbufp->flags |= BUF_PIN;
for (bp = (u_int16_t *)rbufp->page, n = *bp++, ndx = 1; ndx < n;)
for (bp = (u_int16_t *)(void *)rbufp->page, n = *bp++, ndx = 1; ndx < n;)
if (bp[1] >= REAL_KEY) {
/* Real key/data pair */
if (size == off - *bp &&
@ -636,19 +643,19 @@ hash_access(hashp, action, key, val)
bp += 2;
ndx += 2;
} else if (bp[1] == OVFLPAGE) {
rbufp = __get_buf(hashp, *bp, rbufp, 0);
rbufp = __get_buf(hashp, (u_int32_t)*bp, rbufp, 0);
if (!rbufp) {
save_bufp->flags &= ~BUF_PIN;
return (ERROR);
}
/* FOR LOOP INIT */
bp = (u_int16_t *)rbufp->page;
bp = (u_int16_t *)(void *)rbufp->page;
n = *bp++;
ndx = 1;
off = hashp->BSIZE;
} else if (bp[1] < REAL_KEY) {
if ((ndx =
__find_bigpair(hashp, rbufp, ndx, kp, size)) > 0)
__find_bigpair(hashp, rbufp, ndx, kp, (int)size)) > 0)
goto found;
if (ndx == -2) {
bufp = rbufp;
@ -658,13 +665,14 @@ hash_access(hashp, action, key, val)
rbufp = bufp;
break; /* FOR */
}
rbufp = __get_buf(hashp, pageno, bufp, 0);
rbufp = __get_buf(hashp, (u_int32_t)pageno,
bufp, 0);
if (!rbufp) {
save_bufp->flags &= ~BUF_PIN;
return (ERROR);
}
/* FOR LOOP INIT */
bp = (u_int16_t *)rbufp->page;
bp = (u_int16_t *)(void *)rbufp->page;
n = *bp++;
ndx = 1;
off = hashp->BSIZE;
@ -698,7 +706,7 @@ found:
save_bufp->flags &= ~BUF_PIN;
return (ABNORMAL);
case HASH_GET:
bp = (u_int16_t *)rbufp->page;
bp = (u_int16_t *)(void *)rbufp->page;
if (bp[ndx + 1] < REAL_KEY) {
if (__big_return(hashp, rbufp, ndx, val, 0))
return (ERROR);
@ -759,7 +767,7 @@ hash_seq(dbp, key, data, flag)
if (!bufp)
return (ERROR);
hashp->cpage = bufp;
bp = (u_int16_t *)bufp->page;
bp = (u_int16_t *)(void *)bufp->page;
if (bp[0])
break;
}
@ -769,7 +777,7 @@ hash_seq(dbp, key, data, flag)
return (ABNORMAL);
}
} else
bp = (u_int16_t *)hashp->cpage->page;
bp = (u_int16_t *)(void *)hashp->cpage->page;
#ifdef DEBUG
assert(bp);
@ -777,10 +785,11 @@ hash_seq(dbp, key, data, flag)
#endif
while (bp[hashp->cndx + 1] == OVFLPAGE) {
bufp = hashp->cpage =
__get_buf(hashp, bp[hashp->cndx], bufp, 0);
__get_buf(hashp, (u_int32_t)bp[hashp->cndx], bufp,
0);
if (!bufp)
return (ERROR);
bp = (u_int16_t *)(bufp->page);
bp = (u_int16_t *)(void *)(bufp->page);
hashp->cndx = 1;
}
if (!bp[0]) {
@ -841,7 +850,7 @@ __expand_table(hashp)
hashp->DSIZE = dirsize << 1;
}
if ((hashp->dir[new_segnum] =
(SEGMENT)calloc(hashp->SGSIZE, sizeof(SEGMENT))) == NULL)
(SEGMENT)calloc((size_t)hashp->SGSIZE, sizeof(SEGMENT))) == NULL)
return (-1);
hashp->exsegs++;
hashp->nsegs++;
@ -851,7 +860,7 @@ __expand_table(hashp)
* * increases), we need to copy the current contents of the spare
* split bucket to the next bucket.
*/
spare_ndx = __log2(hashp->MAX_BUCKET + 1);
spare_ndx = __log2((u_int32_t)(hashp->MAX_BUCKET + 1));
if (spare_ndx > hashp->OVFL_POINT) {
hashp->SPARES[spare_ndx] = hashp->SPARES[hashp->OVFL_POINT];
hashp->OVFL_POINT = spare_ndx;
@ -877,9 +886,9 @@ hash_realloc(p_ptr, oldsize, newsize)
{
register void *p;
if ((p = malloc(newsize)) != NULL) {
memmove(p, *p_ptr, oldsize);
memset((char *)p + oldsize, 0, newsize - oldsize);
if ((p = malloc((size_t)newsize)) != NULL) {
memmove(p, *p_ptr, (size_t)oldsize);
memset((char *)p + oldsize, 0, (size_t)(newsize - oldsize));
free(*p_ptr);
*p_ptr = p;
}
@ -894,7 +903,7 @@ __call_hash(hashp, k, len)
{
int n, bucket;
n = hashp->hash(k, len);
n = hashp->hash(k, (size_t)len);
bucket = n & hashp->HIGH_MASK;
if (bucket > hashp->MAX_BUCKET)
bucket = bucket & hashp->LOW_MASK;
@ -917,7 +926,8 @@ alloc_segs(hashp, nsegs)
int save_errno;
if ((hashp->dir =
(SEGMENT *)calloc(hashp->DSIZE, sizeof(SEGMENT *))) == NULL) {
(SEGMENT *)calloc((size_t)hashp->DSIZE,
sizeof(SEGMENT *))) == NULL) {
save_errno = errno;
(void)hdestroy(hashp);
errno = save_errno;
@ -925,7 +935,8 @@ alloc_segs(hashp, nsegs)
}
/* Allocate segments */
if ((store =
(SEGMENT)calloc(nsegs << hashp->SSHIFT, sizeof(SEGMENT))) == NULL) {
(SEGMENT)calloc((size_t)(nsegs << hashp->SSHIFT),
sizeof(SEGMENT))) == NULL) {
save_errno = errno;
(void)hdestroy(hashp);
errno = save_errno;

View File

@ -1,4 +1,4 @@
/* $NetBSD: hash.h,v 1.7 1996/11/07 06:48:02 jtc Exp $ */
/* $NetBSD: hash.h,v 1.8 1998/12/09 12:42:49 christos Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@ -143,11 +143,11 @@ typedef struct htab { /* Memory resident data structure */
#define ALL_SET ((u_int32_t)0xFFFFFFFF)
#define ALL_CLEAR 0
#define PTROF(X) ((BUFHEAD *)((ptrdiff_t)(X)&~0x3))
#define ISMOD(X) ((u_int32_t)(ptrdiff_t)(X)&0x1)
#define DOMOD(X) ((X) = (char *)((ptrdiff_t)(X)|0x1))
#define ISDISK(X) ((u_int32_t)(ptrdiff_t)(X)&0x2)
#define DODISK(X) ((X) = (char *)((ptrdiff_t)(X)|0x2))
#define PTROF(X) ((BUFHEAD *)(void *)((u_long)(X)&~0x3))
#define ISMOD(X) ((u_int32_t)(u_long)(X)&0x1)
#define DOMOD(X) ((X) = (char *)(void *)((u_long)(X)|0x1))
#define ISDISK(X) ((u_int32_t)(u_long)(X)&0x2)
#define DODISK(X) ((X) = (char *)(void *)((u_long)(X)|0x2))
#define BITS_PER_MAP 32
@ -172,7 +172,8 @@ typedef struct htab { /* Memory resident data structure */
#define OADDR_OF(S,O) ((u_int32_t)((u_int32_t)(S) << SPLITSHIFT) + (O))
#define BUCKET_TO_PAGE(B) \
(B) + hashp->HDRPAGES + ((B) ? hashp->SPARES[__log2((B)+1)-1] : 0)
(B) + hashp->HDRPAGES + \
((B) ? hashp->SPARES[__log2((u_int32_t)((B)+1))-1] : 0)
#define OADDR_TO_PAGE(B) \
BUCKET_TO_PAGE ( (1 << SPLITNUM((B))) -1 ) + OPAGENUM((B));

View File

@ -1,4 +1,4 @@
/* $NetBSD: hash_bigkey.c,v 1.8 1998/08/18 23:50:08 thorpej Exp $ */
/* $NetBSD: hash_bigkey.c,v 1.9 1998/12/09 12:42:49 christos Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)hash_bigkey.c 8.3 (Berkeley) 5/31/94";
#else
__RCSID("$NetBSD: hash_bigkey.c,v 1.8 1998/08/18 23:50:08 thorpej Exp $");
__RCSID("$NetBSD: hash_bigkey.c,v 1.9 1998/12/09 12:42:49 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -103,7 +103,7 @@ __big_insert(hashp, bufp, key, val)
char *cp, *key_data, *val_data;
cp = bufp->page; /* Character pointer of p. */
p = (u_int16_t *)cp;
p = (u_int16_t *)(void *)cp;
key_data = (char *)key->data;
key_size = key->size;
@ -115,7 +115,7 @@ __big_insert(hashp, bufp, key, val)
space = FREESPACE(p) - BIGOVERHEAD) {
move_bytes = MIN(space, key_size);
off = OFFSET(p) - move_bytes;
memmove(cp + off, key_data, move_bytes);
memmove(cp + off, key_data, (size_t)move_bytes);
key_size -= move_bytes;
key_data += move_bytes;
n = p[0];
@ -133,7 +133,7 @@ __big_insert(hashp, bufp, key, val)
move_bytes = MIN(FREESPACE(p), val_size);
off = OFFSET(p) - move_bytes;
p[n] = off;
memmove(cp + off, val_data, move_bytes);
memmove(cp + off, val_data, (size_t)move_bytes);
val_data += move_bytes;
val_size -= move_bytes;
p[n - 2] = FULL_KEY_DATA;
@ -142,7 +142,7 @@ __big_insert(hashp, bufp, key, val)
} else
p[n - 2] = FULL_KEY;
}
p = (u_int16_t *)bufp->page;
p = (u_int16_t *)(void *)bufp->page;
cp = bufp->page;
bufp->flags |= BUF_MOD;
}
@ -158,7 +158,7 @@ __big_insert(hashp, bufp, key, val)
if (space == val_size && val_size == val->size)
move_bytes--;
off = OFFSET(p) - move_bytes;
memmove(cp + off, val_data, move_bytes);
memmove(cp + off, val_data, (size_t)move_bytes);
val_size -= move_bytes;
val_data += move_bytes;
n = p[0];
@ -172,7 +172,7 @@ __big_insert(hashp, bufp, key, val)
if (!bufp)
return (-1);
cp = bufp->page;
p = (u_int16_t *)cp;
p = (u_int16_t *)(void *)cp;
} else
p[n] = FULL_KEY_DATA;
bufp->flags |= BUF_MOD;
@ -202,7 +202,7 @@ __big_delete(hashp, bufp)
rbufp = bufp;
last_bfp = NULL;
bp = (u_int16_t *)bufp->page;
bp = (u_int16_t *)(void *)bufp->page;
pageno = 0;
key_done = 0;
@ -219,13 +219,13 @@ __big_delete(hashp, bufp)
break;
pageno = bp[bp[0] - 1];
rbufp->flags |= BUF_MOD;
rbufp = __get_buf(hashp, pageno, rbufp, 0);
rbufp = __get_buf(hashp, (u_int32_t)pageno, rbufp, 0);
if (last_bfp)
__free_ovflpage(hashp, last_bfp);
last_bfp = rbufp;
if (!rbufp)
return (-1); /* Error. */
bp = (u_int16_t *)rbufp->page;
bp = (u_int16_t *)(void *)rbufp->page;
}
/*
@ -240,7 +240,7 @@ __big_delete(hashp, bufp)
pageno = bp[n - 1];
/* Now, bp is the first page of the pair. */
bp = (u_int16_t *)bufp->page;
bp = (u_int16_t *)(void *)bufp->page;
if (n > 2) {
/* There is an overflow page. */
bp[1] = pageno;
@ -284,7 +284,7 @@ __find_bigpair(hashp, bufp, ndx, key, size)
u_int16_t bytes;
char *kkey;
bp = (u_int16_t *)bufp->page;
bp = (u_int16_t *)(void *)bufp->page;
p = bufp->page;
ksize = size;
kkey = key;
@ -292,19 +292,19 @@ __find_bigpair(hashp, bufp, ndx, key, size)
for (bytes = hashp->BSIZE - bp[ndx];
bytes <= size && bp[ndx + 1] == PARTIAL_KEY;
bytes = hashp->BSIZE - bp[ndx]) {
if (memcmp(p + bp[ndx], kkey, bytes))
if (memcmp(p + bp[ndx], kkey, (size_t)bytes))
return (-2);
kkey += bytes;
ksize -= bytes;
bufp = __get_buf(hashp, bp[ndx + 2], bufp, 0);
bufp = __get_buf(hashp, (u_int32_t)bp[ndx + 2], bufp, 0);
if (!bufp)
return (-3);
p = bufp->page;
bp = (u_int16_t *)p;
bp = (u_int16_t *)(void *)p;
ndx = 1;
}
if (bytes != ksize || memcmp(p + bp[ndx], kkey, bytes)) {
if (bytes != ksize || memcmp(p + bp[ndx], kkey, (size_t)bytes)) {
#ifdef HASH_STATISTICS
++hash_collisions;
#endif
@ -332,7 +332,7 @@ __find_last_page(hashp, bpp)
int n;
bufp = *bpp;
bp = (u_int16_t *)bufp->page;
bp = (u_int16_t *)(void *)bufp->page;
for (;;) {
n = bp[0];
@ -346,10 +346,10 @@ __find_last_page(hashp, bpp)
break;
pageno = bp[n - 1];
bufp = __get_buf(hashp, pageno, bufp, 0);
bufp = __get_buf(hashp, (u_int32_t)pageno, bufp, 0);
if (!bufp)
return (0); /* Need to indicate an error! */
bp = (u_int16_t *)bufp->page;
bp = (u_int16_t *)(void *)bufp->page;
}
*bpp = bufp;
@ -375,20 +375,20 @@ __big_return(hashp, bufp, ndx, val, set_current)
u_int16_t *bp, len, off, save_addr;
char *tp;
bp = (u_int16_t *)bufp->page;
bp = (u_int16_t *)(void *)bufp->page;
while (bp[ndx + 1] == PARTIAL_KEY) {
bufp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0);
bufp = __get_buf(hashp, (u_int32_t)bp[bp[0] - 1], bufp, 0);
if (!bufp)
return (-1);
bp = (u_int16_t *)bufp->page;
bp = (u_int16_t *)(void *)bufp->page;
ndx = 1;
}
if (bp[ndx + 1] == FULL_KEY) {
bufp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0);
bufp = __get_buf(hashp, (u_int32_t)bp[bp[0] - 1], bufp, 0);
if (!bufp)
return (-1);
bp = (u_int16_t *)bufp->page;
bp = (u_int16_t *)(void *)bufp->page;
save_p = bufp;
save_addr = save_p->addr;
off = bp[1];
@ -406,13 +406,14 @@ __big_return(hashp, bufp, ndx, val, set_current)
len = bp[1] - off;
save_p = bufp;
save_addr = bufp->addr;
bufp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0);
bufp = __get_buf(hashp, (u_int32_t)bp[bp[0] - 1], bufp,
0);
if (!bufp)
return (-1);
bp = (u_int16_t *)bufp->page;
bp = (u_int16_t *)(void *)bufp->page;
} else {
/* The data is all on one page. */
tp = (char *)bp;
tp = (char *)(void *)bp;
off = bp[bp[0]];
val->data = (u_char *)tp + off;
val->size = bp[1] - off;
@ -424,11 +425,11 @@ __big_return(hashp, bufp, ndx, val, set_current)
hashp->cndx = 1;
} else {
hashp->cpage = __get_buf(hashp,
bp[bp[0] - 1], bufp, 0);
(u_int32_t)bp[bp[0] - 1], bufp, 0);
if (!hashp->cpage)
return (-1);
hashp->cndx = 1;
if (!((u_int16_t *)
if (!((u_int16_t *)(void *)
hashp->cpage->page)[0]) {
hashp->cbucket++;
hashp->cpage = NULL;
@ -439,14 +440,14 @@ __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. */
errno = EINVAL; /* OUT OF BUFFERS */
return (-1);
}
memmove(hashp->tmp_buf, (save_p->page) + off, len);
memmove(hashp->tmp_buf, (save_p->page) + off, (size_t)len);
val->data = (u_char *)hashp->tmp_buf;
return (0);
}
@ -467,7 +468,7 @@ collect_data(hashp, bufp, len, set)
int mylen, totlen;
p = bufp->page;
bp = (u_int16_t *)p;
bp = (u_int16_t *)(void *)p;
mylen = hashp->BSIZE - bp[1];
save_addr = bufp->addr;
@ -475,7 +476,7 @@ collect_data(hashp, bufp, len, set)
totlen = len + mylen;
if (hashp->tmp_buf)
free(hashp->tmp_buf);
if ((hashp->tmp_buf = (char *)malloc(totlen)) == NULL)
if ((hashp->tmp_buf = (char *)malloc((size_t)totlen)) == NULL)
return (-1);
if (set) {
hashp->cndx = 1;
@ -484,17 +485,18 @@ collect_data(hashp, bufp, len, set)
hashp->cbucket++;
} else {
hashp->cpage =
__get_buf(hashp, bp[bp[0] - 1], bufp, 0);
__get_buf(hashp, (u_int32_t)bp[bp[0] - 1],
bufp, 0);
if (!hashp->cpage)
return (-1);
else if (!((u_int16_t *)hashp->cpage->page)[0]) {
else if (!((u_int16_t *)(void *)hashp->cpage->page)[0]) {
hashp->cbucket++;
hashp->cpage = NULL;
}
}
}
} else {
xbp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0);
xbp = __get_buf(hashp, (u_int32_t)bp[bp[0] - 1], bufp, 0);
if (!xbp || ((totlen =
collect_data(hashp, xbp, len + mylen, set)) < 1))
return (-1);
@ -503,7 +505,7 @@ collect_data(hashp, bufp, len, set)
errno = EINVAL; /* Out of buffers. */
return (-1);
}
memmove(&hashp->tmp_buf[len], (bufp->page) + bp[1], mylen);
memmove(&hashp->tmp_buf[len], (bufp->page) + bp[1], (size_t)mylen);
return (totlen);
}
@ -518,7 +520,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);
@ -542,7 +544,7 @@ collect_key(hashp, bufp, len, val, set)
u_int16_t *bp, save_addr;
p = bufp->page;
bp = (u_int16_t *)p;
bp = (u_int16_t *)(void *)p;
mylen = hashp->BSIZE - bp[1];
save_addr = bufp->addr;
@ -550,12 +552,12 @@ collect_key(hashp, bufp, len, val, set)
if (bp[2] == FULL_KEY || bp[2] == FULL_KEY_DATA) { /* End of Key. */
if (hashp->tmp_key != NULL)
free(hashp->tmp_key);
if ((hashp->tmp_key = (char *)malloc(totlen)) == NULL)
if ((hashp->tmp_key = (char *)malloc((size_t)totlen)) == NULL)
return (-1);
if (__big_return(hashp, bufp, 1, val, set))
return (-1);
} else {
xbp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0);
xbp = __get_buf(hashp, (u_int32_t)bp[bp[0] - 1], bufp, 0);
if (!xbp || ((totlen =
collect_key(hashp, xbp, totlen, val, set)) < 1))
return (-1);
@ -564,7 +566,7 @@ collect_key(hashp, bufp, len, val, set)
errno = EINVAL; /* MIS -- OUT OF BUFFERS */
return (-1);
}
memmove(&hashp->tmp_key[len], (bufp->page) + bp[1], mylen);
memmove(&hashp->tmp_key[len], (bufp->page) + bp[1], (size_t)mylen);
return (totlen);
}
@ -596,11 +598,11 @@ __big_split(hashp, op, np, big_keyp, addr, obucket, ret)
/* Now figure out where the big key/data goes */
if (__big_keydata(hashp, big_keyp, &key, &val, 0))
return (-1);
change = (__call_hash(hashp, key.data, key.size) != obucket);
change = (__call_hash(hashp, key.data, (int)key.size) != obucket);
if ((ret->next_addr = __find_last_page(hashp, &big_keyp)) != NULL) {
if (!(ret->nextp =
__get_buf(hashp, ret->next_addr, big_keyp, 0)))
__get_buf(hashp, (u_int32_t)ret->next_addr, big_keyp, 0)))
return (-1);;
} else
ret->nextp = NULL;
@ -621,7 +623,7 @@ __big_split(hashp, op, np, big_keyp, addr, obucket, ret)
(tmpp->ovfl ? tmpp->ovfl->addr : 0), (bp ? bp->addr : 0));
#endif
tmpp->ovfl = bp; /* one of op/np point to big_keyp */
tp = (u_int16_t *)tmpp->page;
tp = (u_int16_t *)(void *)tmpp->page;
#ifdef DEBUG
assert(FREESPACE(tp) >= OVFLSIZE);
#endif
@ -644,7 +646,7 @@ __big_split(hashp, op, np, big_keyp, addr, obucket, ret)
ret->newp = np;
ret->oldp = op;
tp = (u_int16_t *)big_keyp->page;
tp = (u_int16_t *)(void *)big_keyp->page;
big_keyp->flags |= BUF_MOD;
if (tp[0] > 2) {
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: hash_buf.c,v 1.7 1997/07/13 18:52:04 christos Exp $ */
/* $NetBSD: hash_buf.c,v 1.8 1998/12/09 12:42:49 christos Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)hash_buf.c 8.5 (Berkeley) 7/15/94";
#else
__RCSID("$NetBSD: hash_buf.c,v 1.7 1997/07/13 18:52:04 christos Exp $");
__RCSID("$NetBSD: hash_buf.c,v 1.8 1998/12/09 12:42:49 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -149,7 +149,7 @@ __get_buf(hashp, addr, prev_bp, newpage)
return (NULL);
if (!prev_bp)
segp[segment_ndx] =
(BUFHEAD *)((ptrdiff_t)bp | is_disk_mask);
(BUFHEAD *)(void *)((u_long)bp | is_disk_mask);
} else {
BUF_REMOVE(bp);
MRU_INSERT(bp);
@ -189,7 +189,7 @@ newbuf(hashp, addr, prev_bp)
#ifdef PURIFY
memset(bp, 0xff, sizeof(BUFHEAD));
#endif
if ((bp->page = (char *)malloc(hashp->BSIZE)) == NULL) {
if ((bp->page = (char *)malloc((size_t)hashp->BSIZE)) == NULL) {
free(bp);
return (NULL);
}
@ -210,7 +210,7 @@ newbuf(hashp, addr, prev_bp)
* Set oaddr before __put_page so that you get it
* before bytes are swapped.
*/
shortp = (u_int16_t *)bp->page;
shortp = (u_int16_t *)(void *)bp->page;
if (shortp[0])
oaddr = shortp[shortp[0] - 1];
if ((bp->flags & BUF_MOD) && __put_page(hashp, bp->page,
@ -253,7 +253,7 @@ newbuf(hashp, addr, prev_bp)
(oaddr != xbp->addr))
break;
shortp = (u_int16_t *)xbp->page;
shortp = (u_int16_t *)(void *)xbp->page;
if (shortp[0])
/* set before __put_page */
oaddr = shortp[shortp[0] - 1];
@ -296,13 +296,13 @@ newbuf(hashp, addr, prev_bp)
extern void
__buf_init(hashp, nbytes)
HTAB *hashp;
int nbytes;
u_int nbytes;
{
BUFHEAD *bfp;
int npages;
bfp = &(hashp->bufhead);
npages = (nbytes + hashp->BSIZE - 1) >> hashp->BSHIFT;
npages = (unsigned int)(nbytes + hashp->BSIZE - 1) >> hashp->BSHIFT;
npages = MAX(npages, MIN_BUFFERS);
hashp->nbufs = npages;

View File

@ -1,4 +1,4 @@
/* $NetBSD: hash_func.c,v 1.7 1997/07/13 18:52:05 christos Exp $ */
/* $NetBSD: hash_func.c,v 1.8 1998/12/09 12:42:50 christos Exp $ */
/*-
* Copyright (c) 1990, 1993
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)hash_func.c 8.2 (Berkeley) 2/21/94";
#else
__RCSID("$NetBSD: hash_func.c,v 1.7 1997/07/13 18:52:05 christos Exp $");
__RCSID("$NetBSD: hash_func.c,v 1.8 1998/12/09 12:42:50 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -52,14 +52,16 @@ __RCSID("$NetBSD: hash_func.c,v 1.7 1997/07/13 18:52:05 christos Exp $");
#include "page.h"
#include "extern.h"
#if 0
static u_int32_t hash1 __P((const void *, size_t)) __attribute__((__unused__));
static u_int32_t hash2 __P((const void *, size_t)) __attribute__((__unused__));
static u_int32_t hash3 __P((const void *, size_t)) __attribute__((__unused__));
#endif
static u_int32_t hash4 __P((const void *, size_t)) __attribute__((__unused__));
/* Global default hash function */
u_int32_t (*__default_hash) __P((const void *, size_t)) = hash4;
#if 0
/*
* HASH FUNCTIONS
*
@ -167,6 +169,7 @@ hash3(keyarg, len)
}
return (h);
}
#endif
/* Hash function from Chris Torek. */
static u_int32_t

View File

@ -1,4 +1,4 @@
/* $NetBSD: hash_page.c,v 1.12 1998/10/14 12:06:49 kleink Exp $ */
/* $NetBSD: hash_page.c,v 1.13 1998/12/09 12:42:50 christos Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)hash_page.c 8.7 (Berkeley) 8/16/94";
#else
__RCSID("$NetBSD: hash_page.c,v 1.12 1998/10/14 12:06:49 kleink Exp $");
__RCSID("$NetBSD: hash_page.c,v 1.13 1998/12/09 12:42:50 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -91,9 +91,9 @@ static int ugly_split
__P((HTAB *, u_int32_t, BUFHEAD *, BUFHEAD *, int, int));
#define PAGE_INIT(P) { \
((u_int16_t *)(P))[0] = 0; \
((u_int16_t *)(P))[1] = hashp->BSIZE - 3 * sizeof(u_int16_t); \
((u_int16_t *)(P))[2] = hashp->BSIZE; \
((u_int16_t *)(void *)(P))[0] = 0; \
((u_int16_t *)(void *)(P))[1] = hashp->BSIZE - 3 * sizeof(u_int16_t); \
((u_int16_t *)(void *)(P))[2] = hashp->BSIZE; \
}
/*
@ -108,7 +108,7 @@ putpair(p, key, val)
{
register u_int16_t *bp, n, off;
bp = (u_int16_t *)p;
bp = (u_int16_t *)(void *)p;
/* Enter the key first. */
n = bp[0];
@ -143,7 +143,7 @@ __delpair(hashp, bufp, ndx)
register int n;
u_int16_t pairlen;
bp = (u_int16_t *)bufp->page;
bp = (u_int16_t *)(void *)bufp->page;
n = bp[0];
if (bp[ndx + 1] < REAL_KEY)
@ -159,7 +159,7 @@ __delpair(hashp, bufp, ndx)
register int i;
register char *src = bufp->page + (int)OFFSET(bp);
register char *dst = src + (int)pairlen;
memmove(dst, src, bp[ndx + 1] - OFFSET(bp));
memmove(dst, src, (size_t)(bp[ndx + 1] - OFFSET(bp)));
/* Now adjust the pointers */
for (i = ndx + 2; i <= n; i += 2) {
@ -211,7 +211,7 @@ __split_page(hashp, obucket, nbucket)
old_bufp->flags |= (BUF_MOD | BUF_PIN);
new_bufp->flags |= (BUF_MOD | BUF_PIN);
ino = (u_int16_t *)(op = old_bufp->page);
ino = (u_int16_t *)(void *)(op = old_bufp->page);
np = new_bufp->page;
moved = 0;
@ -228,13 +228,13 @@ __split_page(hashp, obucket, nbucket)
key.data = (u_char *)op + ino[n];
key.size = off - ino[n];
if (__call_hash(hashp, key.data, key.size) == obucket) {
if (__call_hash(hashp, key.data, (int)key.size) == obucket) {
/* Don't switch page */
diff = copyto - off;
if (diff) {
copyto = ino[n + 1] + diff;
memmove(op + copyto, op + ino[n + 1],
off - ino[n + 1]);
(size_t)(off - ino[n + 1]));
ino[ndx] = copyto + ino[n] - ino[n + 1];
ino[ndx + 1] = copyto;
} else
@ -302,9 +302,9 @@ ugly_split(hashp, obucket, old_bufp, new_bufp, copyto, moved)
char *cino; /* Character value of ino */
bufp = old_bufp;
ino = (u_int16_t *)old_bufp->page;
np = (u_int16_t *)new_bufp->page;
op = (u_int16_t *)old_bufp->page;
ino = (u_int16_t *)(void *)old_bufp->page;
np = (u_int16_t *)(void *)new_bufp->page;
op = (u_int16_t *)(void *)old_bufp->page;
last_bfp = NULL;
scopyto = (u_int16_t)copyto; /* ANSI */
@ -312,21 +312,21 @@ ugly_split(hashp, obucket, old_bufp, new_bufp, copyto, moved)
while (n < ino[0]) {
if (ino[2] < REAL_KEY && ino[2] != OVFLPAGE) {
if (__big_split(hashp, old_bufp,
new_bufp, bufp, bufp->addr, obucket, &ret))
new_bufp, bufp, (int)bufp->addr, obucket, &ret))
return (-1);
old_bufp = ret.oldp;
if (!old_bufp)
return (-1);
op = (u_int16_t *)old_bufp->page;
op = (u_int16_t *)(void *)old_bufp->page;
new_bufp = ret.newp;
if (!new_bufp)
return (-1);
np = (u_int16_t *)new_bufp->page;
np = (u_int16_t *)(void *)new_bufp->page;
bufp = ret.nextp;
if (!bufp)
return (0);
cino = (char *)bufp->page;
ino = (u_int16_t *)cino;
ino = (u_int16_t *)(void *)cino;
last_bfp = ret.nextp;
} else if (ino[n + 1] == OVFLPAGE) {
ov_addr = ino[n];
@ -339,11 +339,11 @@ ugly_split(hashp, obucket, old_bufp, new_bufp, copyto, moved)
scopyto - sizeof(u_int16_t) * (ino[0] + 3);
OFFSET(ino) = scopyto;
bufp = __get_buf(hashp, ov_addr, bufp, 0);
bufp = __get_buf(hashp, (u_int32_t)ov_addr, bufp, 0);
if (!bufp)
return (-1);
ino = (u_int16_t *)bufp->page;
ino = (u_int16_t *)(void *)bufp->page;
n = 1;
scopyto = hashp->BSIZE;
moved = 0;
@ -355,37 +355,37 @@ ugly_split(hashp, obucket, old_bufp, new_bufp, copyto, moved)
/* Move regular sized pairs of there are any */
off = hashp->BSIZE;
for (n = 1; (n < ino[0]) && (ino[n + 1] >= REAL_KEY); n += 2) {
cino = (char *)ino;
cino = (char *)(void *)ino;
key.data = (u_char *)cino + ino[n];
key.size = off - ino[n];
val.data = (u_char *)cino + ino[n + 1];
val.size = ino[n] - ino[n + 1];
off = ino[n + 1];
if (__call_hash(hashp, key.data, key.size) == obucket) {
if (__call_hash(hashp, key.data, (int)key.size) == obucket) {
/* Keep on old page */
if (PAIRFITS(op, (&key), (&val)))
putpair((char *)op, &key, &val);
putpair((char *)(void *)op, &key, &val);
else {
old_bufp =
__add_ovflpage(hashp, old_bufp);
if (!old_bufp)
return (-1);
op = (u_int16_t *)old_bufp->page;
putpair((char *)op, &key, &val);
op = (u_int16_t *)(void *)old_bufp->page;
putpair((char *)(void *)op, &key, &val);
}
old_bufp->flags |= BUF_MOD;
} else {
/* Move to new page */
if (PAIRFITS(np, (&key), (&val)))
putpair((char *)np, &key, &val);
putpair((char *)(void *)np, &key, &val);
else {
new_bufp =
__add_ovflpage(hashp, new_bufp);
if (!new_bufp)
return (-1);
np = (u_int16_t *)new_bufp->page;
putpair((char *)np, &key, &val);
np = (u_int16_t *)(void *)new_bufp->page;
putpair((char *)(void *)np, &key, &val);
}
new_bufp->flags |= BUF_MOD;
}
@ -412,7 +412,7 @@ __addel(hashp, bufp, key, val)
register u_int16_t *bp, *sop;
int do_expand;
bp = (u_int16_t *)bufp->page;
bp = (u_int16_t *)(void *)bufp->page;
do_expand = 0;
while (bp[0] && (bp[2] < REAL_KEY || bp[bp[0]] < REAL_KEY))
/* Exception case */
@ -421,20 +421,22 @@ __addel(hashp, bufp, key, val)
and we need to add another page */
break;
else if (bp[2] < REAL_KEY && bp[bp[0]] != OVFLPAGE) {
bufp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0);
bufp = __get_buf(hashp, (u_int32_t)bp[bp[0] - 1], bufp,
0);
if (!bufp)
return (-1);
bp = (u_int16_t *)bufp->page;
bp = (u_int16_t *)(void *)bufp->page;
} else
/* Try to squeeze key on this page */
if (FREESPACE(bp) > PAIRSIZE(key, val)) {
squeeze_key(bp, key, val);
return (0);
} else {
bufp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0);
bufp = __get_buf(hashp,
(u_int32_t)bp[bp[0] - 1], bufp, 0);
if (!bufp)
return (-1);
bp = (u_int16_t *)bufp->page;
bp = (u_int16_t *)(void *)bufp->page;
}
if (PAIRFITS(bp, key, val))
@ -444,10 +446,10 @@ __addel(hashp, bufp, key, val)
bufp = __add_ovflpage(hashp, bufp);
if (!bufp)
return (-1);
sop = (u_int16_t *)bufp->page;
sop = (u_int16_t *)(void *)bufp->page;
if (PAIRFITS(sop, key, val))
putpair((char *)sop, key, val);
putpair((char *)(void *)sop, key, val);
else
if (__big_insert(hashp, bufp, key, val))
return (-1);
@ -480,11 +482,11 @@ __add_ovflpage(hashp, bufp)
#ifdef DEBUG1
int tmp1, tmp2;
#endif
sp = (u_int16_t *)bufp->page;
sp = (u_int16_t *)(void *)bufp->page;
/* Check if we are dynamically determining the fill factor */
if (hashp->FFACTOR == DEF_FFACTOR) {
hashp->FFACTOR = sp[0] >> 1;
hashp->FFACTOR = (u_int32_t)sp[0] >> 1;
if (hashp->FFACTOR < MIN_FFACTOR)
hashp->FFACTOR = MIN_FFACTOR;
}
@ -494,7 +496,8 @@ __add_ovflpage(hashp, bufp)
tmp1 = bufp->addr;
tmp2 = bufp->ovfl ? bufp->ovfl->addr : 0;
#endif
if (!ovfl_num || !(bufp->ovfl = __get_buf(hashp, ovfl_num, bufp, 1)))
if (!ovfl_num || !(bufp->ovfl = __get_buf(hashp, (u_int32_t)ovfl_num,
bufp, 1)))
return (NULL);
bufp->ovfl->flags |= BUF_MOD;
#ifdef DEBUG1
@ -545,9 +548,9 @@ __get_page(hashp, p, bucket, is_bucket, is_disk, is_bitmap)
page = BUCKET_TO_PAGE(bucket);
else
page = OADDR_TO_PAGE(bucket);
if ((rsize = pread(fd, p, size, (off_t)page << hashp->BSHIFT)) == -1)
if ((rsize = pread(fd, p, (size_t)size, (off_t)page << hashp->BSHIFT)) == -1)
return (-1);
bp = (u_int16_t *)p;
bp = (u_int16_t *)(void *)p;
if (!rsize)
bp[0] = 0; /* We hit the EOF, so initialize a new page */
else
@ -562,9 +565,9 @@ __get_page(hashp, p, bucket, is_bucket, is_disk, is_bitmap)
register int i, max;
if (is_bitmap) {
max = hashp->BSIZE >> 2; /* divide by 4 */
max = (u_int32_t)hashp->BSIZE >> 2; /* divide by 4 */
for (i = 0; i < max; i++)
M_32_SWAP(((int *)p)[i]);
M_32_SWAP(((int *)(void *)p)[i]);
} else {
M_16_SWAP(bp[0]);
max = bp[0] + 2;
@ -602,20 +605,20 @@ __put_page(hashp, p, bucket, is_bucket, is_bitmap)
register int max;
if (is_bitmap) {
max = hashp->BSIZE >> 2; /* divide by 4 */
max = (u_int32_t)hashp->BSIZE >> 2; /* divide by 4 */
for (i = 0; i < max; i++)
M_32_SWAP(((int *)p)[i]);
M_32_SWAP(((int *)(void *)p)[i]);
} else {
max = ((u_int16_t *)p)[0] + 2;
max = ((u_int16_t *)(void *)p)[0] + 2;
for (i = 0; i <= max; i++)
M_16_SWAP(((u_int16_t *)p)[i]);
M_16_SWAP(((u_int16_t *)(void *)p)[i]);
}
}
if (is_bucket)
page = BUCKET_TO_PAGE(bucket);
else
page = OADDR_TO_PAGE(bucket);
if ((wsize = pwrite(fd, p, size, (off_t)page << hashp->BSHIFT)) == -1)
if ((wsize = pwrite(fd, p, (size_t)size, (off_t)page << hashp->BSHIFT)) == -1)
/* Errno is set */
return (-1);
if (wsize != size) {
@ -638,14 +641,14 @@ __ibitmap(hashp, pnum, nbits, ndx)
u_int32_t *ip;
int clearbytes, clearints;
if ((ip = (u_int32_t *)malloc(hashp->BSIZE)) == NULL)
if ((ip = (u_int32_t *)malloc((size_t)hashp->BSIZE)) == NULL)
return (1);
hashp->nmaps++;
clearints = ((nbits - 1) >> INT_BYTE_SHIFT) + 1;
clearints = ((u_int32_t)(nbits - 1) >> INT_BYTE_SHIFT) + 1;
clearbytes = clearints << INT_TO_BYTE;
(void)memset((char *)ip, 0, clearbytes);
(void)memset(((char *)ip) + clearbytes, 0xFF,
hashp->BSIZE - clearbytes);
(void)memset(ip, 0, (size_t)clearbytes);
(void)memset(((char *)(void *)ip) + clearbytes, 0xFF,
(size_t)(hashp->BSIZE - clearbytes));
ip[clearints - 1] = ALL_SET << (nbits & BYTE_MASK);
SETBIT(ip, 0);
hashp->BITMAPS[ndx] = (u_int16_t)pnum;
@ -682,11 +685,11 @@ overflow_page(hashp)
splitnum = hashp->OVFL_POINT;
max_free = hashp->SPARES[splitnum];
free_page = (max_free - 1) >> (hashp->BSHIFT + BYTE_SHIFT);
free_page = (u_int32_t)(max_free - 1) >> (hashp->BSHIFT + BYTE_SHIFT);
free_bit = (max_free - 1) & ((hashp->BSIZE << BYTE_SHIFT) - 1);
/* Look through all the free maps to find the first free block */
first_page = hashp->LAST_FREED >>(hashp->BSHIFT + BYTE_SHIFT);
first_page = (u_int32_t)hashp->LAST_FREED >>(hashp->BSHIFT + BYTE_SHIFT);
for ( i = first_page; i <= free_page; i++ ) {
if (!(freep = (u_int32_t *)hashp->mapp[i]) &&
!(freep = fetch_bitmap(hashp, i)))
@ -830,12 +833,12 @@ __free_ovflpage(hashp, obufp)
#ifdef DEBUG1
(void)fprintf(stderr, "Freeing %d\n", addr);
#endif
ndx = (((u_int16_t)addr) >> SPLITSHIFT);
ndx = (((u_int32_t)addr) >> SPLITSHIFT);
bit_address =
(ndx ? hashp->SPARES[ndx - 1] : 0) + (addr & SPLITMASK) - 1;
if (bit_address < hashp->LAST_FREED)
hashp->LAST_FREED = bit_address;
free_page = (bit_address >> (hashp->BSHIFT + BYTE_SHIFT));
free_page = ((u_int32_t)bit_address >> (hashp->BSHIFT + BYTE_SHIFT));
free_bit = bit_address & ((hashp->BSIZE << BYTE_SHIFT) - 1);
if (!(freep = hashp->mapp[free_page]))
@ -892,7 +895,7 @@ squeeze_key(sp, key, val)
register char *p;
u_int16_t free_space, n, off, pageno;
p = (char *)sp;
p = (char *)(void *)sp;
n = sp[0];
free_space = FREESPACE(sp);
off = OFFSET(sp);
@ -918,10 +921,10 @@ fetch_bitmap(hashp, ndx)
{
if (ndx >= hashp->nmaps)
return (NULL);
if ((hashp->mapp[ndx] = (u_int32_t *)malloc(hashp->BSIZE)) == NULL)
if ((hashp->mapp[ndx] = (u_int32_t *)malloc((size_t)hashp->BSIZE)) == NULL)
return (NULL);
if (__get_page(hashp,
(char *)hashp->mapp[ndx], hashp->BITMAPS[ndx], 0, 1, 1)) {
(char *)(void *)hashp->mapp[ndx], (u_int32_t)hashp->BITMAPS[ndx], 0, 1, 1)) {
free(hashp->mapp[ndx]);
return (NULL);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ndbm.c,v 1.14 1998/05/07 19:11:14 kleink Exp $ */
/* $NetBSD: ndbm.c,v 1.15 1998/12/09 12:42:50 christos Exp $ */
/*-
* Copyright (c) 1990, 1993
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)ndbm.c 8.4 (Berkeley) 7/21/94";
#else
__RCSID("$NetBSD: ndbm.c,v 1.14 1998/05/07 19:11:14 kleink Exp $");
__RCSID("$NetBSD: ndbm.c,v 1.15 1998/12/09 12:42:50 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -212,7 +212,7 @@ dbm_store(db, key, data, flags)
dbtdata.data = data.dptr;
dbtdata.size = data.dsize;
return ((db->put)(db, &dbtkey, &dbtdata,
(flags == DBM_INSERT) ? R_NOOVERWRITE : 0));
(u_int)((flags == DBM_INSERT) ? R_NOOVERWRITE : 0)));
}
extern int

View File

@ -1,4 +1,4 @@
/* $NetBSD: mpool.c,v 1.9 1998/06/30 21:30:52 thorpej Exp $ */
/* $NetBSD: mpool.c,v 1.10 1998/12/09 12:42:51 christos Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)mpool.c 8.5 (Berkeley) 7/26/94";
#else
__RCSID("$NetBSD: mpool.c,v 1.9 1998/06/30 21:30:52 thorpej Exp $");
__RCSID("$NetBSD: mpool.c,v 1.10 1998/12/09 12:42:51 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -76,6 +76,7 @@ static int mpool_write __P((MPOOL *, BKT *));
* mpool_open --
* Initialize a memory pool.
*/
/*ARGSUSED*/
MPOOL *
mpool_open(key, fd, pagesize, maxcache)
void *key;
@ -106,7 +107,7 @@ mpool_open(key, fd, pagesize, maxcache)
for (entry = 0; entry < HASHSIZE; ++entry)
CIRCLEQ_INIT(&mp->hqh[entry]);
mp->maxcache = maxcache;
mp->npages = sb.st_size / pagesize;
mp->npages = (pgno_t)(sb.st_size / pagesize);
mp->pagesize = pagesize;
mp->fd = fd;
return (mp);
@ -167,6 +168,7 @@ mpool_new(mp, pgnoaddr)
* mpool_get
* Get a page.
*/
/*ARGSUSED*/
void *
mpool_get(mp, pgno, flags)
MPOOL *mp;
@ -221,7 +223,7 @@ mpool_get(mp, pgno, flags)
++mp->pageread;
#endif
off = mp->pagesize * pgno;
if ((nr = pread(mp->fd, bp->page, mp->pagesize, off)) != mp->pagesize) {
if ((nr = pread(mp->fd, bp->page, (size_t)mp->pagesize, off)) != (int)mp->pagesize) {
if (nr >= 0)
errno = EFTYPE;
return (NULL);
@ -250,6 +252,7 @@ mpool_get(mp, pgno, flags)
* mpool_put
* Return a page.
*/
/*ARGSUSED*/
int
mpool_put(mp, page, flags)
MPOOL *mp;
@ -261,7 +264,7 @@ mpool_put(mp, page, flags)
#ifdef STATISTICS
++mp->pageput;
#endif
bp = (BKT *)((char *)page - sizeof(BKT));
bp = (BKT *)(void *)((char *)page - sizeof(BKT));
#ifdef DEBUG
if (!(bp->flags & MPOOL_PINNED)) {
(void)fprintf(stderr,
@ -361,7 +364,7 @@ mpool_bkt(mp)
return (bp);
}
new: if ((bp = (BKT *)malloc(sizeof(BKT) + mp->pagesize)) == NULL)
new: if ((bp = (BKT *)malloc((size_t)(sizeof(BKT) + mp->pagesize))) == NULL)
return (NULL);
#ifdef STATISTICS
++mp->pagealloc;
@ -369,7 +372,7 @@ new: if ((bp = (BKT *)malloc(sizeof(BKT) + mp->pagesize)) == NULL)
#if defined(DEBUG) || defined(PURIFY)
memset(bp, 0xff, sizeof(BKT) + mp->pagesize);
#endif
bp->page = (char *)bp + sizeof(BKT);
bp->page = (char *)(void *)bp + sizeof(BKT);
++mp->curcache;
return (bp);
}
@ -394,7 +397,7 @@ mpool_write(mp, bp)
(mp->pgout)(mp->pgcookie, bp->pgno, bp->page);
off = mp->pagesize * bp->pgno;
if (pwrite(mp->fd, bp->page, mp->pagesize, off) != mp->pagesize)
if (pwrite(mp->fd, bp->page, (size_t)mp->pagesize, off) != (int)mp->pagesize)
return (RET_ERROR);
bp->flags &= ~MPOOL_DIRTY;

View File

@ -1,4 +1,4 @@
/* $NetBSD: rec_delete.c,v 1.10 1997/07/21 14:06:43 jtc Exp $ */
/* $NetBSD: rec_delete.c,v 1.11 1998/12/09 12:42:51 christos Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)rec_delete.c 8.7 (Berkeley) 7/14/94";
#else
__RCSID("$NetBSD: rec_delete.c,v 1.10 1997/07/21 14:06:43 jtc Exp $");
__RCSID("$NetBSD: rec_delete.c,v 1.11 1998/12/09 12:42:51 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -139,7 +139,7 @@ rec_rdelete(t, nrec)
/* Delete the record. */
h = e->page;
status = __rec_dleaf(t, h, e->index);
status = __rec_dleaf(t, h, (u_int32_t)e->index);
if (status != RET_SUCCESS) {
mpool_put(t->bt_mp, h, 0);
return (status);
@ -189,8 +189,8 @@ __rec_dleaf(t, h, index)
* Compress the key/data pairs. Compress and adjust the [BR]LEAF
* offsets. Reset the headers.
*/
from = (char *)h + h->upper;
memmove(from + nbytes, from, (char *)to - from);
from = (char *)(void *)h + h->upper;
memmove(from + nbytes, from, (size_t)((char *)to - from));
h->upper += nbytes;
offset = h->linp[index];

View File

@ -1,4 +1,4 @@
/* $NetBSD: rec_put.c,v 1.10 1997/07/21 14:06:46 jtc Exp $ */
/* $NetBSD: rec_put.c,v 1.11 1998/12/09 12:42:51 christos Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)rec_put.c 8.7 (Berkeley) 8/18/94";
#else
__RCSID("$NetBSD: rec_put.c,v 1.10 1997/07/21 14:06:46 jtc Exp $");
__RCSID("$NetBSD: rec_put.c,v 1.11 1998/12/09 12:42:51 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -204,7 +204,7 @@ __rec_iput(t, nrec, data, flags)
DBT tdata;
EPG *e;
PAGE *h;
indx_t index, nxtindex;
indx_t idx, nxtindex;
pgno_t pg;
u_int32_t nbytes;
int dflags, status;
@ -221,8 +221,8 @@ __rec_iput(t, nrec, data, flags)
return (RET_ERROR);
tdata.data = db;
tdata.size = NOVFLSIZE;
*(pgno_t *)db = pg;
*(u_int32_t *)(db + sizeof(pgno_t)) = data->size;
*(pgno_t *)(void *)db = pg;
*(u_int32_t *)(void *)(db + sizeof(pgno_t)) = data->size;
dflags = P_BIGDATA;
data = &tdata;
} else
@ -235,7 +235,7 @@ __rec_iput(t, nrec, data, flags)
return (RET_ERROR);
h = e->page;
index = e->index;
idx = e->index;
/*
* Add the specified key/data pair to the tree. The R_IAFTER and
@ -245,13 +245,13 @@ __rec_iput(t, nrec, data, flags)
*/
switch (flags) {
case R_IAFTER:
++index;
++idx;
break;
case R_IBEFORE:
break;
default:
if (nrec < t->bt_nrecs &&
__rec_dleaf(t, h, index) == RET_ERROR) {
__rec_dleaf(t, h, (u_int32_t)idx) == RET_ERROR) {
mpool_put(t->bt_mp, h, 0);
return (RET_ERROR);
}
@ -265,19 +265,20 @@ __rec_iput(t, nrec, data, flags)
*/
nbytes = NRLEAFDBT(data->size);
if (h->upper - h->lower < nbytes + sizeof(indx_t)) {
status = __bt_split(t, h, NULL, data, dflags, nbytes, index);
status = __bt_split(t, h, NULL, data, dflags, nbytes,
(u_int32_t)idx);
if (status == RET_SUCCESS)
++t->bt_nrecs;
return (status);
}
if (index < (nxtindex = NEXTINDEX(h)))
memmove(h->linp + index + 1, h->linp + index,
(nxtindex - index) * sizeof(indx_t));
if (idx < (nxtindex = NEXTINDEX(h)))
memmove(h->linp + idx + 1, h->linp + idx,
(nxtindex - idx) * sizeof(indx_t));
h->lower += sizeof(indx_t);
h->linp[index] = h->upper -= nbytes;
dest = (char *)h + h->upper;
h->linp[idx] = h->upper -= nbytes;
dest = (char *)(void *)h + h->upper;
WR_RLEAF(dest, data, dflags);
++t->bt_nrecs;