summaryrefslogtreecommitdiffstats
path: root/test/vfd.c
diff options
context:
space:
mode:
authorJacob Smith <jake.smith@hdfgroup.org>2019-07-22 21:55:37 (GMT)
committerJacob Smith <jake.smith@hdfgroup.org>2019-07-22 21:55:37 (GMT)
commit7ff3a63d5f6c74210a7e5ee064086306436c4062 (patch)
tree812406ba59c35ae766ded6e7a53ea0db793667d3 /test/vfd.c
parent9103fd59530cc45cef39cba81e0f1330a94b4807 (diff)
downloadhdf5-7ff3a63d5f6c74210a7e5ee064086306436c4062.zip
hdf5-7ff3a63d5f6c74210a7e5ee064086306436c4062.tar.gz
hdf5-7ff3a63d5f6c74210a7e5ee064086306436c4062.tar.bz2
Minor formatting adjustments.
Diffstat (limited to 'test/vfd.c')
-rw-r--r--test/vfd.c85
1 files changed, 53 insertions, 32 deletions
diff --git a/test/vfd.c b/test/vfd.c
index 7c1d9d5..e7c133b 100644
--- a/test/vfd.c
+++ b/test/vfd.c
@@ -1113,54 +1113,60 @@ error:
/*-------------------------------------------------------------------------
- * Function: test_family_member_fapl
+ * Function: test_family_member_fapl
*
- * Purpose: Actually use the member fapl input to the member vfd.
+ * Purpose: Actually use the member fapl input to the member vfd.
*
- * Return: 0 - success
- * -1 - failure
+ * Return: Success: 0
+ * Failure: -1
*
- * Programmer: Jacob Smith
- * 21 May 2019
+ * Programmer: Jacob Smith
+ * 21 May 2019
*
*-------------------------------------------------------------------------
*/
static herr_t
test_family_member_fapl(void)
{
- hid_t file;
- hid_t fapl_id;
- hid_t memb_fapl_id;
- hid_t space;
- hid_t dset;
+ hid_t file = H5I_INVALID_HID;
+ hid_t fapl_id = H5I_INVALID_HID;
+ hid_t memb_fapl_id = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hid_t dset = H5I_INVALID_HID;
char filename[1024];
- char dname[] = "dataset";
- unsigned i;
- unsigned j;
+ char dname[] = "dataset";
+ unsigned i = 0;
+ unsigned j = 0;
int buf[FAMILY_NUMBER][FAMILY_SIZE];
- hsize_t dims[2] = {FAMILY_NUMBER, FAMILY_SIZE};
+ hsize_t dims[2] = {FAMILY_NUMBER, FAMILY_SIZE};
TESTING("Family member FAPL");
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- if (H5I_INVALID_HID == fapl_id)
+ if (H5I_INVALID_HID == fapl_id) {
TEST_ERROR;
+ }
memb_fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- if (H5I_INVALID_HID == memb_fapl_id)
+ if (H5I_INVALID_HID == memb_fapl_id) {
TEST_ERROR;
- if (H5Pset_fapl_sec2(memb_fapl_id) == FAIL)
+ }
+ if (H5Pset_fapl_sec2(memb_fapl_id) == FAIL) {
TEST_ERROR;
- if (H5Pset_fapl_family(fapl_id, (hsize_t)FAMILY_SIZE, memb_fapl_id) == FAIL)
+ }
+ if (H5Pset_fapl_family(fapl_id, (hsize_t)FAMILY_SIZE, memb_fapl_id) == FAIL) {
TEST_ERROR;
+ }
h5_fixname(FILENAME[2], fapl_id, filename, sizeof(filename));
file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
- if (H5I_INVALID_HID == file)
+ if (H5I_INVALID_HID == file) {
TEST_ERROR;
+ }
space = H5Screate_simple(2, dims, NULL);
- if (H5I_INVALID_HID == space)
+ if (H5I_INVALID_HID == space) {
TEST_ERROR;
+ }
/* Create and write to dataset, then close file.
*/
@@ -1172,11 +1178,14 @@ test_family_member_fapl(void)
H5P_DEFAULT,
H5P_DEFAULT,
H5P_DEFAULT);
- if (H5I_INVALID_HID == dset)
+ if (H5I_INVALID_HID == dset) {
TEST_ERROR;
- for (i = 0; i < FAMILY_NUMBER; i++)
- for (j = 0; j < FAMILY_SIZE; j++)
+ }
+ for (i = 0; i < FAMILY_NUMBER; i++) {
+ for (j = 0; j < FAMILY_SIZE; j++) {
buf[i][j] = (int)((i * 10000) + j);
+ }
+ }
if (H5Dwrite(dset,
H5T_NATIVE_INT,
H5S_ALL,
@@ -1184,34 +1193,46 @@ test_family_member_fapl(void)
H5P_DEFAULT,
buf)
== FAIL)
+ {
TEST_ERROR;
- if (H5Dclose(dset) == FAIL) TEST_ERROR;
- if (H5Sclose(space) == FAIL) TEST_ERROR;
- if (H5Fclose(file) == FAIL) TEST_ERROR;
+ }
+ if (H5Dclose(dset) == FAIL) {
+ TEST_ERROR;
+ }
+ if (H5Sclose(space) == FAIL) {
+ TEST_ERROR;
+ }
+ if (H5Fclose(file) == FAIL) {
+ TEST_ERROR;
+ }
/* "Close" member FAPL at top level and re-open file.
* Should succeed, with library managing reference count properly
*/
- if (H5Pclose(memb_fapl_id) == FAIL)
+ if (H5Pclose(memb_fapl_id) == FAIL) {
TEST_ERROR;
+ }
file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id);
- if (H5I_INVALID_HID == file)
+ if (H5I_INVALID_HID == file) {
TEST_ERROR;
+ }
- if (H5Fclose(file) == FAIL)
+ if (H5Fclose(file) == FAIL) {
TEST_ERROR;
+ }
h5_delete_test_file(FILENAME[2], fapl_id);
- if (H5Pclose(fapl_id) == FAIL)
+ if (H5Pclose(fapl_id) == FAIL) {
TEST_ERROR;
+ }
PASSED();
return 0;
error:
- H5E_BEGIN_TRY{
+ H5E_BEGIN_TRY {
H5Sclose(space);
H5Dclose(dset);
H5Pclose(memb_fapl_id);