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 /tools/test/misc/vds/UC_3_gaps_gen.c | |
parent | 29ab58b58dce556639ea3154e262895773a8a8df (diff) | |
download | hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.zip hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.gz hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.bz2 |
Clang-format of source files
Diffstat (limited to 'tools/test/misc/vds/UC_3_gaps_gen.c')
-rw-r--r-- | tools/test/misc/vds/UC_3_gaps_gen.c | 146 |
1 files changed, 68 insertions, 78 deletions
diff --git a/tools/test/misc/vds/UC_3_gaps_gen.c b/tools/test/misc/vds/UC_3_gaps_gen.c index 74a23dc..54fa766 100644 --- a/tools/test/misc/vds/UC_3_gaps_gen.c +++ b/tools/test/misc/vds/UC_3_gaps_gen.c @@ -29,28 +29,26 @@ static herr_t create_3_1_vds(void) { - hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */ - hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */ - hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */ + hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */ + hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */ + hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */ - hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */ - hid_t did = H5I_INVALID_HID; /* dataset ID */ + hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */ + hid_t did = H5I_INVALID_HID; /* dataset ID */ - hsize_t start[RANK]; /* source starting point for hyperslab */ - hsize_t position[RANK]; /* vds mapping positions */ + hsize_t start[RANK]; /* source starting point for hyperslab */ + hsize_t position[RANK]; /* vds mapping positions */ - int i; /* iterator */ + int i; /* iterator */ /* Create VDS dcpl */ - if((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if ((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) UC_ERROR - if(H5Pset_fill_value(vds_dcplid, UC_31_VDS_DATATYPE, - &UC_3_VDS_FILL_VALUE) < 0) + if (H5Pset_fill_value(vds_dcplid, UC_31_VDS_DATATYPE, &UC_3_VDS_FILL_VALUE) < 0) UC_ERROR /* Create VDS dataspace */ - if((vds_sid = H5Screate_simple(RANK, UC_31_VDS_DIMS, - UC_31_VDS_MAX_DIMS)) < 0) + if ((vds_sid = H5Screate_simple(RANK, UC_31_VDS_DIMS, UC_31_VDS_MAX_DIMS)) < 0) UC_ERROR /* Set starting positions */ @@ -65,26 +63,22 @@ create_3_1_vds(void) /****************************** * Create source-VDS mappings * ******************************/ - for(i = 0; i < UC_1_N_SOURCES; i++) { + for (i = 0; i < UC_1_N_SOURCES; i++) { - if((src_sid = H5Screate_simple(RANK, UC_1_DIMS[i], - UC_1_MAX_DIMS[i])) < 0) - UC_ERROR + if ((src_sid = H5Screate_simple(RANK, UC_1_DIMS[i], UC_1_MAX_DIMS[i])) < 0) + UC_ERROR /* set up hyperslabs for source and destination datasets */ - if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL, - UC_1_MAX_DIMS[i], NULL) < 0) + if (H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL, UC_1_MAX_DIMS[i], NULL) < 0) UC_ERROR - if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, position, - NULL, UC_1_MAX_DIMS[i], NULL) < 0) + if (H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, position, NULL, UC_1_MAX_DIMS[i], NULL) < 0) UC_ERROR position[1] += UC_1_DIMS[i][1] + UC_31_GAP; /* Add VDS mapping */ - if(H5Pset_virtual(vds_dcplid, vds_sid, UC_1_FILE_NAMES[i], - UC_1_SOURCE_DSET_PATH, src_sid) < 0) + if (H5Pset_virtual(vds_dcplid, vds_sid, UC_1_FILE_NAMES[i], UC_1_SOURCE_DSET_PATH, src_sid) < 0) UC_ERROR - if(H5Sclose(src_sid) < 0) + if (H5Sclose(src_sid) < 0) UC_ERROR } /* end for */ @@ -94,39 +88,40 @@ create_3_1_vds(void) *******************************/ /* file */ - if((fid = H5Fcreate(UC_31_VDS_FILE_NAME, H5F_ACC_TRUNC, - H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((fid = H5Fcreate(UC_31_VDS_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) UC_ERROR /* dataset */ - if((did = H5Dcreate2(fid, UC_3_VDS_DSET_NAME, UC_31_VDS_DATATYPE, vds_sid, - H5P_DEFAULT, vds_dcplid, H5P_DEFAULT)) < 0) + if ((did = H5Dcreate2(fid, UC_3_VDS_DSET_NAME, UC_31_VDS_DATATYPE, vds_sid, H5P_DEFAULT, vds_dcplid, + H5P_DEFAULT)) < 0) UC_ERROR /* close */ - if(H5Pclose(vds_dcplid) < 0) + if (H5Pclose(vds_dcplid) < 0) UC_ERROR - if(H5Sclose(vds_sid) < 0) + if (H5Sclose(vds_sid) < 0) UC_ERROR - if(H5Dclose(did) < 0) + if (H5Dclose(did) < 0) UC_ERROR - if(H5Fclose(fid) < 0) + if (H5Fclose(fid) < 0) UC_ERROR return 0; error: - H5E_BEGIN_TRY { - if(vds_sid >= 0) + H5E_BEGIN_TRY + { + if (vds_sid >= 0) (void)H5Sclose(vds_sid); - if(vds_dcplid >= 0) + if (vds_dcplid >= 0) (void)H5Pclose(vds_dcplid); - if(fid >= 0) + if (fid >= 0) (void)H5Fclose(fid); - if(did >= 0) + if (did >= 0) (void)H5Dclose(did); - } H5E_END_TRY + } + H5E_END_TRY return -1; @@ -136,27 +131,25 @@ error: static herr_t create_3_2_vds(void) { - hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */ - hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */ - hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */ + hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */ + hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */ + hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */ - hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */ - hid_t did = H5I_INVALID_HID; /* dataset ID */ + hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */ + hid_t did = H5I_INVALID_HID; /* dataset ID */ - hsize_t start[RANK]; /* source starting point for hyperslab */ + hsize_t start[RANK]; /* source starting point for hyperslab */ - int i; /* iterator */ + int i; /* iterator */ /* Create VDS dcpl */ - if((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if ((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) UC_ERROR - if(H5Pset_fill_value(vds_dcplid, UC_32_VDS_DATATYPE, - &UC_3_VDS_FILL_VALUE) < 0) + if (H5Pset_fill_value(vds_dcplid, UC_32_VDS_DATATYPE, &UC_3_VDS_FILL_VALUE) < 0) UC_ERROR /* Create VDS dataspace */ - if((vds_sid = H5Screate_simple(RANK, UC_32_VDS_DIMS, - UC_32_VDS_MAX_DIMS)) < 0) + if ((vds_sid = H5Screate_simple(RANK, UC_32_VDS_DIMS, UC_32_VDS_MAX_DIMS)) < 0) UC_ERROR /* Set starting positions */ @@ -167,25 +160,22 @@ create_3_2_vds(void) /****************************** * Create source-VDS mappings * ******************************/ - for(i = 0; i < UC_2_N_SOURCES; i++) { + for (i = 0; i < UC_2_N_SOURCES; i++) { - if((src_sid = H5Screate_simple(RANK, UC_2_DIMS[i], - UC_2_MAX_DIMS[i])) < 0) - UC_ERROR + if ((src_sid = H5Screate_simple(RANK, UC_2_DIMS[i], UC_2_MAX_DIMS[i])) < 0) + UC_ERROR /* set up hyperslabs for source and destination datasets */ - if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL, - UC_2_MAX_DIMS[i], NULL) < 0) + if (H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL, UC_2_MAX_DIMS[i], NULL) < 0) UC_ERROR - if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, UC_32_POSITIONS[i], - NULL, UC_2_MAX_DIMS[i], NULL) < 0) + if (H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, UC_32_POSITIONS[i], NULL, UC_2_MAX_DIMS[i], NULL) < + 0) UC_ERROR /* Add VDS mapping */ - if(H5Pset_virtual(vds_dcplid, vds_sid, UC_2_FILE_NAMES[i], - UC_2_SOURCE_DSET_PATH, src_sid) < 0) + if (H5Pset_virtual(vds_dcplid, vds_sid, UC_2_FILE_NAMES[i], UC_2_SOURCE_DSET_PATH, src_sid) < 0) UC_ERROR - if(H5Sclose(src_sid) < 0) + if (H5Sclose(src_sid) < 0) UC_ERROR } /* end for */ @@ -195,39 +185,40 @@ create_3_2_vds(void) *******************************/ /* file */ - if((fid = H5Fcreate(UC_32_VDS_FILE_NAME, H5F_ACC_TRUNC, - H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((fid = H5Fcreate(UC_32_VDS_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) UC_ERROR /* dataset */ - if((did = H5Dcreate2(fid, UC_3_VDS_DSET_NAME, UC_32_VDS_DATATYPE, vds_sid, - H5P_DEFAULT, vds_dcplid, H5P_DEFAULT)) < 0) + if ((did = H5Dcreate2(fid, UC_3_VDS_DSET_NAME, UC_32_VDS_DATATYPE, vds_sid, H5P_DEFAULT, vds_dcplid, + H5P_DEFAULT)) < 0) UC_ERROR /* close */ - if(H5Pclose(vds_dcplid) < 0) + if (H5Pclose(vds_dcplid) < 0) UC_ERROR - if(H5Sclose(vds_sid) < 0) + if (H5Sclose(vds_sid) < 0) UC_ERROR - if(H5Dclose(did) < 0) + if (H5Dclose(did) < 0) UC_ERROR - if(H5Fclose(fid) < 0) + if (H5Fclose(fid) < 0) UC_ERROR return 0; error: - H5E_BEGIN_TRY { - if(vds_sid >= 0) + H5E_BEGIN_TRY + { + if (vds_sid >= 0) (void)H5Sclose(vds_sid); - if(vds_dcplid >= 0) + if (vds_dcplid >= 0) (void)H5Pclose(vds_dcplid); - if(fid >= 0) + if (fid >= 0) (void)H5Fclose(fid); - if(did >= 0) + if (did >= 0) (void)H5Dclose(did); - } H5E_END_TRY + } + H5E_END_TRY return -1; @@ -237,10 +228,10 @@ int main(void) { - if(create_3_1_vds() < 0) + if (create_3_1_vds() < 0) UC_ERROR - if(create_3_2_vds() < 0) + if (create_3_2_vds() < 0) UC_ERROR return EXIT_SUCCESS; @@ -250,4 +241,3 @@ error: return EXIT_FAILURE; } /* end main() */ - |