diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-10-01 15:29:53 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-10-01 15:29:53 (GMT) |
commit | ec8ad09125032c9c232878d02e90aa86df162841 (patch) | |
tree | 5d63105d3a0db7d5bbee41c5b74b097649a2115e /hl/test/test_h5do_compat.c | |
parent | 453238e90e1574ef1c15e3c79f7fb3d77920e77c (diff) | |
download | hdf5-ec8ad09125032c9c232878d02e90aa86df162841.zip hdf5-ec8ad09125032c9c232878d02e90aa86df162841.tar.gz hdf5-ec8ad09125032c9c232878d02e90aa86df162841.tar.bz2 |
Source formatted
Diffstat (limited to 'hl/test/test_h5do_compat.c')
-rw-r--r-- | hl/test/test_h5do_compat.c | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/hl/test/test_h5do_compat.c b/hl/test/test_h5do_compat.c index 75028fb..7efef3f 100644 --- a/hl/test/test_h5do_compat.c +++ b/hl/test/test_h5do_compat.c @@ -20,12 +20,11 @@ #ifndef H5_NO_DEPRECATED_SYMBOLS -#define FILE_NAME "h5do_compat.h5" -#define DATASET_NAME "direct_chunk_io" - -#define NX 8 -#define CHUNK_NX 4 +#define FILE_NAME "h5do_compat.h5" +#define DATASET_NAME "direct_chunk_io" +#define NX 8 +#define CHUNK_NX 4 /*------------------------------------------------------------------------- * Function: test_direct_chunk_write @@ -40,12 +39,12 @@ static hid_t create_dataset(hid_t fid) { - hid_t did = H5I_INVALID_HID; - hid_t sid = H5I_INVALID_HID; - hid_t dcpl_id = H5I_INVALID_HID; - hsize_t dims[1] = {NX}; - hsize_t maxdims[1] = {H5S_UNLIMITED}; - hsize_t chunk_dims[1] = {CHUNK_NX}; + hid_t did = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + hid_t dcpl_id = H5I_INVALID_HID; + hsize_t dims[1] = {NX}; + hsize_t maxdims[1] = {H5S_UNLIMITED}; + hsize_t chunk_dims[1] = {CHUNK_NX}; int data[NX]; int i; @@ -79,19 +78,19 @@ create_dataset(hid_t fid) return did; - error: - H5E_BEGIN_TRY { +error: + H5E_BEGIN_TRY + { H5Dclose(did); H5Sclose(sid); H5Pclose(dcpl_id); - } H5E_END_TRY; + } + H5E_END_TRY; return H5I_INVALID_HID; } /* end create_dataset() */ - - /*------------------------------------------------------------------------- * Function: test_direct_chunk_write * @@ -105,11 +104,11 @@ create_dataset(hid_t fid) static int test_direct_chunk_write(hid_t did) { - unsigned filter_mask = 0; - int chunk_data[CHUNK_NX]; - hsize_t offset[1]; - size_t data_size; - int i; + unsigned filter_mask = 0; + int chunk_data[CHUNK_NX]; + hsize_t offset[1]; + size_t data_size; + int i; HL_TESTING2("H5DOwrite_chunk wrapper"); @@ -124,7 +123,7 @@ test_direct_chunk_write(hid_t did) * dataset, using the direct writing function. */ offset[0] = 0; - for (i = 0; i < NX/CHUNK_NX; i++) { + for (i = 0; i < NX / CHUNK_NX; i++) { if (H5DOwrite_chunk(did, H5P_DEFAULT, filter_mask, offset, data_size, chunk_data) < 0) TEST_ERROR offset[0] += CHUNK_NX; @@ -138,7 +137,6 @@ error: return 1; } /* test_direct_chunk_write() */ - /*------------------------------------------------------------------------- * Function: test_direct_chunk_read * @@ -152,22 +150,22 @@ error: static int test_direct_chunk_read(hid_t did) { - hid_t mem_sid = H5I_INVALID_HID; - hid_t file_sid = H5I_INVALID_HID; - hsize_t dims[1] = {NX}; - hsize_t chunk_dims[1] = {CHUNK_NX}; + hid_t mem_sid = H5I_INVALID_HID; + hid_t file_sid = H5I_INVALID_HID; + hsize_t dims[1] = {NX}; + hsize_t chunk_dims[1] = {CHUNK_NX}; - unsigned filter_mask; - int chunk_data[CHUNK_NX]; /* Chunk read with H5DOread_chunk */ - int check[CHUNK_NX]; /* Chunk read with H5Dread */ - hsize_t offset[1]; + unsigned filter_mask; + int chunk_data[CHUNK_NX]; /* Chunk read with H5DOread_chunk */ + int check[CHUNK_NX]; /* Chunk read with H5Dread */ + hsize_t offset[1]; - hsize_t start[1]; /* Start of hyperslab */ - hsize_t stride[1]; /* Stride of hyperslab */ - hsize_t count[1]; /* Block count */ - hsize_t block[1]; /* Block sizes */ + hsize_t start[1]; /* Start of hyperslab */ + hsize_t stride[1]; /* Stride of hyperslab */ + hsize_t count[1]; /* Block count */ + hsize_t block[1]; /* Block sizes */ - int i,j; + int i, j; HL_TESTING2("H5DOread_chunk wrapper"); @@ -178,7 +176,7 @@ test_direct_chunk_read(hid_t did) TEST_ERROR /* For each chunk in the dataset, compare the result of H5Dread and H5DOread_chunk. */ - for (i = 0; i < NX/CHUNK_NX; i++) { + for (i = 0; i < NX / CHUNK_NX; i++) { /* Select hyperslab for one chunk in the file */ start[0] = (hsize_t)i * CHUNK_NX; @@ -197,7 +195,7 @@ test_direct_chunk_read(hid_t did) /* Read the raw chunk back */ HDmemset(chunk_data, 0, CHUNK_NX * sizeof(int)); filter_mask = UINT_MAX; - offset[0] = (hsize_t)i * CHUNK_NX; + offset[0] = (hsize_t)i * CHUNK_NX; if (H5DOread_chunk(did, H5P_DEFAULT, offset, &filter_mask, chunk_data) < 0) TEST_ERROR @@ -221,10 +219,12 @@ test_direct_chunk_read(hid_t did) return 0; error: - H5E_BEGIN_TRY { + H5E_BEGIN_TRY + { H5Sclose(mem_sid); H5Sclose(file_sid); - } H5E_END_TRY; + } + H5E_END_TRY; H5_FAILED(); return 1; @@ -232,7 +232,6 @@ error: #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /*------------------------------------------------------------------------- * Function: main * @@ -244,7 +243,8 @@ error: * *------------------------------------------------------------------------- */ -int main( void ) +int +main(void) { #ifdef H5_NO_DEPRECATED_SYMBOLS @@ -254,9 +254,9 @@ int main( void ) #else - hid_t fid = H5I_INVALID_HID; - hid_t did = H5I_INVALID_HID; - int nerrors = 0; + hid_t fid = H5I_INVALID_HID; + hid_t did = H5I_INVALID_HID; + int nerrors = 0; if ((fid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; |