diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-09-30 14:27:10 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-09-30 14:27:10 (GMT) |
commit | b2d661b508a7fc7a2592c13bc6bdc175551f075d (patch) | |
tree | 13baeb0d83a7c2a4c6299993c182b1227c2f6114 /test/del_many_dense_attrs.c | |
parent | 29ab58b58dce556639ea3154e262895773a8a8df (diff) | |
download | hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.zip hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.gz hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.bz2 |
Clang-format of source files
Diffstat (limited to 'test/del_many_dense_attrs.c')
-rw-r--r-- | test/del_many_dense_attrs.c | 96 |
1 files changed, 47 insertions, 49 deletions
diff --git a/test/del_many_dense_attrs.c b/test/del_many_dense_attrs.c index 6f48901..95b5854 100644 --- a/test/del_many_dense_attrs.c +++ b/test/del_many_dense_attrs.c @@ -17,16 +17,12 @@ * (See HDFFV-10659). */ - #include "h5test.h" /* The test file name */ -const char *FILENAME[] = { - "del_many_dense_attrs", - NULL -}; +const char *FILENAME[] = {"del_many_dense_attrs", NULL}; -#define ATTR_COUNT 64 /* The number of attributes */ +#define ATTR_COUNT 64 /* The number of attributes */ /*------------------------------------------------------------------------- * Function: catch_signal @@ -39,12 +35,12 @@ const char *FILENAME[] = { * *------------------------------------------------------------------------- */ -static void catch_signal(int H5_ATTR_UNUSED signo) +static void +catch_signal(int H5_ATTR_UNUSED signo) { HDexit(EXIT_FAILURE); } /* catch_signal() */ - /*------------------------------------------------------------------------- * Function: main * @@ -62,108 +58,108 @@ static void catch_signal(int H5_ATTR_UNUSED signo) int main(void) { - hid_t fid = -1; /* HDF5 File ID */ - hid_t gid = -1; /* Group ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t aid = -1; /* Attribute ID */ - hid_t tid = -1; /* Datatype ID */ - hid_t fapl = -1; /* File access property lists */ - hid_t gcpl = -1; /* Group creation property list */ - char aname[50]; /* Name of attribute */ - const char *basename="attr"; /* Name prefix for attribute */ - char filename[100]; /* File name */ - int i; /* Local index variable */ + hid_t fid = -1; /* HDF5 File ID */ + hid_t gid = -1; /* Group ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t aid = -1; /* Attribute ID */ + hid_t tid = -1; /* Datatype ID */ + hid_t fapl = -1; /* File access property lists */ + hid_t gcpl = -1; /* Group creation property list */ + char aname[50]; /* Name of attribute */ + const char *basename = "attr"; /* Name prefix for attribute */ + char filename[100]; /* File name */ + int i; /* Local index variable */ /* Testing setup */ h5_reset(); /* To exit from the file for SIGABRT signal */ - if(HDsignal(SIGABRT, catch_signal) == SIG_ERR) - TEST_ERROR + if (HDsignal(SIGABRT, catch_signal) == SIG_ERR) + TEST_ERROR fapl = h5_fileaccess(); h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); /* Set to latest format */ - if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR /* Create the file */ - if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Close the file */ - if(H5Fclose(fid) < 0) + if (H5Fclose(fid) < 0) TEST_ERROR - /* Re-open the file */ - if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + /* Re-open the file */ + if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Create the group creation property list */ - if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0) + if ((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR /* Set to use dense storage for all attributes on the group */ - if(H5Pset_attr_phase_change(gcpl, 0, 0) < 0) + if (H5Pset_attr_phase_change(gcpl, 0, 0) < 0) TEST_ERROR /* Create the group in the file */ - if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, gcpl, H5P_DEFAULT)) < 0) + if ((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, gcpl, H5P_DEFAULT)) < 0) TEST_ERROR /* Create dataspace */ - if((sid = H5Screate(H5S_SCALAR)) < 0) + if ((sid = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR /* Get a copy of the datatype */ - if((tid = H5Tcopy(H5T_NATIVE_FLOAT)) < 0) + if ((tid = H5Tcopy(H5T_NATIVE_FLOAT)) < 0) TEST_ERROR /* Create attributes in the group */ - for(i = ATTR_COUNT; i >= 0; i--) { + for (i = ATTR_COUNT; i >= 0; i--) { /* Set up the attribute name */ HDsprintf(aname, "%s%d", basename, i); /* Create the attribute */ - if((aid = H5Acreate2(gid, aname, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((aid = H5Acreate2(gid, aname, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Write to the attribute */ - if(H5Awrite(aid, tid, &i) < 0) + if (H5Awrite(aid, tid, &i) < 0) TEST_ERROR /* Close the attribute */ - if(H5Aclose(aid) < 0) + if (H5Aclose(aid) < 0) TEST_ERROR } /* Close the datatype */ - if(H5Tclose(tid) < 0) - TEST_ERROR + if (H5Tclose(tid) < 0) + TEST_ERROR /* Close the dataspace */ - if(H5Sclose(sid) < 0) + if (H5Sclose(sid) < 0) TEST_ERROR /* Close the group */ - if(H5Gclose(gid) < 0) + if (H5Gclose(gid) < 0) TEST_ERROR /* Close the group creation property list */ - if(H5Pclose(gcpl) < 0) + if (H5Pclose(gcpl) < 0) TEST_ERROR /* Close the file */ - if(H5Fclose(fid) < 0) + if (H5Fclose(fid) < 0) TEST_ERROR /* Re-open the file */ - if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Open the group */ - if((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0) + if ((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0) TEST_ERROR /* Delete the attributes */ @@ -172,24 +168,25 @@ main(void) HDsprintf(aname, "%s%d", basename, i); /* Delete the attribute */ - if(H5Adelete(gid, aname) < 0) + if (H5Adelete(gid, aname) < 0) TEST_ERROR } /* end for */ /* Close the group */ - if(H5Gclose(gid) < 0) + if (H5Gclose(gid) < 0) TEST_ERROR /* Close the file */ - if(H5Fclose(fid) < 0) + if (H5Fclose(fid) < 0) TEST_ERROR h5_cleanup(FILENAME, fapl); - return(EXIT_SUCCESS); + return (EXIT_SUCCESS); error: - H5E_BEGIN_TRY { + H5E_BEGIN_TRY + { H5Gclose(gid); H5Sclose(sid); H5Tclose(tid); @@ -197,7 +194,8 @@ error: H5Fclose(fid); H5Pclose(gcpl); H5Pclose(fapl); - } H5E_END_TRY + } + H5E_END_TRY return EXIT_FAILURE; } |