diff options
author | Larry Knox <lrknox@hdfgroup.org> | 2021-10-29 22:10:31 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-29 22:10:31 (GMT) |
commit | 111c7ae9ac2efc29e8b399e6951253af9110b81a (patch) | |
tree | f69fa03253bdab97d7cf3615baff02cd936323f9 /test/gen_bad_ohdr.c | |
parent | db30c2da68ece4a155e9e50c28ec16d6057509b2 (diff) | |
download | hdf5-hdf5-1_10_8.zip hdf5-hdf5-1_10_8.tar.gz hdf5-hdf5-1_10_8.tar.bz2 |
Merge hdf5 1 10 8 (#1154)hdf5-1_10_8
Merge HDF5 1.10.8 release files to 1.10/master
Diffstat (limited to 'test/gen_bad_ohdr.c')
-rw-r--r-- | test/gen_bad_ohdr.c | 68 |
1 files changed, 42 insertions, 26 deletions
diff --git a/test/gen_bad_ohdr.c b/test/gen_bad_ohdr.c index 0f85cfe..b24371e 100644 --- a/test/gen_bad_ohdr.c +++ b/test/gen_bad_ohdr.c @@ -6,7 +6,7 @@ * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * distribution tree, or in https://www.hdfgroup.org/licenses. * * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -27,7 +27,7 @@ #include "H5Oprivate.h" #ifdef H5O_ENABLE_BAD_MESG_COUNT -#define FILENAME "tbad_msg_count.h5" +#define FILENAME "tbad_msg_count.h5" #define GROUPNAME "Group" #define ATTRNAME1 "Attribute #1" #define ATTRNAME2 "Attribute #2" @@ -40,64 +40,80 @@ #define FALSE 0 #endif /* FALSE */ -int main(void) +int +main(void) { #ifdef H5O_ENABLE_BAD_MESG_COUNT - hid_t fid = -1; /* File ID */ - hid_t gid = -1; /* Group ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t aid = -1; /* Attribute ID */ - hid_t gcpl = -1; /* Group creation property list ID */ - hbool_t store_bad_mesg_count; /* Flag for storing a bad message count */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t aid = -1; /* Attribute ID */ + hid_t gcpl = -1; /* Group creation property list ID */ + hbool_t store_bad_mesg_count; /* Flag for storing a bad message count */ /* Create test file */ - if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; + if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; /* Create group creation property list */ - if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0) goto error; + if ((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0) + goto error; /* Add property for storing bad message count */ store_bad_mesg_count = TRUE; - if(H5Pinsert2(gcpl, H5O_BAD_MESG_COUNT_NAME, H5O_BAD_MESG_COUNT_SIZE, &store_bad_mesg_count, NULL, NULL, NULL, NULL, NULL, NULL) < 0) goto error; + if (H5Pinsert2(gcpl, H5O_BAD_MESG_COUNT_NAME, H5O_BAD_MESG_COUNT_SIZE, &store_bad_mesg_count, NULL, NULL, + NULL, NULL, NULL, NULL) < 0) + goto error; /* Create group with bad object header message count */ - if((gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, gcpl, H5P_DEFAULT)) < 0) goto error; + if ((gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, gcpl, H5P_DEFAULT)) < 0) + goto error; /* Close group creation property list */ - if(H5Pclose(gcpl) < 0) goto error; + if (H5Pclose(gcpl) < 0) + goto error; /* Create dataspace for attributes */ - if((sid = H5Screate(H5S_SCALAR)) < 0) goto error; + if ((sid = H5Screate(H5S_SCALAR)) < 0) + goto error; /* Create attribute on root group */ - if((aid = H5Acreate2(gid, ATTRNAME1, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; - if(H5Aclose(aid) < 0) goto error; + if ((aid = H5Acreate2(gid, ATTRNAME1, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + if (H5Aclose(aid) < 0) + goto error; /* Create another attribute on root group */ - if((aid = H5Acreate2(gid, ATTRNAME2, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; - if(H5Aclose(aid) < 0) goto error; + if ((aid = H5Acreate2(gid, ATTRNAME2, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + if (H5Aclose(aid) < 0) + goto error; /* Close dataspace */ - if(H5Sclose(sid) < 0) goto error; + if (H5Sclose(sid) < 0) + goto error; /* Close group */ - if(H5Gclose(gid) < 0) goto error; + if (H5Gclose(gid) < 0) + goto error; /* Close file */ - if(H5Fclose(fid) < 0) goto error; + if (H5Fclose(fid) < 0) + goto error; return 0; error: - H5E_BEGIN_TRY { + H5E_BEGIN_TRY + { H5Dclose(aid); H5Sclose(sid); H5Pclose(gcpl); H5Fclose(fid); - } H5E_END_TRY; -#else /* H5O_ENABLE_BAD_MESG_COUNT */ + } + H5E_END_TRY; +#else /* H5O_ENABLE_BAD_MESG_COUNT */ HDputs("H5O_BAD_MESG_COUNT compiler macro not defined!"); #endif /* H5O_ENABLE_BAD_MESG_COUNT */ return 1; } - |