diff --git a/src/H5Dearray.c b/src/H5Dearray.c index e9dbd0d757..240afb713b 100644 --- a/src/H5Dearray.c +++ b/src/H5Dearray.c @@ -1137,7 +1137,7 @@ H5D__earray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *uda H5VM_swizzle_coords(hsize_t, swizzled_coords, idx_info->layout->u.earray.unlim_dim); /* Calculate the index of this chunk */ - idx = H5VM_chunk_index(ndims, swizzled_coords, idx_info->layout->u.earray.swizzled_dim, idx_info->layout->u.earray.swizzled_down_chunks); + idx = H5VM_chunk_index(ndims, swizzled_coords, idx_info->layout->u.earray.swizzled_dim, idx_info->layout->u.earray.swizzled_max_down_chunks); } /* end if */ else { /* Calculate the index of this chunk */ @@ -1202,7 +1202,8 @@ H5D__earray_idx_resize(H5O_layout_chunk_t *layout) /* "Swizzle" constant dimensions for this dataset */ if(layout->u.earray.unlim_dim > 0) { - hsize_t swizzled_chunks[H5O_LAYOUT_NDIMS]; /* Swizzled form of # of chunks in each dimension */ + hsize_t swizzled_chunks[H5O_LAYOUT_NDIMS]; /* Swizzled form of # of chunks in each dimension */ + hsize_t swizzled_max_chunks[H5O_LAYOUT_NDIMS]; /* Swizzled form of max # of chunks in each dimension */ /* Get the swizzled chunk dimensions */ HDmemcpy(layout->u.earray.swizzled_dim, layout->dim, (layout->ndims - 1) * sizeof(layout->dim[0])); @@ -1215,6 +1216,14 @@ H5D__earray_idx_resize(H5O_layout_chunk_t *layout) /* Get the swizzled "down" sizes for each dimension */ if(H5VM_array_down((layout->ndims - 1), swizzled_chunks, layout->u.earray.swizzled_down_chunks) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute swizzled 'down' chunk size value") + + /* Get the swizzled max number of chunks in each dimension */ + HDmemcpy(swizzled_max_chunks, layout->max_chunks, (layout->ndims - 1) * sizeof(swizzled_max_chunks[0])); + H5VM_swizzle_coords(hsize_t, swizzled_max_chunks, layout->u.earray.unlim_dim); + + /* Get the swizzled max "down" sizes for each dimension */ + if(H5VM_array_down((layout->ndims - 1), swizzled_max_chunks, layout->u.earray.swizzled_max_down_chunks) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute swizzled 'down' chunk size value") } /* end if */ done: @@ -1414,7 +1423,7 @@ H5D__earray_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t H5VM_swizzle_coords(hsize_t, swizzled_coords, idx_info->layout->u.earray.unlim_dim); /* Calculate the index of this chunk */ - idx = H5VM_chunk_index(ndims, swizzled_coords, idx_info->layout->u.earray.swizzled_dim, idx_info->layout->u.earray.swizzled_down_chunks); + idx = H5VM_chunk_index(ndims, swizzled_coords, idx_info->layout->u.earray.swizzled_dim, idx_info->layout->u.earray.swizzled_max_down_chunks); } /* end if */ else { /* Calculate the index of this chunk */ diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index f0fbe72d23..0a4ed748f9 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -584,6 +584,7 @@ typedef struct H5O_layout_chunk_earray_t { unsigned unlim_dim; /* Rank of unlimited dimension for dataset */ uint32_t swizzled_dim[H5O_LAYOUT_NDIMS]; /* swizzled chunk dimensions */ hsize_t swizzled_down_chunks[H5O_LAYOUT_NDIMS]; /* swizzled "down" size of number of chunks in each dimension */ + hsize_t swizzled_max_down_chunks[H5O_LAYOUT_NDIMS]; /* swizzled max "down" size of number of chunks in each dimension */ } H5O_layout_chunk_earray_t; typedef struct H5O_layout_chunk_bt2_t { diff --git a/test/fheap.c b/test/fheap.c index 77de4a8842..d2a7900b39 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -553,7 +553,7 @@ begin_test(fheap_test_param_t *tparam, const char *base_desc, del_str = get_del_string(tparam); HDassert(del_str); test_desc = (char *)H5MM_malloc(HDstrlen(del_str) + HDstrlen(base_desc)); - sprintf(test_desc, base_desc, del_str); + HDsprintf(test_desc, base_desc, del_str); TESTING(test_desc); H5MM_xfree(del_str); H5MM_xfree(test_desc); @@ -7683,10 +7683,10 @@ test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_ TESTING("incremental object insertion and removal") for(i = 0; i < 100; i++) { - sprintf(obj1.b, "%s%d", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", i); + HDsprintf(obj1.b, "%s%d", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", i); for(j = 0; j < i; j++) { - sprintf(obj2.b, "%s%d", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", j); + HDsprintf(obj2.b, "%s%d", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", j); if(H5HF_remove(fh, dxpl, heap_id[j]) < 0) FAIL_STACK_ERROR @@ -16393,7 +16393,7 @@ main(void) * running time will be long. */ if(ExpressMode > 1) - printf("***Express test mode on. Some tests may be skipped\n"); + HDprintf("***Express test mode on. Some tests may be skipped\n"); else if(ExpressMode == 0) num_pb_fs = NUM_PB_FS; @@ -16475,12 +16475,12 @@ main(void) switch(curr_test) { /* "Normal" testing parameters */ case FHEAP_TEST_NORMAL: - puts("Testing with normal parameters"); + HDputs("Testing with normal parameters"); break; /* "Re-open heap" testing parameters */ case FHEAP_TEST_REOPEN: - puts("Testing with reopen heap flag set"); + HDputs("Testing with reopen heap flag set"); tparam.reopen_heap = FHEAP_TEST_REOPEN; break; @@ -16512,12 +16512,12 @@ main(void) switch(fill) { /* "Bulk fill" heap blocks with 'large' objects */ case FHEAP_TEST_FILL_LARGE: - puts("Bulk-filling blocks w/large objects"); + HDputs("Bulk-filling blocks w/large objects"); break; /* "Bulk fill" heap blocks with 'single' objects */ case FHEAP_TEST_FILL_SINGLE: - puts("Bulk-filling blocks w/single object"); + HDputs("Bulk-filling blocks w/single object"); break; /* An unknown test? */ @@ -16568,25 +16568,25 @@ main(void) * level of complexity gradually. -QAK */ if(ExpressMode > 1) - printf("***Express test mode on. test_man_start_5th_recursive_indirect is skipped\n"); + HDprintf("***Express test mode on. test_man_start_5th_recursive_indirect is skipped\n"); else nerrors += test_man_start_5th_recursive_indirect(fapl, &small_cparam, &tparam); /* * Test fractal heap object deletion */ - /* Simple removal */ - nerrors += test_man_remove_bogus(fapl, &small_cparam, &tparam); - nerrors += test_man_remove_one(fapl, &small_cparam, &tparam); - nerrors += test_man_remove_two(fapl, &small_cparam, &tparam); - nerrors += test_man_remove_one_larger(fapl, &small_cparam, &tparam); - tparam.del_dir = FHEAP_DEL_FORWARD; - nerrors += test_man_remove_two_larger(fapl, &small_cparam, &tparam); - tparam.del_dir = FHEAP_DEL_REVERSE; - nerrors += test_man_remove_two_larger(fapl, &small_cparam, &tparam); - tparam.del_dir = FHEAP_DEL_FORWARD; - nerrors += test_man_remove_three_larger(fapl, &small_cparam, &tparam); - tparam.del_dir = FHEAP_DEL_REVERSE; + /* Simple removal */ + nerrors += test_man_remove_bogus(fapl, &small_cparam, &tparam); + nerrors += test_man_remove_one(fapl, &small_cparam, &tparam); + nerrors += test_man_remove_two(fapl, &small_cparam, &tparam); + nerrors += test_man_remove_one_larger(fapl, &small_cparam, &tparam); + tparam.del_dir = FHEAP_DEL_FORWARD; + nerrors += test_man_remove_two_larger(fapl, &small_cparam, &tparam); + tparam.del_dir = FHEAP_DEL_REVERSE; + nerrors += test_man_remove_two_larger(fapl, &small_cparam, &tparam); + tparam.del_dir = FHEAP_DEL_FORWARD; + nerrors += test_man_remove_three_larger(fapl, &small_cparam, &tparam); + tparam.del_dir = FHEAP_DEL_REVERSE; nerrors += test_man_remove_three_larger(fapl, &small_cparam, &tparam); /* Incremental insert & removal */ @@ -16613,7 +16613,7 @@ main(void) nerrors += test_man_remove_first_two_rows(fapl, &small_cparam, &tparam); nerrors += test_man_remove_first_four_rows(fapl, &small_cparam, &tparam); if(ExpressMode > 1) - printf("***Express test mode on. Some tests skipped\n"); + HDprintf("***Express test mode on. Some tests skipped\n"); else { nerrors += test_man_remove_all_root_direct(fapl, &small_cparam, &tparam); nerrors += test_man_remove_2nd_indirect(fapl, &small_cparam, &tparam); @@ -16643,7 +16643,7 @@ main(void) nerrors += test_man_fill_3rd_direct_less_one_fill_direct_wrap_start_block_add_skipped(fapl, &small_cparam, &tparam); nerrors += test_man_fill_1st_row_3rd_direct_fill_2nd_direct_less_one_wrap_start_block_add_skipped(fapl, &small_cparam, &tparam); if(ExpressMode > 1) - printf("***Express test mode on. Some tests skipped\n"); + HDprintf("***Express test mode on. Some tests skipped\n"); else { nerrors += test_man_fill_3rd_direct_fill_direct_skip_start_block_add_skipped(fapl, &small_cparam, &tparam); nerrors += test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_block_add_skipped(fapl, &small_cparam, &tparam); @@ -16684,12 +16684,12 @@ main(void) switch(id_len) { /* Use "normal" form for 'huge' object's heap IDs */ case 0: - puts("Using 'normal' heap ID format for 'huge' objects"); + HDputs("Using 'normal' heap ID format for 'huge' objects"); break; /* Use "direct" form for 'huge' object's heap IDs */ case 1: - puts("Using 'direct' heap ID format for 'huge' objects"); + HDputs("Using 'direct' heap ID format for 'huge' objects"); /* Adjust actual length of heap IDs for directly storing 'huge' object's file offset & length in heap ID */ tparam.actual_id_len = 17; /* 1 + 8 (file address size) + 8 (file length size) */ @@ -16698,7 +16698,7 @@ main(void) /* Use "direct" storage for 'huge' objects and larger IDs for 'tiny' objects */ case 2: small_cparam.id_len = 37; - puts("Using 'direct' heap ID format for 'huge' objects and larger IDs for 'tiny' objects"); + HDputs("Using 'direct' heap ID format for 'huge' objects and larger IDs for 'tiny' objects"); tparam.actual_id_len = 37; break; @@ -16756,10 +16756,10 @@ main(void) /* Random object insertion & deletion */ if(ExpressMode > 1) - printf("***Express test mode on. Some tests skipped\n"); + HDprintf("***Express test mode on. Some tests skipped\n"); else { /* Random tests using "small" heap creation parameters */ - puts("Using 'small' heap creation parameters"); + HDputs("Using 'small' heap creation parameters"); /* (reduce size of tests when re-opening each time) */ /* XXX: Try to speed things up enough that these tests don't have to be reduced when re-opening */ @@ -16772,7 +16772,7 @@ main(void) nerrors += test_random_pow2((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100*1000*1000) : (hsize_t)(4*1000*1000)), fapl, &small_cparam, &tparam); /* Random tests using "large" heap creation parameters */ - puts("Using 'large' heap creation parameters"); + HDputs("Using 'large' heap creation parameters"); tparam.actual_id_len = LARGE_HEAP_ID_LEN; /* (reduce size of tests when re-opening each time) */ @@ -16818,7 +16818,7 @@ main(void) if(nerrors) goto error; - puts("All fractal heap tests passed."); + HDputs("All fractal heap tests passed."); /* Release space for the shared objects */ H5MM_xfree(shared_wobj_g); @@ -16840,7 +16840,7 @@ HDfprintf(stderr, "Uncomment cleanup!\n"); return 0; error: - puts("*** TESTS FAILED ***"); + HDputs("*** TESTS FAILED ***"); H5E_BEGIN_TRY { H5MM_xfree(shared_wobj_g); H5MM_xfree(shared_robj_g); diff --git a/test/set_extent.c b/test/set_extent.c index 949120b6ca..052a35aebf 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -2603,15 +2603,6 @@ static int test_random_rank4( hid_t fapl, hid_t dcpl, hbool_t do_fillvalue, volatile unsigned i, j, k, l, m; /* Local indices */ char filename[NAME_BUF_SIZE]; - /* *** FIXME *** - * Skip the test if an extensible array index is requested, as resizing - * them is broken. - * - * Remove these lines as appropriate when these problems are fixed. - */ - if(index_type == RANK4_INDEX_EARRAY) - return 0; - /* create a new file */ h5_fixname(FILENAME[4], fapl, filename, sizeof filename); if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) @@ -2816,15 +2807,6 @@ static int test_random_rank4_vl( hid_t fapl, hid_t dcpl, hbool_t do_fillvalue, volatile unsigned i, j, k, l, m; /* Local indices */ char filename[NAME_BUF_SIZE]; - /* *** FIXME *** - * Skip the test if an extensible array index is requested, as resizing - * them is broken. - * - * Remove these lines as appropriate when these problems are fixed. - */ - if(index_type == RANK4_INDEX_EARRAY) - return 0; - /* Initialize fill value buffers so they aren't freed in case of an error */ fill_value.len = 0; fill_value.p = NULL;