diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-09-30 14:27:10 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-09-30 14:27:10 (GMT) |
commit | b2d661b508a7fc7a2592c13bc6bdc175551f075d (patch) | |
tree | 13baeb0d83a7c2a4c6299993c182b1227c2f6114 /test/vds.c | |
parent | 29ab58b58dce556639ea3154e262895773a8a8df (diff) | |
download | hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.zip hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.gz hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.bz2 |
Clang-format of source files
Diffstat (limited to 'test/vds.c')
-rw-r--r-- | test/vds.c | 8414 |
1 files changed, 4207 insertions, 4207 deletions
@@ -29,35 +29,22 @@ typedef enum { TEST_API_NTESTS } test_api_config_t; -const char *FILENAME[] = { - "vds_virt_0", - "vds_virt_1", - "vds_src_0", - "vds_src_1", - "vds%%_src", - "vds_dapl", - "vds_virt_2", - "vds_virt_3", - "vds_src_2", - "vds_src_3", - "vds%%_src2", - "vds_dapl2", - NULL -}; +const char *FILENAME[] = {"vds_virt_0", "vds_virt_1", "vds_src_0", "vds_src_1", "vds%%_src", + "vds_dapl", "vds_virt_2", "vds_virt_3", "vds_src_2", "vds_src_3", + "vds%%_src2", "vds_dapl2", NULL}; /* I/O test config flags */ -#define TEST_IO_CLOSE_SRC 0x01u -#define TEST_IO_DIFFERENT_FILE 0x02u -#define TEST_IO_REOPEN_VIRT 0x04u -#define TEST_IO_NTESTS 0x08u +#define TEST_IO_CLOSE_SRC 0x01u +#define TEST_IO_DIFFERENT_FILE 0x02u +#define TEST_IO_REOPEN_VIRT 0x04u +#define TEST_IO_NTESTS 0x08u #define LIST_DOUBLE_SIZE (H5D_VIRTUAL_DEF_LIST_SIZE + 1) -#define FILENAME_BUF_SIZE 1024 +#define FILENAME_BUF_SIZE 1024 -#define TMPDIR "tmp_vds/" +#define TMPDIR "tmp_vds/" - /*------------------------------------------------------------------------- * Function: vds_select_equal * @@ -71,126 +58,126 @@ const char *FILENAME[] = { static htri_t vds_select_equal(hid_t space1, hid_t space2) { - H5S_sel_type type1; - H5S_sel_type type2; - hsize_t *buf1 = NULL; - hsize_t *buf2 = NULL; - size_t i; - htri_t ret_value = TRUE; + H5S_sel_type type1; + H5S_sel_type type2; + hsize_t * buf1 = NULL; + hsize_t * buf2 = NULL; + size_t i; + htri_t ret_value = TRUE; /* Get and compare selection types */ - if((type1 = H5Sget_select_type(space1)) < 0) + if ((type1 = H5Sget_select_type(space1)) < 0) TEST_ERROR - if((type2 = H5Sget_select_type(space2)) < 0) + if ((type2 = H5Sget_select_type(space2)) < 0) TEST_ERROR - if(type1 != type2) + if (type1 != type2) return FALSE; /* Check selection type */ - switch(type1) { + switch (type1) { case H5S_SEL_NONE: case H5S_SEL_ALL: break; - case H5S_SEL_POINTS: - { - int rank1; - int rank2; - hssize_t npoints1; - hssize_t npoints2; + case H5S_SEL_POINTS: { + int rank1; + int rank2; + hssize_t npoints1; + hssize_t npoints2; - /* Get and compare rank */ - if((rank1 = H5Sget_simple_extent_ndims(space1)) < 0) - TEST_ERROR - if((rank2 = H5Sget_simple_extent_ndims(space2)) < 0) - TEST_ERROR - if(rank1 != rank2) - return FALSE; + /* Get and compare rank */ + if ((rank1 = H5Sget_simple_extent_ndims(space1)) < 0) + TEST_ERROR + if ((rank2 = H5Sget_simple_extent_ndims(space2)) < 0) + TEST_ERROR + if (rank1 != rank2) + return FALSE; - /* Get and compare number of points */ - if((npoints1 = H5Sget_select_elem_npoints(space1)) < 0) - TEST_ERROR - if((npoints2 = H5Sget_select_elem_npoints(space2)) < 0) - TEST_ERROR - if(npoints1 != npoints2) - return FALSE; + /* Get and compare number of points */ + if ((npoints1 = H5Sget_select_elem_npoints(space1)) < 0) + TEST_ERROR + if ((npoints2 = H5Sget_select_elem_npoints(space2)) < 0) + TEST_ERROR + if (npoints1 != npoints2) + return FALSE; - /* Allocate point lists. Do not return directly after - * allocating, to make sure buffers are freed. */ - if(NULL == (buf1 = (hsize_t *)HDmalloc((size_t)rank1 * (size_t)npoints1 * sizeof(hsize_t)))) - TEST_ERROR - if(NULL == (buf2 = (hsize_t *)HDmalloc((size_t)rank1 * (size_t)npoints1 * sizeof(hsize_t)))) - TEST_ERROR + /* Allocate point lists. Do not return directly after + * allocating, to make sure buffers are freed. */ + if (NULL == (buf1 = (hsize_t *)HDmalloc((size_t)rank1 * (size_t)npoints1 * sizeof(hsize_t)))) + TEST_ERROR + if (NULL == (buf2 = (hsize_t *)HDmalloc((size_t)rank1 * (size_t)npoints1 * sizeof(hsize_t)))) + TEST_ERROR - /* Get and compare point lists */ - if(H5Sget_select_elem_pointlist(space1, (hsize_t)0, (hsize_t)npoints1, buf1) < 0) - TEST_ERROR - if(H5Sget_select_elem_pointlist(space2, (hsize_t)0, (hsize_t)npoints1, buf2) < 0) - TEST_ERROR - for(i = 0; i < ((size_t)rank1 * (size_t)npoints1); i++) - if(buf1[i] != buf2[i]) { - ret_value = FALSE; - break; - } + /* Get and compare point lists */ + if (H5Sget_select_elem_pointlist(space1, (hsize_t)0, (hsize_t)npoints1, buf1) < 0) + TEST_ERROR + if (H5Sget_select_elem_pointlist(space2, (hsize_t)0, (hsize_t)npoints1, buf2) < 0) + TEST_ERROR + for (i = 0; i < ((size_t)rank1 * (size_t)npoints1); i++) + if (buf1[i] != buf2[i]) { + ret_value = FALSE; + break; + } - /* Free buffers */ - HDfree(buf1); - buf1 = NULL; - HDfree(buf2); - buf2 = NULL; - } /* end block */ + /* Free buffers */ + HDfree(buf1); + buf1 = NULL; + HDfree(buf2); + buf2 = NULL; + } /* end block */ - break; + break; - case H5S_SEL_HYPERSLABS: - { - int rank1; - int rank2; - hssize_t nblocks1; - hssize_t nblocks2; + case H5S_SEL_HYPERSLABS: { + int rank1; + int rank2; + hssize_t nblocks1; + hssize_t nblocks2; - /* Get and compare rank */ - if((rank1 = H5Sget_simple_extent_ndims(space1)) < 0) - TEST_ERROR - if((rank2 = H5Sget_simple_extent_ndims(space2)) < 0) - TEST_ERROR - if(rank1 != rank2) - return FALSE; + /* Get and compare rank */ + if ((rank1 = H5Sget_simple_extent_ndims(space1)) < 0) + TEST_ERROR + if ((rank2 = H5Sget_simple_extent_ndims(space2)) < 0) + TEST_ERROR + if (rank1 != rank2) + return FALSE; - /* Get and compare number of blocks */ - if((nblocks1 = H5Sget_select_hyper_nblocks(space1)) < 0) - TEST_ERROR - if((nblocks2 = H5Sget_select_hyper_nblocks(space2)) < 0) - TEST_ERROR - if(nblocks1 != nblocks2) - return FALSE; + /* Get and compare number of blocks */ + if ((nblocks1 = H5Sget_select_hyper_nblocks(space1)) < 0) + TEST_ERROR + if ((nblocks2 = H5Sget_select_hyper_nblocks(space2)) < 0) + TEST_ERROR + if (nblocks1 != nblocks2) + return FALSE; - /* Allocate block lists. Do not return directly afer - * allocating, to make sure buffers are freed. */ - if(NULL == (buf1 = (hsize_t *)HDmalloc((size_t)2 * (size_t)rank1 * (size_t)nblocks1 * sizeof(*buf1)))) - TEST_ERROR - if(NULL == (buf2 = (hsize_t *)HDmalloc((size_t)2 * (size_t)rank1 * (size_t)nblocks1 * sizeof(*buf2)))) - TEST_ERROR + /* Allocate block lists. Do not return directly afer + * allocating, to make sure buffers are freed. */ + if (NULL == + (buf1 = (hsize_t *)HDmalloc((size_t)2 * (size_t)rank1 * (size_t)nblocks1 * sizeof(*buf1)))) + TEST_ERROR + if (NULL == + (buf2 = (hsize_t *)HDmalloc((size_t)2 * (size_t)rank1 * (size_t)nblocks1 * sizeof(*buf2)))) + TEST_ERROR - /* Get and compare block lists */ - if(H5Sget_select_hyper_blocklist(space1, (hsize_t)0, (hsize_t)nblocks1, buf1) < 0) - TEST_ERROR - if(H5Sget_select_hyper_blocklist(space2, (hsize_t)0, (hsize_t)nblocks1, buf2) < 0) - TEST_ERROR - for(i = 0; i < ((size_t)2 * (size_t)rank1 * (size_t)nblocks1); i++) - if(buf1[i] != buf2[i]) { - ret_value = FALSE; - break; - } + /* Get and compare block lists */ + if (H5Sget_select_hyper_blocklist(space1, (hsize_t)0, (hsize_t)nblocks1, buf1) < 0) + TEST_ERROR + if (H5Sget_select_hyper_blocklist(space2, (hsize_t)0, (hsize_t)nblocks1, buf2) < 0) + TEST_ERROR + for (i = 0; i < ((size_t)2 * (size_t)rank1 * (size_t)nblocks1); i++) + if (buf1[i] != buf2[i]) { + ret_value = FALSE; + break; + } - /* Free buffers */ - HDfree(buf1); - buf1 = NULL; - HDfree(buf2); - buf2 = NULL; - } /* end block */ + /* Free buffers */ + HDfree(buf1); + buf1 = NULL; + HDfree(buf2); + buf2 = NULL; + } /* end block */ - break; + break; case H5S_SEL_ERROR: case H5S_SEL_N: @@ -201,15 +188,14 @@ vds_select_equal(hid_t space1, hid_t space2) return ret_value; error: - if(buf1) + if (buf1) HDfree(buf1); - if(buf2) + if (buf2) HDfree(buf2); return -1; } /* end vds_select_equal() */ - /*------------------------------------------------------------------------- * Function: vds_check_mapping * @@ -222,13 +208,13 @@ error: *------------------------------------------------------------------------- */ static int -vds_check_mapping(hid_t dcpl, size_t i, hid_t vspace, hid_t srcspace, - const char *filename, const char *dsetname) +vds_check_mapping(hid_t dcpl, size_t i, hid_t vspace, hid_t srcspace, const char *filename, + const char *dsetname) { - hid_t space_out = -1; - char name_out[32]; - htri_t tri_ret; - ssize_t str_len; + hid_t space_out = -1; + char name_out[32]; + htri_t tri_ret; + ssize_t str_len; HDassert(dcpl >= 0); HDassert(vspace >= 0); @@ -237,68 +223,66 @@ vds_check_mapping(hid_t dcpl, size_t i, hid_t vspace, hid_t srcspace, HDassert(dsetname); /* Check vspace */ - if((space_out = H5Pget_virtual_vspace(dcpl, i)) < 0) + if ((space_out = H5Pget_virtual_vspace(dcpl, i)) < 0) TEST_ERROR - if((tri_ret = H5Sextent_equal(space_out, vspace)) < 0) + if ((tri_ret = H5Sextent_equal(space_out, vspace)) < 0) TEST_ERROR - if(!tri_ret) + if (!tri_ret) TEST_ERROR - if((tri_ret = vds_select_equal(space_out, vspace)) < 0) + if ((tri_ret = vds_select_equal(space_out, vspace)) < 0) TEST_ERROR - if(!tri_ret) + if (!tri_ret) TEST_ERROR - if(H5Sclose(space_out) < 0) + if (H5Sclose(space_out) < 0) TEST_ERROR space_out = -1; /* Check srcspace */ - if((space_out = H5Pget_virtual_srcspace(dcpl, i)) < 0) + if ((space_out = H5Pget_virtual_srcspace(dcpl, i)) < 0) TEST_ERROR - if((tri_ret = vds_select_equal(space_out, srcspace)) < 0) + if ((tri_ret = vds_select_equal(space_out, srcspace)) < 0) TEST_ERROR - if(!tri_ret) + if (!tri_ret) TEST_ERROR - if(H5Sclose(space_out) < 0) + if (H5Sclose(space_out) < 0) TEST_ERROR space_out = -1; /* Check filename */ - if((str_len = H5Pget_virtual_filename(dcpl, i, NULL, (size_t)0)) < 0) + if ((str_len = H5Pget_virtual_filename(dcpl, i, NULL, (size_t)0)) < 0) TEST_ERROR - if((size_t)str_len != HDstrlen(filename)) + if ((size_t)str_len != HDstrlen(filename)) TEST_ERROR HDassert((size_t)str_len < sizeof(name_out)); - if((str_len = H5Pget_virtual_filename(dcpl, i, name_out, sizeof(name_out))) < 0) + if ((str_len = H5Pget_virtual_filename(dcpl, i, name_out, sizeof(name_out))) < 0) TEST_ERROR - if((size_t)str_len != HDstrlen(filename)) + if ((size_t)str_len != HDstrlen(filename)) TEST_ERROR - if(HDstrncmp(name_out, filename, (size_t)str_len + 1) != 0) + if (HDstrncmp(name_out, filename, (size_t)str_len + 1) != 0) TEST_ERROR /* Check dsetname */ - if((str_len = H5Pget_virtual_dsetname(dcpl, i, NULL, (size_t)0)) < 0) + if ((str_len = H5Pget_virtual_dsetname(dcpl, i, NULL, (size_t)0)) < 0) TEST_ERROR - if((size_t)str_len != HDstrlen(dsetname)) + if ((size_t)str_len != HDstrlen(dsetname)) TEST_ERROR HDassert((size_t)str_len < sizeof(name_out)); - if((str_len = H5Pget_virtual_dsetname(dcpl, i, name_out, sizeof(name_out))) < 0) + if ((str_len = H5Pget_virtual_dsetname(dcpl, i, name_out, sizeof(name_out))) < 0) TEST_ERROR - if((size_t)str_len != HDstrlen(dsetname)) + if ((size_t)str_len != HDstrlen(dsetname)) TEST_ERROR - if(HDstrncmp(name_out, dsetname, (size_t)str_len + 1) != 0) + if (HDstrncmp(name_out, dsetname, (size_t)str_len + 1) != 0) TEST_ERROR return 0; error: - H5E_BEGIN_TRY { - H5Sclose(space_out); - } H5E_END_TRY + H5E_BEGIN_TRY { H5Sclose(space_out); } + H5E_END_TRY return -1; } /* end vds_check_mapping() */ - /*------------------------------------------------------------------------- * Function: test_api_get_ex_dcpl * @@ -310,15 +294,15 @@ error: */ /* Helper function to get DCPL for examination depending on config */ static int -test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, - hid_t *ex_dcpl, hid_t vspace, char *filename, hsize_t exp_meta_size) +test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, hid_t *ex_dcpl, hid_t vspace, + char *filename, hsize_t exp_meta_size) { - hid_t file = -1; /* File */ - hid_t dset = -1; /* Virtual dataset */ - H5D_space_status_t space_status; /* Dataset space status */ - void *plist_buf = NULL; /* Serialized property list buffer */ - H5O_native_info_t ninfo; /* Object info struct */ - htri_t tri_ret; + hid_t file = -1; /* File */ + hid_t dset = -1; /* Virtual dataset */ + H5D_space_status_t space_status; /* Dataset space status */ + void * plist_buf = NULL; /* Serialized property list buffer */ + H5O_native_info_t ninfo; /* Object info struct */ + htri_t tri_ret; HDassert((config >= TEST_API_BASIC) && (config < TEST_API_NTESTS)); HDassert(fapl >= 0); @@ -329,106 +313,107 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, HDassert(filename); /* Take different action depending on test configuration */ - if(config >= TEST_API_CREATE_DSET) { + if (config >= TEST_API_CREATE_DSET) { /* Create file and dataset */ - if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((dset = H5Dcreate2(file, "vdset", H5T_NATIVE_INT, vspace, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + if ((dset = H5Dcreate2(file, "vdset", H5T_NATIVE_INT, vspace, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR /* Test H5Dget_space_status */ - if(H5Dget_space_status(dset, &space_status) < 0) + if (H5Dget_space_status(dset, &space_status) < 0) TEST_ERROR - if(space_status != H5D_SPACE_STATUS_ALLOCATED) + if (space_status != H5D_SPACE_STATUS_ALLOCATED) TEST_ERROR /* Reopen dataset if requested */ - if(config >= TEST_API_REOPEN_DSET) { + if (config >= TEST_API_REOPEN_DSET) { /* Close dataset */ - if(H5Dclose(dset) < 0) + if (H5Dclose(dset) < 0) TEST_ERROR dset = -1; /* Reopen file if requested */ - if(config == TEST_API_REOPEN_FILE) { - if(H5Fclose(file) < 0) + if (config == TEST_API_REOPEN_FILE) { + if (H5Fclose(file) < 0) TEST_ERROR file = -1; - if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR } /* Open dataset */ - if((dset = H5Dopen2(file, "vdset", H5P_DEFAULT)) < 0) + if ((dset = H5Dopen2(file, "vdset", H5P_DEFAULT)) < 0) TEST_ERROR } /* Get DCPL from dataset */ - if((*ex_dcpl = H5Dget_create_plist(dset)) < 0) + if ((*ex_dcpl = H5Dget_create_plist(dset)) < 0) TEST_ERROR /* Test H5Dget_offset() (just returns HADDR_UNDEF) */ - if(HADDR_UNDEF != H5Dget_offset(dset)) + if (HADDR_UNDEF != H5Dget_offset(dset)) TEST_ERROR /* Test H5Oget_info returns correct metadata size */ - if(H5Oget_native_info(dset, &ninfo, H5O_NATIVE_INFO_META_SIZE) < 0) + if (H5Oget_native_info(dset, &ninfo, H5O_NATIVE_INFO_META_SIZE) < 0) TEST_ERROR - if(ninfo.meta_size.obj.index_size != (hsize_t)0) + if (ninfo.meta_size.obj.index_size != (hsize_t)0) TEST_ERROR - if(config == TEST_API_REOPEN_FILE) { - if(ninfo.meta_size.obj.heap_size != exp_meta_size) { - HDprintf("VDS metadata size: %llu Expected: %llu\n", (long long unsigned)ninfo.meta_size.obj.heap_size, (long long unsigned)exp_meta_size); + if (config == TEST_API_REOPEN_FILE) { + if (ninfo.meta_size.obj.heap_size != exp_meta_size) { + HDprintf("VDS metadata size: %llu Expected: %llu\n", + (long long unsigned)ninfo.meta_size.obj.heap_size, + (long long unsigned)exp_meta_size); TEST_ERROR } } - else - if((ninfo.meta_size.obj.heap_size != exp_meta_size) - && (ninfo.meta_size.obj.heap_size != (hsize_t)0)) - TEST_ERROR - if(ninfo.meta_size.attr.index_size != (hsize_t)0) + else if ((ninfo.meta_size.obj.heap_size != exp_meta_size) && + (ninfo.meta_size.obj.heap_size != (hsize_t)0)) + TEST_ERROR + if (ninfo.meta_size.attr.index_size != (hsize_t)0) TEST_ERROR - if(ninfo.meta_size.attr.index_size != (hsize_t)0) + if (ninfo.meta_size.attr.index_size != (hsize_t)0) TEST_ERROR /* Test H5Dget_space_status */ - if(H5Dget_space_status(dset, &space_status) < 0) + if (H5Dget_space_status(dset, &space_status) < 0) TEST_ERROR - if(space_status != H5D_SPACE_STATUS_ALLOCATED) + if (space_status != H5D_SPACE_STATUS_ALLOCATED) TEST_ERROR /* Close dataset */ - if(H5Dclose(dset) < 0) + if (H5Dclose(dset) < 0) TEST_ERROR dset = -1; /* Delete dataset */ - if(H5Ldelete(file, "vdset", H5P_DEFAULT) < 0) + if (H5Ldelete(file, "vdset", H5P_DEFAULT) < 0) TEST_ERROR /* Close file */ - if(H5Fclose(file) < 0) + if (H5Fclose(file) < 0) TEST_ERROR file = -1; } - else if(config == TEST_API_COPY_PLIST) { + else if (config == TEST_API_COPY_PLIST) { /* Copy property list */ - if((*ex_dcpl = H5Pcopy(dcpl)) < 0) + if ((*ex_dcpl = H5Pcopy(dcpl)) < 0) TEST_ERROR } - else if(config == TEST_API_ENCDEC_PLIST) { + else if (config == TEST_API_ENCDEC_PLIST) { size_t plist_buf_size; /* Encode property list to plist_buf */ - if(H5Pencode2(dcpl, NULL, &plist_buf_size, fapl) < 0) + if (H5Pencode2(dcpl, NULL, &plist_buf_size, fapl) < 0) TEST_ERROR - if(NULL == (plist_buf = HDmalloc(plist_buf_size))) + if (NULL == (plist_buf = HDmalloc(plist_buf_size))) TEST_ERROR - if(H5Pencode2(dcpl, plist_buf, &plist_buf_size, fapl) < 0) + if (H5Pencode2(dcpl, plist_buf, &plist_buf_size, fapl) < 0) TEST_ERROR /* Decode serialized property list to *ex_dcpl */ - if((*ex_dcpl = H5Pdecode(plist_buf)) < 0) + if ((*ex_dcpl = H5Pdecode(plist_buf)) < 0) TEST_ERROR /* Free plist_buf */ @@ -438,7 +423,7 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, else { /* Simply copy the id to ex_dcpl and increment the ref count so ex_dcpl * can be closed */ - if(H5Iinc_ref(dcpl) < 0) + if (H5Iinc_ref(dcpl) < 0) TEST_ERROR *ex_dcpl = dcpl; } @@ -447,21 +432,23 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, * plist to itself, and do not do the comparison if we reopened the file, * because in that case the extent of the source dset will not be corrent. */ - if((*ex_dcpl != dcpl) && (config != TEST_API_REOPEN_FILE)) { - if((tri_ret = H5Pequal(dcpl, *ex_dcpl)) < 0) + if ((*ex_dcpl != dcpl) && (config != TEST_API_REOPEN_FILE)) { + if ((tri_ret = H5Pequal(dcpl, *ex_dcpl)) < 0) TEST_ERROR - if(!tri_ret) + if (!tri_ret) TEST_ERROR } return 0; error: - H5E_BEGIN_TRY { + H5E_BEGIN_TRY + { H5Fclose(file); H5Dclose(dset); - } H5E_END_TRY; - if(plist_buf) + } + H5E_END_TRY; + if (plist_buf) HDfree(plist_buf); return -1; @@ -472,29 +459,31 @@ static int test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low) { char filename[FILENAME_BUF_SIZE]; - hid_t dcpl = -1; /* Dataset creation property list */ - hid_t ex_dcpl = -1; /* Temporary dcpl for examination */ + hid_t dcpl = -1; /* Dataset creation property list */ + hid_t ex_dcpl = -1; /* Temporary dcpl for examination */ hid_t srcspace[4] = {-1, -1, -1, -1}; /* Source dataspaces */ - hid_t vspace[LIST_DOUBLE_SIZE]; /* Virtual dset dataspaces */ - const char *src_file[4] = {"src_file1", "src_file2.", "src_file3..", "src_file4..."}; /* Source file names (different lengths) */ - const char *src_dset[4] = {"src_dset1....", "src_dset2.....", "src_dset3......", "src_dset4......."}; /* Source dataset names (different lengths) */ + hid_t vspace[LIST_DOUBLE_SIZE]; /* Virtual dset dataspaces */ + const char *src_file[4] = {"src_file1", "src_file2.", "src_file3..", + "src_file4..."}; /* Source file names (different lengths) */ + const char *src_dset[4] = {"src_dset1....", "src_dset2.....", "src_dset3......", + "src_dset4......."}; /* Source dataset names (different lengths) */ char tmp_filename[32]; char tmp_dsetname[32]; hsize_t dims[2] = {10, 20}; /* Data space current size */ - hsize_t start[2]; /* Hyperslab start */ - hsize_t stride[2]; /* Hyperslab stride */ - hsize_t count[2]; /* Hyperslab count */ - hsize_t block[2]; /* Hyperslab block */ - hsize_t coord[10]; /* Point selection array */ + hsize_t start[2]; /* Hyperslab start */ + hsize_t stride[2]; /* Hyperslab stride */ + hsize_t count[2]; /* Hyperslab count */ + hsize_t block[2]; /* Hyperslab block */ + hsize_t coord[10]; /* Point selection array */ size_t size_out; herr_t ret; unsigned i; /* Initialize vspace */ - for(i = 0; i < (unsigned)(sizeof(vspace) / sizeof(vspace[0])); i++) + for (i = 0; i < (unsigned)(sizeof(vspace) / sizeof(vspace[0])); i++) vspace[i] = -1; - switch(config) { + switch (config) { case TEST_API_BASIC: TESTING("virtual dataset API functions") break; @@ -521,82 +510,80 @@ test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); /* Create DCPL */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR - /* * Test 1: All - all selection */ /* Create source dataspace */ - if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Create virtual dataspace */ - if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + if ((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Select all (should not be necessary, but just to be sure) */ - if(H5Sselect_all(srcspace[0]) < 0) + if (H5Sselect_all(srcspace[0]) < 0) TEST_ERROR - if(H5Sselect_all(vspace[0]) < 0) + if (H5Sselect_all(vspace[0]) < 0) TEST_ERROR /* Add virtual layout mapping */ - if(H5Pset_virtual(dcpl, vspace[0], src_file[0], src_dset[0], srcspace[0]) < 0) + if (H5Pset_virtual(dcpl, vspace[0], src_file[0], src_dset[0], srcspace[0]) < 0) TEST_ERROR /* Get examination DCPL */ - if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)69) < 0) + if (test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)69) < 0) TEST_ERROR /* Test H5Pget_virtual_count */ - if(H5Pget_virtual_count(ex_dcpl, &size_out) < 0) + if (H5Pget_virtual_count(ex_dcpl, &size_out) < 0) TEST_ERROR - if(size_out != (size_t)1) + if (size_out != (size_t)1) TEST_ERROR /* Check that the mapping in the DCPL is correct */ - if(vds_check_mapping(ex_dcpl, (size_t)0, vspace[0], srcspace[0], src_file[0], src_dset[0]) < 0) + if (vds_check_mapping(ex_dcpl, (size_t)0, vspace[0], srcspace[0], src_file[0], src_dset[0]) < 0) TEST_ERROR /* Close */ - if(H5Sclose(srcspace[0]) < 0) + if (H5Sclose(srcspace[0]) < 0) TEST_ERROR srcspace[0] = -1; - if(H5Sclose(vspace[0]) < 0) + if (H5Sclose(vspace[0]) < 0) TEST_ERROR vspace[0] = -1; - if(H5Pclose(ex_dcpl) < 0) + if (H5Pclose(ex_dcpl) < 0) TEST_ERROR ex_dcpl = -1; - /* * Test 2: Hyper - hyper selection */ /* Clear virtual layout in DCPL */ - if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) TEST_ERROR /* Create source dataspace */ - if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Create virtual dataspace */ - if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + if ((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Select regular hyperslab in source space */ - start[0] = 2; - start[1] = 1; + start[0] = 2; + start[1] = 1; stride[0] = 3; stride[1] = 5; - count[0] = 2; - count[1] = 3; - block[0] = 2; - block[1] = 4; - if(H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, stride, count, block) < 0) + count[0] = 2; + count[1] = 3; + block[0] = 2; + block[1] = 4; + if (H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, stride, count, block) < 0) TEST_ERROR /* Select composite hyperslab in virtual space */ @@ -604,60 +591,60 @@ test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low) count[1] = 1; block[0] = 5; block[1] = 6; - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, block) < 0) + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, block) < 0) TEST_ERROR start[0] = 7; start[1] = 0; block[0] = 1; block[1] = 18; - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_OR, start, NULL, count, block) < 0) + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_OR, start, NULL, count, block) < 0) TEST_ERROR /* Add virtual layout mapping */ - if(H5Pset_virtual(dcpl, vspace[0], src_file[0], src_dset[0], srcspace[0]) < 0) + if (H5Pset_virtual(dcpl, vspace[0], src_file[0], src_dset[0], srcspace[0]) < 0) TEST_ERROR /* Get examination DCPL */ - if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, - (low >= H5F_LIBVER_V112)?(hsize_t)99:(low >= H5F_LIBVER_V110?174:213)) < 0) + if (test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, + (low >= H5F_LIBVER_V112) ? (hsize_t)99 : (low >= H5F_LIBVER_V110 ? 174 : 213)) < + 0) TEST_ERROR /* Test H5Pget_virtual_count */ - if(H5Pget_virtual_count(ex_dcpl, &size_out) < 0) + if (H5Pget_virtual_count(ex_dcpl, &size_out) < 0) TEST_ERROR - if(size_out != (size_t)1) + if (size_out != (size_t)1) TEST_ERROR /* Check that the mapping in the DCPL is correct */ - if(vds_check_mapping(ex_dcpl, (size_t)0, vspace[0], srcspace[0], src_file[0], src_dset[0]) < 0) + if (vds_check_mapping(ex_dcpl, (size_t)0, vspace[0], srcspace[0], src_file[0], src_dset[0]) < 0) TEST_ERROR /* Close */ - if(H5Sclose(srcspace[0]) < 0) + if (H5Sclose(srcspace[0]) < 0) TEST_ERROR srcspace[0] = -1; - if(H5Sclose(vspace[0]) < 0) + if (H5Sclose(vspace[0]) < 0) TEST_ERROR vspace[0] = -1; - if(H5Pclose(ex_dcpl) < 0) + if (H5Pclose(ex_dcpl) < 0) TEST_ERROR ex_dcpl = -1; - #ifdef VDS_POINT_SELECTIONS /* VDS does not currently support point selections */ /* * Test 3: Point - point selection */ /* Clear virtual layout in DCPL */ - if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) TEST_ERROR /* Create source dataspace */ - if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Create virtual dataspace */ - if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + if ((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Select points in source space */ @@ -671,7 +658,7 @@ test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low) coord[7] = 14; coord[8] = 8; coord[9] = 18; - if(H5Sselect_elements(srcspace[0], H5S_SELECT_SET, (size_t)5, coord) < 0) + if (H5Sselect_elements(srcspace[0], H5S_SELECT_SET, (size_t)5, coord) < 0) TEST_ERROR /* Select points in virtual space */ @@ -685,52 +672,51 @@ test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low) coord[7] = 11; coord[8] = 5; coord[9] = 5; - if(H5Sselect_elements(vspace[0], H5S_SELECT_SET, (size_t)5, coord) < 0) + if (H5Sselect_elements(vspace[0], H5S_SELECT_SET, (size_t)5, coord) < 0) TEST_ERROR /* Add virtual layout mapping */ - if(H5Pset_virtual(dcpl, vspace[0], src_file[0], src_dset[0], srcspace[0]) < 0) + if (H5Pset_virtual(dcpl, vspace[0], src_file[0], src_dset[0], srcspace[0]) < 0) TEST_ERROR /* Get examination DCPL */ - if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)0) < 0) + if (test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)0) < 0) TEST_ERROR /* Test H5Pget_virtual_count */ - if(H5Pget_virtual_count(ex_dcpl, &size_out) < 0) + if (H5Pget_virtual_count(ex_dcpl, &size_out) < 0) TEST_ERROR - if(size_out != (size_t)1) + if (size_out != (size_t)1) TEST_ERROR /* Check that the mapping in the DCPL is correct */ - if(vds_check_mapping(ex_dcpl, (size_t)0, vspace[0], srcspace[0], src_file[0], src_dset[0]) < 0) + if (vds_check_mapping(ex_dcpl, (size_t)0, vspace[0], srcspace[0], src_file[0], src_dset[0]) < 0) TEST_ERROR /* Close */ - if(H5Sclose(srcspace[0]) < 0) + if (H5Sclose(srcspace[0]) < 0) TEST_ERROR srcspace[0] = -1; - if(H5Sclose(vspace[0]) < 0) + if (H5Sclose(vspace[0]) < 0) TEST_ERROR vspace[0] = -1; - if(H5Pclose(ex_dcpl) < 0) + if (H5Pclose(ex_dcpl) < 0) TEST_ERROR ex_dcpl = -1; - /* * Test 4: Point - hyper selection */ /* Clear virtual layout in DCPL */ - if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) TEST_ERROR /* Create source dataspace */ - if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Create virtual dataspace */ - if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + if ((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Select hyperslab in source space */ @@ -740,7 +726,7 @@ test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low) count[1] = 1; block[0] = 1; block[1] = 5; - if(H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, NULL, count, block) < 0) + if (H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, NULL, count, block) < 0) TEST_ERROR /* Select points in virtual space */ @@ -754,73 +740,72 @@ test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low) coord[7] = 13; coord[8] = 7; coord[9] = 16; - if(H5Sselect_elements(vspace[0], H5S_SELECT_SET, (size_t)5, coord) < 0) + if (H5Sselect_elements(vspace[0], H5S_SELECT_SET, (size_t)5, coord) < 0) TEST_ERROR /* Add virtual layout mapping */ - if(H5Pset_virtual(dcpl, vspace[0], src_file[0], src_dset[0], srcspace[0]) < 0) + if (H5Pset_virtual(dcpl, vspace[0], src_file[0], src_dset[0], srcspace[0]) < 0) TEST_ERROR /* Get examination DCPL */ - if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)0) < 0) + if (test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)0) < 0) TEST_ERROR /* Test H5Pget_virtual_count */ - if(H5Pget_virtual_count(ex_dcpl, &size_out) < 0) + if (H5Pget_virtual_count(ex_dcpl, &size_out) < 0) TEST_ERROR - if(size_out != (size_t)1) + if (size_out != (size_t)1) TEST_ERROR /* Check that the mapping in the DCPL is correct */ - if(vds_check_mapping(ex_dcpl, (size_t)0, vspace[0], srcspace[0], src_file[0], src_dset[0]) < 0) + if (vds_check_mapping(ex_dcpl, (size_t)0, vspace[0], srcspace[0], src_file[0], src_dset[0]) < 0) TEST_ERROR /* Close */ - if(H5Sclose(srcspace[0]) < 0) + if (H5Sclose(srcspace[0]) < 0) TEST_ERROR srcspace[0] = -1; - if(H5Sclose(vspace[0]) < 0) + if (H5Sclose(vspace[0]) < 0) TEST_ERROR vspace[0] = -1; - if(H5Pclose(ex_dcpl) < 0) + if (H5Pclose(ex_dcpl) < 0) TEST_ERROR ex_dcpl = -1; - /* * Test 5: All previous mappings together */ /* Clear virtual layout in DCPL */ - if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) TEST_ERROR /* Create dataspaces */ - for(i = 0; i < 4; i++) { + for (i = 0; i < 4; i++) { /* Create source dataspace */ - if((srcspace[i] = H5Screate_simple(2, dims, NULL)) < 0) + if ((srcspace[i] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Create virtual dataspace */ - if((vspace[i] = H5Screate_simple(2, dims, NULL)) < 0) + if ((vspace[i] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR } /* Select all (should not be necessary, but just to be sure) */ - if(H5Sselect_all(srcspace[0]) < 0) + if (H5Sselect_all(srcspace[0]) < 0) TEST_ERROR - if(H5Sselect_all(vspace[0]) < 0) + if (H5Sselect_all(vspace[0]) < 0) TEST_ERROR /* Select regular hyperslab in source space */ - start[0] = 2; - start[1] = 1; + start[0] = 2; + start[1] = 1; stride[0] = 3; stride[1] = 5; - count[0] = 2; - count[1] = 3; - block[0] = 2; - block[1] = 4; - if(H5Sselect_hyperslab(srcspace[1], H5S_SELECT_SET, start, stride, count, block) < 0) + count[0] = 2; + count[1] = 3; + block[0] = 2; + block[1] = 4; + if (H5Sselect_hyperslab(srcspace[1], H5S_SELECT_SET, start, stride, count, block) < 0) TEST_ERROR /* Select composite hyperslab in virtual space */ @@ -828,13 +813,13 @@ test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low) count[1] = 1; block[0] = 5; block[1] = 6; - if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, count, block) < 0) + if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, count, block) < 0) TEST_ERROR start[0] = 7; start[1] = 0; block[0] = 1; block[1] = 18; - if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_OR, start, NULL, count, block) < 0) + if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_OR, start, NULL, count, block) < 0) TEST_ERROR /* Select points in source space */ @@ -848,7 +833,7 @@ test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low) coord[7] = 14; coord[8] = 8; coord[9] = 18; - if(H5Sselect_elements(srcspace[2], H5S_SELECT_SET, (size_t)5, coord) < 0) + if (H5Sselect_elements(srcspace[2], H5S_SELECT_SET, (size_t)5, coord) < 0) TEST_ERROR /* Select points in virtual space */ @@ -862,7 +847,7 @@ test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low) coord[7] = 11; coord[8] = 5; coord[9] = 5; - if(H5Sselect_elements(vspace[2], H5S_SELECT_SET, (size_t)5, coord) < 0) + if (H5Sselect_elements(vspace[2], H5S_SELECT_SET, (size_t)5, coord) < 0) TEST_ERROR /* Select hyperslab in source space */ @@ -872,7 +857,7 @@ test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low) count[1] = 1; block[0] = 1; block[1] = 5; - if(H5Sselect_hyperslab(srcspace[3], H5S_SELECT_SET, start, NULL, count, block) < 0) + if (H5Sselect_hyperslab(srcspace[3], H5S_SELECT_SET, start, NULL, count, block) < 0) TEST_ERROR /* Select points in virtual space */ @@ -886,57 +871,57 @@ test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low) coord[7] = 13; coord[8] = 7; coord[9] = 16; - if(H5Sselect_elements(vspace[3], H5S_SELECT_SET, (size_t)5, coord) < 0) + if (H5Sselect_elements(vspace[3], H5S_SELECT_SET, (size_t)5, coord) < 0) TEST_ERROR /* Add virtual layout mappings */ - for(i = 0; i < 4; i++) - if(H5Pset_virtual(dcpl, vspace[i], src_file[i], src_dset[i], srcspace[i]) < 0) + for (i = 0; i < 4; i++) + if (H5Pset_virtual(dcpl, vspace[i], src_file[i], src_dset[i], srcspace[i]) < 0) TEST_ERROR /* Get examination DCPL */ - if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)0) < 0) + if (test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)0) < 0) TEST_ERROR /* Test H5Pget_virtual_count */ - if(H5Pget_virtual_count(ex_dcpl, &size_out) < 0) + if (H5Pget_virtual_count(ex_dcpl, &size_out) < 0) TEST_ERROR - if(size_out != (size_t)4) + if (size_out != (size_t)4) TEST_ERROR /* Check that the mappings in the DCPL are correct */ - for(i = 0; i < 4; i++) - if(vds_check_mapping(ex_dcpl, (size_t)i, vspace[i], srcspace[i], src_file[i], src_dset[i]) < 0) + for (i = 0; i < 4; i++) + if (vds_check_mapping(ex_dcpl, (size_t)i, vspace[i], srcspace[i], src_file[i], src_dset[i]) < 0) TEST_ERROR /* Close */ - for(i = 0; i < 4; i++) { - if(H5Sclose(srcspace[i]) < 0) + for (i = 0; i < 4; i++) { + if (H5Sclose(srcspace[i]) < 0) TEST_ERROR srcspace[i] = -1; - if(H5Sclose(vspace[i]) < 0) + if (H5Sclose(vspace[i]) < 0) TEST_ERROR vspace[i] = -1; } - if(H5Pclose(ex_dcpl) < 0) + if (H5Pclose(ex_dcpl) < 0) TEST_ERROR ex_dcpl = -1; -#else /* VDS_POINT_SELECTIONS */ +#else /* VDS_POINT_SELECTIONS */ /* * Test 3: Verify point selections fail */ /* Clear virtual layout in DCPL */ - if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) TEST_ERROR /* Create source dataspace */ - if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Create virtual dataspace */ - if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + if ((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Select points in source space */ @@ -950,7 +935,7 @@ test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low) coord[7] = 14; coord[8] = 8; coord[9] = 18; - if(H5Sselect_elements(srcspace[0], H5S_SELECT_SET, (size_t)5, coord) < 0) + if (H5Sselect_elements(srcspace[0], H5S_SELECT_SET, (size_t)5, coord) < 0) TEST_ERROR /* Select points in virtual space */ @@ -964,32 +949,30 @@ test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low) coord[7] = 11; coord[8] = 5; coord[9] = 5; - if(H5Sselect_elements(vspace[0], H5S_SELECT_SET, (size_t)5, coord) < 0) + if (H5Sselect_elements(vspace[0], H5S_SELECT_SET, (size_t)5, coord) < 0) TEST_ERROR /* Attempt to add virtual layout mapping */ - H5E_BEGIN_TRY { - ret = H5Pset_virtual(dcpl, vspace[0], src_file[0], src_dset[0], srcspace[0]); - } H5E_END_TRY - if(ret >= 0) + H5E_BEGIN_TRY { ret = H5Pset_virtual(dcpl, vspace[0], src_file[0], src_dset[0], srcspace[0]); } + H5E_END_TRY + if (ret >= 0) TEST_ERROR #endif /* VDS_POINT_SELECTIONS */ - /* * Test 6: Enough Selections to trigger doubling of mapping list */ /* Clear virtual layout in DCPL */ - if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) TEST_ERROR /* Create source dataspace */ dims[0] = 1; - if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Select all in source space (should not be necessary, but just to be sure) */ - if(H5Sselect_all(srcspace[0]) < 0) + if (H5Sselect_all(srcspace[0]) < 0) TEST_ERROR /* Init virtual space extent */ @@ -1004,40 +987,40 @@ test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low) block[1] = 20; /* Build virtual layout */ - for(i = 0; i < LIST_DOUBLE_SIZE; i++) { + for (i = 0; i < LIST_DOUBLE_SIZE; i++) { /* Create virtual dataspace */ - if((vspace[i] = H5Screate_simple(2, dims, NULL)) < 0) + if ((vspace[i] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Select row in virual dataspace */ start[0] = (hsize_t)i; - if(H5Sselect_hyperslab(vspace[i], H5S_SELECT_SET, start, NULL, count, block) < 0) + if (H5Sselect_hyperslab(vspace[i], H5S_SELECT_SET, start, NULL, count, block) < 0) TEST_ERROR - /* Create file and dataset names */ - (void)HDsnprintf(tmp_filename, sizeof(tmp_filename), "src_file%u", i); + /* Create file and dataset names */ + (void) HDsnprintf(tmp_filename, sizeof(tmp_filename), "src_file%u", i); tmp_filename[sizeof(tmp_filename) - 1] = '\0'; (void)HDsnprintf(tmp_dsetname, sizeof(tmp_dsetname), "src_dset%u", i); tmp_dsetname[sizeof(tmp_dsetname) - 1] = '\0'; /* Add virtual layout mapping */ - if(H5Pset_virtual(dcpl, vspace[i], tmp_filename, tmp_dsetname, srcspace[0]) < 0) + if (H5Pset_virtual(dcpl, vspace[i], tmp_filename, tmp_dsetname, srcspace[0]) < 0) TEST_ERROR } /* Get examination DCPL */ - if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, - (low >= H5F_LIBVER_V112)?(hsize_t)607:(hsize_t)697) < 0) + if (test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, + (low >= H5F_LIBVER_V112) ? (hsize_t)607 : (hsize_t)697) < 0) TEST_ERROR /* Test H5Pget_virtual_count */ - if(H5Pget_virtual_count(ex_dcpl, &size_out) < 0) + if (H5Pget_virtual_count(ex_dcpl, &size_out) < 0) TEST_ERROR - if(size_out != (size_t)LIST_DOUBLE_SIZE) + if (size_out != (size_t)LIST_DOUBLE_SIZE) TEST_ERROR /* Verify virtual layout */ - for(i = 0; i < LIST_DOUBLE_SIZE; i++) { + for (i = 0; i < LIST_DOUBLE_SIZE; i++) { /* Generate source file name */ (void)HDsnprintf(tmp_filename, sizeof(tmp_filename), "src_file%u", i); tmp_filename[sizeof(tmp_filename) - 1] = '\0'; @@ -1047,60 +1030,58 @@ test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low) tmp_dsetname[sizeof(tmp_dsetname) - 1] = '\0'; /* Check that the mapping in the DCPL is correct */ - if(vds_check_mapping(ex_dcpl, (size_t)i, vspace[i], srcspace[0], tmp_filename, tmp_dsetname) < 0) + if (vds_check_mapping(ex_dcpl, (size_t)i, vspace[i], srcspace[0], tmp_filename, tmp_dsetname) < 0) TEST_ERROR } /* Close */ - if(H5Sclose(srcspace[0]) < 0) + if (H5Sclose(srcspace[0]) < 0) TEST_ERROR srcspace[0] = -1; - for(i = 0; i < LIST_DOUBLE_SIZE; i++) { - if(H5Sclose(vspace[i]) < 0) + for (i = 0; i < LIST_DOUBLE_SIZE; i++) { + if (H5Sclose(vspace[i]) < 0) TEST_ERROR vspace[i] = -1; } - if(H5Pclose(ex_dcpl) < 0) + if (H5Pclose(ex_dcpl) < 0) TEST_ERROR ex_dcpl = -1; - /* * Test 7: Empty VDS */ /* Clear virtual layout in DCPL */ - if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) TEST_ERROR /* Create virtual dataspace */ - if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + if ((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Select all (should not be necessary, but just to be sure) */ - if(H5Sselect_all(vspace[0]) < 0) + if (H5Sselect_all(vspace[0]) < 0) TEST_ERROR /* Get examination DCPL */ - if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)0) < 0) + if (test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)0) < 0) TEST_ERROR /* Test H5Pget_virtual_count */ - if(H5Pget_virtual_count(ex_dcpl, &size_out) < 0) + if (H5Pget_virtual_count(ex_dcpl, &size_out) < 0) TEST_ERROR - if(size_out != (size_t)0) + if (size_out != (size_t)0) TEST_ERROR /* Close */ - if(H5Sclose(vspace[0]) < 0) + if (H5Sclose(vspace[0]) < 0) TEST_ERROR vspace[0] = -1; - if(H5Pclose(ex_dcpl) < 0) + if (H5Pclose(ex_dcpl) < 0) TEST_ERROR ex_dcpl = -1; - /* Close */ - if(H5Pclose(dcpl) < 0) + if (H5Pclose(dcpl) < 0) TEST_ERROR dcpl = -1; @@ -1108,16 +1089,18 @@ test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low) return 0; error: - H5E_BEGIN_TRY { - for(i = 0; i < (sizeof(srcspace) / sizeof(srcspace[0])); i++) + H5E_BEGIN_TRY + { + for (i = 0; i < (sizeof(srcspace) / sizeof(srcspace[0])); i++) H5Sclose(srcspace[i]); - for(i = 0; i < (sizeof(vspace) / sizeof(vspace[0])); i++) + for (i = 0; i < (sizeof(vspace) / sizeof(vspace[0])); i++) H5Sclose(vspace[i]); H5Pclose(dcpl); H5Pclose(ex_dcpl); - } H5E_END_TRY; + } + H5E_END_TRY; - return 1; + return 1; } /* end test_api() */ /*------------------------------------------------------------------------- @@ -1134,39 +1117,39 @@ error: static int test_vds_prefix_first(unsigned config, hid_t fapl) { - char *srcfilename = NULL; - char *srcfilename_map = NULL; - char *vfilename = NULL; - char *srcfilenamepct = NULL; - char *srcfilenamepct_map = NULL; + char * srcfilename = NULL; + char * srcfilename_map = NULL; + char * vfilename = NULL; + char * srcfilenamepct = NULL; + char * srcfilenamepct_map = NULL; const char *srcfilenamepct_map_orig = "vds%%%%_src"; - hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */ - hid_t vfile = -1; /* File with virtual dset */ - hid_t dcpl = -1; /* Dataset creation property list */ - hid_t dapl = -1; /* Dataset access property list */ - hid_t srcspace[4] = {-1, -1, -1, -1}; /* Source dataspaces */ - hid_t vspace[4] = {-1, -1, -1, -1}; /* Virtual dset dataspaces */ - hid_t memspace = -1; /* Memory dataspace */ - hid_t srcdset[4] = {-1, -1, -1, -1}; /* Source datsets */ - hid_t vdset = -1; /* Virtual dataset */ - hsize_t dims[4] = {10, 26, 0, 0}; /* Data space current size */ - int buf[10][26]; /* Write and expected read buffer */ - int rbuf[10][26]; /* Read buffer */ - int fill = -1; /* Fill value */ + hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */ + hid_t vfile = -1; /* File with virtual dset */ + hid_t dcpl = -1; /* Dataset creation property list */ + hid_t dapl = -1; /* Dataset access property list */ + hid_t srcspace[4] = {-1, -1, -1, -1}; /* Source dataspaces */ + hid_t vspace[4] = {-1, -1, -1, -1}; /* Virtual dset dataspaces */ + hid_t memspace = -1; /* Memory dataspace */ + hid_t srcdset[4] = {-1, -1, -1, -1}; /* Source datsets */ + hid_t vdset = -1; /* Virtual dataset */ + hsize_t dims[4] = {10, 26, 0, 0}; /* Data space current size */ + int buf[10][26]; /* Write and expected read buffer */ + int rbuf[10][26]; /* Read buffer */ + int fill = -1; /* Fill value */ int i, j; - char buffer[1024]; /* buffer to read vds_prefix */ + char buffer[1024]; /* buffer to read vds_prefix */ TESTING("basic virtual dataset I/O via H5Pset_vds_prefix(): all selection") - if((srcfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + if ((srcfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) TEST_ERROR; - if((srcfilename_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + if ((srcfilename_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) TEST_ERROR; - if((vfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + if ((vfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) TEST_ERROR; - if((srcfilenamepct = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + if ((srcfilenamepct = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) TEST_ERROR; - if((srcfilenamepct_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + if ((srcfilenamepct_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) TEST_ERROR; h5_fixname(FILENAME[0], fapl, vfilename, FILENAME_BUF_SIZE); @@ -1180,180 +1163,182 @@ test_vds_prefix_first(unsigned config, hid_t fapl) TEST_ERROR /* Create DCPL */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR /* Set fill value */ - if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0) + if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0) TEST_ERROR /* Initialize VDS prefix items */ - if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + if ((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) TEST_ERROR - if(H5Pset_virtual_prefix(dapl, TMPDIR) < 0) + if (H5Pset_virtual_prefix(dapl, TMPDIR) < 0) TEST_ERROR - if(H5Pget_virtual_prefix(dapl, buffer, sizeof(buffer)) < 0) + if (H5Pget_virtual_prefix(dapl, buffer, sizeof(buffer)) < 0) TEST_ERROR - if(HDstrcmp(buffer, TMPDIR) != 0) + if (HDstrcmp(buffer, TMPDIR) != 0) FAIL_PUTS_ERROR("vds prefix not set correctly"); /* Create source dataspace */ - if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Create virtual dataspace */ - if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + if ((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Select all (should not be necessary, but just to be sure) */ - if(H5Sselect_all(srcspace[0]) < 0) + if (H5Sselect_all(srcspace[0]) < 0) TEST_ERROR - if(H5Sselect_all(vspace[0]) < 0) + if (H5Sselect_all(vspace[0]) < 0) TEST_ERROR /* Add virtual layout mapping */ - if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset", srcspace[0]) < 0) + if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset", + srcspace[0]) < 0) TEST_ERROR /* Create virtual file */ - if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create source file if requested */ - if(config & TEST_IO_DIFFERENT_FILE) { - if(NULL == HDgetcwd(buffer, 1024)) + if (config & TEST_IO_DIFFERENT_FILE) { + if (NULL == HDgetcwd(buffer, 1024)) TEST_ERROR - if(HDchdir(TMPDIR) < 0) + if (HDchdir(TMPDIR) < 0) TEST_ERROR - if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if(HDchdir(buffer) < 0) + if (HDchdir(buffer) < 0) TEST_ERROR } else { srcfile[0] = vfile; - if(H5Iinc_ref(srcfile[0]) < 0) + if (H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR } /* Create source dataset */ - if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Create virtual dataset */ - if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) + if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) TEST_ERROR /* Populate write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j; /* Write data directly to source dataset */ - if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Close srcdset and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[0]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } /* Read data through virtual dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); - if(H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) { - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if(rbuf[i][j] != buf[i][j]) { + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) { + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if (rbuf[i][j] != buf[i][j]) { TEST_ERROR } } /* Adjust write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); /* Write data through virtual dataset */ - if(H5Dwrite(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Reopen srcdset and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(config & TEST_IO_DIFFERENT_FILE) { - if(NULL == HDgetcwd(buffer, 1024)) + if (config & TEST_IO_CLOSE_SRC) { + if (config & TEST_IO_DIFFERENT_FILE) { + if (NULL == HDgetcwd(buffer, 1024)) TEST_ERROR - if(HDchdir(TMPDIR) < 0) + if (HDchdir(TMPDIR) < 0) TEST_ERROR - if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0) + if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - if(HDchdir(buffer) < 0) + if (HDchdir(buffer) < 0) TEST_ERROR } - if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0) TEST_ERROR } /* Read data directly from source dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); - if(H5Dread(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if(rbuf[i][j] != buf[i][j]) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if (rbuf[i][j] != buf[i][j]) TEST_ERROR /* Close */ - if(H5Dclose(srcdset[0]) < 0) + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(srcfile[0]) < 0) + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if(H5Sclose(srcspace[0]) < 0) + if (H5Sclose(srcspace[0]) < 0) TEST_ERROR srcspace[0] = -1; - if(H5Sclose(vspace[0]) < 0) + if (H5Sclose(vspace[0]) < 0) TEST_ERROR vspace[0] = -1; - if(H5Pclose(dapl) < 0) + if (H5Pclose(dapl) < 0) TEST_ERROR dapl = -1; - if(H5Pclose(dcpl) < 0) + if (H5Pclose(dcpl) < 0) TEST_ERROR dcpl = -1; @@ -1366,24 +1351,26 @@ test_vds_prefix_first(unsigned config, hid_t fapl) PASSED(); return 0; - error: - H5E_BEGIN_TRY { - for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) +error: + H5E_BEGIN_TRY + { + for (i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) H5Dclose(srcdset[i]); H5Dclose(vdset); - for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) + for (i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) H5Fclose(srcfile[i]); H5Fclose(vfile); - for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) + for (i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) H5Sclose(srcspace[i]); - for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) + for (i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) H5Sclose(vspace[i]); H5Sclose(memspace); H5Pclose(dapl); H5Pclose(dcpl); - } H5E_END_TRY; + } + H5E_END_TRY; - if(HDsetenv("HDF5_VDS_PREFIX", "", 1) < 0) + if (HDsetenv("HDF5_VDS_PREFIX", "", 1) < 0) TEST_ERROR HDfree(srcfilename); @@ -1395,7 +1382,6 @@ test_vds_prefix_first(unsigned config, hid_t fapl) return 1; } /* end test_vds_prefix */ - /*------------------------------------------------------------------------- * Function: test_basic_io * @@ -1409,50 +1395,50 @@ test_vds_prefix_first(unsigned config, hid_t fapl) static int test_basic_io(unsigned config, hid_t fapl) { - char *srcfilename = NULL; - char *srcfilename_map = NULL; - char *vfilename = NULL; - char *vfilename2 = NULL; - char *srcfilenamepct = NULL; - char *srcfilenamepct_map = NULL; + char * srcfilename = NULL; + char * srcfilename_map = NULL; + char * vfilename = NULL; + char * vfilename2 = NULL; + char * srcfilenamepct = NULL; + char * srcfilenamepct_map = NULL; const char *srcfilenamepct_map_orig = "vds%%%%_src"; - hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */ - hid_t vfile = -1; /* File with virtual dset */ - hid_t vfile2 = -1; /* File with copied virtual dset */ - hid_t dcpl = -1; /* Dataset creation property list */ - hid_t srcspace[4] = {-1, -1, -1, -1}; /* Source dataspaces */ - hid_t vspace[4] = {-1, -1, -1, -1}; /* Virtual dset dataspaces */ - hid_t memspace = -1; /* Memory dataspace */ - hid_t srcdset[4] = {-1, -1, -1, -1}; /* Source datsets */ - hid_t vdset = -1; /* Virtual dataset */ - hsize_t dims[4] = {10, 26, 0, 0}; /* Data space current size */ - hsize_t start[4]; /* Hyperslab start */ - hsize_t stride[4]; /* Hyperslab stride */ - hsize_t count[4]; /* Hyperslab count */ - hsize_t block[4]; /* Hyperslab block */ - hssize_t offset[2] = {0, 0}; /* Selection offset */ - int buf[10][26]; /* Write and expected read buffer */ - int rbuf[10][26]; /* Read buffer */ - int rbuf99[9][9]; /* 9x9 Read buffer */ - int evbuf[10][26]; /* Expected VDS "buffer" */ - int erbuf[10][26]; /* Expected read buffer */ - int fill = -1; /* Fill value */ - herr_t ret; /* Generic return value */ + hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */ + hid_t vfile = -1; /* File with virtual dset */ + hid_t vfile2 = -1; /* File with copied virtual dset */ + hid_t dcpl = -1; /* Dataset creation property list */ + hid_t srcspace[4] = {-1, -1, -1, -1}; /* Source dataspaces */ + hid_t vspace[4] = {-1, -1, -1, -1}; /* Virtual dset dataspaces */ + hid_t memspace = -1; /* Memory dataspace */ + hid_t srcdset[4] = {-1, -1, -1, -1}; /* Source datsets */ + hid_t vdset = -1; /* Virtual dataset */ + hsize_t dims[4] = {10, 26, 0, 0}; /* Data space current size */ + hsize_t start[4]; /* Hyperslab start */ + hsize_t stride[4]; /* Hyperslab stride */ + hsize_t count[4]; /* Hyperslab count */ + hsize_t block[4]; /* Hyperslab block */ + hssize_t offset[2] = {0, 0}; /* Selection offset */ + int buf[10][26]; /* Write and expected read buffer */ + int rbuf[10][26]; /* Read buffer */ + int rbuf99[9][9]; /* 9x9 Read buffer */ + int evbuf[10][26]; /* Expected VDS "buffer" */ + int erbuf[10][26]; /* Expected read buffer */ + int fill = -1; /* Fill value */ + herr_t ret; /* Generic return value */ int i, j, u, v; TESTING("basic virtual dataset I/O") - if((srcfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + if ((srcfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) TEST_ERROR; - if((srcfilename_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + if ((srcfilename_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) TEST_ERROR; - if((vfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + if ((vfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) TEST_ERROR; - if((vfilename2 = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + if ((vfilename2 = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) TEST_ERROR; - if((srcfilenamepct = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + if ((srcfilenamepct = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) TEST_ERROR; - if((srcfilenamepct_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + if ((srcfilenamepct_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) TEST_ERROR; h5_fixname(FILENAME[0], fapl, vfilename, FILENAME_BUF_SIZE); @@ -1463,897 +1449,905 @@ test_basic_io(unsigned config, hid_t fapl) h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, FILENAME_BUF_SIZE); /* Create DCPL */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR /* Set fill value */ - if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0) + if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0) TEST_ERROR /* * Test 1: All - all selection */ /* Create source dataspace */ - if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Create virtual dataspace */ - if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + if ((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Select all (should not be necessary, but just to be sure) */ - if(H5Sselect_all(srcspace[0]) < 0) + if (H5Sselect_all(srcspace[0]) < 0) TEST_ERROR - if(H5Sselect_all(vspace[0]) < 0) + if (H5Sselect_all(vspace[0]) < 0) TEST_ERROR /* Add virtual layout mapping */ - if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset", srcspace[0]) < 0) + if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset", + srcspace[0]) < 0) TEST_ERROR /* Create virtual file */ - if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create source file if requested */ - if(config & TEST_IO_DIFFERENT_FILE) { - if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR } else { srcfile[0] = vfile; - if(H5Iinc_ref(srcfile[0]) < 0) + if (H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR } /* Create source dataset */ - if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Create virtual dataset */ - if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR /* Populate write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j; /* Write data directly to source dataset */ - if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Close srcdset and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[0]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR } /* Read data through virtual dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); - if(H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if(rbuf[i][j] != buf[i][j]) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if (rbuf[i][j] != buf[i][j]) TEST_ERROR /* Adjust write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); /* Write data through virtual dataset */ - if(H5Dwrite(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Reopen srcdset and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(config & TEST_IO_DIFFERENT_FILE) - if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (config & TEST_IO_DIFFERENT_FILE) + if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0) TEST_ERROR } /* Read data directly from source dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); - if(H5Dread(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if(rbuf[i][j] != buf[i][j]) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if (rbuf[i][j] != buf[i][j]) TEST_ERROR /* Close */ - if(H5Dclose(srcdset[0]) < 0) + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(srcfile[0]) < 0) + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if(H5Sclose(srcspace[0]) < 0) + if (H5Sclose(srcspace[0]) < 0) TEST_ERROR srcspace[0] = -1; - if(H5Sclose(vspace[0]) < 0) + if (H5Sclose(vspace[0]) < 0) TEST_ERROR vspace[0] = -1; - /* * Test 2: 2 Source datasets, hyperslab virtual mappings, '%' in source * dataset name, also test H5Ocopy() */ /* Clear virtual layout in DCPL */ - if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) TEST_ERROR /* Create virtual dataspaces */ - if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + if ((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR - if((vspace[1] = H5Screate_simple(2, dims, NULL)) < 0) + if ((vspace[1] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Create source dataspace */ dims[1] = 13; - if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Select all in source space (should not be necessary, but just to be sure) */ - if(H5Sselect_all(srcspace[0]) < 0) + if (H5Sselect_all(srcspace[0]) < 0) TEST_ERROR /* Select hyperslabs in virtual spaces */ start[0] = 0; start[1] = 0; - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR start[1] = 13; - if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Add virtual layout mappings */ - if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "%%src_dset1", srcspace[0]) < 0) + if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", + "%%src_dset1", srcspace[0]) < 0) TEST_ERROR - if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2%%", srcspace[0]) < 0) + if (H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", + "src_dset2%%", srcspace[0]) < 0) TEST_ERROR /* Reset dims */ dims[1] = 26; /* Create virtual file */ - if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create source file if requested */ - if(config & TEST_IO_DIFFERENT_FILE) { - if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR } else { srcfile[0] = vfile; - if(H5Iinc_ref(srcfile[0]) < 0) + if (H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR } /* Create source datasets */ - if((srcdset[0] = H5Dcreate2(srcfile[0], "%src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dcreate2(srcfile[0], "%src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2%", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2%", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Create virtual dataset */ - if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR /* Populate write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j; /* Write data directly to source datasets */ - if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR - if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, vspace[1], H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, vspace[1], H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Close srcdsets and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[0]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(srcdset[1]) < 0) + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR } /* Read data through virtual dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); - if(H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if(rbuf[i][j] != buf[i][j]) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if (rbuf[i][j] != buf[i][j]) TEST_ERROR /* Adjust write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); /* Write data through virtual dataset */ - if(H5Dwrite(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Reopen srcdsets and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(config & TEST_IO_DIFFERENT_FILE) - if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (config & TEST_IO_DIFFERENT_FILE) + if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((srcdset[0] = H5Dopen2(srcfile[0], "%src_dset1", H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dopen2(srcfile[0], "%src_dset1", H5P_DEFAULT)) < 0) TEST_ERROR - if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2%", H5P_DEFAULT)) < 0) + if ((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2%", H5P_DEFAULT)) < 0) TEST_ERROR } /* Read data directly from source datasets */ HDmemset(rbuf[0], 0, sizeof(rbuf)); - if(H5Dread(srcdset[0], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(srcdset[0], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR - if(H5Dread(srcdset[1], H5T_NATIVE_INT, vspace[1], H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(srcdset[1], H5T_NATIVE_INT, vspace[1], H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if(rbuf[i][j] != buf[i][j]) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if (rbuf[i][j] != buf[i][j]) TEST_ERROR /* Test H5Ocopy() to same file */ /* Copy virtual dataset */ - if(H5Ocopy(vfile, "v_dset", vfile, "v_dset2", H5P_DEFAULT, H5P_DEFAULT) < 0) + if (H5Ocopy(vfile, "v_dset", vfile, "v_dset2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close v_dset */ - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; /* Adjust write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); /* Write data directly to source datasets */ - if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR - if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, vspace[1], H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, vspace[1], H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Close srcdsets and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[0]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(srcdset[1]) < 0) + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } } /* Reopen virtual file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Fclose(vfile) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR } /* Open v_dset2 */ - if((vdset = H5Dopen2(vfile, "v_dset2", H5P_DEFAULT)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset2", H5P_DEFAULT)) < 0) TEST_ERROR /* Read data through copied virtual dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); - if(H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if(rbuf[i][j] != buf[i][j]) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if (rbuf[i][j] != buf[i][j]) TEST_ERROR /* Reopen srcdsets and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(config & TEST_IO_DIFFERENT_FILE) - if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (config & TEST_IO_DIFFERENT_FILE) + if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((srcdset[0] = H5Dopen2(srcfile[0], "%src_dset1", H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dopen2(srcfile[0], "%src_dset1", H5P_DEFAULT)) < 0) TEST_ERROR - if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2%", H5P_DEFAULT)) < 0) + if ((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2%", H5P_DEFAULT)) < 0) TEST_ERROR } /* Only copy to a different file if the source datasets are in a different * file */ - if(config & TEST_IO_DIFFERENT_FILE) { + if (config & TEST_IO_DIFFERENT_FILE) { /* Close v_dset2 */ - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; /* Create file to copy virtual dataset to */ - if((vfile2 = H5Fcreate(vfilename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((vfile2 = H5Fcreate(vfilename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Copy virtual dataset */ - if(H5Ocopy(vfile, "v_dset", vfile2, "v_dset3", H5P_DEFAULT, H5P_DEFAULT) < 0) + if (H5Ocopy(vfile, "v_dset", vfile2, "v_dset3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Adjust write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); /* Write data directly to source datasets */ - if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR - if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, vspace[1], H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, vspace[1], H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Close srcdsets and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[0]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(srcdset[1]) < 0) + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } } /* Reopen copied virtual file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Fclose(vfile2) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Fclose(vfile2) < 0) TEST_ERROR vfile2 = -1; - if((vfile2 = H5Fopen(vfilename2, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile2 = H5Fopen(vfilename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR } /* Open v_dset3 */ - if((vdset = H5Dopen2(vfile2, "v_dset3", H5P_DEFAULT)) < 0) + if ((vdset = H5Dopen2(vfile2, "v_dset3", H5P_DEFAULT)) < 0) TEST_ERROR /* Read data through copied virtual dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); - if(H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if(rbuf[i][j] != buf[i][j]) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if (rbuf[i][j] != buf[i][j]) TEST_ERROR /* Reopen srcdsets and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(config & TEST_IO_DIFFERENT_FILE) - if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (config & TEST_IO_DIFFERENT_FILE) + if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - if((srcdset[0] = H5Dopen2(srcfile[0], "%src_dset1", H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dopen2(srcfile[0], "%src_dset1", H5P_DEFAULT)) < 0) TEST_ERROR - if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2%", H5P_DEFAULT)) < 0) + if ((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2%", H5P_DEFAULT)) < 0) TEST_ERROR } /* Close copied virtual file */ - if(H5Fclose(vfile2) < 0) + if (H5Fclose(vfile2) < 0) TEST_ERROR vfile2 = -1; } /* Close */ - if(H5Dclose(srcdset[0]) < 0) + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(srcdset[1]) < 0) + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(srcfile[0]) < 0) + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if(H5Sclose(srcspace[0]) < 0) + if (H5Sclose(srcspace[0]) < 0) TEST_ERROR srcspace[0] = -1; - if(H5Sclose(vspace[0]) < 0) + if (H5Sclose(vspace[0]) < 0) TEST_ERROR vspace[0] = -1; - if(H5Sclose(vspace[1]) < 0) + if (H5Sclose(vspace[1]) < 0) TEST_ERROR vspace[1] = -1; - /* * Test 3: 2 Source datasets, hyperslab virtual mappings with offsets */ /* Clear virtual layout in DCPL */ - if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) TEST_ERROR /* Create virtual dataspaces */ - if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + if ((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Create source dataspace */ dims[1] = 13; - if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Select all in source space (should not be necessary, but just to be sure) */ - if(H5Sselect_all(srcspace[0]) < 0) + if (H5Sselect_all(srcspace[0]) < 0) TEST_ERROR /* Select hyperslabs in virtual spaces */ start[0] = 0; start[1] = 3; - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Add virtual layout mappings */ offset[1] = -3; - if(H5Soffset_simple(vspace[0], offset) < 0) + if (H5Soffset_simple(vspace[0], offset) < 0) TEST_ERROR - if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "%%src_dset1", srcspace[0]) < 0) + if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", + "%%src_dset1", srcspace[0]) < 0) TEST_ERROR offset[1] = 10; - if(H5Soffset_simple(vspace[0], offset) < 0) + if (H5Soffset_simple(vspace[0], offset) < 0) TEST_ERROR - if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2%%", srcspace[0]) < 0) + if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", + "src_dset2%%", srcspace[0]) < 0) TEST_ERROR /* Reset dims */ dims[1] = 26; /* Create virtual file */ - if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create source file if requested */ - if(config & TEST_IO_DIFFERENT_FILE) { - if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR } else { srcfile[0] = vfile; - if(H5Iinc_ref(srcfile[0]) < 0) + if (H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR } /* Create source datasets */ - if((srcdset[0] = H5Dcreate2(srcfile[0], "%src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dcreate2(srcfile[0], "%src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2%", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2%", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Create virtual dataset */ - if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR /* Populate write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j; /* Write data directly to source datasets */ offset[1] = -3; - if(H5Soffset_simple(vspace[0], offset) < 0) + if (H5Soffset_simple(vspace[0], offset) < 0) TEST_ERROR - if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR offset[1] = 10; - if(H5Soffset_simple(vspace[0], offset) < 0) + if (H5Soffset_simple(vspace[0], offset) < 0) TEST_ERROR - if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Close srcdsets and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[0]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(srcdset[1]) < 0) + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR } /* Read data through virtual dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); - if(H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if(rbuf[i][j] != buf[i][j]) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if (rbuf[i][j] != buf[i][j]) TEST_ERROR /* Adjust write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); /* Write data through virtual dataset */ - if(H5Dwrite(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Reopen srcdsets and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(config & TEST_IO_DIFFERENT_FILE) - if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (config & TEST_IO_DIFFERENT_FILE) + if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - if((srcdset[0] = H5Dopen2(srcfile[0], "%src_dset1", H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dopen2(srcfile[0], "%src_dset1", H5P_DEFAULT)) < 0) TEST_ERROR - if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2%", H5P_DEFAULT)) < 0) + if ((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2%", H5P_DEFAULT)) < 0) TEST_ERROR } /* Read data directly from source datasets */ HDmemset(rbuf[0], 0, sizeof(rbuf)); offset[1] = -3; - if(H5Soffset_simple(vspace[0], offset) < 0) + if (H5Soffset_simple(vspace[0], offset) < 0) TEST_ERROR - if(H5Dread(srcdset[0], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(srcdset[0], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR offset[1] = 10; - if(H5Soffset_simple(vspace[0], offset) < 0) + if (H5Soffset_simple(vspace[0], offset) < 0) TEST_ERROR - if(H5Dread(srcdset[1], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(srcdset[1], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if(rbuf[i][j] != buf[i][j]) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if (rbuf[i][j] != buf[i][j]) TEST_ERROR /* Close */ - if(H5Dclose(srcdset[0]) < 0) + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(srcdset[1]) < 0) + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(srcfile[0]) < 0) + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if(H5Sclose(srcspace[0]) < 0) + if (H5Sclose(srcspace[0]) < 0) TEST_ERROR srcspace[0] = -1; - if(H5Sclose(vspace[0]) < 0) + if (H5Sclose(vspace[0]) < 0) TEST_ERROR vspace[0] = -1; - /* * Test 4: 2 Source datasets, hyperslab virtual mappings on one mapping at a * time, '%' in source file name */ /* Clear virtual layout in DCPL */ - if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) TEST_ERROR /* Create virtual dataspaces */ - if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + if ((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR - if((vspace[1] = H5Screate_simple(2, dims, NULL)) < 0) + if ((vspace[1] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Create source dataspace */ dims[1] = 13; - if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Select all in source space (should not be necessary, but just to be sure) */ - if(H5Sselect_all(srcspace[0]) < 0) + if (H5Sselect_all(srcspace[0]) < 0) TEST_ERROR /* Select hyperslabs in virtual spaces */ start[0] = 0; start[1] = 0; - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR start[1] = 13; - if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Add virtual layout mappings */ - if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilenamepct_map : ".", "src_dset1", srcspace[0]) < 0) + if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilenamepct_map : ".", + "src_dset1", srcspace[0]) < 0) TEST_ERROR - if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilenamepct_map : ".", "src_dset2", srcspace[0]) < 0) + if (H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilenamepct_map : ".", + "src_dset2", srcspace[0]) < 0) TEST_ERROR /* Reset dims */ dims[1] = 26; /* Create virtual file */ - if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create source file if requested */ - if(config & TEST_IO_DIFFERENT_FILE) { - if((srcfile[0] = H5Fcreate(srcfilenamepct, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if ((srcfile[0] = H5Fcreate(srcfilenamepct, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR } else { srcfile[0] = vfile; - if(H5Iinc_ref(srcfile[0]) < 0) + if (H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR } /* Create source datasets */ - if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Create virtual dataset */ - if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR /* Populate write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j; /* Write data directly to source datasets */ - if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR - if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, vspace[1], H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, vspace[1], H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Close srcdsets and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[0]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(srcdset[1]) < 0) + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR } /* Read first source dataset through virtual dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); - if(H5Dread(vdset, H5T_NATIVE_INT, vspace[0], vspace[0], H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, vspace[0], vspace[0], H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if(rbuf[i][j] != (j < (int)(sizeof(buf[0]) / sizeof(buf[0][0]) / 2) - ? buf[i][j] : 0)) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if (rbuf[i][j] != (j < (int)(sizeof(buf[0]) / sizeof(buf[0][0]) / 2) ? buf[i][j] : 0)) TEST_ERROR /* Read second source dataset through virtual dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); - if(H5Dread(vdset, H5T_NATIVE_INT, vspace[1], vspace[1], H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, vspace[1], vspace[1], H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if(rbuf[i][j] != (j < (int)(sizeof(buf[0]) / sizeof(buf[0][0]) / 2) - ? 0 : buf[i][j])) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if (rbuf[i][j] != (j < (int)(sizeof(buf[0]) / sizeof(buf[0][0]) / 2) ? 0 : buf[i][j])) TEST_ERROR /* Adjust write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); /* Write first source dataset through virtual dataset */ - if(H5Dwrite(vdset, H5T_NATIVE_INT, vspace[0], vspace[0], H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(vdset, H5T_NATIVE_INT, vspace[0], vspace[0], H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Adjust write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); /* Write second source dataset through virtual dataset */ - if(H5Dwrite(vdset, H5T_NATIVE_INT, vspace[1], vspace[1], H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(vdset, H5T_NATIVE_INT, vspace[1], vspace[1], H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Reopen srcdsets and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(config & TEST_IO_DIFFERENT_FILE) - if((srcfile[0] = H5Fopen(srcfilenamepct, H5F_ACC_RDONLY, fapl)) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (config & TEST_IO_DIFFERENT_FILE) + if ((srcfile[0] = H5Fopen(srcfilenamepct, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) TEST_ERROR - if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) + if ((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR } /* Read data directly from source datasets */ HDmemset(rbuf[0], 0, sizeof(rbuf)); - if(H5Dread(srcdset[0], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(srcdset[0], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR - if(H5Dread(srcdset[1], H5T_NATIVE_INT, vspace[1], H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(srcdset[1], H5T_NATIVE_INT, vspace[1], H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if(rbuf[i][j] != (j < (int)(sizeof(buf[0]) / sizeof(buf[0][0]) / 2) - ? (buf[i][j] - (int)(sizeof(buf) / sizeof(buf[0][0]))) - : buf[i][j])) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if (rbuf[i][j] != (j < (int)(sizeof(buf[0]) / sizeof(buf[0][0]) / 2) + ? (buf[i][j] - (int)(sizeof(buf) / sizeof(buf[0][0]))) + : buf[i][j])) TEST_ERROR /* Close */ - if(H5Dclose(srcdset[0]) < 0) + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(srcdset[1]) < 0) + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(srcfile[0]) < 0) + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if(H5Sclose(srcspace[0]) < 0) + if (H5Sclose(srcspace[0]) < 0) TEST_ERROR srcspace[0] = -1; - if(H5Sclose(vspace[0]) < 0) + if (H5Sclose(vspace[0]) < 0) TEST_ERROR vspace[0] = -1; - if(H5Sclose(vspace[1]) < 0) + if (H5Sclose(vspace[1]) < 0) TEST_ERROR vspace[1] = -1; - /* * Test 5: 2 Source datasets, hyperslab virtual mappings and selections */ /* Clear virtual layout in DCPL */ - if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) TEST_ERROR /* Create virtual dataspaces */ - if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + if ((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR - if((vspace[1] = H5Screate_simple(2, dims, NULL)) < 0) + if ((vspace[1] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Create source dataspaces */ - if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR - if((srcspace[1] = H5Screate_simple(2, dims, NULL)) < 0) + if ((srcspace[1] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Select hyperslabs in source space */ @@ -2361,10 +2355,10 @@ test_basic_io(unsigned config, hid_t fapl) start[1] = 0; count[0] = 10; count[1] = 13; - if(H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR start[1] = 13; - if(H5Sselect_hyperslab(srcspace[1], H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(srcspace[1], H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Select hyperslabs in virtual spaces */ @@ -2372,105 +2366,109 @@ test_basic_io(unsigned config, hid_t fapl) start[1] = 0; count[0] = 5; count[1] = 26; - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR start[0] = 5; - if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Add virtual layout mappings */ - if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0) + if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", + srcspace[0]) < 0) TEST_ERROR - if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", srcspace[1]) < 0) + if (H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", + srcspace[1]) < 0) TEST_ERROR /* Create virtual file */ - if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create source file if requested */ - if(config & TEST_IO_DIFFERENT_FILE) { - if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR } else { srcfile[0] = vfile; - if(H5Iinc_ref(srcfile[0]) < 0) + if (H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR } /* Create source datasets */ - if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[1], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[1], H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Create virtual dataset */ - if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR /* Populate write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j; /* Write data directly to source datasets */ /* Write first dataset */ - if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update evbuf */ - for(i = 0; i < 5; i++) { - for(j = 0; j < 13; j++) + for (i = 0; i < 5; i++) { + for (j = 0; j < 13; j++) evbuf[i][j] = buf[2 * i][j]; - for(/* j = 13 */; j < 26; j++) + for (/* j = 13 */; j < 26; j++) evbuf[i][j] = buf[2 * i + 1][j - 13]; } /* Adjust write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); /* Write second dataset */ - if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update evbuf */ - for(i = 0; i < 5; i++) { - for(j = 0; j < 13; j++) + for (i = 0; i < 5; i++) { + for (j = 0; j < 13; j++) evbuf[i + 5][j] = buf[2 * i][j + 13]; - for(/* j = 13 */; j < 26; j++) + for (/* j = 13 */; j < 26; j++) evbuf[i + 5][j] = buf[2 * i + 1][j]; } /* Close srcdsets and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[0]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(srcdset[1]) < 0) + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR } @@ -2479,78 +2477,78 @@ test_basic_io(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Read first slice */ - if(H5Dread(vdset, H5T_NATIVE_INT, vspace[0], srcspace[0], H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, vspace[0], srcspace[0], H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 5; i++) { - for(j = 0; j < 13; j++) + for (i = 0; i < 5; i++) { + for (j = 0; j < 13; j++) erbuf[i][j] = evbuf[2 * i][j]; - for(/* j = 13 */; j < 26; j++) + for (/* j = 13 */; j < 26; j++) erbuf[i][j] = evbuf[2 * i + 1][j - 13]; } /* Read second slice */ - if(H5Dread(vdset, H5T_NATIVE_INT, vspace[1], srcspace[1], H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, vspace[1], srcspace[1], H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 5; i++) { - for(j = 0; j < 13; j++) + for (i = 0; i < 5; i++) { + for (j = 0; j < 13; j++) erbuf[i + 5][j] = evbuf[2 * i][j + 13]; - for(/* j = 13 */; j < 26; j++) + for (/* j = 13 */; j < 26; j++) erbuf[i + 5][j] = evbuf[2 * i + 1][j]; } /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if(rbuf[i][j] != erbuf[i][j]) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if (rbuf[i][j] != erbuf[i][j]) TEST_ERROR /* Adjust write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); /* Write data through virtual dataset */ /* Write first slice */ - if(H5Dwrite(vdset, H5T_NATIVE_INT, vspace[0], srcspace[0], H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(vdset, H5T_NATIVE_INT, vspace[0], srcspace[0], H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update evbuf */ - for(i = 0; i < 5; i++) { - for(j = 0; j < 13; j++) + for (i = 0; i < 5; i++) { + for (j = 0; j < 13; j++) evbuf[2 * i][j] = buf[i][j]; - for(/* j = 13 */; j < 26; j++) + for (/* j = 13 */; j < 26; j++) evbuf[2 * i + 1][j - 13] = buf[i][j]; } /* Adjust write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); /* Write second slice */ - if(H5Dwrite(vdset, H5T_NATIVE_INT, vspace[1], srcspace[1], H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(vdset, H5T_NATIVE_INT, vspace[1], srcspace[1], H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update evbuf */ - for(i = 0; i < 5; i++) { - for(j = 0; j < 13; j++) + for (i = 0; i < 5; i++) { + for (j = 0; j < 13; j++) evbuf[2 * i][j + 13] = buf[i + 5][j]; - for(/* j = 13 */; j < 26; j++) + for (/* j = 13 */; j < 26; j++) evbuf[2 * i + 1][j] = buf[i + 5][j]; } /* Reopen srcdsets and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(config & TEST_IO_DIFFERENT_FILE) - if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (config & TEST_IO_DIFFERENT_FILE) + if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) TEST_ERROR - if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) + if ((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR } @@ -2559,89 +2557,88 @@ test_basic_io(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Read first dataset */ - if(H5Dread(srcdset[0], H5T_NATIVE_INT, srcspace[0], srcspace[0], H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(srcdset[0], H5T_NATIVE_INT, srcspace[0], srcspace[0], H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 5; i++) { - for(j = 0; j < 13; j++) + for (i = 0; i < 5; i++) { + for (j = 0; j < 13; j++) erbuf[2 * i][j] = evbuf[i][j]; - for(/* j = 13 */; j < 26; j++) + for (/* j = 13 */; j < 26; j++) erbuf[2 * i + 1][j - 13] = evbuf[i][j]; } /* Read second dataset */ - if(H5Dread(srcdset[1], H5T_NATIVE_INT, srcspace[1], srcspace[1], H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(srcdset[1], H5T_NATIVE_INT, srcspace[1], srcspace[1], H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 5; i++) { - for(j = 0; j < 13; j++) + for (i = 0; i < 5; i++) { + for (j = 0; j < 13; j++) erbuf[2 * i][j + 13] = evbuf[i + 5][j]; - for(/* j = 13 */; j < 26; j++) + for (/* j = 13 */; j < 26; j++) erbuf[2 * i + 1][j] = evbuf[i + 5][j]; } /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if(rbuf[i][j] != erbuf[i][j]) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if (rbuf[i][j] != erbuf[i][j]) TEST_ERROR /* Close */ - if(H5Dclose(srcdset[0]) < 0) + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(srcdset[1]) < 0) + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(srcfile[0]) < 0) + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if(H5Sclose(srcspace[0]) < 0) + if (H5Sclose(srcspace[0]) < 0) TEST_ERROR srcspace[0] = -1; - if(H5Sclose(srcspace[1]) < 0) + if (H5Sclose(srcspace[1]) < 0) TEST_ERROR srcspace[1] = -1; - if(H5Sclose(vspace[0]) < 0) + if (H5Sclose(vspace[0]) < 0) TEST_ERROR vspace[0] = -1; - if(H5Sclose(vspace[1]) < 0) + if (H5Sclose(vspace[1]) < 0) TEST_ERROR vspace[1] = -1; - /* * Test 6: 2 Source datasets, checkerboard/stripe pattern to trigger * sequence list refresh internally */ /* Clear virtual layout in DCPL */ - if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) TEST_ERROR /* Create memory dataspace */ - if((memspace = H5Screate_simple(2, dims, NULL)) < 0) + if ((memspace = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Create virtual dataspaces */ dims[1] = 52; - if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + if ((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR - if((vspace[1] = H5Screate_simple(2, dims, NULL)) < 0) + if ((vspace[1] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Create source dataspace and file space for second operation (srcspace[1]) */ - if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR - if((srcspace[1] = H5Screate_simple(2, dims, NULL)) < 0) + if ((srcspace[1] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Reset dims */ @@ -2649,130 +2646,134 @@ test_basic_io(unsigned config, hid_t fapl) /* Select hyperslabs (stripe) in source space and file space for second * operation (srcspace[1]) */ - start[0] = 0; - start[1] = 0; + start[0] = 0; + start[1] = 0; stride[0] = 1; stride[1] = 2; - count[0] = 1; - count[1] = 26; - block[0] = 10; - block[1] = 1; - if(H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, stride, count, block) < 0) + count[0] = 1; + count[1] = 26; + block[0] = 10; + block[1] = 1; + if (H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, stride, count, block) < 0) TEST_ERROR start[1] = 1; - if(H5Sselect_hyperslab(srcspace[1], H5S_SELECT_SET, start, stride, count, block) < 0) + if (H5Sselect_hyperslab(srcspace[1], H5S_SELECT_SET, start, stride, count, block) < 0) TEST_ERROR /* Select hyperslabs (checkerboard) in virtual spaces */ - start[0] = 0; - start[1] = 0; + start[0] = 0; + start[1] = 0; stride[0] = 2; stride[1] = 2; - count[0] = 5; - count[1] = 26; - block[0] = 1; - block[1] = 1; - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0) + count[0] = 5; + count[1] = 26; + block[0] = 1; + block[1] = 1; + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0) TEST_ERROR start[0] = 1; start[1] = 1; - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_OR, start, stride, count, block) < 0) + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_OR, start, stride, count, block) < 0) TEST_ERROR start[0] = 0; - if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, stride, count, block) < 0) + if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, stride, count, block) < 0) TEST_ERROR start[0] = 1; start[1] = 0; - if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_OR, start, stride, count, block) < 0) + if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_OR, start, stride, count, block) < 0) TEST_ERROR /* Add virtual layout mappings */ - if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0) + if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", + srcspace[0]) < 0) TEST_ERROR - if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", srcspace[0]) < 0) + if (H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", + srcspace[0]) < 0) TEST_ERROR /* Create virtual file */ - if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create source file if requested */ - if(config & TEST_IO_DIFFERENT_FILE) { - if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR } else { srcfile[0] = vfile; - if(H5Iinc_ref(srcfile[0]) < 0) + if (H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR } /* Create source datasets */ - if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Create virtual dataset */ - if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR /* Populate write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j; /* Write data directly to source datasets */ /* Write first dataset */ - if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, srcspace[0], H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, srcspace[0], H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 10; i += 2) - for(j = 0; j < 26; j++) + for (i = 0; i < 10; i += 2) + for (j = 0; j < 26; j++) erbuf[i][j] = buf[i][j]; /* Adjust write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); /* Write second dataset */ - if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, srcspace[0], H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, srcspace[0], H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 1; i < 10; i += 2) - for(j = 0; j < 26; j++) + for (i = 1; i < 10; i += 2) + for (j = 0; j < 26; j++) erbuf[i][j] = buf[i][j]; /* Close srcdsets and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[0]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(srcdset[1]) < 0) + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR } @@ -2781,69 +2782,69 @@ test_basic_io(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Read first stripe pattern */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, srcspace[0], H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, srcspace[0], H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if(rbuf[i][j] != erbuf[i][j]) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if (rbuf[i][j] != erbuf[i][j]) TEST_ERROR /* Read second stripe pattern */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, srcspace[1], H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, srcspace[1], H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 10; i += 2) - for(j = 0; j < 26; j++) { + for (i = 0; i < 10; i += 2) + for (j = 0; j < 26; j++) { erbuf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); erbuf[i + 1][j] -= (int)(sizeof(buf) / sizeof(buf[0][0])); } /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if(rbuf[i][j] != erbuf[i][j]) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if (rbuf[i][j] != erbuf[i][j]) TEST_ERROR /* Adjust write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); /* Write data through virtual dataset */ /* Write first slice */ - if(H5Dwrite(vdset, H5T_NATIVE_INT, memspace, srcspace[0], H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(vdset, H5T_NATIVE_INT, memspace, srcspace[0], H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 10; i += 2) - for(j = 0; j < 26; j++) + for (i = 0; i < 10; i += 2) + for (j = 0; j < 26; j++) erbuf[i][j] = buf[i][j]; /* Adjust write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); /* Write second slice */ - if(H5Dwrite(vdset, H5T_NATIVE_INT, memspace, srcspace[1], H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(vdset, H5T_NATIVE_INT, memspace, srcspace[1], H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 1; i < 10; i += 2) - for(j = 0; j < 26; j++) + for (i = 1; i < 10; i += 2) + for (j = 0; j < 26; j++) erbuf[i][j] = buf[i][j]; /* Reopen srcdsets and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(config & TEST_IO_DIFFERENT_FILE) - if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (config & TEST_IO_DIFFERENT_FILE) + if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) TEST_ERROR - if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) + if ((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR } @@ -2852,75 +2853,74 @@ test_basic_io(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Read first dataset */ - if(H5Dread(srcdset[0], H5T_NATIVE_INT, memspace, srcspace[0], H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(srcdset[0], H5T_NATIVE_INT, memspace, srcspace[0], H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if(rbuf[i][j] != erbuf[i][j]) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if (rbuf[i][j] != erbuf[i][j]) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 10; i += 2) - for(j = 0; j < 26; j++) { + for (i = 0; i < 10; i += 2) + for (j = 0; j < 26; j++) { erbuf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); erbuf[i + 1][j] -= (int)(sizeof(buf) / sizeof(buf[0][0])); } /* Read second dataset */ - if(H5Dread(srcdset[1], H5T_NATIVE_INT, memspace, srcspace[0], H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(srcdset[1], H5T_NATIVE_INT, memspace, srcspace[0], H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if(rbuf[i][j] != erbuf[i][j]) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if (rbuf[i][j] != erbuf[i][j]) TEST_ERROR /* Close */ - if(H5Dclose(srcdset[0]) < 0) + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(srcdset[1]) < 0) + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(srcfile[0]) < 0) + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if(H5Sclose(srcspace[0]) < 0) + if (H5Sclose(srcspace[0]) < 0) TEST_ERROR srcspace[0] = -1; - if(H5Sclose(srcspace[1]) < 0) + if (H5Sclose(srcspace[1]) < 0) TEST_ERROR srcspace[1] = -1; - if(H5Sclose(vspace[0]) < 0) + if (H5Sclose(vspace[0]) < 0) TEST_ERROR vspace[0] = -1; - if(H5Sclose(vspace[1]) < 0) + if (H5Sclose(vspace[1]) < 0) TEST_ERROR vspace[1] = -1; - if(H5Sclose(memspace) < 0) + if (H5Sclose(memspace) < 0) TEST_ERROR memspace = -1; - /* * Test 7: 1 Source dataset, two mappings, 4 dimensional virtual dataset * and 3 dimensional source dataset */ /* Clear virtual layout in DCPL */ - if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) TEST_ERROR /* Create memory dataspace */ - if((memspace = H5Screate_simple(2, dims, NULL)) < 0) + if ((memspace = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Create virtual dataspaces */ @@ -2928,18 +2928,18 @@ test_basic_io(unsigned config, hid_t fapl) dims[1] = 3; dims[2] = 3; dims[3] = 3; - if((vspace[0] = H5Screate_simple(4, dims, NULL)) < 0) + if ((vspace[0] = H5Screate_simple(4, dims, NULL)) < 0) TEST_ERROR - if((vspace[1] = H5Screate_simple(4, dims, NULL)) < 0) + if ((vspace[1] = H5Screate_simple(4, dims, NULL)) < 0) TEST_ERROR /* Create source dataspaces */ dims[0] = 2; dims[1] = 4; dims[2] = 4; - if((srcspace[0] = H5Screate_simple(3, dims, NULL)) < 0) + if ((srcspace[0] = H5Screate_simple(3, dims, NULL)) < 0) TEST_ERROR - if((srcspace[1] = H5Screate_simple(3, dims, NULL)) < 0) + if ((srcspace[1] = H5Screate_simple(3, dims, NULL)) < 0) TEST_ERROR /* Reset dims */ @@ -2947,118 +2947,121 @@ test_basic_io(unsigned config, hid_t fapl) dims[1] = 26; /* Select hyperslabs (stripes) in source spaces */ - start[0] = 0; - start[1] = 0; - start[2] = 0; + start[0] = 0; + start[1] = 0; + start[2] = 0; stride[0] = 1; stride[1] = 2; stride[2] = 1; - count[0] = 1; - count[1] = 2; - count[2] = 1; - block[0] = 2; - block[1] = 1; - block[2] = 4; - if(H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, stride, count, block) < 0) + count[0] = 1; + count[1] = 2; + count[2] = 1; + block[0] = 2; + block[1] = 1; + block[2] = 4; + if (H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, stride, count, block) < 0) TEST_ERROR start[1] = 1; - if(H5Sselect_hyperslab(srcspace[1], H5S_SELECT_SET, start, stride, count, block) < 0) + if (H5Sselect_hyperslab(srcspace[1], H5S_SELECT_SET, start, stride, count, block) < 0) TEST_ERROR /* Select hyperslabs (corners) in first virtual space */ - start[0] = 0; - start[1] = 0; - start[2] = 0; - start[3] = 0; + start[0] = 0; + start[1] = 0; + start[2] = 0; + start[3] = 0; stride[0] = 2; stride[1] = 2; stride[2] = 2; stride[3] = 2; - count[0] = 2; - count[1] = 2; - count[2] = 2; - count[3] = 2; - block[0] = 1; - block[1] = 1; - block[2] = 1; - block[3] = 1; - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0) + count[0] = 2; + count[1] = 2; + count[2] = 2; + count[3] = 2; + block[0] = 1; + block[1] = 1; + block[2] = 1; + block[3] = 1; + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0) TEST_ERROR /* Select hyperslabs ("+" pattern) in second virtual space */ - start[0] = 1; - start[1] = 1; - start[2] = 0; - start[3] = 0; + start[0] = 1; + start[1] = 1; + start[2] = 0; + start[3] = 0; stride[0] = 2; stride[1] = 2; stride[2] = 2; stride[3] = 2; - count[0] = 1; - count[1] = 1; - count[2] = 2; - count[3] = 2; - block[0] = 1; - block[1] = 1; - block[2] = 1; - block[3] = 1; - if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, stride, count, block) < 0) + count[0] = 1; + count[1] = 1; + count[2] = 2; + count[3] = 2; + block[0] = 1; + block[1] = 1; + block[2] = 1; + block[3] = 1; + if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, stride, count, block) < 0) TEST_ERROR start[1] = 0; start[2] = 1; count[1] = 2; count[2] = 1; - if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_OR, start, stride, count, block) < 0) + if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_OR, start, stride, count, block) < 0) TEST_ERROR start[0] = 0; start[1] = 1; count[0] = 2; count[1] = 1; - if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_OR, start, stride, count, block) < 0) + if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_OR, start, stride, count, block) < 0) TEST_ERROR start[0] = 1; count[0] = 1; - if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_OR, start, stride, count, block) < 0) + if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_OR, start, stride, count, block) < 0) TEST_ERROR start[1] = 0; start[3] = 1; count[1] = 2; count[3] = 1; - if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_OR, start, stride, count, block) < 0) + if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_OR, start, stride, count, block) < 0) TEST_ERROR /* Add virtual layout mappings */ - if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0) + if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", + srcspace[0]) < 0) TEST_ERROR - if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[1]) < 0) + if (H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", + srcspace[1]) < 0) TEST_ERROR /* Create virtual file */ - if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create source file if requested */ - if(config & TEST_IO_DIFFERENT_FILE) { - if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR } else { srcfile[0] = vfile; - if(H5Iinc_ref(srcfile[0]) < 0) + if (H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR } /* Create source dataset */ - if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Create virtual dataset */ - if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR /* Populate write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j; /* Select hyperslab in memory space */ @@ -3066,37 +3069,37 @@ test_basic_io(unsigned config, hid_t fapl) start[1] = 0; count[0] = 2; count[1] = 16; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL ,count, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Write data directly to source dataset */ - if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Close srcdset and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[0]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR } @@ -3109,7 +3112,7 @@ test_basic_io(unsigned config, hid_t fapl) start[1] = 0; count[0] = 9; count[1] = 3; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL ,count, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Read data through virtual dataset by hyperslab */ @@ -3125,17 +3128,17 @@ test_basic_io(unsigned config, hid_t fapl) count[1] = 3; count[2] = 1; count[3] = 3; - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL ,count, NULL) < 0) + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Read first stripe pattern */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Update erbuf */ HDmemset(erbuf, 0, sizeof(erbuf)); - for(i = 0; i < 9; i++) - for(j = 0; j < 3; j++) + for (i = 0; i < 9; i++) + for (j = 0; j < 3; j++) erbuf[i][j] = fill; erbuf[0][0] = buf[0][0]; erbuf[0][2] = buf[0][1]; @@ -3149,9 +3152,9 @@ test_basic_io(unsigned config, hid_t fapl) erbuf[4][2] = buf[0][14]; /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if(rbuf[i][j] != erbuf[i][j]) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if (rbuf[i][j] != erbuf[i][j]) TEST_ERROR /* Reset rbuf */ @@ -3166,7 +3169,7 @@ test_basic_io(unsigned config, hid_t fapl) count[1] = 3; count[2] = 1; count[3] = 3; - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL ,count, NULL) < 0) + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Select hyperslab in memory space */ @@ -3174,16 +3177,16 @@ test_basic_io(unsigned config, hid_t fapl) start[1] = 3; count[0] = 9; count[1] = 3; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL ,count, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Read second stripe pattern */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 9; i++) - for(j = 3; j < 6; j++) + for (i = 0; i < 9; i++) + for (j = 3; j < 6; j++) erbuf[i][j] = fill; erbuf[1][3] = buf[0][4]; erbuf[1][5] = buf[0][5]; @@ -3199,15 +3202,14 @@ test_basic_io(unsigned config, hid_t fapl) erbuf[7][5] = buf[1][15]; /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if((j >= 3) && (j < 6)) { - if(rbuf[i][j] != erbuf[i][j]) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if ((j >= 3) && (j < 6)) { + if (rbuf[i][j] != erbuf[i][j]) TEST_ERROR } - else - if(rbuf[i][j] != 0) - TEST_ERROR + else if (rbuf[i][j] != 0) + TEST_ERROR /* Reset rbuf */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -3221,7 +3223,7 @@ test_basic_io(unsigned config, hid_t fapl) count[1] = 3; count[2] = 1; count[3] = 3; - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL ,count, NULL) < 0) + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Select hyperslab in memory space */ @@ -3229,16 +3231,16 @@ test_basic_io(unsigned config, hid_t fapl) start[1] = 6; count[0] = 9; count[1] = 3; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL ,count, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Read third stripe pattern */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 9; i++) - for(j = 6; j < 9; j++) + for (i = 0; i < 9; i++) + for (j = 6; j < 9; j++) erbuf[i][j] = fill; erbuf[0][6] = buf[0][2]; erbuf[0][8] = buf[0][3]; @@ -3252,135 +3254,134 @@ test_basic_io(unsigned config, hid_t fapl) erbuf[4][8] = buf[1][6]; /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if((j >= 6) && (j < 9)) { - if(rbuf[i][j] != erbuf[i][j]) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if ((j >= 6) && (j < 9)) { + if (rbuf[i][j] != erbuf[i][j]) TEST_ERROR } - else - if(rbuf[i][j] != 0) - TEST_ERROR + else if (rbuf[i][j] != 0) + TEST_ERROR /* Now read entire VDS */ /* Set memory space extent to 9x9, select all in order to reach part of the * code in H5S_select_subtract() */ dims[0] = 9; dims[1] = 9; - if(H5Sset_extent_simple(memspace, 2, dims, NULL) < 0) + if (H5Sset_extent_simple(memspace, 2, dims, NULL) < 0) TEST_ERROR - if(H5Sselect_all(memspace) < 0) + if (H5Sselect_all(memspace) < 0) TEST_ERROR /* Read third stripe pattern */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf99[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf99[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)(sizeof(rbuf99) / sizeof(rbuf99[0])); i++) - for(j = 0; j < (int)(sizeof(rbuf99[0]) / sizeof(rbuf99[0][0])); j++) - if(rbuf99[i][j] != erbuf[i][j]) + for (i = 0; i < (int)(sizeof(rbuf99) / sizeof(rbuf99[0])); i++) + for (j = 0; j < (int)(sizeof(rbuf99[0]) / sizeof(rbuf99[0][0])); j++) + if (rbuf99[i][j] != erbuf[i][j]) TEST_ERROR /* Adjust write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); /* Write data through virtual dataset by hyperslab */ /* Select stripe (only select mapped elements) */ - start[0] = 0; - start[1] = 0; - start[2] = 0; - start[3] = 0; + start[0] = 0; + start[1] = 0; + start[2] = 0; + start[3] = 0; stride[0] = 2; stride[1] = 2; stride[2] = 1; stride[3] = 2; - count[0] = 2; - count[1] = 2; - count[2] = 1; - count[3] = 2; - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride ,count, NULL) < 0) - TEST_ERROR - start[0] = 1; - start[1] = 1; - start[2] = 0; - start[3] = 0; + count[0] = 2; + count[1] = 2; + count[2] = 1; + count[3] = 2; + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, NULL) < 0) + TEST_ERROR + start[0] = 1; + start[1] = 1; + start[2] = 0; + start[3] = 0; stride[0] = 1; stride[1] = 1; stride[2] = 1; stride[3] = 2; - count[0] = 1; - count[1] = 1; - count[2] = 1; - count[3] = 2; - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_OR, start, stride ,count, NULL) < 0) + count[0] = 1; + count[1] = 1; + count[2] = 1; + count[3] = 2; + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_OR, start, stride, count, NULL) < 0) TEST_ERROR /* Reset extent of memspace, select hyperslab */ dims[0] = 10; dims[1] = 26; - if(H5Sset_extent_simple(memspace, 2, dims, NULL) < 0) + if (H5Sset_extent_simple(memspace, 2, dims, NULL) < 0) TEST_ERROR start[0] = 0; start[1] = 0; count[0] = 1; count[1] = 10; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL ,count, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Write data through virtual dataset by hyperslab */ /* Write first stripe pattern */ - if(H5Dwrite(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ HDmemset(erbuf, 0, sizeof(erbuf)); - erbuf[0][0] = buf[0][0]; - erbuf[0][1] = buf[0][1]; - erbuf[0][8] = buf[0][2]; - erbuf[0][9] = buf[0][3]; - erbuf[1][0] = buf[0][6]; - erbuf[1][1] = buf[0][7]; - erbuf[1][8] = buf[0][8]; - erbuf[1][9] = buf[0][9]; + erbuf[0][0] = buf[0][0]; + erbuf[0][1] = buf[0][1]; + erbuf[0][8] = buf[0][2]; + erbuf[0][9] = buf[0][3]; + erbuf[1][0] = buf[0][6]; + erbuf[1][1] = buf[0][7]; + erbuf[1][8] = buf[0][8]; + erbuf[1][9] = buf[0][9]; erbuf[0][13] = buf[0][4]; erbuf[0][14] = buf[0][5]; /* Adjust write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); /* Select stripe (only select mapped elements) */ - start[0] = 0; - start[1] = 1; - start[2] = 1; - start[3] = 0; + start[0] = 0; + start[1] = 1; + start[2] = 1; + start[3] = 0; stride[0] = 1; stride[1] = 1; stride[2] = 1; stride[3] = 2; - count[0] = 3; - count[1] = 1; - count[2] = 1; - count[3] = 2; - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride ,count, NULL) < 0) - TEST_ERROR - start[0] = 1; - start[1] = 0; - start[2] = 1; - start[3] = 0; + count[0] = 3; + count[1] = 1; + count[2] = 1; + count[3] = 2; + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, NULL) < 0) + TEST_ERROR + start[0] = 1; + start[1] = 0; + start[2] = 1; + start[3] = 0; stride[0] = 1; stride[1] = 2; stride[2] = 1; stride[3] = 1; - count[0] = 1; - count[1] = 2; - count[2] = 1; - count[3] = 3; - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_OR, start, stride ,count, NULL) < 0) + count[0] = 1; + count[1] = 2; + count[2] = 1; + count[3] = 3; + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_OR, start, stride, count, NULL) < 0) TEST_ERROR /* Select hyperslab in memory space */ @@ -3388,60 +3389,60 @@ test_basic_io(unsigned config, hid_t fapl) start[1] = 0; count[0] = 1; count[1] = 12; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL ,count, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Write second slice */ - if(H5Dwrite(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - erbuf[0][4] = buf[0][0]; - erbuf[0][5] = buf[0][1]; - erbuf[0][6] = buf[0][2]; - erbuf[0][7] = buf[0][3]; + erbuf[0][4] = buf[0][0]; + erbuf[0][5] = buf[0][1]; + erbuf[0][6] = buf[0][2]; + erbuf[0][7] = buf[0][3]; erbuf[0][12] = buf[0][4]; erbuf[0][15] = buf[0][5]; - erbuf[1][4] = buf[0][6]; - erbuf[1][7] = buf[0][7]; + erbuf[1][4] = buf[0][6]; + erbuf[1][7] = buf[0][7]; erbuf[1][12] = buf[0][8]; erbuf[1][13] = buf[0][9]; erbuf[1][14] = buf[0][10]; erbuf[1][15] = buf[0][11]; /* Adjust write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); /* Select stripe (only select mapped elements) */ - start[0] = 0; - start[1] = 0; - start[2] = 2; - start[3] = 0; + start[0] = 0; + start[1] = 0; + start[2] = 2; + start[3] = 0; stride[0] = 2; stride[1] = 2; stride[2] = 1; stride[3] = 2; - count[0] = 2; - count[1] = 2; - count[2] = 1; - count[3] = 2; - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride ,count, NULL) < 0) - TEST_ERROR - start[0] = 1; - start[1] = 1; - start[2] = 2; - start[3] = 0; + count[0] = 2; + count[1] = 2; + count[2] = 1; + count[3] = 2; + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, NULL) < 0) + TEST_ERROR + start[0] = 1; + start[1] = 1; + start[2] = 2; + start[3] = 0; stride[0] = 1; stride[1] = 1; stride[2] = 1; stride[3] = 2; - count[0] = 1; - count[1] = 1; - count[2] = 1; - count[3] = 2; - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_OR, start, stride ,count, NULL) < 0) + count[0] = 1; + count[1] = 1; + count[2] = 1; + count[3] = 2; + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_OR, start, stride, count, NULL) < 0) TEST_ERROR /* Select hyperslab in memory space */ @@ -3449,31 +3450,31 @@ test_basic_io(unsigned config, hid_t fapl) start[1] = 0; count[0] = 1; count[1] = 10; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL ,count, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Write third slice */ - if(H5Dwrite(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - erbuf[0][2] = buf[0][0]; - erbuf[0][3] = buf[0][1]; + erbuf[0][2] = buf[0][0]; + erbuf[0][3] = buf[0][1]; erbuf[0][10] = buf[0][2]; erbuf[0][11] = buf[0][3]; - erbuf[1][2] = buf[0][6]; - erbuf[1][3] = buf[0][7]; + erbuf[1][2] = buf[0][6]; + erbuf[1][3] = buf[0][7]; erbuf[1][10] = buf[0][8]; erbuf[1][11] = buf[0][9]; - erbuf[1][5] = buf[0][4]; - erbuf[1][6] = buf[0][5]; + erbuf[1][5] = buf[0][4]; + erbuf[1][6] = buf[0][5]; /* Reopen srcdset and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(config & TEST_IO_DIFFERENT_FILE) - if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (config & TEST_IO_DIFFERENT_FILE) + if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) TEST_ERROR } @@ -3483,106 +3484,106 @@ test_basic_io(unsigned config, hid_t fapl) start[1] = 0; count[0] = 2; count[1] = 16; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL ,count, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Reset rbuf */ HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Read dataset */ - if(H5Dread(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if(rbuf[i][j] != erbuf[i][j]) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if (rbuf[i][j] != erbuf[i][j]) TEST_ERROR /* Now try writing to whole VDS (should fail due to unmapped elements) */ count[0] = 9; count[1] = 9; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR - H5E_BEGIN_TRY { - ret = H5Dwrite(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]); - } H5E_END_TRY - if(ret >= 0) + H5E_BEGIN_TRY { ret = H5Dwrite(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]); } + H5E_END_TRY + if (ret >= 0) TEST_ERROR /* Close */ - if(H5Dclose(srcdset[0]) < 0) + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(srcfile[0]) < 0) + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if(H5Sclose(srcspace[0]) < 0) + if (H5Sclose(srcspace[0]) < 0) TEST_ERROR srcspace[0] = -1; - if(H5Sclose(srcspace[1]) < 0) + if (H5Sclose(srcspace[1]) < 0) TEST_ERROR srcspace[1] = -1; - if(H5Sclose(vspace[0]) < 0) + if (H5Sclose(vspace[0]) < 0) TEST_ERROR vspace[0] = -1; - if(H5Sclose(vspace[1]) < 0) + if (H5Sclose(vspace[1]) < 0) TEST_ERROR vspace[1] = -1; - if(H5Sclose(memspace) < 0) + if (H5Sclose(memspace) < 0) TEST_ERROR memspace = -1; - /* * Test 8: For code coverage: Horizontal block virtual mappings, and file * selection, grid memory selection */ /* Clear virtual layout in DCPL */ - if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) TEST_ERROR /* Create memory dataspace */ - if((memspace = H5Screate_simple(2, dims, NULL)) < 0) + if ((memspace = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Create virtual dataspaces */ dims[0] = 8; dims[1] = 15; - if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + if ((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR - if((vspace[1] = H5Screate_simple(2, dims, NULL)) < 0) + if ((vspace[1] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Create source dataspace */ dims[0] = 4; - if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Select all in source space (should not be necessary, but just to be sure) */ - if(H5Sselect_all(srcspace[0]) < 0) + if (H5Sselect_all(srcspace[0]) < 0) TEST_ERROR /* Select hyperslabs in virtual spaces */ start[0] = 0; start[1] = 0; - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR start[0] = 4; - if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Add virtual layout mappings */ - if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0) + if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", + srcspace[0]) < 0) TEST_ERROR - if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", srcspace[0]) < 0) + if (H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", + srcspace[0]) < 0) TEST_ERROR /* Reset dims */ @@ -3590,36 +3591,38 @@ test_basic_io(unsigned config, hid_t fapl) dims[1] = 26; /* Create virtual file */ - if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create source file if requested */ - if(config & TEST_IO_DIFFERENT_FILE) { - if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR } else { srcfile[0] = vfile; - if(H5Iinc_ref(srcfile[0]) < 0) + if (H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR } /* Create source datasets */ - if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Create virtual dataset */ - if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR /* Reset erbuf */ HDmemset(erbuf[0], 0, sizeof(rbuf)); /* Populate write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j; /* Select hyperslab in memory */ @@ -3627,21 +3630,21 @@ test_basic_io(unsigned config, hid_t fapl) start[1] = 0; count[0] = 4; count[1] = 15; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Write data directly to first source dataset */ - if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ u = 0; v = 0; - for(i = 2; i < 4; i++) - for(j = 0; j < 15; j++) { + for (i = 2; i < 4; i++) + for (j = 0; j < 15; j++) { erbuf[u][v] = buf[i][j]; v += 2; - if(v >= 24) { + if (v >= 24) { u += 2; v = 0; } @@ -3649,61 +3652,61 @@ test_basic_io(unsigned config, hid_t fapl) /* Select hyperslab in memory */ start[0] = 4; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Write data directly to second source dataset */ - if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 4; i < 6; i++) - for(j = 0; j < 15; j++) { + for (i = 4; i < 6; i++) + for (j = 0; j < 15; j++) { erbuf[u][v] = buf[i][j]; v += 2; - if(v >= 24) { + if (v >= 24) { u += 2; v = 0; } } /* Close srcdsets and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[0]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(srcdset[1]) < 0) + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(H5Fclose(srcfile[0]) < 0) + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR } /* Select hyperslab in memory */ - start[0] = 0; - start[1] = 0; + start[0] = 0; + start[1] = 0; stride[0] = 2; stride[1] = 2; - count[0] = 5; - count[1] = 12; - block[0] = 1; - block[1] = 1; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, stride, count, block) < 0) + count[0] = 5; + count[1] = 12; + block[0] = 1; + block[1] = 1; + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, stride, count, block) < 0) TEST_ERROR /* Select hyperslab in file */ @@ -3711,104 +3714,106 @@ test_basic_io(unsigned config, hid_t fapl) start[1] = 0; count[0] = 4; count[1] = 15; - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Read data through virtual dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if(rbuf[i][j] != erbuf[i][j]) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if (rbuf[i][j] != erbuf[i][j]) TEST_ERROR /* Close */ - if(!(config & TEST_IO_CLOSE_SRC)) { - if(H5Dclose(srcdset[0]) < 0) + if (!(config & TEST_IO_CLOSE_SRC)) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(srcdset[1]) < 0) + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(H5Fclose(srcfile[0]) < 0) + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if(H5Sclose(srcspace[0]) < 0) + if (H5Sclose(srcspace[0]) < 0) TEST_ERROR srcspace[0] = -1; - if(H5Sclose(vspace[0]) < 0) + if (H5Sclose(vspace[0]) < 0) TEST_ERROR vspace[0] = -1; - if(H5Sclose(vspace[1]) < 0) + if (H5Sclose(vspace[1]) < 0) TEST_ERROR vspace[1] = -1; - if(H5Sclose(memspace) < 0) + if (H5Sclose(memspace) < 0) TEST_ERROR memspace = -1; - /* * Test 9: For code coverage: Horizontal block virtual mappings, and file * selection, grid memory selection, 3 mappings, 3D memory space */ /* Clear virtual layout in DCPL */ - if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) TEST_ERROR /* Create memory dataspace */ dims[1] = 13; dims[2] = 2; - if((memspace = H5Screate_simple(3, dims, NULL)) < 0) + if ((memspace = H5Screate_simple(3, dims, NULL)) < 0) TEST_ERROR /* Create virtual dataspaces */ dims[0] = 6; dims[1] = 10; - if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + if ((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR - if((vspace[1] = H5Screate_simple(2, dims, NULL)) < 0) + if ((vspace[1] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR - if((vspace[2] = H5Screate_simple(2, dims, NULL)) < 0) + if ((vspace[2] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Create source dataspace */ dims[0] = 2; - if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Select all in source space (should not be necessary, but just to be sure) */ - if(H5Sselect_all(srcspace[0]) < 0) + if (H5Sselect_all(srcspace[0]) < 0) TEST_ERROR /* Select hyperslabs in virtual spaces */ start[0] = 0; start[1] = 0; - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR start[0] = 2; - if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR start[0] = 4; - if(H5Sselect_hyperslab(vspace[2], H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(vspace[2], H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Add virtual layout mappings */ - if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0) + if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", + srcspace[0]) < 0) TEST_ERROR - if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", srcspace[0]) < 0) + if (H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", + srcspace[0]) < 0) TEST_ERROR - if(H5Pset_virtual(dcpl, vspace[2], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset3", srcspace[0]) < 0) + if (H5Pset_virtual(dcpl, vspace[2], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset3", + srcspace[0]) < 0) TEST_ERROR /* Reset dims */ @@ -3816,38 +3821,41 @@ test_basic_io(unsigned config, hid_t fapl) dims[1] = 26; /* Create virtual file */ - if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create source file if requested */ - if(config & TEST_IO_DIFFERENT_FILE) { - if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR } else { srcfile[0] = vfile; - if(H5Iinc_ref(srcfile[0]) < 0) + if (H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR } /* Create source datasets */ - if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((srcdset[2] = H5Dcreate2(srcfile[0], "src_dset3", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[2] = H5Dcreate2(srcfile[0], "src_dset3", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Create virtual dataset */ - if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR /* Reset erbuf */ HDmemset(erbuf[0], 0, sizeof(rbuf)); /* Populate write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j; /* Select hyperslab in memory */ @@ -3857,22 +3865,22 @@ test_basic_io(unsigned config, hid_t fapl) count[0] = 2; count[1] = 5; count[2] = 2; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Write data directly to first source dataset */ - if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ u = 0; v = 0; - for(i = 0; i < 2; i++) - for(j = 0; j < 10; j++) { + for (i = 0; i < 2; i++) + for (j = 0; j < 10; j++) { erbuf[u][v] = buf[i][j]; - if(++v == 6) + if (++v == 6) v += 2; - else if(v == 14) { + else if (v == 14) { u += 2; v = 0; } @@ -3880,20 +3888,20 @@ test_basic_io(unsigned config, hid_t fapl) /* Select hyperslab in memory */ start[0] = 2; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Write data directly to second source dataset */ - if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 2; i < 4; i++) - for(j = 0; j < 10; j++) { + for (i = 2; i < 4; i++) + for (j = 0; j < 10; j++) { erbuf[u][v] = buf[i][j]; - if(++v == 6) + if (++v == 6) v += 2; - else if(v == 14) { + else if (v == 14) { u += 2; v = 0; } @@ -3901,174 +3909,175 @@ test_basic_io(unsigned config, hid_t fapl) /* Select hyperslab in memory */ start[0] = 4; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Write data directly to third source dataset */ - if(H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 4; i < 6; i++) - for(j = 0; j < 10; j++) { + for (i = 4; i < 6; i++) + for (j = 0; j < 10; j++) { erbuf[u][v] = buf[i][j]; - if(++v == 6) + if (++v == 6) v += 2; - else if(v == 14) { + else if (v == 14) { u += 2; v = 0; } } /* Close srcdsets and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[0]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(srcdset[1]) < 0) + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(H5Dclose(srcdset[2]) < 0) + if (H5Dclose(srcdset[2]) < 0) TEST_ERROR srcdset[2] = -1; - if(H5Fclose(srcfile[0]) < 0) + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR } /* Select hyperslab in memory */ - start[0] = 0; - start[1] = 0; - start[2] = 0; + start[0] = 0; + start[1] = 0; + start[2] = 0; stride[0] = 2; stride[1] = 4; stride[2] = 1; - count[0] = 5; - count[1] = 2; - count[2] = 1; - block[0] = 1; - block[1] = 3; - block[2] = 2; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, stride, count, block) < 0) + count[0] = 5; + count[1] = 2; + count[2] = 1; + block[0] = 1; + block[1] = 3; + block[2] = 2; + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, stride, count, block) < 0) TEST_ERROR /* Read data through virtual dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if(rbuf[i][j] != erbuf[i][j]) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if (rbuf[i][j] != erbuf[i][j]) TEST_ERROR /* Close */ - if(!(config & TEST_IO_CLOSE_SRC)) { - if(H5Dclose(srcdset[0]) < 0) + if (!(config & TEST_IO_CLOSE_SRC)) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(srcdset[1]) < 0) + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(H5Dclose(srcdset[2]) < 0) + if (H5Dclose(srcdset[2]) < 0) TEST_ERROR srcdset[2] = -1; - if(H5Fclose(srcfile[0]) < 0) + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if(H5Sclose(srcspace[0]) < 0) + if (H5Sclose(srcspace[0]) < 0) TEST_ERROR srcspace[0] = -1; - if(H5Sclose(vspace[0]) < 0) + if (H5Sclose(vspace[0]) < 0) TEST_ERROR vspace[0] = -1; - if(H5Sclose(vspace[1]) < 0) + if (H5Sclose(vspace[1]) < 0) TEST_ERROR vspace[1] = -1; - if(H5Sclose(vspace[2]) < 0) + if (H5Sclose(vspace[2]) < 0) TEST_ERROR vspace[2] = -1; - if(H5Sclose(memspace) < 0) + if (H5Sclose(memspace) < 0) TEST_ERROR memspace = -1; - /* * Test 10: For code coverage: Vertical stripe virtual mappings, vertical * block file selection, block memory selection, 3D VDS */ /* Clear virtual layout in DCPL */ - if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) TEST_ERROR /* Create memory dataspace */ - if((memspace = H5Screate_simple(2, dims, NULL)) < 0) + if ((memspace = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Create virtual dataspaces */ dims[0] = 10; dims[1] = 9; dims[2] = 6; - if((vspace[0] = H5Screate_simple(3, dims, NULL)) < 0) + if ((vspace[0] = H5Screate_simple(3, dims, NULL)) < 0) TEST_ERROR - if((vspace[1] = H5Screate_simple(3, dims, NULL)) < 0) + if ((vspace[1] = H5Screate_simple(3, dims, NULL)) < 0) TEST_ERROR /* Create source dataspace */ dims[1] = 12; - if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Select all in source space (should not be necessary, but just to be sure) */ - if(H5Sselect_all(srcspace[0]) < 0) + if (H5Sselect_all(srcspace[0]) < 0) TEST_ERROR /* Select hyperslabs in virtual spaces */ - start[0] = 0; - start[1] = 0; - start[2] = 0; - count[0] = 1; - count[1] = 4; - count[2] = 3; + start[0] = 0; + start[1] = 0; + start[2] = 0; + count[0] = 1; + count[1] = 4; + count[2] = 3; stride[0] = 1; stride[1] = 2; stride[2] = 2; - block[0] = 10; - block[1] = 1; - block[2] = 1; - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0) + block[0] = 10; + block[1] = 1; + block[2] = 1; + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0) TEST_ERROR start[2] = 1; - if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, stride, count, block) < 0) + if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, stride, count, block) < 0) TEST_ERROR /* Add virtual layout mappings */ - if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0) + if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", + srcspace[0]) < 0) TEST_ERROR - if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", srcspace[0]) < 0) + if (H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", + srcspace[0]) < 0) TEST_ERROR /* Reset dims */ @@ -4076,41 +4085,43 @@ test_basic_io(unsigned config, hid_t fapl) dims[1] = 26; /* Create virtual file */ - if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create source file if requested */ - if(config & TEST_IO_DIFFERENT_FILE) { - if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR } else { srcfile[0] = vfile; - if(H5Iinc_ref(srcfile[0]) < 0) + if (H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR } /* Create source datasets */ - if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Create virtual dataset */ - if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR /* Initialize erbuf */ HDmemset(erbuf[0], 0, sizeof(rbuf)); - for(i = 0; i < 10; i++) - for(j = 0; j < 24; j += 6) { - erbuf[i][j] = -1; + for (i = 0; i < 10; i++) + for (j = 0; j < 24; j += 6) { + erbuf[i][j] = -1; erbuf[i][j + 1] = -1; } /* Populate write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j; /* Select hyperslab in memory */ @@ -4118,24 +4129,24 @@ test_basic_io(unsigned config, hid_t fapl) start[1] = 0; count[0] = 10; count[1] = 12; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Write data directly to first source dataset */ - if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ u = 0; v = 0; - for(i = 0; i < 10; i++) - for(j = 0; j < 8; j++) { - if(v == 0 || v == 12) + for (i = 0; i < 10; i++) + for (j = 0; j < 8; j++) { + if (v == 0 || v == 12) erbuf[u][v] = buf[i][j]; v += 2; - if(!(v % 6)) + if (!(v % 6)) v += 6; - if(v >= 28) { + if (v >= 28) { u++; v = 0; } @@ -4143,66 +4154,66 @@ test_basic_io(unsigned config, hid_t fapl) /* Select hyperslab in memory */ start[1] = 8; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Write data directly to second source dataset */ - if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ u = 0; v = 1; - for(i = 0; i < 10; i++) - for(j = 8; j < 16; j++) { - if(v == 1 || v == 13) + for (i = 0; i < 10; i++) + for (j = 8; j < 16; j++) { + if (v == 1 || v == 13) erbuf[u][v] = buf[i][j]; v += 2; - if(!((v - 1) % 6)) + if (!((v - 1) % 6)) v += 6; - if(v >= 28) { + if (v >= 28) { u++; v = 1; } } /* Close srcdsets and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[0]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(srcdset[1]) < 0) + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(H5Fclose(srcfile[0]) < 0) + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR } /* Select hyperslab in memory */ - start[0] = 0; - start[1] = 0; + start[0] = 0; + start[1] = 0; stride[0] = 1; stride[1] = 6; - count[0] = 1; - count[1] = 4; - block[0] = 10; - block[1] = 2; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, stride, count, block) < 0) + count[0] = 1; + count[1] = 4; + block[0] = 10; + block[1] = 2; + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, stride, count, block) < 0) TEST_ERROR /* Select hyperslab in file */ @@ -4212,54 +4223,53 @@ test_basic_io(unsigned config, hid_t fapl) count[0] = 10; count[1] = 4; count[2] = 2; - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Read data through virtual dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if(rbuf[i][j] != erbuf[i][j]) + for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if (rbuf[i][j] != erbuf[i][j]) TEST_ERROR /* Close */ - if(!(config & TEST_IO_CLOSE_SRC)) { - if(H5Dclose(srcdset[0]) < 0) + if (!(config & TEST_IO_CLOSE_SRC)) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(srcdset[1]) < 0) + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(H5Fclose(srcfile[0]) < 0) + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if(H5Sclose(srcspace[0]) < 0) + if (H5Sclose(srcspace[0]) < 0) TEST_ERROR srcspace[0] = -1; - if(H5Sclose(vspace[0]) < 0) + if (H5Sclose(vspace[0]) < 0) TEST_ERROR vspace[0] = -1; - if(H5Sclose(vspace[1]) < 0) + if (H5Sclose(vspace[1]) < 0) TEST_ERROR vspace[1] = -1; - if(H5Sclose(memspace) < 0) + if (H5Sclose(memspace) < 0) TEST_ERROR memspace = -1; - /* Close */ - if(H5Pclose(dcpl) < 0) + if (H5Pclose(dcpl) < 0) TEST_ERROR dcpl = -1; @@ -4274,21 +4284,23 @@ test_basic_io(unsigned config, hid_t fapl) return 0; error: - H5E_BEGIN_TRY { - for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) + H5E_BEGIN_TRY + { + for (i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) H5Dclose(srcdset[i]); H5Dclose(vdset); - for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) + for (i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) H5Fclose(srcfile[i]); H5Fclose(vfile); H5Fclose(vfile2); - for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) + for (i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) H5Sclose(srcspace[i]); - for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) + for (i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) H5Sclose(vspace[i]); H5Sclose(memspace); H5Pclose(dcpl); - } H5E_END_TRY; + } + H5E_END_TRY; HDfree(srcfilename); HDfree(srcfilename_map); @@ -4297,10 +4309,9 @@ error: HDfree(srcfilenamepct); HDfree(srcfilenamepct_map); - return 1; + return 1; } /* end test_basic_io() */ - /*------------------------------------------------------------------------- * Function: test_unlim * @@ -4313,34 +4324,34 @@ error: static int test_unlim(unsigned config, hid_t fapl) { - char srcfilename[FILENAME_BUF_SIZE]; - char srcfilename_map[FILENAME_BUF_SIZE]; - char vfilename[FILENAME_BUF_SIZE]; - hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */ - hid_t vfile = -1; /* File with virtual dset */ - hid_t dcpl = -1; /* Dataset creation property list */ - hid_t srcdcpl = -1; /* DCPL for source dset */ - hid_t dapl = -1; /* Dataset access property list */ - hid_t srcspace[4] = {-1, -1, -1, -1}; /* Source dataspaces */ - hid_t vspace[4] = {-1, -1, -1, -1}; /* Virtual dset dataspaces */ - hid_t memspace = -1; /* Memory dataspace */ - hid_t filespace = -1; /* File dataspace */ - hid_t srcdset[4] = {-1, -1, -1, -1}; /* Source datsets */ - hid_t vdset = -1; /* Virtual dataset */ - hsize_t dims[2] = {10, 10}; /* Data space current size */ - hsize_t mdims[2] = {10, 20}; /* Data space maximum size */ - hsize_t cdims[2] = {4, 4}; /* Chunk dimensions */ - hsize_t start[4]; /* Hyperslab start */ - hsize_t stride[4]; /* Hyperslab stride */ - hsize_t count[4]; /* Hyperslab count */ - hsize_t block[4]; /* Hyperslab block */ - int buf[10][20]; /* Write and expected read buffer */ - int rbuf[10][20]; /* Read buffer */ - int erbuf[10][20]; /* Expected read buffer */ - int ndims; /* Number of dimensions */ - int fill = -1; /* Fill value */ - H5D_vds_view_t virtual_view; /* Virtual view property */ - int i, j; + char srcfilename[FILENAME_BUF_SIZE]; + char srcfilename_map[FILENAME_BUF_SIZE]; + char vfilename[FILENAME_BUF_SIZE]; + hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */ + hid_t vfile = -1; /* File with virtual dset */ + hid_t dcpl = -1; /* Dataset creation property list */ + hid_t srcdcpl = -1; /* DCPL for source dset */ + hid_t dapl = -1; /* Dataset access property list */ + hid_t srcspace[4] = {-1, -1, -1, -1}; /* Source dataspaces */ + hid_t vspace[4] = {-1, -1, -1, -1}; /* Virtual dset dataspaces */ + hid_t memspace = -1; /* Memory dataspace */ + hid_t filespace = -1; /* File dataspace */ + hid_t srcdset[4] = {-1, -1, -1, -1}; /* Source datsets */ + hid_t vdset = -1; /* Virtual dataset */ + hsize_t dims[2] = {10, 10}; /* Data space current size */ + hsize_t mdims[2] = {10, 20}; /* Data space maximum size */ + hsize_t cdims[2] = {4, 4}; /* Chunk dimensions */ + hsize_t start[4]; /* Hyperslab start */ + hsize_t stride[4]; /* Hyperslab stride */ + hsize_t count[4]; /* Hyperslab count */ + hsize_t block[4]; /* Hyperslab block */ + int buf[10][20]; /* Write and expected read buffer */ + int rbuf[10][20]; /* Read buffer */ + int erbuf[10][20]; /* Expected read buffer */ + int ndims; /* Number of dimensions */ + int fill = -1; /* Fill value */ + H5D_vds_view_t virtual_view; /* Virtual view property */ + int i, j; TESTING("virtual dataset I/O with unlimited selections") @@ -4349,45 +4360,44 @@ test_unlim(unsigned config, hid_t fapl) h5_fixname_printf(FILENAME[2], fapl, srcfilename_map, sizeof srcfilename_map); /* Create DCPLs */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR - if((srcdcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if ((srcdcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR /* Set fill value */ - if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0) + if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0) TEST_ERROR /* Set chunk dimensions */ - if(H5Pset_chunk(srcdcpl, 2, cdims) < 0) + if (H5Pset_chunk(srcdcpl, 2, cdims) < 0) TEST_ERROR /* Create DAPL */ - if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + if ((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) TEST_ERROR /* Create memory space */ - if((memspace = H5Screate_simple(2, mdims, NULL)) < 0) + if ((memspace = H5Screate_simple(2, mdims, NULL)) < 0) TEST_ERROR - /* * Test 1: 2 Source datasets, single unlimited hyperslab virtual mappings */ /* Clear virtual layout in DCPL */ - if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) TEST_ERROR /* Create virtual dataspaces */ - if((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0) + if ((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0) TEST_ERROR - if((vspace[1] = H5Screate_simple(2, dims, mdims)) < 0) + if ((vspace[1] = H5Screate_simple(2, dims, mdims)) < 0) TEST_ERROR /* Create source dataspace */ - dims[0] = 5; + dims[0] = 5; mdims[0] = 5; - if((srcspace[0] = H5Screate_simple(2, dims, mdims)) < 0) + if ((srcspace[0] = H5Screate_simple(2, dims, mdims)) < 0) TEST_ERROR mdims[0] = 10; @@ -4396,139 +4406,143 @@ test_unlim(unsigned config, hid_t fapl) start[1] = 0; count[0] = 5; count[1] = H5S_UNLIMITED; - if(H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Select hyperslabs in virtual spaces */ - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR start[0] = 5; - if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Add virtual layout mappings */ - if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0) + if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", + srcspace[0]) < 0) TEST_ERROR - if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", srcspace[0]) < 0) + if (H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", + srcspace[0]) < 0) TEST_ERROR /* Create virtual file */ - if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create source file if requested */ - if(config & TEST_IO_DIFFERENT_FILE) { - if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR } else { srcfile[0] = vfile; - if(H5Iinc_ref(srcfile[0]) < 0) + if (H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR } /* Create source datasets */ - if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, + H5P_DEFAULT)) < 0) TEST_ERROR - if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0) + if ((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, + H5P_DEFAULT)) < 0) TEST_ERROR /* Create virtual dataset */ - if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) + if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) TEST_ERROR /* Populate write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] = (i * (int)mdims[1]) + j; /* Initialize erbuf */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) erbuf[i][j] = fill; /* Write data directly to source datasets */ /* Select hyperslab in memory */ start[0] = 0; count[1] = 10; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Write first dataset */ - if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 5; i++) - for(j = 0; j < 10; j++) + for (i = 0; i < 5; i++) + for (j = 0; j < 10; j++) erbuf[i][j] = buf[i][j]; /* Adjust write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] += (int)mdims[0] * (int)mdims[1]; /* Write second dataset */ - if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 5; i++) - for(j = 0; j < 10; j++) + for (i = 0; i < 5; i++) + for (j = 0; j < 10; j++) erbuf[i + 5][j] = buf[i][j]; /* Close srcdsets and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[0]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(srcdset[1]) < 0) + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 10) + if (dims[1] != 10) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -4537,75 +4551,74 @@ test_unlim(unsigned config, hid_t fapl) /* Select hyperslab in memory space */ start[0] = 0; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Test H5Pget_virtual_view() */ - if(H5Pget_virtual_view(dapl, &virtual_view) < 0) + if (H5Pget_virtual_view(dapl, &virtual_view) < 0) TEST_ERROR - if(virtual_view != H5D_VDS_LAST_AVAILABLE) + if (virtual_view != H5D_VDS_LAST_AVAILABLE) TEST_ERROR /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR - if(H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0) + if (H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0) TEST_ERROR - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Fclose(vfile) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR } - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR /* Test H5Pget_virtual_view() */ - if(H5Pget_virtual_view(dapl, &virtual_view) < 0) + if (H5Pget_virtual_view(dapl, &virtual_view) < 0) TEST_ERROR - if(virtual_view != H5D_VDS_FIRST_MISSING) + if (virtual_view != H5D_VDS_FIRST_MISSING) TEST_ERROR /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 10) + if (dims[1] != 10) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -4613,106 +4626,105 @@ test_unlim(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Reopen srcdset[0] and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(config & TEST_IO_DIFFERENT_FILE) - if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (config & TEST_IO_DIFFERENT_FILE) + if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) TEST_ERROR } /* Extend srcdset[0] */ dims[0] = 5; dims[1] = 15; - if(H5Dset_extent(srcdset[0], dims) < 0) + if (H5Dset_extent(srcdset[0], dims) < 0) TEST_ERROR /* Adjust write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] += (int)mdims[0] * (int)mdims[1]; /* Write to new area of srcdset */ count[1] = 5; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR - if((filespace = H5Dget_space(srcdset[0])) < 0) + if ((filespace = H5Dget_space(srcdset[0])) < 0) TEST_ERROR start[1] = 10; - if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR - if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Close srcdset[0] and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[0]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions. Note that since we are using * H5D_VDS_FIRST_MISSING and we only extended one source dataset the * dimensions will not have changed. */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 10) + if (dims[1] != 10) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -4721,69 +4733,68 @@ test_unlim(unsigned config, hid_t fapl) /* Select hyperslab in memory space */ start[1] = 0; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR - if(H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0) + if (H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0) TEST_ERROR - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Fclose(vfile) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR } - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR /* Update erbuf to reflect new data that is now visible due to the change to * H5D_VDS_LAST_AVAILABLE */ - for(i = 0; i < 5; i++) - for(j = 0; j < 5; j++) + for (i = 0; i < 5; i++) + for (j = 0; j < 5; j++) erbuf[i][j + 10] = buf[i][j]; /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 15) + if (dims[1] != 15) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -4792,113 +4803,112 @@ test_unlim(unsigned config, hid_t fapl) /* Select hyperslab in memory space */ start[1] = 0; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Reopen srcdset[1] and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(config & TEST_IO_DIFFERENT_FILE) - if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (config & TEST_IO_DIFFERENT_FILE) + if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) + if ((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR } /* Extend srcdset[1] */ dims[0] = 5; dims[1] = 20; - if(H5Dset_extent(srcdset[1], dims) < 0) + if (H5Dset_extent(srcdset[1], dims) < 0) TEST_ERROR /* Adjust write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] += (int)mdims[0] * (int)mdims[1]; /* Write to new area of srcdset */ count[1] = 10; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR - if((filespace = H5Dget_space(srcdset[1])) < 0) + if ((filespace = H5Dget_space(srcdset[1])) < 0) TEST_ERROR start[1] = 10; - if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR - if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 5; i++) - for(j = 0; j < 10; j++) + for (i = 0; i < 5; i++) + for (j = 0; j < 10; j++) erbuf[i + 5][j + 10] = buf[i][j]; /* Close srcdset[1] and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[1]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 20) + if (dims[1] != 20) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -4907,17 +4917,17 @@ test_unlim(unsigned config, hid_t fapl) /* Select hyperslab in memory space */ start[1] = 0; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) - if(rbuf[i][j] != erbuf[i][j]) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) + if (rbuf[i][j] != erbuf[i][j]) TEST_ERROR /* Now just read middle 2 rows */ @@ -4925,35 +4935,34 @@ test_unlim(unsigned config, hid_t fapl) start[0] = 4; count[0] = 2; count[1] = 20; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, memspace, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, memspace, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data - algorithmically check for only 2 middle rows being * read so we don't have to wipe out erbuf and then restore it afterwards */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) - if((i == 4) || (i == 5)) { - if(rbuf[i][j] != erbuf[i][j]) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) + if ((i == 4) || (i == 5)) { + if (rbuf[i][j] != erbuf[i][j]) TEST_ERROR } - else - if(rbuf[i][j] != 0) - TEST_ERROR + else if (rbuf[i][j] != 0) + TEST_ERROR /* Now test reopening virtual dataset without calling H5Dget_space, if * REOPEN_VIRT flag set */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -4963,23 +4972,23 @@ test_unlim(unsigned config, hid_t fapl) /* Select hyperslab in memory space */ start[0] = 0; start[1] = 0; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) - if(rbuf[i][j] != erbuf[i][j]) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) + if (rbuf[i][j] != erbuf[i][j]) TEST_ERROR /* Now try setting extent manually */ /* Shrink to 18 */ dims[1] = 18; - if(H5Dset_extent(vdset, dims) < 0) + if (H5Dset_extent(vdset, dims) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -4989,28 +4998,27 @@ test_unlim(unsigned config, hid_t fapl) /* Select hyperslab in memory space */ start[0] = 0; start[1] = 0; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Shrink to 15 */ dims[1] = 15; - if(H5Dset_extent(vdset, dims) < 0) + if (H5Dset_extent(vdset, dims) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -5020,64 +5028,63 @@ test_unlim(unsigned config, hid_t fapl) /* Select hyperslab in memory space */ start[0] = 0; start[1] = 0; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } } /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR - if(H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0) + if (H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0) TEST_ERROR - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Fclose(vfile) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR } - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 15) + if (dims[1] != 15) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -5087,37 +5094,36 @@ test_unlim(unsigned config, hid_t fapl) /* Select hyperslab in memory space */ start[0] = 0; start[1] = 0; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Now test reopening virtual dataset without calling H5Dget_space, if * REOPEN_VIRT flag set */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -5126,29 +5132,28 @@ test_unlim(unsigned config, hid_t fapl) /* Select hyperslab in memory space */ start[1] = 0; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Now try setting extent manually */ /* Grow to 18 */ dims[1] = 18; - if(H5Dset_extent(vdset, dims) < 0) + if (H5Dset_extent(vdset, dims) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -5158,28 +5163,27 @@ test_unlim(unsigned config, hid_t fapl) /* Select hyperslab in memory space */ start[0] = 0; start[1] = 0; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Grow to 20 */ dims[1] = 20; - if(H5Dset_extent(vdset, dims) < 0) + if (H5Dset_extent(vdset, dims) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -5189,73 +5193,72 @@ test_unlim(unsigned config, hid_t fapl) /* Select hyperslab in memory space */ start[0] = 0; start[1] = 0; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) - if(rbuf[i][j] != erbuf[i][j]) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) + if (rbuf[i][j] != erbuf[i][j]) TEST_ERROR } /* Close */ - if(!(config & TEST_IO_CLOSE_SRC)) { - if(H5Dclose(srcdset[0]) < 0) + if (!(config & TEST_IO_CLOSE_SRC)) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(srcdset[1]) < 0) + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(H5Fclose(srcfile[0]) < 0) + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } - else if(!(config & TEST_IO_DIFFERENT_FILE)) { - if(H5Fclose(srcfile[0]) < 0) + else if (!(config & TEST_IO_DIFFERENT_FILE)) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if(H5Sclose(srcspace[0]) < 0) + if (H5Sclose(srcspace[0]) < 0) TEST_ERROR srcspace[0] = -1; - if(H5Sclose(vspace[0]) < 0) + if (H5Sclose(vspace[0]) < 0) TEST_ERROR vspace[0] = -1; - if(H5Sclose(vspace[1]) < 0) + if (H5Sclose(vspace[1]) < 0) TEST_ERROR vspace[1] = -1; - /* * Test 2: 2 Source datasets, interleaved slices, single element wide */ /* Clear virtual layout in DCPL */ - if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) TEST_ERROR /* Create virtual dataspaces */ dims[0] = 10; dims[1] = 10; - if((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0) + if ((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0) TEST_ERROR - if((vspace[1] = H5Screate_simple(2, dims, mdims)) < 0) + if ((vspace[1] = H5Screate_simple(2, dims, mdims)) < 0) TEST_ERROR /* Create source dataspace */ - dims[1] = 5; + dims[1] = 5; mdims[1] = 10; - if((srcspace[0] = H5Screate_simple(2, dims, mdims)) < 0) + if ((srcspace[0] = H5Screate_simple(2, dims, mdims)) < 0) TEST_ERROR mdims[1] = 20; @@ -5264,146 +5267,150 @@ test_unlim(unsigned config, hid_t fapl) start[1] = 0; count[0] = 10; count[1] = H5S_UNLIMITED; - if(H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Select hyperslabs in virtual spaces */ stride[0] = 1; stride[1] = 2; - count[0] = 1; - count[1] = H5S_UNLIMITED; - block[0] = 10; - block[1] = 1; - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0) + count[0] = 1; + count[1] = H5S_UNLIMITED; + block[0] = 10; + block[1] = 1; + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0) TEST_ERROR start[1] = 1; - if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, stride, count, block) < 0) + if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, stride, count, block) < 0) TEST_ERROR start[1] = 0; /* Add virtual layout mappings */ - if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0) + if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", + srcspace[0]) < 0) TEST_ERROR - if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", srcspace[0]) < 0) + if (H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", + srcspace[0]) < 0) TEST_ERROR /* Create virtual file */ - if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create source file if requested */ - if(config & TEST_IO_DIFFERENT_FILE) { - if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR } else { srcfile[0] = vfile; - if(H5Iinc_ref(srcfile[0]) < 0) + if (H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR } /* Create source datasets */ - if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, + H5P_DEFAULT)) < 0) TEST_ERROR - if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0) + if ((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, + H5P_DEFAULT)) < 0) TEST_ERROR /* Create virtual dataset */ - if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) + if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) TEST_ERROR /* Populate write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] = (i * (int)mdims[1]) + j; /* Initialize erbuf */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) erbuf[i][j] = fill; /* Write data directly to source datasets */ /* Select hyperslab in memory */ count[0] = 10; count[1] = 5; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Write first dataset */ - if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 10; i++) - for(j = 0; j < 5; j++) + for (i = 0; i < 10; i++) + for (j = 0; j < 5; j++) erbuf[i][2 * j] = buf[i][j]; /* Adjust write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] += (int)mdims[0] * (int)mdims[1]; /* Write second dataset */ - if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 10; i++) - for(j = 0; j < 5; j++) + for (i = 0; i < 10; i++) + for (j = 0; j < 5; j++) erbuf[i][(2 * j) + 1] = buf[i][j]; /* Close srcdsets and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[0]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(srcdset[1]) < 0) + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 10) + if (dims[1] != 10) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -5411,63 +5418,62 @@ test_unlim(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR - if(H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0) + if (H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0) TEST_ERROR - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Fclose(vfile) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR } - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 10) + if (dims[1] != 10) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -5475,111 +5481,110 @@ test_unlim(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Reopen srcdset[0] and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(config & TEST_IO_DIFFERENT_FILE) - if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (config & TEST_IO_DIFFERENT_FILE) + if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) TEST_ERROR } /* Extend srcdset[0] */ dims[1] = 7; - if(H5Dset_extent(srcdset[0], dims) < 0) + if (H5Dset_extent(srcdset[0], dims) < 0) TEST_ERROR /* Adjust write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] += (int)mdims[0] * (int)mdims[1]; /* Write to new area of srcdset */ count[1] = 2; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR - if((filespace = H5Dget_space(srcdset[0])) < 0) + if ((filespace = H5Dget_space(srcdset[0])) < 0) TEST_ERROR start[1] = 5; - if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR start[1] = 0; - if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Update erbuf to reflect only new data that is now visible under * H5D_VDS_FIRST_MISSING (first slice) */ - for(i = 0; i < 10; i++) + for (i = 0; i < 10; i++) erbuf[i][10] = buf[i][0]; /* Close srcdset[0] and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[0]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions. Note that since we are using * H5D_VDS_FIRST_MISSING and we only extended one source dataset the * dimension will only have changed to add one more slice. */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 11) + if (dims[1] != 11) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -5587,68 +5592,67 @@ test_unlim(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR - if(H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0) + if (H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0) TEST_ERROR - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Fclose(vfile) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR } - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR /* Update erbuf to reflect new data that is now visible due to the change to * H5D_VDS_LAST_AVAILABLE (second new slice) */ - for(i = 0; i < 10; i++) - erbuf[i][12] = buf[i][1]; + for (i = 0; i < 10; i++) + erbuf[i][12] = buf[i][1]; /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 13) + if (dims[1] != 13) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -5656,113 +5660,112 @@ test_unlim(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Reopen srcdset[1] and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(config & TEST_IO_DIFFERENT_FILE) - if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (config & TEST_IO_DIFFERENT_FILE) + if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) + if ((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR } /* Extend srcdset[1] */ dims[1] = 10; - if(H5Dset_extent(srcdset[1], dims) < 0) + if (H5Dset_extent(srcdset[1], dims) < 0) TEST_ERROR /* Adjust write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] += (int)mdims[0] * (int)mdims[1]; /* Write to new area of srcdset */ count[1] = 5; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR - if((filespace = H5Dget_space(srcdset[1])) < 0) + if ((filespace = H5Dget_space(srcdset[1])) < 0) TEST_ERROR start[1] = 5; - if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR start[1] = 0; - if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 10; i++) - for(j = 0; j < 5; j++) + for (i = 0; i < 10; i++) + for (j = 0; j < 5; j++) erbuf[i][(2 * j) + 11] = buf[i][j]; /* Close srcdset[1] and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[1]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 20) + if (dims[1] != 20) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -5770,17 +5773,17 @@ test_unlim(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) - if(rbuf[i][j] != erbuf[i][j]) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) + if (rbuf[i][j] != erbuf[i][j]) TEST_ERROR /* Now just read middle 2 rows */ @@ -5788,68 +5791,67 @@ test_unlim(unsigned config, hid_t fapl) start[0] = 4; count[0] = 2; count[1] = 20; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR start[0] = 0; - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, memspace, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, memspace, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data - algorithmically check for only 2 middle rows being * read so we don't have to wipe out erbuf and then restore it afterwards */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) - if((i == 4) || (i == 5)) { - if(rbuf[i][j] != erbuf[i][j]) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) + if ((i == 4) || (i == 5)) { + if (rbuf[i][j] != erbuf[i][j]) TEST_ERROR } - else - if(rbuf[i][j] != 0) - TEST_ERROR + else if (rbuf[i][j] != 0) + TEST_ERROR /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR - if(H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0) + if (H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0) TEST_ERROR - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Fclose(vfile) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR } - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR /* Update erbuf to reflect new data that is no longer visible due to the * change to H5D_VDS_FIRST_MISSING */ - for(i = 0; i < 10; i++) - for(j = 15; j < 20; j += 2) + for (i = 0; i < 10; i++) + for (j = 15; j < 20; j += 2) erbuf[i][j] = fill; /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 14) + if (dims[1] != 14) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -5857,88 +5859,86 @@ test_unlim(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Close */ - if(!(config & TEST_IO_CLOSE_SRC)) { - if(H5Dclose(srcdset[0]) < 0) + if (!(config & TEST_IO_CLOSE_SRC)) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(srcdset[1]) < 0) + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(H5Fclose(srcfile[0]) < 0) + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } - else if(!(config & TEST_IO_DIFFERENT_FILE)) { - if(H5Fclose(srcfile[0]) < 0) + else if (!(config & TEST_IO_DIFFERENT_FILE)) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if(H5Sclose(srcspace[0]) < 0) + if (H5Sclose(srcspace[0]) < 0) TEST_ERROR srcspace[0] = -1; - if(H5Sclose(vspace[0]) < 0) + if (H5Sclose(vspace[0]) < 0) TEST_ERROR vspace[0] = -1; - if(H5Sclose(vspace[1]) < 0) + if (H5Sclose(vspace[1]) < 0) TEST_ERROR vspace[1] = -1; - /* * Test 3: 3 Source datasets, interleaved slices, two elements wide */ /* Clear virtual layout in DCPL */ - if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) TEST_ERROR /* Create virtual dataspaces */ dims[0] = 10; dims[1] = 10; - if((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0) + if ((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0) TEST_ERROR - if((vspace[1] = H5Screate_simple(2, dims, mdims)) < 0) + if ((vspace[1] = H5Screate_simple(2, dims, mdims)) < 0) TEST_ERROR - if((vspace[2] = H5Screate_simple(2, dims, mdims)) < 0) + if ((vspace[2] = H5Screate_simple(2, dims, mdims)) < 0) TEST_ERROR /* Create source dataspaces */ - dims[1] = 4; + dims[1] = 4; mdims[1] = 8; - if((srcspace[0] = H5Screate_simple(2, dims, mdims)) < 0) + if ((srcspace[0] = H5Screate_simple(2, dims, mdims)) < 0) TEST_ERROR - dims[1] = 4; + dims[1] = 4; mdims[1] = 6; - if((srcspace[1] = H5Screate_simple(2, dims, mdims)) < 0) + if ((srcspace[1] = H5Screate_simple(2, dims, mdims)) < 0) TEST_ERROR - dims[1] = 2; + dims[1] = 2; mdims[1] = 6; - if((srcspace[2] = H5Screate_simple(2, dims, mdims)) < 0) + if ((srcspace[2] = H5Screate_simple(2, dims, mdims)) < 0) TEST_ERROR mdims[1] = 20; @@ -5947,185 +5947,191 @@ test_unlim(unsigned config, hid_t fapl) start[1] = 0; count[0] = 10; count[1] = H5S_UNLIMITED; - if(H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR - if(H5Sselect_hyperslab(srcspace[1], H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(srcspace[1], H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR - if(H5Sselect_hyperslab(srcspace[2], H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(srcspace[2], H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Select hyperslabs in virtual spaces */ stride[0] = 1; stride[1] = 6; - count[0] = 1; - count[1] = H5S_UNLIMITED; - block[0] = 10; - block[1] = 2; - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0) + count[0] = 1; + count[1] = H5S_UNLIMITED; + block[0] = 10; + block[1] = 2; + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0) TEST_ERROR start[1] = 2; - if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, stride, count, block) < 0) + if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, stride, count, block) < 0) TEST_ERROR start[1] = 4; - if(H5Sselect_hyperslab(vspace[2], H5S_SELECT_SET, start, stride, count, block) < 0) + if (H5Sselect_hyperslab(vspace[2], H5S_SELECT_SET, start, stride, count, block) < 0) TEST_ERROR start[1] = 0; /* Add virtual layout mappings */ - if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0) + if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", + srcspace[0]) < 0) TEST_ERROR - if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", srcspace[1]) < 0) + if (H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", + srcspace[1]) < 0) TEST_ERROR - if(H5Pset_virtual(dcpl, vspace[2], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset3", srcspace[2]) < 0) + if (H5Pset_virtual(dcpl, vspace[2], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset3", + srcspace[2]) < 0) TEST_ERROR /* Create virtual file */ - if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create source file if requested */ - if(config & TEST_IO_DIFFERENT_FILE) { - if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR } else { srcfile[0] = vfile; - if(H5Iinc_ref(srcfile[0]) < 0) + if (H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR } /* Create source datasets */ - if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, + H5P_DEFAULT)) < 0) TEST_ERROR - if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[1], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0) + if ((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[1], H5P_DEFAULT, srcdcpl, + H5P_DEFAULT)) < 0) TEST_ERROR - if((srcdset[2] = H5Dcreate2(srcfile[0], "src_dset3", H5T_NATIVE_INT, srcspace[2], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0) + if ((srcdset[2] = H5Dcreate2(srcfile[0], "src_dset3", H5T_NATIVE_INT, srcspace[2], H5P_DEFAULT, srcdcpl, + H5P_DEFAULT)) < 0) TEST_ERROR /* Create virtual dataset */ - if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) + if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) TEST_ERROR /* Populate write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] = (i * (int)mdims[1]) + j; /* Initialize erbuf */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) erbuf[i][j] = fill; /* Write data directly to source datasets */ /* Select hyperslab in memory */ count[0] = 10; count[1] = 4; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Write first dataset */ - if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 10; i++) - for(j = 0; j < 2; j++) { - erbuf[i][6 * j] = buf[i][2 * j]; + for (i = 0; i < 10; i++) + for (j = 0; j < 2; j++) { + erbuf[i][6 * j] = buf[i][2 * j]; erbuf[i][(6 * j) + 1] = buf[i][(2 * j) + 1]; } /* Adjust write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] += (int)mdims[0] * (int)mdims[1]; /* Write second dataset */ - if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 10; i++) - for(j = 0; j < 2; j++) { + for (i = 0; i < 10; i++) + for (j = 0; j < 2; j++) { erbuf[i][(6 * j) + 2] = buf[i][2 * j]; erbuf[i][(6 * j) + 3] = buf[i][(2 * j) + 1]; } /* Adjust write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] += (int)mdims[0] * (int)mdims[1]; /* Select hyperslab in memory */ count[0] = 10; count[1] = 2; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Write third dataset */ - if(H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 10; i++) { + for (i = 0; i < 10; i++) { erbuf[i][4] = buf[i][0]; erbuf[i][5] = buf[i][1]; } /* Close srcdsets and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[0]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(srcdset[1]) < 0) + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(H5Dclose(srcdset[2]) < 0) + if (H5Dclose(srcdset[2]) < 0) TEST_ERROR srcdset[2] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 10) + if (dims[1] != 10) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -6133,63 +6139,62 @@ test_unlim(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR - if(H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0) + if (H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0) TEST_ERROR - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Fclose(vfile) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR } - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 10) + if (dims[1] != 10) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -6197,105 +6202,104 @@ test_unlim(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Reopen srcdset[0] and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(config & TEST_IO_DIFFERENT_FILE) - if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (config & TEST_IO_DIFFERENT_FILE) + if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) TEST_ERROR } /* Extend srcdset[0] */ dims[1] = 7; - if(H5Dset_extent(srcdset[0], dims) < 0) + if (H5Dset_extent(srcdset[0], dims) < 0) TEST_ERROR /* Adjust write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] += (int)mdims[0] * (int)mdims[1]; /* Write to new area of srcdset */ count[1] = 3; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR - if((filespace = H5Dget_space(srcdset[0])) < 0) + if ((filespace = H5Dget_space(srcdset[0])) < 0) TEST_ERROR start[1] = 4; - if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR start[1] = 0; - if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Close srcdset[0] and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[0]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions. Note that since we are using * H5D_VDS_FIRST_MISSING the size will not have changed. */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 10) + if (dims[1] != 10) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -6303,71 +6307,70 @@ test_unlim(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR - if(H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0) + if (H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0) TEST_ERROR - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Fclose(vfile) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR } - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR /* Update erbuf to reflect new data that is now visible due to the change to * H5D_VDS_LAST_AVAILABLE */ - for(i = 0; i < 10; i++) { + for (i = 0; i < 10; i++) { erbuf[i][12] = buf[i][0]; erbuf[i][13] = buf[i][1]; erbuf[i][18] = buf[i][2]; } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 19) + if (dims[1] != 19) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -6375,116 +6378,115 @@ test_unlim(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Reopen srcdset[2] and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(config & TEST_IO_DIFFERENT_FILE) - if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (config & TEST_IO_DIFFERENT_FILE) + if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((srcdset[2] = H5Dopen2(srcfile[0], "src_dset3", H5P_DEFAULT)) < 0) + if ((srcdset[2] = H5Dopen2(srcfile[0], "src_dset3", H5P_DEFAULT)) < 0) TEST_ERROR } /* Extend srcdset[2] */ dims[1] = 5; - if(H5Dset_extent(srcdset[2], dims) < 0) + if (H5Dset_extent(srcdset[2], dims) < 0) TEST_ERROR /* Adjust write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] += (int)mdims[0] * (int)mdims[1]; /* Write to new area of srcdset */ count[1] = 3; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR - if((filespace = H5Dget_space(srcdset[2])) < 0) + if ((filespace = H5Dget_space(srcdset[2])) < 0) TEST_ERROR start[1] = 2; - if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR start[1] = 0; - if(H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 10; i++) { + for (i = 0; i < 10; i++) { erbuf[i][10] = buf[i][0]; erbuf[i][11] = buf[i][1]; erbuf[i][16] = buf[i][2]; } /* Close srcdset[2] and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[2]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[2]) < 0) TEST_ERROR srcdset[2] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions. Note that the dimensions will not have * changed. */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 19) + if (dims[1] != 19) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -6492,63 +6494,62 @@ test_unlim(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR - if(H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0) + if (H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0) TEST_ERROR - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Fclose(vfile) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR } - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 14) + if (dims[1] != 14) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -6556,114 +6557,113 @@ test_unlim(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Reopen srcdset[1] and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(config & TEST_IO_DIFFERENT_FILE) - if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (config & TEST_IO_DIFFERENT_FILE) + if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) + if ((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR } /* Extend srcdset[1] */ dims[1] = 6; - if(H5Dset_extent(srcdset[1], dims) < 0) + if (H5Dset_extent(srcdset[1], dims) < 0) TEST_ERROR /* Adjust write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] += (int)mdims[0] * (int)mdims[1]; /* Write to new area of srcdset */ count[1] = 2; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR - if((filespace = H5Dget_space(srcdset[1])) < 0) + if ((filespace = H5Dget_space(srcdset[1])) < 0) TEST_ERROR start[1] = 4; - if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR start[1] = 0; - if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 10; i++) { + for (i = 0; i < 10; i++) { erbuf[i][14] = buf[i][0]; erbuf[i][15] = buf[i][1]; } /* Close srcdset[1] and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[1]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 17) + if (dims[1] != 17) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -6671,59 +6671,58 @@ test_unlim(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR - if(H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0) + if (H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0) TEST_ERROR - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Fclose(vfile) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR } - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 19) + if (dims[1] != 19) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Read data through virtual dataset */ @@ -6731,23 +6730,22 @@ test_unlim(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Now just read middle 2 rows */ @@ -6755,98 +6753,96 @@ test_unlim(unsigned config, hid_t fapl) start[0] = 4; count[0] = 2; count[1] = 19; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR - if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR start[0] = 0; - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Verify read data - algorithmically check for only 2 middle rows being * read */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else if((i == 4) || (i == 5)) { - if(rbuf[i][j] != erbuf[i][j]) + else if ((i == 4) || (i == 5)) { + if (rbuf[i][j] != erbuf[i][j]) TEST_ERROR } - else - if(rbuf[i][j] != 0) - TEST_ERROR + else if (rbuf[i][j] != 0) + TEST_ERROR /* Close */ - if(!(config & TEST_IO_CLOSE_SRC)) { - if(H5Dclose(srcdset[0]) < 0) + if (!(config & TEST_IO_CLOSE_SRC)) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(srcdset[1]) < 0) + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(H5Dclose(srcdset[2]) < 0) + if (H5Dclose(srcdset[2]) < 0) TEST_ERROR srcdset[2] = -1; - if(H5Fclose(srcfile[0]) < 0) + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } - else if(!(config & TEST_IO_DIFFERENT_FILE)) { - if(H5Fclose(srcfile[0]) < 0) + else if (!(config & TEST_IO_DIFFERENT_FILE)) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if(H5Sclose(srcspace[0]) < 0) + if (H5Sclose(srcspace[0]) < 0) TEST_ERROR srcspace[0] = -1; - if(H5Sclose(srcspace[1]) < 0) + if (H5Sclose(srcspace[1]) < 0) TEST_ERROR srcspace[1] = -1; - if(H5Sclose(srcspace[2]) < 0) + if (H5Sclose(srcspace[2]) < 0) TEST_ERROR srcspace[2] = -1; - if(H5Sclose(vspace[0]) < 0) + if (H5Sclose(vspace[0]) < 0) TEST_ERROR vspace[0] = -1; - if(H5Sclose(vspace[1]) < 0) + if (H5Sclose(vspace[1]) < 0) TEST_ERROR vspace[1] = -1; - /* * Test 4: 2 Source datasets, offset starts */ /* Clear virtual layout in DCPL */ - if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) TEST_ERROR /* Create virtual dataspaces */ - if((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0) + if ((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0) TEST_ERROR - if((vspace[1] = H5Screate_simple(2, dims, mdims)) < 0) + if ((vspace[1] = H5Screate_simple(2, dims, mdims)) < 0) TEST_ERROR /* Create source dataspaces */ - dims[0] = 5; - dims[1] = 0; + dims[0] = 5; + dims[1] = 0; mdims[0] = 5; - if((srcspace[0] = H5Screate_simple(2, dims, mdims)) < 0) + if ((srcspace[0] = H5Screate_simple(2, dims, mdims)) < 0) TEST_ERROR dims[1] = 5; - if((srcspace[1] = H5Screate_simple(2, dims, mdims)) < 0) + if ((srcspace[1] = H5Screate_simple(2, dims, mdims)) < 0) TEST_ERROR mdims[0] = 10; @@ -6855,59 +6851,63 @@ test_unlim(unsigned config, hid_t fapl) start[1] = 0; count[0] = 5; count[1] = H5S_UNLIMITED; - if(H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR - if(H5Sselect_hyperslab(srcspace[1], H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(srcspace[1], H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Select hyperslabs in virtual spaces */ start[1] = 10; - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR start[0] = 5; start[1] = 0; - if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Add virtual layout mappings */ - if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0) + if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", + srcspace[0]) < 0) TEST_ERROR - if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", srcspace[1]) < 0) + if (H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", + srcspace[1]) < 0) TEST_ERROR /* Create virtual file */ - if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create source file if requested */ - if(config & TEST_IO_DIFFERENT_FILE) { - if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR } else { srcfile[0] = vfile; - if(H5Iinc_ref(srcfile[0]) < 0) + if (H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR } /* Create source datasets */ - if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, + H5P_DEFAULT)) < 0) TEST_ERROR - if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[1], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0) + if ((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[1], H5P_DEFAULT, srcdcpl, + H5P_DEFAULT)) < 0) TEST_ERROR /* Create virtual dataset */ - if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) + if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) TEST_ERROR /* Populate write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] = (i * (int)mdims[1]) + j; /* Initialize erbuf */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) erbuf[i][j] = fill; /* Write data directly to second source dataset */ @@ -6916,70 +6916,70 @@ test_unlim(unsigned config, hid_t fapl) start[1] = 0; count[0] = 5; count[1] = 5; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Write second dataset */ - if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 5; i++) - for(j = 0; j < 5; j++) + for (i = 0; i < 5; i++) + for (j = 0; j < 5; j++) erbuf[i + 5][j] = buf[i][j]; /* Close srcdsets and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[0]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(srcdset[1]) < 0) + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 5) + if (dims[1] != 5) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -6989,63 +6989,62 @@ test_unlim(unsigned config, hid_t fapl) /* Select hyperslab in memory space */ start[0] = 0; start[1] = 0; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR - if(H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0) + if (H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0) TEST_ERROR - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Fclose(vfile) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR } - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 5) + if (dims[1] != 5) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -7053,39 +7052,38 @@ test_unlim(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Reopen srcdset[0] and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(config & TEST_IO_DIFFERENT_FILE) - if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (config & TEST_IO_DIFFERENT_FILE) + if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) TEST_ERROR } /* Extend srcdset[0] */ dims[0] = 5; dims[1] = 5; - if(H5Dset_extent(srcdset[0], dims) < 0) + if (H5Dset_extent(srcdset[0], dims) < 0) TEST_ERROR /* Adjust write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] += (int)mdims[0] * (int)mdims[1]; /* Write to srcdset[0] */ @@ -7093,65 +7091,65 @@ test_unlim(unsigned config, hid_t fapl) start[1] = 0; count[0] = 5; count[1] = 5; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR - if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 5; i++) - for(j = 0; j < 5; j++) + for (i = 0; i < 5; i++) + for (j = 0; j < 5; j++) erbuf[i][j + 10] = buf[i][j]; /* Close srcdset[0] and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[0]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 5) + if (dims[1] != 5) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -7161,63 +7159,62 @@ test_unlim(unsigned config, hid_t fapl) /* Select hyperslab in memory space */ start[0] = 0; start[1] = 0; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR - if(H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0) + if (H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0) TEST_ERROR - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Fclose(vfile) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR } - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 15) + if (dims[1] != 15) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -7227,73 +7224,71 @@ test_unlim(unsigned config, hid_t fapl) /* Select hyperslab in memory space */ start[0] = 0; start[1] = 0; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Close */ - if(!(config & TEST_IO_CLOSE_SRC)) { - if(H5Dclose(srcdset[0]) < 0) + if (!(config & TEST_IO_CLOSE_SRC)) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(srcdset[1]) < 0) + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(H5Fclose(srcfile[0]) < 0) + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } - else if(!(config & TEST_IO_DIFFERENT_FILE)) { - if(H5Fclose(srcfile[0]) < 0) + else if (!(config & TEST_IO_DIFFERENT_FILE)) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if(H5Sclose(srcspace[0]) < 0) + if (H5Sclose(srcspace[0]) < 0) TEST_ERROR srcspace[0] = -1; - if(H5Sclose(srcspace[1]) < 0) + if (H5Sclose(srcspace[1]) < 0) TEST_ERROR srcspace[1] = -1; - if(H5Sclose(vspace[0]) < 0) + if (H5Sclose(vspace[0]) < 0) TEST_ERROR vspace[0] = -1; - if(H5Sclose(vspace[1]) < 0) + if (H5Sclose(vspace[1]) < 0) TEST_ERROR vspace[1] = -1; - /* Close */ - if(H5Pclose(dcpl) < 0) + if (H5Pclose(dcpl) < 0) TEST_ERROR dcpl = -1; - if(H5Pclose(srcdcpl) < 0) + if (H5Pclose(srcdcpl) < 0) TEST_ERROR dcpl = -1; - if(H5Pclose(dapl) < 0) + if (H5Pclose(dapl) < 0) TEST_ERROR dapl = -1; - if(H5Sclose(memspace) < 0) + if (H5Sclose(memspace) < 0) TEST_ERROR memspace = -1; @@ -7301,28 +7296,29 @@ test_unlim(unsigned config, hid_t fapl) return 0; error: - H5E_BEGIN_TRY { - for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) + H5E_BEGIN_TRY + { + for (i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) H5Dclose(srcdset[i]); H5Dclose(vdset); - for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) + for (i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) H5Fclose(srcfile[i]); H5Fclose(vfile); - for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) + for (i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) H5Sclose(srcspace[i]); - for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) + for (i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) H5Sclose(vspace[i]); H5Sclose(filespace); H5Sclose(memspace); H5Pclose(dcpl); H5Pclose(srcdcpl); H5Pclose(dapl); - } H5E_END_TRY; + } + H5E_END_TRY; - return 1; + return 1; } /* end test_unlim() */ - /*------------------------------------------------------------------------- * Function: test_printf * @@ -7336,57 +7332,57 @@ error: static int test_printf(unsigned config, hid_t fapl) { - char *srcfilename = NULL; - char *srcfilename_map = NULL; - char *srcfilename2 = NULL; - char *srcfilename2_map = NULL; - char *vfilename = NULL; - char *printf_srcfilename_map = NULL; - char *srcfilenamepct = NULL; - char *srcfilenamepct_map = NULL; + char * srcfilename = NULL; + char * srcfilename_map = NULL; + char * srcfilename2 = NULL; + char * srcfilename2_map = NULL; + char * vfilename = NULL; + char * printf_srcfilename_map = NULL; + char * srcfilenamepct = NULL; + char * srcfilenamepct_map = NULL; const char *printf_srcfilename_map_orig = "vds_src_%b"; - const char *srcfilenamepct_map_orig = "vds%%%%_src"; - hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */ - hid_t vfile = -1; /* File with virtual dset */ - hid_t dcpl = -1; /* Dataset creation property list */ - hid_t dapl = -1; /* Dataset access property list */ - hid_t srcspace = -1; /* Source dataspace */ - hid_t vspace[2] = {-1, -1}; /* Virtual dset dataspaces */ - hid_t memspace = -1; /* Memory dataspace */ - hid_t filespace = -1; /* File dataspace */ - hid_t srcdset[6] = {-1, -1, -1, -1, -1, -1}; /* Source datsets */ - hid_t vdset = -1; /* Virtual dataset */ - hsize_t dims[2] = {10, 0}; /* Data space current size */ - hsize_t mdims[2] = {10, 20}; /* Data space maximum size */ - hsize_t start[2] = {0, 0}; /* Hyperslab start */ - hsize_t stride[2]; /* Hyperslab stride */ - hsize_t count[2]; /* Hyperslab count */ - hsize_t block[2]; /* Hyperslab block */ - int buf[10][20]; /* Write and expected read buffer */ - int rbuf[10][20]; /* Read buffer */ - int erbuf[10][20]; /* Expected read buffer */ - int ndims; /* Number of dimensions */ - int fill = -1; /* Fill value */ - hsize_t gap_size; /* Gap size property */ + const char *srcfilenamepct_map_orig = "vds%%%%_src"; + hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */ + hid_t vfile = -1; /* File with virtual dset */ + hid_t dcpl = -1; /* Dataset creation property list */ + hid_t dapl = -1; /* Dataset access property list */ + hid_t srcspace = -1; /* Source dataspace */ + hid_t vspace[2] = {-1, -1}; /* Virtual dset dataspaces */ + hid_t memspace = -1; /* Memory dataspace */ + hid_t filespace = -1; /* File dataspace */ + hid_t srcdset[6] = {-1, -1, -1, -1, -1, -1}; /* Source datsets */ + hid_t vdset = -1; /* Virtual dataset */ + hsize_t dims[2] = {10, 0}; /* Data space current size */ + hsize_t mdims[2] = {10, 20}; /* Data space maximum size */ + hsize_t start[2] = {0, 0}; /* Hyperslab start */ + hsize_t stride[2]; /* Hyperslab stride */ + hsize_t count[2]; /* Hyperslab count */ + hsize_t block[2]; /* Hyperslab block */ + int buf[10][20]; /* Write and expected read buffer */ + int rbuf[10][20]; /* Read buffer */ + int erbuf[10][20]; /* Expected read buffer */ + int ndims; /* Number of dimensions */ + int fill = -1; /* Fill value */ + hsize_t gap_size; /* Gap size property */ int i, j; TESTING("virtual dataset I/O with printf source") - if((srcfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + if ((srcfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) TEST_ERROR; - if((srcfilename_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + if ((srcfilename_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) TEST_ERROR; - if((srcfilename2 = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + if ((srcfilename2 = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) TEST_ERROR; - if((srcfilename2_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + if ((srcfilename2_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) TEST_ERROR; - if((vfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + if ((vfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) TEST_ERROR; - if((printf_srcfilename_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + if ((printf_srcfilename_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) TEST_ERROR; - if((srcfilenamepct = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + if ((srcfilenamepct = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) TEST_ERROR; - if((srcfilenamepct_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + if ((srcfilenamepct_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) TEST_ERROR; h5_fixname(FILENAME[0], fapl, vfilename, FILENAME_BUF_SIZE); @@ -7399,216 +7395,218 @@ test_printf(unsigned config, hid_t fapl) h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, FILENAME_BUF_SIZE); /* Create DCPL */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR /* Set fill value */ - if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0) + if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0) TEST_ERROR /* Create DAPL */ - if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + if ((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) TEST_ERROR /* Create memory space */ - if((memspace = H5Screate_simple(2, mdims, NULL)) < 0) + if ((memspace = H5Screate_simple(2, mdims, NULL)) < 0) TEST_ERROR - /* * Test 1: 1 Source dataset mapping, 10x5 blocks */ /* Clear virtual layout in DCPL */ - if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) TEST_ERROR /* Create virtual dataspace */ - if((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0) + if ((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0) TEST_ERROR /* Create source dataspace */ dims[1] = 5; - if((srcspace = H5Screate_simple(2, dims, NULL)) < 0) + if ((srcspace = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Select hyperslabs in virtual space */ stride[0] = 1; stride[1] = 5; - count[0] = 1; - count[1] = H5S_UNLIMITED; - block[0] = 10; - block[1] = 5; - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0) + count[0] = 1; + count[1] = H5S_UNLIMITED; + block[0] = 10; + block[1] = 5; + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0) TEST_ERROR /* Add virtual layout mapping */ - if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset%b", srcspace) < 0) + if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset%b", + srcspace) < 0) TEST_ERROR /* Create virtual file */ - if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create source file if requested */ - if(config & TEST_IO_DIFFERENT_FILE) { - if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR } else { srcfile[0] = vfile; - if(H5Iinc_ref(srcfile[0]) < 0) + if (H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR } /* Create virtual dataset */ - if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) + if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) TEST_ERROR /* Close srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_CLOSE_SRC) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 0) + if (dims[1] != 0) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Reopen srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) - if(config & TEST_IO_DIFFERENT_FILE) - if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) + if (config & TEST_IO_CLOSE_SRC) + if (config & TEST_IO_DIFFERENT_FILE) + if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Create 2 source datasets */ - if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset0", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset0", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT)) < 0) TEST_ERROR - if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT)) < 0) TEST_ERROR /* Populate write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] = (i * (int)mdims[1]) + j; /* Initialize erbuf */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) erbuf[i][j] = fill; /* Write to srcdset[0] */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) TEST_ERROR - if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 10; i++) - for(j = 0; j < 5; j++) + for (i = 0; i < 10; i++) + for (j = 0; j < 5; j++) erbuf[i][j] = buf[i][j]; /* Adjust write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] += (int)mdims[0] * (int)mdims[1]; /* Write to srcdset[1] */ - if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 10; i++) - for(j = 0; j < 5; j++) + for (i = 0; i < 10; i++) + for (j = 0; j < 5; j++) erbuf[i][j + 5] = buf[i][j]; /* Close srcdsets and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[0]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(srcdset[1]) < 0) + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 10) + if (dims[1] != 10) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -7616,95 +7614,95 @@ test_printf(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Reopen srcfile if config option specified */ - if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) - if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) + if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Create 3rd source dataset */ - if((srcdset[2] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[2] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT)) < 0) TEST_ERROR /* Adjust write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] += (int)mdims[0] * (int)mdims[1]; /* Write to srcdset[2] */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) TEST_ERROR - if(H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 10; i++) - for(j = 0; j < 5; j++) + for (i = 0; i < 10; i++) + for (j = 0; j < 5; j++) erbuf[i][j + 10] = buf[i][j]; /* Close srcdset[2] and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[2]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[2]) < 0) TEST_ERROR srcdset[2] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 15) + if (dims[1] != 15) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Read data through virtual dataset */ @@ -7712,407 +7710,411 @@ test_printf(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Now try with different selections */ count[0] = 10; - for(start[1] = (hsize_t)0; start[1] < (hsize_t)5; start[1]++) - for(count[1] = (hsize_t)1; count[1] < (hsize_t)11; count[1]++) { + for (start[1] = (hsize_t)0; start[1] < (hsize_t)5; start[1]++) + for (count[1] = (hsize_t)1; count[1] < (hsize_t)11; count[1]++) { /* Reset rbuf */ HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Select hyperslab in file space */ - if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if((j < (int)start[1]) || (j >= (int)(start[1] + count[1]))) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if ((j < (int)start[1]) || (j >= (int)(start[1] + count[1]))) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } } start[1] = 0; /* Now try writing through VDS */ /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Select hyperslab in file space */ - if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Adjust write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] += (int)mdims[0] * (int)mdims[1]; /* Write data through VDS */ - if(H5Dwrite(vdset, H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(vdset, H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Reopen srcdsets and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(config & TEST_IO_DIFFERENT_FILE) - if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (config & TEST_IO_DIFFERENT_FILE) + if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset0", H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dopen2(srcfile[0], "src_dset0", H5P_DEFAULT)) < 0) TEST_ERROR - if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) + if ((srcdset[1] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) TEST_ERROR - if((srcdset[2] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) + if ((srcdset[2] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR } /* Read srcdset[0] */ count[0] = 10; count[1] = 5; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR - if(H5Dread(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < 10; i++) - for(j = 0; j < 5; j++) - if(rbuf[i][j] != buf[i][j]) + for (i = 0; i < 10; i++) + for (j = 0; j < 5; j++) + if (rbuf[i][j] != buf[i][j]) TEST_ERROR /* Read srcdset[1] */ - if(H5Dread(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < 10; i++) - for(j = 0; j < 5; j++) - if(rbuf[i][j] != buf[i][j + 5]) + for (i = 0; i < 10; i++) + for (j = 0; j < 5; j++) + if (rbuf[i][j] != buf[i][j + 5]) TEST_ERROR /* Read srcdset[2] */ - if(H5Dread(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < 10; i++) - for(j = 0; j < 5; j++) - if(rbuf[i][j] != buf[i][j + 10]) + for (i = 0; i < 10; i++) + for (j = 0; j < 5; j++) + if (rbuf[i][j] != buf[i][j + 10]) TEST_ERROR /* Close */ - if(H5Dclose(srcdset[0]) < 0) + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(srcdset[1]) < 0) + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(H5Dclose(srcdset[2]) < 0) + if (H5Dclose(srcdset[2]) < 0) TEST_ERROR srcdset[2] = -1; - if(H5Fclose(srcfile[0]) < 0) + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if(H5Sclose(srcspace) < 0) + if (H5Sclose(srcspace) < 0) TEST_ERROR srcspace = -1; - if(H5Sclose(vspace[0]) < 0) + if (H5Sclose(vspace[0]) < 0) TEST_ERROR vspace[0] = -1; - /* * Test 2: 1 Source dataset mapping, 10x1 blocks, test printf gap setting, * '%' in source file name */ /* Clear virtual layout in DCPL */ - if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) TEST_ERROR /* Create virtual dataspaces */ - if((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0) + if ((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0) TEST_ERROR /* Create source dataspace */ dims[1] = 1; - if((srcspace = H5Screate_simple(2, dims, NULL)) < 0) + if ((srcspace = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Select hyperslabs in virtual space */ stride[0] = 1; stride[1] = 1; - count[0] = 1; - count[1] = H5S_UNLIMITED; - block[0] = 10; - block[1] = 1; - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0) + count[0] = 1; + count[1] = H5S_UNLIMITED; + block[0] = 10; + block[1] = 1; + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0) TEST_ERROR /* Add virtual layout mapping */ - if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilenamepct_map : ".", "src_dset%b", srcspace) < 0) + if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilenamepct_map : ".", + "src_dset%b", srcspace) < 0) TEST_ERROR /* Create virtual file */ - if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create source file if requested */ - if(config & TEST_IO_DIFFERENT_FILE) { - if((srcfile[0] = H5Fcreate(srcfilenamepct, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if ((srcfile[0] = H5Fcreate(srcfilenamepct, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR } else { srcfile[0] = vfile; - if(H5Iinc_ref(srcfile[0]) < 0) + if (H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR } /* Create virtual dataset */ - if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) + if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) TEST_ERROR /* Close srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_CLOSE_SRC) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 0) + if (dims[1] != 0) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Reopen srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) - if(config & TEST_IO_DIFFERENT_FILE) - if((srcfile[0] = H5Fopen(srcfilenamepct, H5F_ACC_RDWR, fapl)) < 0) + if (config & TEST_IO_CLOSE_SRC) + if (config & TEST_IO_DIFFERENT_FILE) + if ((srcfile[0] = H5Fopen(srcfilenamepct, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Create source datasets in a pattern with increasing gaps: * XX-X--X---X----X */ - if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset0", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset0", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT)) < 0) TEST_ERROR - if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT)) < 0) TEST_ERROR - if((srcdset[2] = H5Dcreate2(srcfile[0], "src_dset3", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[2] = H5Dcreate2(srcfile[0], "src_dset3", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT)) < 0) TEST_ERROR - if((srcdset[3] = H5Dcreate2(srcfile[0], "src_dset6", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[3] = H5Dcreate2(srcfile[0], "src_dset6", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT)) < 0) TEST_ERROR - if((srcdset[4] = H5Dcreate2(srcfile[0], "src_dset10", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[4] = H5Dcreate2(srcfile[0], "src_dset10", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT)) < 0) TEST_ERROR - if((srcdset[5] = H5Dcreate2(srcfile[0], "src_dset15", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[5] = H5Dcreate2(srcfile[0], "src_dset15", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT)) < 0) TEST_ERROR /* Populate write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] = (i * (int)mdims[1]) + j; /* Initialize erbuf */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) erbuf[i][j] = fill; /* Write to srcdset[0] */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) TEST_ERROR - if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 10; i++) + for (i = 0; i < 10; i++) erbuf[i][0] = buf[i][0]; /* Adjust write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] += (int)mdims[0] * (int)mdims[1]; /* Write to srcdset[1] */ - if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 10; i++) + for (i = 0; i < 10; i++) erbuf[i][1] = buf[i][0]; /* Adjust write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] += (int)mdims[0] * (int)mdims[1]; /* Write to srcdset[2] */ - if(H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 10; i++) + for (i = 0; i < 10; i++) erbuf[i][3] = buf[i][0]; /* Adjust write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] += (int)mdims[0] * (int)mdims[1]; /* Write to srcdset[3] */ - if(H5Dwrite(srcdset[3], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[3], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 10; i++) + for (i = 0; i < 10; i++) erbuf[i][6] = buf[i][0]; /* Adjust write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] += (int)mdims[0] * (int)mdims[1]; /* Write to srcdset[4] */ - if(H5Dwrite(srcdset[4], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[4], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 10; i++) + for (i = 0; i < 10; i++) erbuf[i][10] = buf[i][0]; /* Adjust write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] += (int)mdims[0] * (int)mdims[1]; /* Write to srcdset[5] */ - if(H5Dwrite(srcdset[5], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[5], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 10; i++) + for (i = 0; i < 10; i++) erbuf[i][15] = buf[i][0]; /* Close srcdsets and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - for(i = 0; i < 6; i++) { - if(H5Dclose(srcdset[i]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + for (i = 0; i < 6; i++) { + if (H5Dclose(srcdset[i]) < 0) TEST_ERROR srcdset[i] = -1; } - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 2) + if (dims[1] != 2) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -8120,75 +8122,74 @@ test_printf(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Test H5Pget_virtual_printf_gap() */ - if(H5Pget_virtual_printf_gap(dapl, &gap_size) < 0) + if (H5Pget_virtual_printf_gap(dapl, &gap_size) < 0) TEST_ERROR - if(gap_size != (hsize_t)0) + if (gap_size != (hsize_t)0) TEST_ERROR /* Close VDS and reopen with printf gap set to 1, reopen file as well if * config option specified */ - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR - if(H5Pset_virtual_printf_gap(dapl, (hsize_t)1) < 0) + if (H5Pset_virtual_printf_gap(dapl, (hsize_t)1) < 0) TEST_ERROR - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Fclose(vfile) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR } - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR /* Test H5Pget_virtual_printf_gap() */ - if(H5Pget_virtual_printf_gap(dapl, &gap_size) < 0) + if (H5Pget_virtual_printf_gap(dapl, &gap_size) < 0) TEST_ERROR - if(gap_size != (hsize_t)1) + if (gap_size != (hsize_t)1) TEST_ERROR /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 4) + if (dims[1] != 4) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -8196,69 +8197,68 @@ test_printf(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Close VDS and reopen with printf gap set to 2, reopen file as well if * config option specified */ - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR - if(H5Pset_virtual_printf_gap(dapl, (hsize_t)2) < 0) + if (H5Pset_virtual_printf_gap(dapl, (hsize_t)2) < 0) TEST_ERROR - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Fclose(vfile) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR } - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR /* Test H5Pget_virtual_printf_gap() */ - if(H5Pget_virtual_printf_gap(dapl, &gap_size) < 0) + if (H5Pget_virtual_printf_gap(dapl, &gap_size) < 0) TEST_ERROR - if(gap_size != (hsize_t)2) + if (gap_size != (hsize_t)2) TEST_ERROR /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 7) + if (dims[1] != 7) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -8266,69 +8266,68 @@ test_printf(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Close VDS and reopen with printf gap set to 3, reopen file as well if * config option specified */ - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR - if(H5Pset_virtual_printf_gap(dapl, (hsize_t)3) < 0) + if (H5Pset_virtual_printf_gap(dapl, (hsize_t)3) < 0) TEST_ERROR - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Fclose(vfile) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR } - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR /* Test H5Pget_virtual_printf_gap() */ - if(H5Pget_virtual_printf_gap(dapl, &gap_size) < 0) + if (H5Pget_virtual_printf_gap(dapl, &gap_size) < 0) TEST_ERROR - if(gap_size != (hsize_t)3) + if (gap_size != (hsize_t)3) TEST_ERROR /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 11) + if (dims[1] != 11) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -8336,69 +8335,68 @@ test_printf(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Close VDS and reopen with printf gap set to 4, reopen file as well if * config option specified */ - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR - if(H5Pset_virtual_printf_gap(dapl, (hsize_t)4) < 0) + if (H5Pset_virtual_printf_gap(dapl, (hsize_t)4) < 0) TEST_ERROR - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Fclose(vfile) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR } - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR /* Test H5Pget_virtual_printf_gap() */ - if(H5Pget_virtual_printf_gap(dapl, &gap_size) < 0) + if (H5Pget_virtual_printf_gap(dapl, &gap_size) < 0) TEST_ERROR - if(gap_size != (hsize_t)4) + if (gap_size != (hsize_t)4) TEST_ERROR /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 16) + if (dims[1] != 16) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -8406,63 +8404,62 @@ test_printf(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR - if(H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0) + if (H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0) TEST_ERROR - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Fclose(vfile) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR } - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 2) + if (dims[1] != 2) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -8470,223 +8467,222 @@ test_printf(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Reset dapl */ - if(H5Pset_virtual_printf_gap(dapl, (hsize_t)0) < 0) + if (H5Pset_virtual_printf_gap(dapl, (hsize_t)0) < 0) TEST_ERROR - if(H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0) + if (H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0) TEST_ERROR /* Close */ - if(!(config & TEST_IO_CLOSE_SRC)) { - for(i = 0; i < 6; i++) { - if(H5Dclose(srcdset[i]) < 0) + if (!(config & TEST_IO_CLOSE_SRC)) { + for (i = 0; i < 6; i++) { + if (H5Dclose(srcdset[i]) < 0) TEST_ERROR srcdset[i] = -1; } - if(H5Fclose(srcfile[0]) < 0) + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } - else if(!(config & TEST_IO_DIFFERENT_FILE)) { - if(H5Fclose(srcfile[0]) < 0) + else if (!(config & TEST_IO_DIFFERENT_FILE)) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if(H5Sclose(srcspace) < 0) + if (H5Sclose(srcspace) < 0) TEST_ERROR srcspace = -1; - if(H5Sclose(vspace[0]) < 0) + if (H5Sclose(vspace[0]) < 0) TEST_ERROR vspace[0] = -1; - /* Next 2 tests are always run with a different source file, so only run if * that config option is set (so they're not run twice with the same * configuration) */ - if(config & TEST_IO_DIFFERENT_FILE) { + if (config & TEST_IO_DIFFERENT_FILE) { /* * Test 3: 1 Source dataset mapping, 10x5 blocks, printf source file */ /* Clean up files so the source files do not exist yet */ - H5Iinc_ref(fapl); /* Prevent FAPL from being closed */ + H5Iinc_ref(fapl); /* Prevent FAPL from being closed */ h5_clean_files(FILENAME, fapl); /* Clear virtual layout in DCPL */ - if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) TEST_ERROR /* Create virtual dataspaces */ - if((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0) + if ((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0) TEST_ERROR /* Create source dataspace */ dims[1] = 5; - if((srcspace = H5Screate_simple(2, dims, NULL)) < 0) + if ((srcspace = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Select hyperslabs in virtual space */ stride[0] = 1; stride[1] = 5; - count[0] = 1; - count[1] = H5S_UNLIMITED; - block[0] = 10; - block[1] = 5; - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0) + count[0] = 1; + count[1] = H5S_UNLIMITED; + block[0] = 10; + block[1] = 5; + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0) TEST_ERROR /* Add virtual layout mapping */ - if(H5Pset_virtual(dcpl, vspace[0], printf_srcfilename_map, "src_dset", srcspace) < 0) + if (H5Pset_virtual(dcpl, vspace[0], printf_srcfilename_map, "src_dset", srcspace) < 0) TEST_ERROR /* Create virtual file */ - if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create virtual dataset */ - if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) + if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) TEST_ERROR /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 0) + if (dims[1] != 0) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Create 2 source files, one source dataset */ - if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((srcfile[1] = H5Fcreate(srcfilename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((srcfile[1] = H5Fcreate(srcfilename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Populate write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] = (i * (int)mdims[1]) + j; /* Initialize erbuf */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) erbuf[i][j] = fill; /* Write to srcdset[0] */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) TEST_ERROR - if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 10; i++) - for(j = 0; j < 5; j++) + for (i = 0; i < 10; i++) + for (j = 0; j < 5; j++) erbuf[i][j] = buf[i][j]; /* Close srcdset and srcfiles if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[0]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Fclose(srcfile[0]) < 0) + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - if(H5Fclose(srcfile[1]) < 0) + if (H5Fclose(srcfile[1]) < 0) TEST_ERROR srcfile[1] = -1; } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 5) + if (dims[1] != 5) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -8694,96 +8690,96 @@ test_printf(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Reopen srcfile[1] if config option specified */ - if(config & TEST_IO_CLOSE_SRC) - if((srcfile[1] = H5Fopen(srcfilename2, H5F_ACC_RDWR, fapl)) < 0) + if (config & TEST_IO_CLOSE_SRC) + if ((srcfile[1] = H5Fopen(srcfilename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Create 2nd source dataset */ - if((srcdset[1] = H5Dcreate2(srcfile[1], "src_dset", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[1] = H5Dcreate2(srcfile[1], "src_dset", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Adjust write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] += (int)mdims[0] * (int)mdims[1]; /* Write to srcdset[1] */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) TEST_ERROR - if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 10; i++) - for(j = 0; j < 5; j++) + for (i = 0; i < 10; i++) + for (j = 0; j < 5; j++) erbuf[i][j + 5] = buf[i][j]; /* Close srcdset[1] and srcfile[1] if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[1]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(H5Fclose(srcfile[1]) < 0) + if (H5Fclose(srcfile[1]) < 0) TEST_ERROR srcfile[1] = -1; } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 10) + if (dims[1] != 10) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -8791,213 +8787,212 @@ test_printf(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Close */ - if(!(config & TEST_IO_CLOSE_SRC)) { - if(H5Dclose(srcdset[0]) < 0) + if (!(config & TEST_IO_CLOSE_SRC)) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(srcdset[1]) < 0) + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(H5Fclose(srcfile[0]) < 0) + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - if(H5Fclose(srcfile[1]) < 0) + if (H5Fclose(srcfile[1]) < 0) TEST_ERROR srcfile[1] = -1; } - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if(H5Sclose(srcspace) < 0) + if (H5Sclose(srcspace) < 0) TEST_ERROR srcspace = -1; - if(H5Sclose(vspace[0]) < 0) + if (H5Sclose(vspace[0]) < 0) TEST_ERROR vspace[0] = -1; - /* * Test 4: 1 Source dataset mapping, 10x5 blocks, printf source file and * source dset, extra %%s in source dataset name */ /* Clean up files so the source files do not exist yet */ - H5Iinc_ref(fapl); /* Prevent FAPL from being closed */ + H5Iinc_ref(fapl); /* Prevent FAPL from being closed */ h5_clean_files(FILENAME, fapl); /* Clear virtual layout in DCPL */ - if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) TEST_ERROR /* Create virtual dataspaces */ - if((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0) + if ((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0) TEST_ERROR /* Create source dataspace */ dims[1] = 5; - if((srcspace = H5Screate_simple(2, dims, NULL)) < 0) + if ((srcspace = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Select hyperslabs in virtual space */ stride[0] = 1; stride[1] = 5; - count[0] = 1; - count[1] = H5S_UNLIMITED; - block[0] = 10; - block[1] = 5; - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0) + count[0] = 1; + count[1] = H5S_UNLIMITED; + block[0] = 10; + block[1] = 5; + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0) TEST_ERROR /* Add virtual layout mapping */ - if(H5Pset_virtual(dcpl, vspace[0], printf_srcfilename_map, "%%src%%_dset%%%b", srcspace) < 0) + if (H5Pset_virtual(dcpl, vspace[0], printf_srcfilename_map, "%%src%%_dset%%%b", srcspace) < 0) TEST_ERROR /* Create virtual file */ - if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create virtual dataset */ - if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) + if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) TEST_ERROR /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 0) + if (dims[1] != 0) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Create 2 source files, one source dataset */ - if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((srcdset[0] = H5Dcreate2(srcfile[0], "%src%_dset%0", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dcreate2(srcfile[0], "%src%_dset%0", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((srcfile[1] = H5Fcreate(srcfilename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((srcfile[1] = H5Fcreate(srcfilename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Populate write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] = (i * (int)mdims[1]) + j; /* Initialize erbuf */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) erbuf[i][j] = fill; /* Write to srcdset[0] */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) TEST_ERROR - if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 10; i++) - for(j = 0; j < 5; j++) + for (i = 0; i < 10; i++) + for (j = 0; j < 5; j++) erbuf[i][j] = buf[i][j]; /* Close srcdset and srcfiles if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[0]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Fclose(srcfile[0]) < 0) + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - if(H5Fclose(srcfile[1]) < 0) + if (H5Fclose(srcfile[1]) < 0) TEST_ERROR srcfile[1] = -1; } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 5) + if (dims[1] != 5) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -9005,96 +9000,96 @@ test_printf(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Reopen srcfile[1] if config option specified */ - if(config & TEST_IO_CLOSE_SRC) - if((srcfile[1] = H5Fopen(srcfilename2, H5F_ACC_RDWR, fapl)) < 0) + if (config & TEST_IO_CLOSE_SRC) + if ((srcfile[1] = H5Fopen(srcfilename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Create 2nd source dataset */ - if((srcdset[1] = H5Dcreate2(srcfile[1], "%src%_dset%1", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[1] = H5Dcreate2(srcfile[1], "%src%_dset%1", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Adjust write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] += (int)mdims[0] * (int)mdims[1]; /* Write to srcdset[1] */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) TEST_ERROR - if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 10; i++) - for(j = 0; j < 5; j++) + for (i = 0; i < 10; i++) + for (j = 0; j < 5; j++) erbuf[i][j + 5] = buf[i][j]; /* Close srcdset[1] and srcfile[1] if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[1]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(H5Fclose(srcfile[1]) < 0) + if (H5Fclose(srcfile[1]) < 0) TEST_ERROR srcfile[1] = -1; } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 10) + if (dims[1] != 10) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -9102,266 +9097,268 @@ test_printf(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Close */ - if(!(config & TEST_IO_CLOSE_SRC)) { - if(H5Dclose(srcdset[0]) < 0) + if (!(config & TEST_IO_CLOSE_SRC)) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(srcdset[1]) < 0) + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(H5Fclose(srcfile[0]) < 0) + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - if(H5Fclose(srcfile[1]) < 0) + if (H5Fclose(srcfile[1]) < 0) TEST_ERROR srcfile[1] = -1; } - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if(H5Sclose(srcspace) < 0) + if (H5Sclose(srcspace) < 0) TEST_ERROR srcspace = -1; - if(H5Sclose(vspace[0]) < 0) + if (H5Sclose(vspace[0]) < 0) TEST_ERROR vspace[0] = -1; } - /* * Test 5: 2 Source mappings, interleaved slices, single element wide, * hyperslab selection in source, extra %%s in source dataset names */ /* Clear virtual layout in DCPL */ - if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) TEST_ERROR /* Create virtual dataspaces */ dims[0] = 10; dims[1] = 10; - if((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0) + if ((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0) TEST_ERROR - if((vspace[1] = H5Screate_simple(2, dims, mdims)) < 0) + if ((vspace[1] = H5Screate_simple(2, dims, mdims)) < 0) TEST_ERROR /* Create source dataspace (2 elements wide) */ dims[1] = 2; - if((srcspace = H5Screate_simple(2, dims, NULL)) < 0) + if ((srcspace = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Select hyperslab in source space */ count[0] = 10; count[1] = 1; - if(H5Sselect_hyperslab(srcspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(srcspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Select hyperslabs in virtual spaces */ stride[0] = 1; stride[1] = 2; - count[0] = 1; - count[1] = H5S_UNLIMITED; - block[0] = 10; - block[1] = 1; - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0) + count[0] = 1; + count[1] = H5S_UNLIMITED; + block[0] = 10; + block[1] = 1; + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0) TEST_ERROR start[1] = 1; - if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, stride, count, block) < 0) + if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, stride, count, block) < 0) TEST_ERROR start[1] = 0; /* Add virtual layout mappings */ - if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "%bsrc_dset_a%b%%", srcspace) < 0) + if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", + "%bsrc_dset_a%b%%", srcspace) < 0) TEST_ERROR - if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset_b%b%%%%", srcspace) < 0) + if (H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", + "src_dset_b%b%%%%", srcspace) < 0) TEST_ERROR /* Create virtual file */ - if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create source file if requested */ - if(config & TEST_IO_DIFFERENT_FILE) { - if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR } else { srcfile[0] = vfile; - if(H5Iinc_ref(srcfile[0]) < 0) + if (H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR } /* Create virtual dataset */ - if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) + if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) TEST_ERROR /* Close srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_CLOSE_SRC) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 0) + if (dims[1] != 0) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Reopen srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) - if(config & TEST_IO_DIFFERENT_FILE) - if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) + if (config & TEST_IO_CLOSE_SRC) + if (config & TEST_IO_DIFFERENT_FILE) + if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Create 2 source datasets */ - if((srcdset[0] = H5Dcreate2(srcfile[0], "0src_dset_a0%", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dcreate2(srcfile[0], "0src_dset_a0%", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset_b0%%", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset_b0%%", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Populate write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] = (i * (int)mdims[1]) + j; /* Initialize erbuf */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) erbuf[i][j] = fill; /* Write to srcdset[0] */ block[0] = 10; block[1] = 2; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) TEST_ERROR - if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 10; i++) + for (i = 0; i < 10; i++) erbuf[i][0] = buf[i][0]; /* Adjust write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] += (int)mdims[0] * (int)mdims[1]; /* Write to srcdset[1] */ - if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 10; i++) + for (i = 0; i < 10; i++) erbuf[i][1] = buf[i][0]; /* Close srcdsets and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[0]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(srcdset[1]) < 0) + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 2) + if (dims[1] != 2) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -9369,98 +9366,98 @@ test_printf(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Reopen srcfile if config option specified */ - if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) - if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) + if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Create 3rd source dataset */ - if((srcdset[2] = H5Dcreate2(srcfile[0], "src_dset_b1%%", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[2] = H5Dcreate2(srcfile[0], "src_dset_b1%%", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Adjust write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] += (int)mdims[0] * (int)mdims[1]; /* Write to srcdset[2] */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) TEST_ERROR - if(H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 10; i++) + for (i = 0; i < 10; i++) erbuf[i][3] = buf[i][0]; /* Close srcdset[2] and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[2]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[2]) < 0) TEST_ERROR srcdset[2] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 4) + if (dims[1] != 4) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -9468,64 +9465,63 @@ test_printf(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR - if(H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0) + if (H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0) TEST_ERROR - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Fclose(vfile) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR } - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions. Make sure that the 4th slice is no longer * visible due to the change to H5D_VDS_FIRST_MISSING. */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 2) + if (dims[1] != 2) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -9533,98 +9529,98 @@ test_printf(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Reopen srcfile if config option specified */ - if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) - if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) + if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Create 4th source dataset */ - if((srcdset[3] = H5Dcreate2(srcfile[0], "2src_dset_a2%", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[3] = H5Dcreate2(srcfile[0], "2src_dset_a2%", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Adjust write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] += (int)mdims[0] * (int)mdims[1]; /* Write to srcdset[3] */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) TEST_ERROR - if(H5Dwrite(srcdset[3], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[3], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 10; i++) + for (i = 0; i < 10; i++) erbuf[i][4] = buf[i][0]; /* Close srcdset[3] and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[3]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[3]) < 0) TEST_ERROR srcdset[3] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 2) + if (dims[1] != 2) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -9632,64 +9628,63 @@ test_printf(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR - if(H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0) + if (H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0) TEST_ERROR - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Fclose(vfile) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR } - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions. Make sure that the 4th slice is now visible * due to the change to H5D_VDS_LAST_AVAILABLE. */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 4) + if (dims[1] != 4) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -9697,64 +9692,63 @@ test_printf(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Close VDS and reopen with printf_gap set to 1, reopen file as well if * config option specified */ - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR - if(H5Pset_virtual_printf_gap(dapl, (hsize_t)1) < 0) + if (H5Pset_virtual_printf_gap(dapl, (hsize_t)1) < 0) TEST_ERROR - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Fclose(vfile) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR } - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions. Make sure that the 6th slice is now visible * due to the change to printf_gap. */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 5) + if (dims[1] != 5) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -9762,288 +9756,290 @@ test_printf(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Reset dapl */ - if(H5Pset_virtual_printf_gap(dapl, (hsize_t)0) < 0) + if (H5Pset_virtual_printf_gap(dapl, (hsize_t)0) < 0) TEST_ERROR - if(H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0) + if (H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0) TEST_ERROR /* Close */ - if(!(config & TEST_IO_CLOSE_SRC)) { - for(i = 0; i < 4; i++) { - if(H5Dclose(srcdset[i]) < 0) + if (!(config & TEST_IO_CLOSE_SRC)) { + for (i = 0; i < 4; i++) { + if (H5Dclose(srcdset[i]) < 0) TEST_ERROR srcdset[i] = -1; } - if(H5Fclose(srcfile[0]) < 0) + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } - else if(!(config & TEST_IO_DIFFERENT_FILE)) { - if(H5Fclose(srcfile[0]) < 0) + else if (!(config & TEST_IO_DIFFERENT_FILE)) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if(H5Sclose(srcspace) < 0) + if (H5Sclose(srcspace) < 0) TEST_ERROR srcspace = -1; - if(H5Sclose(vspace[0]) < 0) + if (H5Sclose(vspace[0]) < 0) TEST_ERROR vspace[0] = -1; - if(H5Sclose(vspace[1]) < 0) + if (H5Sclose(vspace[1]) < 0) TEST_ERROR vspace[1] = -1; - /* * Test 6: 2 Source mappings, side-by-side, 5x5 and 5x10 blocks */ /* Clear virtual layout in DCPL */ - if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) TEST_ERROR /* Create virtual dataspaces */ dims[0] = 10; dims[1] = 10; - if((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0) + if ((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0) TEST_ERROR - if((vspace[1] = H5Screate_simple(2, dims, mdims)) < 0) + if ((vspace[1] = H5Screate_simple(2, dims, mdims)) < 0) TEST_ERROR /* Create source dataspace (1 dimensional) */ dims[0] = 50; - if((srcspace = H5Screate_simple(1, dims, NULL)) < 0) + if ((srcspace = H5Screate_simple(1, dims, NULL)) < 0) TEST_ERROR /* Select hyperslab in source space */ count[0] = 25; - if(H5Sselect_hyperslab(srcspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(srcspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR /* Select hyperslabs in virtual spaces */ stride[0] = 1; stride[1] = 5; - count[0] = 1; - count[1] = H5S_UNLIMITED; - block[0] = 5; - block[1] = 5; - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0) + count[0] = 1; + count[1] = H5S_UNLIMITED; + block[0] = 5; + block[1] = 5; + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0) TEST_ERROR - start[0] = 5; + start[0] = 5; stride[1] = 10; - block[1] = 10; - if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, stride, count, block) < 0) + block[1] = 10; + if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, stride, count, block) < 0) TEST_ERROR start[0] = 0; /* Add virtual layout mappings (select ALL in source space for second * mapping) */ - if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset_a%b", srcspace) < 0) + if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", + "src_dset_a%b", srcspace) < 0) TEST_ERROR - if(H5Sselect_all(srcspace) < 0) + if (H5Sselect_all(srcspace) < 0) TEST_ERROR - if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset_b%b", srcspace) < 0) + if (H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", + "src_dset_b%b", srcspace) < 0) TEST_ERROR /* Create virtual file */ - if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create source file if requested */ - if(config & TEST_IO_DIFFERENT_FILE) { - if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR } else { srcfile[0] = vfile; - if(H5Iinc_ref(srcfile[0]) < 0) + if (H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR } /* Create virtual dataset */ - if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) + if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) TEST_ERROR /* Close srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_CLOSE_SRC) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 0) + if (dims[1] != 0) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Reopen srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) - if(config & TEST_IO_DIFFERENT_FILE) - if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) + if (config & TEST_IO_CLOSE_SRC) + if (config & TEST_IO_DIFFERENT_FILE) + if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Create 2 source datasets */ - if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset_a0", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset_a0", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset_b0", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset_b0", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Populate write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] = (i * (int)mdims[1]) + j; /* Initialize erbuf */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) erbuf[i][j] = fill; /* Write to srcdset[0] */ block[0] = 5; block[1] = 5; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) TEST_ERROR count[0] = 25; - if(H5Sselect_hyperslab(srcspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(srcspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR - if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, srcspace, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, srcspace, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 5; i++) - for(j = 0; j < 5; j++) + for (i = 0; i < 5; i++) + for (j = 0; j < 5; j++) erbuf[i][j] = buf[i][j]; /* Adjust write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] += (int)mdims[0] * (int)mdims[1]; /* Write to srcdset[1] */ block[1] = 10; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) TEST_ERROR - if(H5Sselect_all(srcspace) < 0) + if (H5Sselect_all(srcspace) < 0) TEST_ERROR - if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, srcspace, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, srcspace, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 5; i++) - for(j = 0; j < 10; j++) + for (i = 0; i < 5; i++) + for (j = 0; j < 10; j++) erbuf[i + 5][j] = buf[i][j]; /* Close srcdsets and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[0]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Dclose(srcdset[1]) < 0) + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 10) + if (dims[1] != 10) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -10051,64 +10047,63 @@ test_printf(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR - if(H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0) + if (H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0) TEST_ERROR - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Fclose(vfile) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR } - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions. Make sure that the 4th slice is no longer * visible due to the change to H5D_VDS_FIRST_MISSING. */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 5) + if (dims[1] != 5) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -10116,102 +10111,102 @@ test_printf(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Reopen srcfile if config option specified */ - if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) - if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) + if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Create 3rd source dataset */ - if((srcdset[2] = H5Dcreate2(srcfile[0], "src_dset_a1", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[2] = H5Dcreate2(srcfile[0], "src_dset_a1", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Adjust write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] += (int)mdims[0] * (int)mdims[1]; /* Write to srcdset[2] */ block[1] = 5; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) TEST_ERROR - if(H5Sselect_hyperslab(srcspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(srcspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR - if(H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, srcspace, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, srcspace, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 5; i++) - for(j = 0; j < 5; j++) + for (i = 0; i < 5; i++) + for (j = 0; j < 5; j++) erbuf[i][j + 5] = buf[i][j]; /* Close srcdset[2] and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[2]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[2]) < 0) TEST_ERROR srcdset[2] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 10) + if (dims[1] != 10) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -10219,63 +10214,62 @@ test_printf(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR - if(H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0) + if (H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0) TEST_ERROR - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Fclose(vfile) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR } - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions. There should be no change. */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 10) + if (dims[1] != 10) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -10283,99 +10277,99 @@ test_printf(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Reopen srcfile if config option specified */ - if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) - if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) + if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Create 4th source dataset */ - if((srcdset[3] = H5Dcreate2(srcfile[0], "src_dset_a2", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[3] = H5Dcreate2(srcfile[0], "src_dset_a2", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Adjust write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] += (int)mdims[0] * (int)mdims[1]; /* Write to srcdset[3] */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) TEST_ERROR - if(H5Dwrite(srcdset[3], H5T_NATIVE_INT, memspace, srcspace, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[3], H5T_NATIVE_INT, memspace, srcspace, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 5; i++) - for(j = 0; j < 5; j++) + for (i = 0; i < 5; i++) + for (j = 0; j < 5; j++) erbuf[i][j + 10] = buf[i][j]; /* Close srcdset[3] and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[3]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[3]) < 0) TEST_ERROR srcdset[3] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 15) + if (dims[1] != 15) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -10383,37 +10377,36 @@ test_printf(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Now test reopening virtual dataset without calling H5Dget_space, if * REOPEN_VIRT flag set */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -10421,29 +10414,28 @@ test_printf(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Now try setting extent manually */ /* Shrink to 12 */ dims[1] = 12; - if(H5Dset_extent(vdset, dims) < 0) + if (H5Dset_extent(vdset, dims) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -10451,28 +10443,27 @@ test_printf(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Shrink to 10 */ dims[1] = 12; - if(H5Dset_extent(vdset, dims) < 0) + if (H5Dset_extent(vdset, dims) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -10480,64 +10471,63 @@ test_printf(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } } /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR - if(H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0) + if (H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0) TEST_ERROR - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Fclose(vfile) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR } - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 10) + if (dims[1] != 10) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -10545,37 +10535,36 @@ test_printf(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Now test reopening virtual dataset without calling H5Dget_space, if * REOPEN_VIRT flag set */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -10583,29 +10572,28 @@ test_printf(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Now try setting extent manually */ /* Grow to 12 */ dims[1] = 12; - if(H5Dset_extent(vdset, dims) < 0) + if (H5Dset_extent(vdset, dims) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -10613,28 +10601,27 @@ test_printf(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Grow to 15 */ dims[1] = 15; - if(H5Dset_extent(vdset, dims) < 0) + if (H5Dset_extent(vdset, dims) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -10642,238 +10629,238 @@ test_printf(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } } /* Reset dapl */ - if(H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0) + if (H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0) TEST_ERROR /* Close */ - if(!(config & TEST_IO_CLOSE_SRC)) { - for(i = 0; i < 4; i++) { - if(H5Dclose(srcdset[i]) < 0) + if (!(config & TEST_IO_CLOSE_SRC)) { + for (i = 0; i < 4; i++) { + if (H5Dclose(srcdset[i]) < 0) TEST_ERROR srcdset[i] = -1; } - if(H5Fclose(srcfile[0]) < 0) + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } - else if(!(config & TEST_IO_DIFFERENT_FILE)) { - if(H5Fclose(srcfile[0]) < 0) + else if (!(config & TEST_IO_DIFFERENT_FILE)) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if(H5Sclose(srcspace) < 0) + if (H5Sclose(srcspace) < 0) TEST_ERROR srcspace = -1; - if(H5Sclose(vspace[0]) < 0) + if (H5Sclose(vspace[0]) < 0) TEST_ERROR vspace[0] = -1; - if(H5Sclose(vspace[1]) < 0) + if (H5Sclose(vspace[1]) < 0) TEST_ERROR vspace[1] = -1; - /* * Test 7: 1 Source dataset mapping, 10x1 blocks, test reallocating sub_dset * array */ /* Clear virtual layout in DCPL */ - if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) TEST_ERROR /* Create virtual dataspaces */ - if((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0) + if ((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0) TEST_ERROR /* Create source dataspace */ dims[1] = 1; - if((srcspace = H5Screate_simple(2, dims, NULL)) < 0) + if ((srcspace = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Select hyperslabs in virtual space */ stride[0] = 1; stride[1] = 1; - count[0] = 1; - count[1] = H5S_UNLIMITED; - block[0] = 10; - block[1] = 1; - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0) + count[0] = 1; + count[1] = H5S_UNLIMITED; + block[0] = 10; + block[1] = 1; + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0) TEST_ERROR /* Add virtual layout mapping */ - if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilenamepct_map : ".", "src_dset%b", srcspace) < 0) + if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilenamepct_map : ".", + "src_dset%b", srcspace) < 0) TEST_ERROR /* Create virtual file */ - if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create source file if requested */ - if(config & TEST_IO_DIFFERENT_FILE) { - if((srcfile[0] = H5Fcreate(srcfilenamepct, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if ((srcfile[0] = H5Fcreate(srcfilenamepct, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR } else { srcfile[0] = vfile; - if(H5Iinc_ref(srcfile[0]) < 0) + if (H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR } /* Create virtual dataset */ - if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) + if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) TEST_ERROR /* Close srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_CLOSE_SRC) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 0) + if (dims[1] != 0) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Reopen srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) - if(config & TEST_IO_DIFFERENT_FILE) - if((srcfile[0] = H5Fopen(srcfilenamepct, H5F_ACC_RDWR, fapl)) < 0) + if (config & TEST_IO_CLOSE_SRC) + if (config & TEST_IO_DIFFERENT_FILE) + if ((srcfile[0] = H5Fopen(srcfilenamepct, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Create 1 source dataset */ - if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset0", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset0", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT)) < 0) TEST_ERROR /* Populate write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] = (i * (int)mdims[1]) + j; /* Initialize erbuf */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) erbuf[i][j] = fill; /* Write to srcdset[0] */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) TEST_ERROR - if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 10; i++) + for (i = 0; i < 10; i++) erbuf[i][0] = buf[i][0]; /* Close srcdset[0] and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[0]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 1) + if (dims[1] != 1) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -10881,63 +10868,62 @@ test_printf(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Close VDS and reopen with printf gap set to 127, reopen file as well if * config option specified */ - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR - if(H5Pset_virtual_printf_gap(dapl, (hsize_t)127) < 0) + if (H5Pset_virtual_printf_gap(dapl, (hsize_t)127) < 0) TEST_ERROR - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Fclose(vfile) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR } - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 1) + if (dims[1] != 1) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 20) + if (mdims[1] != 20) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -10945,65 +10931,63 @@ test_printf(unsigned config, hid_t fapl) HDmemset(rbuf[0], 0, sizeof(rbuf)); /* Select hyperslab in memory space */ - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Reset dapl */ - if(H5Pset_virtual_printf_gap(dapl, (hsize_t)0) < 0) + if (H5Pset_virtual_printf_gap(dapl, (hsize_t)0) < 0) TEST_ERROR /* Close */ - if(!(config & TEST_IO_CLOSE_SRC)) { - if(H5Dclose(srcdset[0]) < 0) + if (!(config & TEST_IO_CLOSE_SRC)) { + if (H5Dclose(srcdset[0]) < 0) TEST_ERROR srcdset[0] = -1; - if(H5Fclose(srcfile[0]) < 0) + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } - else if(!(config & TEST_IO_DIFFERENT_FILE)) { - if(H5Fclose(srcfile[0]) < 0) + else if (!(config & TEST_IO_DIFFERENT_FILE)) { + if (H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; } - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if(H5Sclose(srcspace) < 0) + if (H5Sclose(srcspace) < 0) TEST_ERROR srcspace = -1; - if(H5Sclose(vspace[0]) < 0) + if (H5Sclose(vspace[0]) < 0) TEST_ERROR vspace[0] = -1; - /* Close */ - if(H5Pclose(dcpl) < 0) + if (H5Pclose(dcpl) < 0) TEST_ERROR dcpl = -1; - if(H5Pclose(dapl) < 0) + if (H5Pclose(dapl) < 0) TEST_ERROR dapl = -1; - if(H5Sclose(memspace) < 0) + if (H5Sclose(memspace) < 0) TEST_ERROR memspace = -1; @@ -11020,21 +11004,23 @@ test_printf(unsigned config, hid_t fapl) return 0; error: - H5E_BEGIN_TRY { - for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) + H5E_BEGIN_TRY + { + for (i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) H5Dclose(srcdset[i]); H5Dclose(vdset); - for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) + for (i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) H5Fclose(srcfile[i]); H5Fclose(vfile); H5Sclose(srcspace); - for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) + for (i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) H5Sclose(vspace[i]); H5Sclose(filespace); H5Sclose(memspace); H5Pclose(dcpl); H5Pclose(dapl); - } H5E_END_TRY; + } + H5E_END_TRY; HDfree(srcfilename); HDfree(srcfilename_map); @@ -11045,10 +11031,9 @@ error: HDfree(srcfilenamepct); HDfree(srcfilenamepct_map); - return 1; + return 1; } /* end test_printf() */ - /*------------------------------------------------------------------------- * Function: test_all * @@ -11062,32 +11047,32 @@ error: static int test_all(unsigned config, hid_t fapl) { - char vfilename[FILENAME_BUF_SIZE]; - char srcfilename[FILENAME_BUF_SIZE]; - char srcfilename_map[FILENAME_BUF_SIZE]; - hid_t srcfile = -1; /* File with source dsets */ - hid_t vfile = -1; /* File with virtual dset */ - hid_t dcpl = -1; /* Dataset creation property list */ - hid_t srcdcpl = -1; /* DCPL for source dset */ - hid_t srcspace[3] = {-1, -1, -1}; /* Source dataspaces */ - hid_t vspace[3] = {-1, -1, -1}; /* Virtual dset dataspaces */ - hid_t memspace = -1; /* Memory dataspace */ - hid_t filespace = -1; /* File dataspace */ - hid_t srcdset[5] = {-1, -1, -1, -1, -1}; /* Source datsets */ - hid_t vdset = -1; /* Virtual dataset */ - hsize_t dims[2] = {6, 6}; /* Data space current size */ - hsize_t mdims[2] = {10, 10}; /* Data space maximum size */ - hsize_t cdims[2] = {2, 2}; /* Chunk dimensions */ - hsize_t start[2]; /* Hyperslab start */ - hsize_t stride[2]; /* Hyperslab stride */ - hsize_t count[2]; /* Hyperslab count */ - hsize_t block[2]; /* Hyperslab block */ - int buf[10][10]; /* Write and expected read buffer */ - int rbuf[10][10]; /* Read buffer */ - int erbuf[10][10]; /* Expected read buffer */ - int ndims; /* Number of dimensions */ - int fill = -1; /* Fill value */ - int i, j; + char vfilename[FILENAME_BUF_SIZE]; + char srcfilename[FILENAME_BUF_SIZE]; + char srcfilename_map[FILENAME_BUF_SIZE]; + hid_t srcfile = -1; /* File with source dsets */ + hid_t vfile = -1; /* File with virtual dset */ + hid_t dcpl = -1; /* Dataset creation property list */ + hid_t srcdcpl = -1; /* DCPL for source dset */ + hid_t srcspace[3] = {-1, -1, -1}; /* Source dataspaces */ + hid_t vspace[3] = {-1, -1, -1}; /* Virtual dset dataspaces */ + hid_t memspace = -1; /* Memory dataspace */ + hid_t filespace = -1; /* File dataspace */ + hid_t srcdset[5] = {-1, -1, -1, -1, -1}; /* Source datsets */ + hid_t vdset = -1; /* Virtual dataset */ + hsize_t dims[2] = {6, 6}; /* Data space current size */ + hsize_t mdims[2] = {10, 10}; /* Data space maximum size */ + hsize_t cdims[2] = {2, 2}; /* Chunk dimensions */ + hsize_t start[2]; /* Hyperslab start */ + hsize_t stride[2]; /* Hyperslab stride */ + hsize_t count[2]; /* Hyperslab count */ + hsize_t block[2]; /* Hyperslab block */ + int buf[10][10]; /* Write and expected read buffer */ + int rbuf[10][10]; /* Read buffer */ + int erbuf[10][10]; /* Expected read buffer */ + int ndims; /* Number of dimensions */ + int fill = -1; /* Fill value */ + int i, j; TESTING("virtual dataset I/O with mixed selection types") @@ -11096,43 +11081,44 @@ test_all(unsigned config, hid_t fapl) h5_fixname_printf(FILENAME[2], fapl, srcfilename_map, sizeof srcfilename_map); /* Create DCPLs */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR - if((srcdcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if ((srcdcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR /* Set fill value */ - if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0) + if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0) TEST_ERROR /* Set chunk dimensions */ - if(H5Pset_chunk(srcdcpl, 2, cdims) < 0) + if (H5Pset_chunk(srcdcpl, 2, cdims) < 0) TEST_ERROR /* Create memory space */ - if((memspace = H5Screate_simple(2, mdims, NULL)) < 0) + if ((memspace = H5Screate_simple(2, mdims, NULL)) < 0) TEST_ERROR /* Clear virtual layout in DCPL */ - if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) TEST_ERROR /* Create fixed mapping */ - if((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0) + if ((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0) TEST_ERROR start[0] = 3; start[1] = 3; count[0] = 3; count[1] = 3; - if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0) + if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR - if((srcspace[0] = H5Screate_simple(2, count, NULL)) < 0) + if ((srcspace[0] = H5Screate_simple(2, count, NULL)) < 0) TEST_ERROR - if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset_fixed", srcspace[0]) < 0) + if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", + "src_dset_fixed", srcspace[0]) < 0) TEST_ERROR /* Create unlimited mapping */ - if((vspace[1] = H5Screate_simple(2, dims, mdims)) < 0) + if ((vspace[1] = H5Screate_simple(2, dims, mdims)) < 0) TEST_ERROR start[0] = 3; start[1] = 0; @@ -11140,123 +11126,127 @@ test_all(unsigned config, hid_t fapl) count[1] = 1; block[0] = H5S_UNLIMITED; block[1] = 3; - if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, count, block) < 0) + if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, count, block) < 0) TEST_ERROR dims[0] = 0; dims[1] = 3; - if((srcspace[1] = H5Screate_simple(2, dims, block)) < 0) + if ((srcspace[1] = H5Screate_simple(2, dims, block)) < 0) TEST_ERROR start[0] = 0; - if(H5Sselect_hyperslab(srcspace[1], H5S_SELECT_SET, start, NULL, block, NULL) < 0) + if (H5Sselect_hyperslab(srcspace[1], H5S_SELECT_SET, start, NULL, block, NULL) < 0) TEST_ERROR - if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset_unlim", srcspace[1]) < 0) + if (H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", + "src_dset_unlim", srcspace[1]) < 0) TEST_ERROR /* Create printf mapping */ - if((vspace[2] = H5Screate_simple(2, dims, mdims)) < 0) + if ((vspace[2] = H5Screate_simple(2, dims, mdims)) < 0) TEST_ERROR - start[0] = 0; - start[1] = 2; + start[0] = 0; + start[1] = 2; stride[0] = 1; stride[1] = 3; - count[0] = 1; - count[1] = H5S_UNLIMITED; - block[0] = 3; - block[1] = 2; - if(H5Sselect_hyperslab(vspace[2], H5S_SELECT_SET, start, stride, count, block) < 0) + count[0] = 1; + count[1] = H5S_UNLIMITED; + block[0] = 3; + block[1] = 2; + if (H5Sselect_hyperslab(vspace[2], H5S_SELECT_SET, start, stride, count, block) < 0) TEST_ERROR - if((srcspace[2] = H5Screate_simple(2, block, NULL)) < 0) + if ((srcspace[2] = H5Screate_simple(2, block, NULL)) < 0) TEST_ERROR - if(H5Pset_virtual(dcpl, vspace[2], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset_printf_%b", srcspace[2]) < 0) + if (H5Pset_virtual(dcpl, vspace[2], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", + "src_dset_printf_%b", srcspace[2]) < 0) TEST_ERROR /* Create virtual file */ - if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create source file if requested */ - if(config & TEST_IO_DIFFERENT_FILE) { - if((srcfile = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if ((srcfile = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR } else { srcfile = vfile; - if(H5Iinc_ref(srcfile) < 0) + if (H5Iinc_ref(srcfile) < 0) TEST_ERROR } /* Create virtual dataset */ - if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR /* Close srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile) < 0) + if (config & TEST_IO_CLOSE_SRC) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 6) + if (dims[0] != 6) TEST_ERROR - if(dims[1] != 6) + if (dims[1] != 6) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 10) + if (mdims[1] != 10) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Reopen srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) - if(config & TEST_IO_DIFFERENT_FILE) - if((srcfile = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) + if (config & TEST_IO_CLOSE_SRC) + if (config & TEST_IO_DIFFERENT_FILE) + if ((srcfile = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Create fixed source dataset */ - if((srcdset[0] = H5Dcreate2(srcfile, "src_dset_fixed", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0) + if ((srcdset[0] = H5Dcreate2(srcfile, "src_dset_fixed", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, + H5P_DEFAULT)) < 0) TEST_ERROR /* Create unlimited source_dataset */ - if((srcdset[1] = H5Dcreate2(srcfile, "src_dset_unlim", H5T_NATIVE_INT, srcspace[1], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0) + if ((srcdset[1] = H5Dcreate2(srcfile, "src_dset_unlim", H5T_NATIVE_INT, srcspace[1], H5P_DEFAULT, srcdcpl, + H5P_DEFAULT)) < 0) TEST_ERROR /* Populate write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] = (i * (int)mdims[1]) + j; /* Initialize erbuf */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) erbuf[i][j] = fill; /* Write to srcdset[0] */ @@ -11264,67 +11254,67 @@ test_all(unsigned config, hid_t fapl) start[1] = 0; block[0] = 3; block[1] = 3; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) TEST_ERROR - if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 3; i++) - for(j = 0; j < 3; j++) + for (i = 0; i < 3; i++) + for (j = 0; j < 3; j++) erbuf[i + 3][j + 3] = buf[i][j]; /* Close srcdsets and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - for(i = 0; i < 2; i++) { - if(H5Dclose(srcdset[i]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + for (i = 0; i < 2; i++) { + if (H5Dclose(srcdset[i]) < 0) TEST_ERROR srcdset[i] = -1; } - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 6) + if (dims[0] != 6) TEST_ERROR - if(dims[1] != 6) + if (dims[1] != 6) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 10) + if (mdims[1] != 10) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -11334,106 +11324,105 @@ test_all(unsigned config, hid_t fapl) /* Select hyperslab in memory space */ start[0] = 0; start[1] = 0; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if((i >= (int)dims[0]) || (j >= (int)dims[1])) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if ((i >= (int)dims[0]) || (j >= (int)dims[1])) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Reopen srcdset[1] and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(config & TEST_IO_DIFFERENT_FILE) - if((srcfile = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (config & TEST_IO_DIFFERENT_FILE) + if ((srcfile = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((srcdset[1] = H5Dopen2(srcfile, "src_dset_unlim", H5P_DEFAULT)) < 0) + if ((srcdset[1] = H5Dopen2(srcfile, "src_dset_unlim", H5P_DEFAULT)) < 0) TEST_ERROR } /* Extend srcdset[1] */ dims[0] = 2; dims[1] = 3; - if(H5Dset_extent(srcdset[1], dims) < 0) + if (H5Dset_extent(srcdset[1], dims) < 0) TEST_ERROR /* Adjust write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] += (int)mdims[0] * (int)mdims[1]; /* Write to srcdset[1] */ start[0] = 0; start[1] = 0; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR - if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 2; i++) - for(j = 0; j < 3; j++) + for (i = 0; i < 2; i++) + for (j = 0; j < 3; j++) erbuf[i + 3][j] = buf[i][j]; /* Close srcdset[1] and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[1]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 6) + if (dims[0] != 6) TEST_ERROR - if(dims[1] != 6) + if (dims[1] != 6) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 10) + if (mdims[1] != 10) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -11443,37 +11432,37 @@ test_all(unsigned config, hid_t fapl) /* Select hyperslab in memory space */ start[0] = 0; start[1] = 0; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if((i >= (int)dims[0]) || (j >= (int)dims[1])) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if ((i >= (int)dims[0]) || (j >= (int)dims[1])) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Reopen srcfile if config option specified */ - if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) - if((srcfile = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) + if ((srcfile = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Create first printf source dataset */ - if((srcdset[2] = H5Dcreate2(srcfile, "src_dset_printf_0", H5T_NATIVE_INT, srcspace[2], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0) + if ((srcdset[2] = H5Dcreate2(srcfile, "src_dset_printf_0", H5T_NATIVE_INT, srcspace[2], H5P_DEFAULT, + srcdcpl, H5P_DEFAULT)) < 0) TEST_ERROR /* Adjust write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] += (int)mdims[0] * (int)mdims[1]; /* Write to srcdset[2] */ @@ -11481,64 +11470,64 @@ test_all(unsigned config, hid_t fapl) start[1] = 0; block[0] = 3; block[1] = 2; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) TEST_ERROR - if(H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 3; i++) - for(j = 0; j < 2; j++) + for (i = 0; i < 3; i++) + for (j = 0; j < 2; j++) erbuf[i][j + 2] = buf[i][j]; /* Close srcdset[2] srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[2]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[2]) < 0) TEST_ERROR srcdset[2] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 6) + if (dims[0] != 6) TEST_ERROR - if(dims[1] != 6) + if (dims[1] != 6) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 10) + if (mdims[1] != 10) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -11548,43 +11537,42 @@ test_all(unsigned config, hid_t fapl) /* Select hyperslab in memory space */ start[0] = 0; start[1] = 0; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if((i >= (int)dims[0]) || (j >= (int)dims[1])) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if ((i >= (int)dims[0]) || (j >= (int)dims[1])) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Reopen srcdset[1] and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(config & TEST_IO_DIFFERENT_FILE) - if((srcfile = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (config & TEST_IO_DIFFERENT_FILE) + if ((srcfile = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((srcdset[1] = H5Dopen2(srcfile, "src_dset_unlim", H5P_DEFAULT)) < 0) + if ((srcdset[1] = H5Dopen2(srcfile, "src_dset_unlim", H5P_DEFAULT)) < 0) TEST_ERROR } /* Extend srcdset[1] */ dims[0] = 3; dims[1] = 3; - if(H5Dset_extent(srcdset[1], dims) < 0) + if (H5Dset_extent(srcdset[1], dims) < 0) TEST_ERROR /* Adjust write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] += (int)mdims[0] * (int)mdims[1]; /* Write to new area of srcdset[1] */ @@ -11592,71 +11580,71 @@ test_all(unsigned config, hid_t fapl) start[1] = 0; block[0] = 1; block[1] = 3; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) TEST_ERROR - if((filespace = H5Dget_space(srcdset[1])) < 0) + if ((filespace = H5Dget_space(srcdset[1])) < 0) TEST_ERROR start[0] = 2; start[1] = 0; - if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) + if (H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) TEST_ERROR - if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 3; i++) + for (i = 0; i < 3; i++) erbuf[5][i] = buf[0][i]; /* Close srcdset[1] and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[1]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 6) + if (dims[0] != 6) TEST_ERROR - if(dims[1] != 6) + if (dims[1] != 6) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 10) + if (mdims[1] != 10) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -11666,37 +11654,37 @@ test_all(unsigned config, hid_t fapl) /* Select hyperslab in memory space */ start[0] = 0; start[1] = 0; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if((i >= (int)dims[0]) || (j >= (int)dims[1])) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if ((i >= (int)dims[0]) || (j >= (int)dims[1])) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Reopen srcfile if config option specified */ - if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) - if((srcfile = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) + if ((srcfile = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Create second printf source dataset, this time without using srcdcpl */ - if((srcdset[3] = H5Dcreate2(srcfile, "src_dset_printf_1", H5T_NATIVE_INT, srcspace[2], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((srcdset[3] = H5Dcreate2(srcfile, "src_dset_printf_1", H5T_NATIVE_INT, srcspace[2], H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Adjust write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] += (int)mdims[0] * (int)mdims[1]; /* Write to srcdset[3] */ @@ -11704,64 +11692,64 @@ test_all(unsigned config, hid_t fapl) start[1] = 0; block[0] = 3; block[1] = 2; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) TEST_ERROR - if(H5Dwrite(srcdset[3], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[3], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 3; i++) - for(j = 0; j < 2; j++) + for (i = 0; i < 3; i++) + for (j = 0; j < 2; j++) erbuf[i][j + 5] = buf[i][j]; /* Close srcdset[3] srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[3]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[3]) < 0) TEST_ERROR srcdset[3] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 6) + if (dims[0] != 6) TEST_ERROR - if(dims[1] != 7) + if (dims[1] != 7) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 10) + if (mdims[1] != 10) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -11771,43 +11759,42 @@ test_all(unsigned config, hid_t fapl) /* Select hyperslab in memory space */ start[0] = 0; start[1] = 0; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if((i >= (int)dims[0]) || (j >= (int)dims[1])) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if ((i >= (int)dims[0]) || (j >= (int)dims[1])) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Reopen srcdset[1] and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(config & TEST_IO_DIFFERENT_FILE) - if((srcfile = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (config & TEST_IO_DIFFERENT_FILE) + if ((srcfile = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((srcdset[1] = H5Dopen2(srcfile, "src_dset_unlim", H5P_DEFAULT)) < 0) + if ((srcdset[1] = H5Dopen2(srcfile, "src_dset_unlim", H5P_DEFAULT)) < 0) TEST_ERROR } /* Extend srcdset[1] */ dims[0] = 7; dims[1] = 3; - if(H5Dset_extent(srcdset[1], dims) < 0) + if (H5Dset_extent(srcdset[1], dims) < 0) TEST_ERROR /* Adjust write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] += (int)mdims[0] * (int)mdims[1]; /* Write to new area of srcdset[1] */ @@ -11815,72 +11802,72 @@ test_all(unsigned config, hid_t fapl) start[1] = 0; block[0] = 4; block[1] = 3; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) TEST_ERROR - if((filespace = H5Dget_space(srcdset[1])) < 0) + if ((filespace = H5Dget_space(srcdset[1])) < 0) TEST_ERROR start[0] = 3; start[1] = 0; - if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) + if (H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) TEST_ERROR - if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 4; i++) - for(j = 0; j < 3; j++) + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) erbuf[i + 6][j] = buf[i][j]; /* Close srcdset[1] and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[1]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[1]) < 0) TEST_ERROR srcdset[1] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 7) + if (dims[1] != 7) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 10) + if (mdims[1] != 10) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -11890,37 +11877,37 @@ test_all(unsigned config, hid_t fapl) /* Select hyperslab in memory space */ start[0] = 0; start[1] = 0; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) { - if(j >= (int)dims[1]) { - if(rbuf[i][j] != 0) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) { + if (j >= (int)dims[1]) { + if (rbuf[i][j] != 0) TEST_ERROR } - else - if(rbuf[i][j] != erbuf[i][j]) - TEST_ERROR + else if (rbuf[i][j] != erbuf[i][j]) + TEST_ERROR } /* Reopen srcfile if config option specified */ - if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) - if((srcfile = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) + if ((srcfile = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Create third printf source dataset */ - if((srcdset[4] = H5Dcreate2(srcfile, "src_dset_printf_2", H5T_NATIVE_INT, srcspace[2], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0) + if ((srcdset[4] = H5Dcreate2(srcfile, "src_dset_printf_2", H5T_NATIVE_INT, srcspace[2], H5P_DEFAULT, + srcdcpl, H5P_DEFAULT)) < 0) TEST_ERROR /* Adjust write buffer */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) buf[i][j] += (int)mdims[0] * (int)mdims[1]; /* Write to srcdset[4] */ @@ -11928,64 +11915,64 @@ test_all(unsigned config, hid_t fapl) start[1] = 0; block[0] = 3; block[1] = 2; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0) TEST_ERROR - if(H5Dwrite(srcdset[4], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(srcdset[4], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) TEST_ERROR /* Update erbuf */ - for(i = 0; i < 3; i++) - for(j = 0; j < 2; j++) + for (i = 0; i < 3; i++) + for (j = 0; j < 2; j++) erbuf[i][j + 8] = buf[i][j]; /* Close srcdset[4] srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[4]) < 0) + if (config & TEST_IO_CLOSE_SRC) { + if (H5Dclose(srcdset[4]) < 0) TEST_ERROR srcdset[4] = -1; - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile) < 0) + if (config & TEST_IO_DIFFERENT_FILE) { + if (H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; } } /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) + if (config & TEST_IO_REOPEN_VIRT) { + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) + if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR } /* Get VDS space */ - if((filespace = H5Dget_space(vdset)) < 0) + if ((filespace = H5Dget_space(vdset)) < 0) TEST_ERROR /* Get VDS space dimensions */ - if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) + if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0) TEST_ERROR - if(ndims != 2) + if (ndims != 2) TEST_ERROR - if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) + if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0) TEST_ERROR - if(dims[0] != 10) + if (dims[0] != 10) TEST_ERROR - if(dims[1] != 10) + if (dims[1] != 10) TEST_ERROR - if(mdims[0] != 10) + if (mdims[0] != 10) TEST_ERROR - if(mdims[1] != 10) + if (mdims[1] != 10) TEST_ERROR /* Close filespace */ - if(H5Sclose(filespace) < 0) + if (H5Sclose(filespace) < 0) TEST_ERROR /* Read data through virtual dataset */ @@ -11995,58 +11982,58 @@ test_all(unsigned config, hid_t fapl) /* Select hyperslab in memory space */ start[0] = 0; start[1] = 0; - if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0) TEST_ERROR /* Read data */ - if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) TEST_ERROR /* Verify read data */ - for(i = 0; i < (int)mdims[0]; i++) - for(j = 0; j < (int)mdims[1]; j++) - if(rbuf[i][j] != erbuf[i][j]) + for (i = 0; i < (int)mdims[0]; i++) + for (j = 0; j < (int)mdims[1]; j++) + if (rbuf[i][j] != erbuf[i][j]) TEST_ERROR /* Close */ - if(!(config & TEST_IO_CLOSE_SRC)) { - for(i = 0; i < 5; i++) { - if(H5Dclose(srcdset[i]) < 0) + if (!(config & TEST_IO_CLOSE_SRC)) { + for (i = 0; i < 5; i++) { + if (H5Dclose(srcdset[i]) < 0) TEST_ERROR srcdset[i] = -1; } - if(H5Fclose(srcfile) < 0) + if (H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; } - else if(!(config & TEST_IO_DIFFERENT_FILE)) { - if(H5Fclose(srcfile) < 0) + else if (!(config & TEST_IO_DIFFERENT_FILE)) { + if (H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; } - if(H5Dclose(vdset) < 0) + if (H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; - if(H5Fclose(vfile) < 0) + if (H5Fclose(vfile) < 0) TEST_ERROR vfile = -1; - for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) { - if(H5Sclose(srcspace[i]) < 0) + for (i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) { + if (H5Sclose(srcspace[i]) < 0) TEST_ERROR srcspace[i] = -1; } - for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) { - if(H5Sclose(vspace[i]) < 0) + for (i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) { + if (H5Sclose(vspace[i]) < 0) TEST_ERROR vspace[i] = -1; } - if(H5Pclose(dcpl) < 0) + if (H5Pclose(dcpl) < 0) TEST_ERROR dcpl = -1; - if(H5Pclose(srcdcpl) < 0) + if (H5Pclose(srcdcpl) < 0) TEST_ERROR srcdcpl = -1; - if(H5Sclose(memspace) < 0) + if (H5Sclose(memspace) < 0) TEST_ERROR memspace = -1; @@ -12054,26 +12041,27 @@ test_all(unsigned config, hid_t fapl) return 0; error: - H5E_BEGIN_TRY { - for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) + H5E_BEGIN_TRY + { + for (i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) H5Dclose(srcdset[i]); H5Dclose(vdset); H5Fclose(srcfile); H5Fclose(vfile); - for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) + for (i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) H5Sclose(srcspace[i]); - for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) + for (i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) H5Sclose(vspace[i]); H5Sclose(filespace); H5Sclose(memspace); H5Pclose(dcpl); H5Pclose(srcdcpl); - } H5E_END_TRY; + } + H5E_END_TRY; - return 1; + return 1; } /* end test_all() */ - /*------------------------------------------------------------------------- * Function: test_dapl_values * @@ -12086,51 +12074,51 @@ error: static int test_dapl_values(hid_t fapl_id) { - hid_t fid = -1; /* file to write to */ - hid_t dcpl_id = -1; /* dataset creation properties */ - hid_t dapl_id1 = -1; /* dataset access properties */ - hid_t dapl_id2 = -1; /* dataset access properties */ - hid_t vds_sid = -1; /* vds data space */ - hid_t src_sid = -1; /* source data space */ - hid_t did1 = -1; /* dataset */ - hid_t did2 = -1; /* dataset */ - hsize_t start; /* hyperslab start */ - hsize_t stride; /* hyperslab count */ - hsize_t count; /* hyperslab count */ - hsize_t block; /* hyperslab count */ - hsize_t dims; /* dataset size */ - hsize_t max_dims; /* dataset max size */ - H5D_vds_view_t view; /* view from dapl */ - hsize_t gap_size; /* gap size from dapl */ - char filename[1024]; /* file names */ + hid_t fid = -1; /* file to write to */ + hid_t dcpl_id = -1; /* dataset creation properties */ + hid_t dapl_id1 = -1; /* dataset access properties */ + hid_t dapl_id2 = -1; /* dataset access properties */ + hid_t vds_sid = -1; /* vds data space */ + hid_t src_sid = -1; /* source data space */ + hid_t did1 = -1; /* dataset */ + hid_t did2 = -1; /* dataset */ + hsize_t start; /* hyperslab start */ + hsize_t stride; /* hyperslab count */ + hsize_t count; /* hyperslab count */ + hsize_t block; /* hyperslab count */ + hsize_t dims; /* dataset size */ + hsize_t max_dims; /* dataset max size */ + H5D_vds_view_t view; /* view from dapl */ + hsize_t gap_size; /* gap size from dapl */ + char filename[1024]; /* file names */ TESTING("H5Dget_access_plist() returns dapl w/ correct values"); /* Create the file */ h5_fixname(FILENAME[5], fapl_id, filename, sizeof(filename)); - if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) FAIL_STACK_ERROR /* Create the dcpl and set up VDS mapping */ - if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR /* source */ dims = 42; - if((src_sid = H5Screate_simple(1, &dims, NULL)) < 0) + if ((src_sid = H5Screate_simple(1, &dims, NULL)) < 0) FAIL_STACK_ERROR /* vds */ - dims = 0; + dims = 0; max_dims = H5S_UNLIMITED; - if((vds_sid = H5Screate_simple(1, &dims, &max_dims)) < 0) + if ((vds_sid = H5Screate_simple(1, &dims, &max_dims)) < 0) FAIL_STACK_ERROR - start = 0; + start = 0; stride = 42; - count = H5S_UNLIMITED; - block = 42; - if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, &start, &stride, &count, &block) < 0) + count = H5S_UNLIMITED; + block = 42; + if (H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, &start, &stride, &count, &block) < 0) FAIL_STACK_ERROR /* map */ - if(H5Pset_virtual(dcpl_id, vds_sid, "f-%b.h5", "/dset1", src_sid) < 0) + if (H5Pset_virtual(dcpl_id, vds_sid, "f-%b.h5", "/dset1", src_sid) < 0) FAIL_STACK_ERROR /* Create the dapls and set values @@ -12139,70 +12127,79 @@ test_dapl_values(hid_t fapl_id) * default isn't the best way to test setting and getting the view. */ /* dapl 1 */ - if((dapl_id1 = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + if ((dapl_id1 = H5Pcreate(H5P_DATASET_ACCESS)) < 0) FAIL_STACK_ERROR - if(H5Pset_virtual_view(dapl_id1, H5D_VDS_FIRST_MISSING) < 0) + if (H5Pset_virtual_view(dapl_id1, H5D_VDS_FIRST_MISSING) < 0) FAIL_STACK_ERROR /* dapl 2 */ - if((dapl_id2 = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + if ((dapl_id2 = H5Pcreate(H5P_DATASET_ACCESS)) < 0) FAIL_STACK_ERROR /* default but we set it explicitly to be sure */ - if(H5Pset_virtual_view(dapl_id2, H5D_VDS_LAST_AVAILABLE) < 0) + if (H5Pset_virtual_view(dapl_id2, H5D_VDS_LAST_AVAILABLE) < 0) FAIL_STACK_ERROR - if(H5Pset_virtual_printf_gap(dapl_id2, 123) < 0) + if (H5Pset_virtual_printf_gap(dapl_id2, 123) < 0) FAIL_STACK_ERROR /* Create the datasets */ - if((did1 = H5Dcreate2(fid, "dset1", H5T_NATIVE_INT, vds_sid, H5P_DEFAULT, dcpl_id, dapl_id1)) < 0) + if ((did1 = H5Dcreate2(fid, "dset1", H5T_NATIVE_INT, vds_sid, H5P_DEFAULT, dcpl_id, dapl_id1)) < 0) FAIL_STACK_ERROR - if((did2 = H5Dcreate2(fid, "dset2", H5T_NATIVE_INT, vds_sid, H5P_DEFAULT, dcpl_id, dapl_id2)) < 0) + if ((did2 = H5Dcreate2(fid, "dset2", H5T_NATIVE_INT, vds_sid, H5P_DEFAULT, dcpl_id, dapl_id2)) < 0) FAIL_STACK_ERROR /* Close the dapls */ - if(H5Pclose(dapl_id1) < 0) + if (H5Pclose(dapl_id1) < 0) FAIL_STACK_ERROR dapl_id1 = -1; - if(H5Pclose(dapl_id2) < 0) + if (H5Pclose(dapl_id2) < 0) FAIL_STACK_ERROR dapl_id2 = -1; /* Get a data access property lists from the dataset */ - if((dapl_id1 = H5Dget_access_plist(did1)) < 0) + if ((dapl_id1 = H5Dget_access_plist(did1)) < 0) FAIL_STACK_ERROR - if((dapl_id2 = H5Dget_access_plist(did2)) < 0) + if ((dapl_id2 = H5Dget_access_plist(did2)) < 0) FAIL_STACK_ERROR /* Check the values from the dapls */ /* dapl 1 */ - if(H5Pget_virtual_view(dapl_id1, &view) < 0) + if (H5Pget_virtual_view(dapl_id1, &view) < 0) FAIL_STACK_ERROR - if(H5D_VDS_FIRST_MISSING != view) + if (H5D_VDS_FIRST_MISSING != view) TEST_ERROR /* dapl 2 */ - if(H5Pget_virtual_view(dapl_id2, &view) < 0) + if (H5Pget_virtual_view(dapl_id2, &view) < 0) FAIL_STACK_ERROR - if(H5D_VDS_LAST_AVAILABLE != view) + if (H5D_VDS_LAST_AVAILABLE != view) TEST_ERROR - if(H5Pget_virtual_printf_gap(dapl_id2, &gap_size) < 0) + if (H5Pget_virtual_printf_gap(dapl_id2, &gap_size) < 0) FAIL_STACK_ERROR - if(gap_size != 123) + if (gap_size != 123) TEST_ERROR /* Close everything */ - if(H5Sclose(vds_sid) < 0) FAIL_STACK_ERROR - if(H5Sclose(src_sid) < 0) FAIL_STACK_ERROR - if(H5Dclose(did1) < 0) FAIL_STACK_ERROR - if(H5Dclose(did2) < 0) FAIL_STACK_ERROR - if(H5Pclose(dapl_id1) < 0) FAIL_STACK_ERROR - if(H5Pclose(dapl_id2) < 0) FAIL_STACK_ERROR - if(H5Pclose(dcpl_id) < 0) FAIL_STACK_ERROR - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + if (H5Sclose(vds_sid) < 0) + FAIL_STACK_ERROR + if (H5Sclose(src_sid) < 0) + FAIL_STACK_ERROR + if (H5Dclose(did1) < 0) + FAIL_STACK_ERROR + if (H5Dclose(did2) < 0) + FAIL_STACK_ERROR + if (H5Pclose(dapl_id1) < 0) + FAIL_STACK_ERROR + if (H5Pclose(dapl_id2) < 0) + FAIL_STACK_ERROR + if (H5Pclose(dcpl_id) < 0) + FAIL_STACK_ERROR + if (H5Fclose(fid) < 0) + FAIL_STACK_ERROR PASSED(); return 0; - error: - H5E_BEGIN_TRY { +error: + H5E_BEGIN_TRY + { H5Dclose(did1); H5Dclose(did2); H5Pclose(dapl_id1); @@ -12211,11 +12208,11 @@ test_dapl_values(hid_t fapl_id) H5Sclose(vds_sid); H5Sclose(src_sid); H5Fclose(fid); - } H5E_END_TRY; + } + H5E_END_TRY; return 1; } /* end test_dapl_values() */ - /*------------------------------------------------------------------------- * Function: main * @@ -12232,13 +12229,13 @@ test_dapl_values(hid_t fapl_id) int main(void) { - char filename[FILENAME_BUF_SIZE]; - hid_t fapl; - hid_t my_fapl = -1; /* File access property list */ - int test_api_config; - unsigned bit_config; - H5F_libver_t low, high; /* Low and high bounds */ - int nerrors = 0; + char filename[FILENAME_BUF_SIZE]; + hid_t fapl; + hid_t my_fapl = -1; /* File access property list */ + int test_api_config; + unsigned bit_config; + H5F_libver_t low, high; /* Low and high bounds */ + int nerrors = 0; /* Testing setup */ h5_reset(); @@ -12247,37 +12244,42 @@ main(void) h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); /* Set to use the latest file format */ - if((my_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR + if ((my_fapl = H5Pcopy(fapl)) < 0) + TEST_ERROR - /* Loop through all the combinations of low/high version bounds */ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { - char msg[80]; /* Message for file version bounds */ - const char *low_string; /* The low bound string */ - const char *high_string; /* The high bound string */ + /* Loop through all the combinations of low/high version bounds */ + for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { + for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { + char msg[80]; /* Message for file version bounds */ + const char *low_string; /* The low bound string */ + const char *high_string; /* The high bound string */ /* Invalid combinations, just continue */ - if(high == H5F_LIBVER_EARLIEST || high < low) + if (high == H5F_LIBVER_EARLIEST || high < low) continue; /* Test virtual dataset only for V110 and above */ - if(high < H5F_LIBVER_V110) + if (high < H5F_LIBVER_V110) continue; /* Set the low/high version bounds */ - if(H5Pset_libver_bounds(my_fapl, low, high) < 0) + if (H5Pset_libver_bounds(my_fapl, low, high) < 0) TEST_ERROR /* Display testing info */ - low_string = h5_get_version_string(low); + low_string = h5_get_version_string(low); high_string = h5_get_version_string(high); - HDsprintf(msg, "Testing virtual dataset with file version bounds: (%s, %s):", low_string, high_string); + HDsprintf(msg, "Testing virtual dataset with file version bounds: (%s, %s):", low_string, + high_string); HDputs(msg); - for(test_api_config = (int)TEST_API_BASIC; test_api_config < (int)TEST_API_NTESTS; test_api_config++) + for (test_api_config = (int)TEST_API_BASIC; test_api_config < (int)TEST_API_NTESTS; + test_api_config++) nerrors += test_api((test_api_config_t)test_api_config, my_fapl, low); - for(bit_config = 0; bit_config < TEST_IO_NTESTS; bit_config++) { - HDprintf("Config: %s%s%s\n", bit_config & TEST_IO_CLOSE_SRC ? "closed source dataset, " : "", bit_config & TEST_IO_DIFFERENT_FILE ? "different source file" : "same source file", bit_config & TEST_IO_REOPEN_VIRT ? ", reopen virtual file" : ""); + for (bit_config = 0; bit_config < TEST_IO_NTESTS; bit_config++) { + HDprintf("Config: %s%s%s\n", bit_config & TEST_IO_CLOSE_SRC ? "closed source dataset, " : "", + bit_config & TEST_IO_DIFFERENT_FILE ? "different source file" : "same source file", + bit_config & TEST_IO_REOPEN_VIRT ? ", reopen virtual file" : ""); nerrors += test_basic_io(bit_config, my_fapl); nerrors += test_vds_prefix_first(bit_config, my_fapl); nerrors += test_unlim(bit_config, my_fapl); @@ -12290,13 +12292,13 @@ main(void) /* Verify symbol table messages are cached */ nerrors += (h5_verify_cached_stabs(FILENAME, my_fapl) < 0 ? 1 : 0); - } /* end for high */ - } /* end for low */ + } /* end for high */ + } /* end for low */ - if(H5Pclose(my_fapl) < 0) + if (H5Pclose(my_fapl) < 0) TEST_ERROR - if(nerrors) + if (nerrors) goto error; HDprintf("All virtual dataset tests passed.\n"); h5_cleanup(FILENAME, fapl); @@ -12305,8 +12307,6 @@ main(void) error: nerrors = MAX(1, nerrors); - HDprintf("***** %d VIRTUAL DATASET TEST%s FAILED! *****\n", - nerrors, 1 == nerrors ? "" : "S"); + HDprintf("***** %d VIRTUAL DATASET TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); return EXIT_FAILURE; } /* end main() */ - |