summaryrefslogtreecommitdiffstats
path: root/test/accum_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/accum_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/accum_swmr_reader.c')
-rw-r--r--test/accum_swmr_reader.c72
1 files changed, 35 insertions, 37 deletions
diff --git a/test/accum_swmr_reader.c b/test/accum_swmr_reader.c
index c3be09a..1d48d43 100644
--- a/test/accum_swmr_reader.c
+++ b/test/accum_swmr_reader.c
@@ -11,26 +11,20 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "h5test.h"
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
-#define H5FD_FRIEND /*suppress error about including H5FDpkg */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5FD_FRIEND /*suppress error about including H5FDpkg */
#define H5FD_TESTING
#include "H5Fpkg.h"
#include "H5FDpkg.h"
-#include "H5CXprivate.h" /* API Contexts */
+#include "H5CXprivate.h" /* API Contexts */
#include "H5Iprivate.h"
-#include "H5VLprivate.h" /* Virtual Object Layer */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/* Filename: this is the same as the define in accum.c used by test_swmr_write_big() */
-const char *FILENAME[] = {
- "accum",
- "accum_swmr_big",
- NULL
-};
+const char *FILENAME[] = {"accum", "accum_swmr_big", NULL};
-
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -49,73 +43,77 @@ const char *FILENAME[] = {
int
main(void)
{
- hid_t fid = -1; /* File ID */
- hid_t fapl = -1; /* file access property list ID */
- H5F_t *f = NULL; /* File pointer */
- char filename[1024];
- unsigned u; /* Local index variable */
- uint8_t rbuf[1024]; /* Buffer for reading */
- uint8_t buf[1024]; /* Buffer for holding the expected data */
- char *driver = NULL; /* VFD string (from env variable) */
- hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ hid_t fid = -1; /* File ID */
+ hid_t fapl = -1; /* file access property list ID */
+ H5F_t * f = NULL; /* File pointer */
+ char filename[1024];
+ unsigned u; /* Local index variable */
+ uint8_t rbuf[1024]; /* Buffer for reading */
+ uint8_t buf[1024]; /* Buffer for holding the expected data */
+ char * driver = NULL; /* VFD string (from env variable) */
+ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
/* Skip this test if SWMR I/O is not supported for the VFD specified
* by the environment variable.
*/
driver = HDgetenv("HDF5_DRIVER");
- if(!H5FD__supports_swmr_test(driver))
+ if (!H5FD__supports_swmr_test(driver))
return EXIT_SUCCESS;
/* Initialize buffers */
- for(u = 0; u < 1024; u++) {
- rbuf[u] = 0; /* The buffer for reading */
- buf[u] = 1; /* The expected data should be all 1s */
+ for (u = 0; u < 1024; u++) {
+ rbuf[u] = 0; /* The buffer for reading */
+ buf[u] = 1; /* The expected data should be all 1s */
}
- if((fapl = h5_fileaccess()) < 0)
+ if ((fapl = h5_fileaccess()) < 0)
FAIL_STACK_ERROR
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
/* Open the file with SWMR_READ */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
FAIL_STACK_ERROR
/* Push API context */
- if(H5CX_push() < 0) FAIL_STACK_ERROR
+ if (H5CX_push() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = TRUE;
/* Get H5F_t * to internal file structure */
- if(NULL == (f = (H5F_t *)H5VL_object(fid)))
+ if (NULL == (f = (H5F_t *)H5VL_object(fid)))
FAIL_STACK_ERROR
/* Should read in [1024, 2024] with buf data */
- if(H5F_block_read(f, H5FD_MEM_DEFAULT, (haddr_t)1024, (size_t)1024, rbuf) < 0)
+ if (H5F_block_read(f, H5FD_MEM_DEFAULT, (haddr_t)1024, (size_t)1024, rbuf) < 0)
FAIL_STACK_ERROR;
/* Verify the data read is correct */
- if(HDmemcmp(buf, rbuf, (size_t)1024) != 0)
+ if (HDmemcmp(buf, rbuf, (size_t)1024) != 0)
TEST_ERROR;
/* CLose the file */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
/* Pop API context */
- if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR
+ if (api_ctx_pushed && H5CX_pop() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = FALSE;
return EXIT_SUCCESS;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- if(api_ctx_pushed) H5CX_pop();
+ if (api_ctx_pushed)
+ H5CX_pop();
return EXIT_FAILURE;
} /* end main() */
-