[svn-r12602] Description:

Correct bug in doubling table algorithm which was generating incorrect
row & column for offset larger than could be represented in 32 bits.

    Also, beef up the error checking in direct block code a bit

Tested On:
    FreeBSD/32 4.11 (sleipnir)
    Linux/32 2.4 (heping)
    Linux/64 2.4 (mir)
    Solaris/64 2.9 (shanti)
This commit is contained in:
Quincey Koziol 2006-08-21 09:51:16 -05:00
parent fc409b2cd0
commit 143cfe24b4
2 changed files with 10 additions and 2 deletions

View File

@ -352,7 +352,7 @@ HDfprintf(stderr, "%s: request = %Zu\n", FUNC, request);
if(request < hdr->man_dtable.cparam.start_block_size)
min_dblock_size = hdr->man_dtable.cparam.start_block_size;
else {
min_dblock_size = 1 << (1 + H5V_log2_gen((hsize_t)request));
min_dblock_size = ((size_t)1) << (1 + H5V_log2_gen((hsize_t)request));
HDassert(min_dblock_size <= hdr->man_dtable.cparam.max_direct_size);
} /* end else */
@ -554,6 +554,7 @@ HDfprintf(stderr, "%s: iblock_addr = %a\n", FUNC, iblock_addr);
/* Compute # of rows in child indirect block */
nrows = (H5V_log2_gen(hdr->man_dtable.row_block_size[row]) - hdr->man_dtable.first_row_bits) + 1;
HDassert(nrows < iblock->nrows); /* child must be smaller than parent */
/* Compute indirect block's entry */
entry = (row * hdr->man_dtable.cparam.width) + col;
@ -592,6 +593,7 @@ HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off);
/* Look up row & column in new indirect block for object */
if(H5HF_dtable_lookup(&hdr->man_dtable, (obj_off - iblock->block_off), &row, &col) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of object")
HDassert(row < iblock->nrows); /* child must be smaller than parent */
#ifdef QAK
HDfprintf(stderr, "%s: row = %u, col = %u\n", FUNC, row, col);
#endif /* QAK */

View File

@ -160,6 +160,9 @@ H5HF_dtable_lookup(const H5HF_dtable_t *dtable, hsize_t off, unsigned *row, unsi
HDassert(dtable);
HDassert(row);
HDassert(col);
#ifdef QAK
HDfprintf(stderr, "%s: off = %Hu\n", "H5HF_dtable_lookup", off);
#endif /* QAK */
/* Check for offset in first row */
if(off < dtable->num_id_first_row) {
@ -168,8 +171,11 @@ H5HF_dtable_lookup(const H5HF_dtable_t *dtable, hsize_t off, unsigned *row, unsi
} /* end if */
else {
unsigned high_bit = H5V_log2_gen(off); /* Determine the high bit in the offset */
hsize_t off_mask = 1 << high_bit; /* Compute mask for determining column */
hsize_t off_mask = ((hsize_t)1) << high_bit; /* Compute mask for determining column */
#ifdef QAK
HDfprintf(stderr, "%s: high_bit = %u, off_mask = %Hu\n", "H5HF_dtable_lookup", high_bit, off_mask);
#endif /* QAK */
*row = (high_bit - dtable->first_row_bits) + 1;
*col = (off - off_mask) / dtable->row_block_size[*row];
} /* end else */