summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5EA.c9
-rw-r--r--test/earray.c6
2 files changed, 11 insertions, 4 deletions
diff --git a/src/H5EA.c b/src/H5EA.c
index 8db42c4..6f28238 100644
--- a/src/H5EA.c
+++ b/src/H5EA.c
@@ -380,9 +380,12 @@ HDfprintf(stderr, "%s: Index block address is: %a\n", FUNC, hdr->idx_blk_addr);
/* Get super block index where element is located */
sblk_idx = H5EA__dblock_sblk_idx(hdr, idx);
+#ifdef QAK
+HDfprintf(stderr, "%s: sblk_idx = %u, iblock->nsblks = %Zu\n", FUNC, sblk_idx, iblock->nsblks);
+#endif /* QAK */
/* Adjust index to offset in super block */
- elmt_idx = idx - hdr->cparam.idx_blk_elmts + hdr->sblk_info[sblk_idx].start_idx;
+ elmt_idx = idx - (hdr->cparam.idx_blk_elmts + hdr->sblk_info[sblk_idx].start_idx);
#ifdef QAK
HDfprintf(stderr, "%s: after adjusting for super block elements, elmt_idx = %Hu\n", FUNC, elmt_idx);
#endif /* QAK */
@@ -397,7 +400,7 @@ HDfprintf(stderr, "%s: Element in data block pointed to by address in index bloc
/* Compute the data block index in index block */
dblk_idx = (size_t)(hdr->sblk_info[sblk_idx].start_dblk + (elmt_idx / hdr->sblk_info[sblk_idx].dblk_nelmts));
#ifdef QAK
-HDfprintf(stderr, "%s: dblk_idx = %u\n", FUNC, dblk_idx);
+HDfprintf(stderr, "%s: dblk_idx = %u, iblock->ndblk_addrs = %Zu\n", FUNC, dblk_idx, iblock->ndblk_addrs);
#endif /* QAK */
HDassert(dblk_idx < iblock->ndblk_addrs);
@@ -528,7 +531,7 @@ HDfprintf(stderr, "%s: Index block address is: %a\n", FUNC, hdr->idx_blk_addr);
sblk_idx = H5EA__dblock_sblk_idx(hdr, idx);
/* Adjust index to offset in super block */
- elmt_idx = idx - hdr->cparam.idx_blk_elmts + hdr->sblk_info[sblk_idx].start_idx;
+ elmt_idx = idx - (hdr->cparam.idx_blk_elmts + hdr->sblk_info[sblk_idx].start_idx);
#ifdef QAK
HDfprintf(stderr, "%s: after adjusting for super block elements, elmt_idx = %Hu\n", FUNC, elmt_idx);
#endif /* QAK */
diff --git a/test/earray.c b/test/earray.c
index 1a45bf1..2019aae 100644
--- a/test/earray.c
+++ b/test/earray.c
@@ -1057,7 +1057,7 @@ HDfprintf(stderr, "idx = %Hu, tparam->sblk_info[%u] = {%Hu, %Zu, %Hu, %Hu}\n", i
HDfprintf(stderr, "state.nelmts = %Hu\n", state.nelmts);
#endif /* QAK */
state.ndata_blks = 1 + tparam->sblk_info[sblk_idx].start_dblk +
- ((idx - cparam->idx_blk_elmts) / tparam->sblk_info[sblk_idx].dblk_nelmts);
+ ((idx - (cparam->idx_blk_elmts + tparam->sblk_info[sblk_idx].start_idx)) / tparam->sblk_info[sblk_idx].dblk_nelmts);
#ifdef QAK
HDfprintf(stderr, "state.ndata_blks = %Hu\n", state.ndata_blks);
#endif /* QAK */
@@ -1191,6 +1191,10 @@ main(void)
nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + 1), "setting first element of array's first data block");
nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + cparam.data_blk_min_elmts), "setting all elements of array's first data block");
nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + cparam.data_blk_min_elmts + 1), "setting first element of array's second data block");
+ nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (3 * cparam.data_blk_min_elmts)), "setting all elements of array's second data block");
+ nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (3 * cparam.data_blk_min_elmts) + 1), "setting first element of array's third data block");
+ nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (5 * cparam.data_blk_min_elmts)), "setting all elements of array's third data block");
+ nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (5 * cparam.data_blk_min_elmts) + 1), "setting first element of array's fourth data block");
/* Close down testing parameters */
finish_tparam(&tparam);