diff options
Diffstat (limited to 'db2/db/db_conv.c')
-rw-r--r-- | db2/db/db_conv.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/db2/db/db_conv.c b/db2/db/db_conv.c index e9c4bf90bd..8b5cf5f4a7 100644 --- a/db2/db/db_conv.c +++ b/db2/db/db_conv.c @@ -1,7 +1,7 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 1996, 1997 + * Copyright (c) 1996, 1997, 1998 * Sleepycat Software. All rights reserved. */ /* @@ -44,7 +44,7 @@ #include "config.h" #ifndef lint -static const char sccsid[] = "@(#)db_conv.c 10.8 (Sleepycat) 1/8/98"; +static const char sccsid[] = "@(#)db_conv.c 10.13 (Sleepycat) 4/26/98"; #endif /* not lint */ #ifndef NO_SYSTEM_INCLUDES @@ -160,6 +160,13 @@ __db_convert(pg, pp, pagesize, pgin) } } + + /* + * The offsets in the inp array are used to determine + * the size of entries on a page; therefore they + * cannot be converted until we've done all the + * entries. + */ if (!pgin) for (i = 0; i < NUM_ENT(h); i++) M_16_SWAP(h->inp[i]); @@ -179,8 +186,8 @@ __db_convert(pg, pp, pagesize, pgin) case B_DUPLICATE: case B_OVERFLOW: bo = (BOVERFLOW *)bk; - M_32_SWAP(bo->tlen); M_32_SWAP(bo->pgno); + M_32_SWAP(bo->tlen); break; } @@ -194,17 +201,18 @@ __db_convert(pg, pp, pagesize, pgin) M_16_SWAP(h->inp[i]); bi = GET_BINTERNAL(h, i); + M_16_SWAP(bi->len); + M_32_SWAP(bi->pgno); + M_32_SWAP(bi->nrecs); + switch (B_TYPE(bi->type)) { case B_KEYDATA: - M_16_SWAP(bi->len); - M_32_SWAP(bi->pgno); - M_32_SWAP(bi->nrecs); break; case B_DUPLICATE: case B_OVERFLOW: - bo = (BOVERFLOW *)bi; - M_32_SWAP(bo->tlen); + bo = (BOVERFLOW *)bi->data; M_32_SWAP(bo->pgno); + M_32_SWAP(bo->tlen); break; } @@ -224,6 +232,7 @@ __db_convert(pg, pp, pagesize, pgin) if (!pgin) M_16_SWAP(h->inp[i]); } + break; case P_OVERFLOW: case P_INVALID: /* Nothing to do. */ |