diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-10-01 14:04:36 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-10-01 14:04:36 (GMT) |
commit | f1ba03cea5b82699a984c80bd2deac14fdc8df18 (patch) | |
tree | ebe777c3e0b83f4c4cec9212731da9ebe0a0cfd3 /test/gen_udlinks.c | |
parent | 10343c197906415388f2a4c8d292e21d25cf7381 (diff) | |
download | hdf5-f1ba03cea5b82699a984c80bd2deac14fdc8df18.zip hdf5-f1ba03cea5b82699a984c80bd2deac14fdc8df18.tar.gz hdf5-f1ba03cea5b82699a984c80bd2deac14fdc8df18.tar.bz2 |
Source formatted
Diffstat (limited to 'test/gen_udlinks.c')
-rw-r--r-- | test/gen_udlinks.c | 104 |
1 files changed, 57 insertions, 47 deletions
diff --git a/test/gen_udlinks.c b/test/gen_udlinks.c index e48d0e8..7bac453 100644 --- a/test/gen_udlinks.c +++ b/test/gen_udlinks.c @@ -25,64 +25,74 @@ #include "hdf5.h" #include <string.h> -#define NAME_LE_1 "le_extlink1.h5" -#define NAME_LE_2 "le_extlink2.h5" -#define NAME_BE_1 "be_extlink1.h5" -#define NAME_BE_2 "be_extlink2.h5" +#define NAME_LE_1 "le_extlink1.h5" +#define NAME_LE_2 "le_extlink2.h5" +#define NAME_BE_1 "be_extlink1.h5" +#define NAME_BE_2 "be_extlink2.h5" #define NAME_BUF_SIZE 25 int -main (void) +main(void) { - hid_t fid1=-1; - hid_t fid2=-1; - hid_t gid=-1; - char filename1[NAME_BUF_SIZE]; - char filename2[NAME_BUF_SIZE]; + hid_t fid1 = -1; + hid_t fid2 = -1; + hid_t gid = -1; + char filename1[NAME_BUF_SIZE]; + char filename2[NAME_BUF_SIZE]; - /* Name the files differently depending on the endianness of this platform */ + /* Name the files differently depending on the endianness of this platform */ - switch(H5Tget_order(H5T_NATIVE_INT)) - { - case H5T_ORDER_LE: - strcpy(filename1, NAME_LE_1); - strcpy(filename2, NAME_LE_2); - break; - case H5T_ORDER_BE: - strcpy(filename1, NAME_BE_1); - strcpy(filename2, NAME_BE_2); - break; - case H5T_ORDER_ERROR: - case H5T_ORDER_VAX: - case H5T_ORDER_MIXED: - case H5T_ORDER_NONE: - default: - goto error; - } + switch (H5Tget_order(H5T_NATIVE_INT)) { + case H5T_ORDER_LE: + strcpy(filename1, NAME_LE_1); + strcpy(filename2, NAME_LE_2); + break; + case H5T_ORDER_BE: + strcpy(filename1, NAME_BE_1); + strcpy(filename2, NAME_BE_2); + break; + case H5T_ORDER_ERROR: + case H5T_ORDER_VAX: + case H5T_ORDER_MIXED: + case H5T_ORDER_NONE: + default: + goto error; + } - /* Create the two files */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; + /* Create the two files */ + if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; - /* Create two groups in the second file */ - if((gid = H5Gcreate2(fid2, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; - if((H5Gclose(gid)) < 0) goto error; - if((gid = H5Gcreate2(fid2, "group/subgroup", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; - if((H5Gclose(gid)) < 0) goto error; + /* Create two groups in the second file */ + if ((gid = H5Gcreate2(fid2, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + if ((H5Gclose(gid)) < 0) + goto error; + if ((gid = H5Gcreate2(fid2, "group/subgroup", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + if ((H5Gclose(gid)) < 0) + goto error; - /* Create an external link in the first file pointing to the group in the second file */ - if(H5Lcreate_external(filename2, "group", fid1, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) goto error; + /* Create an external link in the first file pointing to the group in the second file */ + if (H5Lcreate_external(filename2, "group", fid1, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) + goto error; - if((H5Fclose(fid1)) < 0) goto error; - if((H5Fclose(fid2)) < 0) goto error; + if ((H5Fclose(fid1)) < 0) + goto error; + if ((H5Fclose(fid2)) < 0) + goto error; - return 0; + return 0; error: - H5E_BEGIN_TRY { - H5Fclose(fid1); - H5Fclose(fid2); - H5Gclose(gid); - } H5E_END_TRY - return 1; + H5E_BEGIN_TRY + { + H5Fclose(fid1); + H5Fclose(fid2); + H5Gclose(gid); + } + H5E_END_TRY + return 1; } |