summaryrefslogtreecommitdiffstats
path: root/test/vds_swmr_reader.c
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-09-30 14:27:10 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-09-30 14:27:10 (GMT)
commitb2d661b508a7fc7a2592c13bc6bdc175551f075d (patch)
tree13baeb0d83a7c2a4c6299993c182b1227c2f6114 /test/vds_swmr_reader.c
parent29ab58b58dce556639ea3154e262895773a8a8df (diff)
downloadhdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.zip
hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.gz
hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.bz2
Clang-format of source files
Diffstat (limited to 'test/vds_swmr_reader.c')
-rw-r--r--test/vds_swmr_reader.c98
1 files changed, 49 insertions, 49 deletions
diff --git a/test/vds_swmr_reader.c b/test/vds_swmr_reader.c
index 1ee65a0..bdb73b8 100644
--- a/test/vds_swmr_reader.c
+++ b/test/vds_swmr_reader.c
@@ -19,78 +19,77 @@ static hsize_t VDS_PLANE[RANK] = {1, FULL_HEIGHT, WIDTH};
int
main(void)
{
- hid_t fid = -1; /* HDF5 file ID */
- hid_t faplid = -1; /* file access property list ID */
- hid_t did = -1; /* dataset ID */
- hid_t msid = -1; /* memory dataspace ID */
- hid_t fsid = -1; /* file dataspace ID */
+ hid_t fid = -1; /* HDF5 file ID */
+ hid_t faplid = -1; /* file access property list ID */
+ hid_t did = -1; /* dataset ID */
+ hid_t msid = -1; /* memory dataspace ID */
+ hid_t fsid = -1; /* file dataspace ID */
- hsize_t start[RANK]; /* hyperslab start point */
+ hsize_t start[RANK]; /* hyperslab start point */
- int n_elements = 0; /* size of buffer (elements) */
- size_t size = 0; /* size of buffer (bytes) */
- int *buffer = NULL; /* data buffer */
-
- int n_dims = -1; /* # dimensions in dataset */
- hsize_t dims[RANK]; /* current size of dataset */
- hsize_t max_dims[RANK]; /* max size of dataset */
+ int n_elements = 0; /* size of buffer (elements) */
+ size_t size = 0; /* size of buffer (bytes) */
+ int * buffer = NULL; /* data buffer */
+ int n_dims = -1; /* # dimensions in dataset */
+ hsize_t dims[RANK]; /* current size of dataset */
+ hsize_t max_dims[RANK]; /* max size of dataset */
/* Open the VDS file and dataset */
- if((faplid = h5_fileaccess()) < 0)
+ if ((faplid = h5_fileaccess()) < 0)
TEST_ERROR
- if((fid = H5Fopen(VDS_FILE_NAME, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, faplid)) < 0)
+ if ((fid = H5Fopen(VDS_FILE_NAME, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, faplid)) < 0)
TEST_ERROR
- if((did = H5Dopen2(fid, VDS_DSET_NAME, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, VDS_DSET_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create the read buffer */
- if(VDS_PLANE[1] * VDS_PLANE[2] > INT_MAX)
+ if (VDS_PLANE[1] * VDS_PLANE[2] > INT_MAX)
TEST_ERROR
n_elements = (int)(VDS_PLANE[1] * VDS_PLANE[2]);
- size = (size_t)n_elements * sizeof(int);
- if(NULL == (buffer = (int *)HDmalloc(size)))
+ size = (size_t)n_elements * sizeof(int);
+ if (NULL == (buffer = (int *)HDmalloc(size)))
TEST_ERROR
/* Create memory dataspace */
- if((msid = H5Screate_simple(RANK, VDS_PLANE, NULL)) < 0)
+ if ((msid = H5Screate_simple(RANK, VDS_PLANE, NULL)) < 0)
TEST_ERROR
/* Read data until the dataset is full (via the writer) */
do {
/* Refresh metadata */
- if(H5Drefresh(did) < 0)
+ if (H5Drefresh(did) < 0)
TEST_ERROR
/* Get the dataset dimensions */
- if((fsid = H5Dget_space(did)) < 0)
+ if ((fsid = H5Dget_space(did)) < 0)
TEST_ERROR
- if(H5Sget_simple_extent_dims(fsid, dims, max_dims) < 0)
+ if (H5Sget_simple_extent_dims(fsid, dims, max_dims) < 0)
TEST_ERROR
/* Check the reported size of the VDS */
- if((n_dims = H5Sget_simple_extent_ndims(fsid)) < 0)
+ if ((n_dims = H5Sget_simple_extent_ndims(fsid)) < 0)
TEST_ERROR
- if(n_dims != RANK)
+ if (n_dims != RANK)
TEST_ERROR
- if(H5Sget_simple_extent_dims(fsid, dims, max_dims) < 0)
+ if (H5Sget_simple_extent_dims(fsid, dims, max_dims) < 0)
TEST_ERROR
/* NOTE: Don't care what dims[0] is. */
- if(dims[1] != FULL_HEIGHT)
+ if (dims[1] != FULL_HEIGHT)
TEST_ERROR
- if(dims[2] != WIDTH)
+ if (dims[2] != WIDTH)
TEST_ERROR
- if(max_dims[0] != H5S_UNLIMITED)
+ if (max_dims[0] != H5S_UNLIMITED)
TEST_ERROR
- if(max_dims[1] != FULL_HEIGHT)
+ if (max_dims[1] != FULL_HEIGHT)
TEST_ERROR
- if(max_dims[2] != WIDTH)
+ if (max_dims[2] != WIDTH)
TEST_ERROR
/* Continue if there's nothing to read */
- if(0 == dims[0]) {
- if(H5Sclose(fsid) < 0)
+ if (0 == dims[0]) {
+ if (H5Sclose(fsid) < 0)
TEST_ERROR
continue;
}
@@ -100,23 +99,23 @@ main(void)
start[0] = dims[0] - 1;
start[1] = 0;
start[2] = 0;
- if(H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, VDS_PLANE, NULL) < 0)
+ if (H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, VDS_PLANE, NULL) < 0)
TEST_ERROR
- if(H5Dread(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0)
+ if (H5Dread(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0)
TEST_ERROR
- if(H5Sclose(fsid) < 0)
+ if (H5Sclose(fsid) < 0)
TEST_ERROR
} while (dims[0] < N_PLANES_TO_WRITE);
/* Close file and dataset */
- if(H5Pclose(faplid) < 0)
+ if (H5Pclose(faplid) < 0)
TEST_ERROR
- if(H5Sclose(msid) < 0)
+ if (H5Sclose(msid) < 0)
TEST_ERROR
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR
HDfree(buffer);
@@ -126,23 +125,24 @@ main(void)
error:
- H5E_BEGIN_TRY {
- if(fid >= 0)
+ H5E_BEGIN_TRY
+ {
+ if (fid >= 0)
(void)H5Fclose(fid);
- if(faplid >= 0)
+ if (faplid >= 0)
(void)H5Pclose(faplid);
- if(did >= 0)
+ if (did >= 0)
(void)H5Dclose(did);
- if(msid >= 0)
+ if (msid >= 0)
(void)H5Sclose(msid);
- if(fsid >= 0)
+ if (fsid >= 0)
(void)H5Sclose(fsid);
- if(buffer != NULL)
+ if (buffer != NULL)
HDfree(buffer);
- } H5E_END_TRY
+ }
+ H5E_END_TRY
HDfprintf(stderr, "ERROR: SWMR reader exited with errors\n");
return EXIT_FAILURE;
} /* end main */
-