diff options
-rw-r--r-- | fortran/src/H5Gf.c | 65 | ||||
-rw-r--r-- | src/H5Gdeprec.c | 4 | ||||
-rw-r--r-- | src/H5Gpublic.h | 4 | ||||
-rw-r--r-- | test/getname.c | 2 | ||||
-rw-r--r-- | test/links.c | 38 | ||||
-rwxr-xr-x | test/objcopy.c | 48 | ||||
-rw-r--r-- | test/titerate.c | 8 | ||||
-rw-r--r-- | test/tmisc.c | 12 | ||||
-rw-r--r-- | test/tunicode.c | 8 | ||||
-rw-r--r-- | test/unlink.c | 252 | ||||
-rw-r--r-- | tools/h5repack/h5repacktst.c | 4 |
11 files changed, 224 insertions, 221 deletions
diff --git a/fortran/src/H5Gf.c b/fortran/src/H5Gf.c index 3d71e29..b51329c 100644 --- a/fortran/src/H5Gf.c +++ b/fortran/src/H5Gf.c @@ -342,42 +342,45 @@ DONE: *---------------------------------------------------------------------------*/ int_f -nh5glink2_c(hid_t_f *cur_loc_id, _fcd cur_name, int_f *cur_namelen, int_f *link_type, hid_t_f *new_loc_id, _fcd new_name, int_f *new_namelen) +nh5glink2_c(hid_t_f *cur_loc_id, _fcd cur_name, int_f *cur_namelen, + int_f *link_type, hid_t_f *new_loc_id, _fcd new_name, int_f *new_namelen) { - int ret_value = -1; - hid_t c_cur_loc_id; - hid_t c_new_loc_id; - H5G_link_t c_link_type; - char *c_cur_name, *c_new_name; - size_t c_cur_namelen, c_new_namelen; - herr_t c_ret_value; - /* - * Convert Fortran name to C name - */ - c_cur_namelen =*cur_namelen; - c_new_namelen =*new_namelen; - c_cur_name = (char *)HD5f2cstring(cur_name, c_cur_namelen); - c_new_name = (char *)HD5f2cstring(new_name, c_new_namelen); - if (c_cur_name == NULL) return ret_value; - if (c_new_name == NULL) { HDfree(c_cur_name); - return ret_value; - } + char *c_cur_name = NULL, *c_new_name = NULL; + int ret_value = -1; - /* - * Call H5Glink2 function - */ - c_cur_loc_id = *cur_loc_id; - c_new_loc_id = *new_loc_id; - c_link_type = (H5G_link_t)*link_type; - c_ret_value = H5Glink2(c_cur_loc_id, c_cur_name, c_link_type, c_new_loc_id, c_new_name); + /* + * Convert Fortran name to C name + */ + if(NULL == (c_cur_name = (char *)HD5f2cstring(cur_name, (size_t)*cur_namelen))) + goto DONE; + if(NULL == (c_new_name = (char *)HD5f2cstring(new_name, (size_t)*new_namelen))) + goto DONE; - if(c_ret_value < 0) goto DONE; - ret_value = 0; + /* + * Call appropriate link creation function + */ + switch((H5G_link_t)*link_type) { + case H5L_TYPE_HARD: + if(H5Lcreate_hard((hid_t)*cur_loc_id, c_cur_name, (hid_t)*new_loc_id, c_new_name, H5P_DEFAULT, H5P_DEFAULT) < 0) + goto DONE; + break; + + case H5L_TYPE_SOFT: + if(H5Lcreate_soft(c_cur_name, (hid_t)*cur_loc_id, c_new_name, H5P_DEFAULT, H5P_DEFAULT) < 0) + goto DONE; + break; + + default: /* Unknown/unhandled link type */ + goto DONE; + } /* end switch */ + ret_value = 0; DONE: - HDfree(c_cur_name); - HDfree(c_new_name); - return ret_value ; + if(c_cur_name) + HDfree(c_cur_name); + if(c_new_name) + HDfree(c_new_name); + return ret_value ; } /*---------------------------------------------------------------------------- diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 3ee2c2b..7e7c051 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -75,8 +75,10 @@ typedef struct { /* Local Prototypes */ /********************/ +#ifndef H5_NO_DEPRECATED_SYMBOLS static herr_t H5G_link_hard(hid_t cur_loc_id, const char *cur_name, hid_t new_loc_id, const char *new_name); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ static herr_t H5G_move(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name); static herr_t H5G_set_comment(H5G_loc_t *loc, const char *name, @@ -309,7 +311,6 @@ H5Glink(hid_t cur_loc_id, H5L_type_t type, const char *cur_name, const char *new done: FUNC_LEAVE_API(ret_value) } /* end H5Glink() */ -#endif /* H5_NO_DEPRECATED_SYMBOLS */ /*------------------------------------------------------------------------- @@ -415,6 +416,7 @@ H5G_link_hard(hid_t cur_loc_id, const char *cur_name, hid_t new_loc_id, done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_link_hard() */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /*------------------------------------------------------------------------- diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h index 4691e09..11f8f7b 100644 --- a/src/H5Gpublic.h +++ b/src/H5Gpublic.h @@ -137,8 +137,6 @@ H5_DLL herr_t H5Gclose(hid_t group_id); * * Use of these functions and variables is deprecated. */ -H5_DLL herr_t H5Glink2(hid_t cur_loc_id, const char *cur_name, H5L_type_t type, - hid_t new_loc_id, const char *new_name); H5_DLL herr_t H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name); H5_DLL herr_t H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, @@ -170,6 +168,8 @@ H5_DLL hid_t H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint); H5_DLL hid_t H5Gopen1(hid_t loc_id, const char *name); H5_DLL herr_t H5Glink(hid_t cur_loc_id, H5L_type_t type, const char *cur_name, const char *new_name); +H5_DLL herr_t H5Glink2(hid_t cur_loc_id, const char *cur_name, H5L_type_t type, + hid_t new_loc_id, const char *new_name); #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/test/getname.c b/test/getname.c index 29085e0..c8386ad 100644 --- a/test/getname.c +++ b/test/getname.c @@ -1035,7 +1035,7 @@ test_main(hid_t file_id, hid_t fapl) if((dataset_id = H5Dopen(file_id, "/g17/d")) < 0) FAIL_STACK_ERROR /* Create link to dataset named "link" */ - if(H5Glink2(dataset_id,".",H5G_LINK_HARD,file_id,"/g17/link") < 0) FAIL_STACK_ERROR + if(H5Lcreate_hard(dataset_id, ".", file_id, "/g17/link", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if((dataset2_id = H5Dopen(file_id, "/g17/link")) < 0) FAIL_STACK_ERROR /* Make sure that the two IDs use two different names */ diff --git a/test/links.c b/test/links.c index 0b1a85f..0117e30 100644 --- a/test/links.c +++ b/test/links.c @@ -4937,23 +4937,23 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Create chain of soft links to existing object (limited) */ - if(H5Glink2(fid, "final", H5G_LINK_SOFT, fid, "soft1") < 0) TEST_ERROR - if(H5Glink2(fid, "soft1", H5G_LINK_SOFT, fid, "soft2") < 0) TEST_ERROR - if(H5Glink2(fid, "soft2", H5G_LINK_SOFT, fid, "soft3") < 0) TEST_ERROR - if(H5Glink2(fid, "soft3", H5G_LINK_SOFT, fid, "soft4") < 0) TEST_ERROR - if(H5Glink2(fid, "soft4", H5G_LINK_SOFT, fid, "soft5") < 0) TEST_ERROR - if(H5Glink2(fid, "soft5", H5G_LINK_SOFT, fid, "soft6") < 0) TEST_ERROR - if(H5Glink2(fid, "soft6", H5G_LINK_SOFT, fid, "soft7") < 0) TEST_ERROR - if(H5Glink2(fid, "soft7", H5G_LINK_SOFT, fid, "soft8") < 0) TEST_ERROR - if(H5Glink2(fid, "soft8", H5G_LINK_SOFT, fid, "soft9") < 0) TEST_ERROR - if(H5Glink2(fid, "soft9", H5G_LINK_SOFT, fid, "soft10") < 0) TEST_ERROR - if(H5Glink2(fid, "soft10", H5G_LINK_SOFT, fid, "soft11") < 0) TEST_ERROR - if(H5Glink2(fid, "soft11", H5G_LINK_SOFT, fid, "soft12") < 0) TEST_ERROR - if(H5Glink2(fid, "soft12", H5G_LINK_SOFT, fid, "soft13") < 0) TEST_ERROR - if(H5Glink2(fid, "soft13", H5G_LINK_SOFT, fid, "soft14") < 0) TEST_ERROR - if(H5Glink2(fid, "soft14", H5G_LINK_SOFT, fid, "soft15") < 0) TEST_ERROR - if(H5Glink2(fid, "soft15", H5G_LINK_SOFT, fid, "soft16") < 0) TEST_ERROR - if(H5Glink2(fid, "soft16", H5G_LINK_SOFT, fid, "soft17") < 0) TEST_ERROR + if(H5Lcreate_soft("final", fid, "soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft1", fid, "soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft2", fid, "soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft3", fid, "soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft4", fid, "soft5", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft5", fid, "soft6", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft6", fid, "soft7", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft7", fid, "soft8", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft8", fid, "soft9", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft9", fid, "soft10", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft10", fid, "soft11", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft11", fid, "soft12", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft12", fid, "soft13", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft13", fid, "soft14", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft14", fid, "soft15", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft15", fid, "soft16", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft16", fid, "soft17", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close objects */ if(H5Gclose(gid) < 0) TEST_ERROR @@ -5173,8 +5173,8 @@ linkinfo(hid_t fapl, hbool_t new_format) /* Create an object of each type */ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR if(H5Tcommit(fid, "datatype", tid) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Glink2(fid, "group", H5G_LINK_SOFT, H5G_SAME_LOC, "softlink") < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("group", fid, "softlink", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if((sid = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR if((did = H5Dcreate(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) TEST_ERROR diff --git a/test/objcopy.c b/test/objcopy.c index a8a7252..4aa4c45 100755 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -4717,7 +4717,7 @@ test_copy_group_loop(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if((gid_sub2 = H5Gcreate2(gid, NAME_GROUP_SUB_SUB, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Create link to top group */ - if(H5Glink2(gid, ".", H5L_TYPE_HARD, gid_sub2, NAME_GROUP_LOOP) < 0) TEST_ERROR + if(H5Lcreate_hard(gid, ".", gid_sub2, NAME_GROUP_LOOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* close sub sub group */ if( H5Gclose(gid_sub2) < 0) TEST_ERROR @@ -4835,19 +4835,19 @@ test_copy_group_wide_loop(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) for(v = 0; v < NUM_WIDE_LOOP_GROUPS; v++) { sprintf(objname, "%s-%u", NAME_GROUP_SUB_SUB2, v); - if((gid_sub2 = H5Gcreate2(gid_sub, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid_sub2 = H5Gcreate2(gid_sub, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create link to top group */ - if(H5Glink2(gid, ".", H5L_TYPE_HARD, gid_sub2, NAME_GROUP_LOOP) < 0) TEST_ERROR + if(H5Lcreate_hard(gid, ".", gid_sub2, NAME_GROUP_LOOP, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Create link to sub-group */ - if(H5Glink2(gid_sub, ".", H5L_TYPE_HARD, gid_sub2, NAME_GROUP_LOOP2) < 0) TEST_ERROR + if(H5Lcreate_hard(gid_sub, ".", gid_sub2, NAME_GROUP_LOOP2, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Create link to self :-) */ - if(H5Glink2(gid_sub2, ".", H5L_TYPE_HARD, gid_sub2, NAME_GROUP_LOOP3) < 0) TEST_ERROR + if(H5Lcreate_hard(gid_sub2, ".", gid_sub2, NAME_GROUP_LOOP3, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* close sub sub group */ - if( H5Gclose(gid_sub2) < 0) TEST_ERROR + if(H5Gclose(gid_sub2) < 0) FAIL_STACK_ERROR } /* end for */ /* close sub group */ @@ -4979,16 +4979,16 @@ test_copy_group_links(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Dclose(did) < 0) TEST_ERROR /* make a hard link to the dataset */ - if(H5Glink2(fid_src, NAME_LINK_DATASET, H5L_TYPE_HARD, H5G_SAME_LOC, NAME_LINK_HARD) < 0) TEST_ERROR + if(H5Lcreate_hard(fid_src, NAME_LINK_DATASET, H5G_SAME_LOC, NAME_LINK_HARD, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* make a soft link to the dataset */ - if(H5Glink2(fid_src, NAME_LINK_DATASET, H5L_TYPE_SOFT, H5G_SAME_LOC, NAME_LINK_SOFT) < 0) TEST_ERROR + if(H5Lcreate_soft(NAME_LINK_DATASET, fid_src, NAME_LINK_SOFT, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* make a soft link to nowhere */ - if(H5Glink2(fid_src, "nowhere", H5L_TYPE_SOFT, H5G_SAME_LOC, NAME_LINK_SOFT_DANGLE) < 0) TEST_ERROR + if(H5Lcreate_soft("nowhere", fid_src, NAME_LINK_SOFT_DANGLE, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* make a dangling external link */ - if(H5Lcreate_external("filename", "obj_name", fid_src, NAME_LINK_EXTERN, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external("filename", "obj_name", fid_src, NAME_LINK_EXTERN, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* close the group */ if(H5Gclose(gid) < 0) TEST_ERROR @@ -5108,19 +5108,19 @@ test_copy_soft_link(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR /* close dataspace */ - if(H5Sclose(sid) < 0) TEST_ERROR + if(H5Sclose(sid) < 0) FAIL_STACK_ERROR /* close the dataset */ - if(H5Dclose(did) < 0) TEST_ERROR + if(H5Dclose(did) < 0) FAIL_STACK_ERROR /* make a soft link to the dataset */ - if(H5Glink2(fid_src, NAME_LINK_DATASET, H5L_TYPE_SOFT, H5G_SAME_LOC, NAME_LINK_SOFT) < 0) TEST_ERROR + if(H5Lcreate_soft(NAME_LINK_DATASET, fid_src, NAME_LINK_SOFT, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* close the group */ - if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* close the SRC file */ - if(H5Fclose(fid_src) < 0) TEST_ERROR + if(H5Fclose(fid_src) < 0) FAIL_STACK_ERROR /* open the source file with read-only */ @@ -7008,20 +7008,20 @@ test_copy_option(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl, unsigned flag, hboo if(H5Gclose(gid_sub) < 0) TEST_ERROR /* close the group */ - if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR if((flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG) > 0) { /* Create group to copy */ - if((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Glink2(fid_src, NAME_DATASET_SUB_SUB, H5L_TYPE_SOFT, H5G_SAME_LOC, NAME_LINK_SOFT) < 0) TEST_ERROR - if(H5Glink2(fid_src, "nowhere", H5L_TYPE_SOFT, H5G_SAME_LOC, NAME_LINK_SOFT_DANGLE) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft(NAME_DATASET_SUB_SUB, fid_src, NAME_LINK_SOFT, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("nowhere", fid_src, NAME_LINK_SOFT_DANGLE, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Create group to compare with */ - if((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Glink2(fid_src, NAME_DATASET_SUB_SUB, H5L_TYPE_HARD, H5G_SAME_LOC, NAME_LINK_SOFT2) < 0) TEST_ERROR - if(H5Glink2(fid_src, "nowhere", H5L_TYPE_SOFT, H5G_SAME_LOC, NAME_LINK_SOFT_DANGLE2) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Lcreate_hard(fid_src, NAME_DATASET_SUB_SUB, H5G_SAME_LOC, NAME_LINK_SOFT2, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("nowhere", fid_src, NAME_LINK_SOFT_DANGLE2, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR } /* end if */ if((flag & H5O_COPY_EXPAND_REFERENCE_FLAG) > 0) { diff --git a/test/titerate.c b/test/titerate.c index b2dd8d4..8f19c6c 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -859,11 +859,11 @@ static void test_links(hid_t fapl) CHECK(gid1, FAIL, "H5Gcreate2"); /* create soft and hard links to the group "/g1". */ - ret = H5Glink2(gid, "something", H5L_TYPE_SOFT, H5G_SAME_LOC, "softlink"); - CHECK(ret, FAIL, "H5Glink2"); + ret = H5Lcreate_soft("something", gid, "softlink", H5P_DEFAULT, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lcreate_soft"); - ret = H5Glink2(gid, "/g1", H5L_TYPE_HARD, H5G_SAME_LOC, "hardlink"); - CHECK(ret, FAIL, "H5Glink2"); + ret = H5Lcreate_hard(gid, "/g1", H5L_SAME_LOC, "hardlink", H5P_DEFAULT, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lcreate_hard"); ret = H5Gget_num_objs(gid, &nobjs); CHECK(ret, FAIL, "H5Gget_num_objs"); diff --git a/test/tmisc.c b/test/tmisc.c index 8320979..539229b 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -4088,14 +4088,14 @@ test_misc24(void) CHECK(ret, FAIL, "H5Tcommit"); /* Create soft links to the objects created */ - ret = H5Glink2(file_id, MISC24_GROUP_NAME, H5L_TYPE_SOFT, file_id, MISC24_GROUP_LINK); - CHECK(ret, FAIL, "H5Glink2"); + ret = H5Lcreate_soft(MISC24_GROUP_NAME, file_id, MISC24_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lcreate_soft"); - ret = H5Glink2(file_id, MISC24_DATASET_NAME, H5L_TYPE_SOFT, file_id, MISC24_DATASET_LINK); - CHECK(ret, FAIL, "H5Glink2"); + ret = H5Lcreate_soft(MISC24_DATASET_NAME, file_id, MISC24_DATASET_LINK, H5P_DEFAULT, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lcreate_soft"); - ret = H5Glink2(file_id, MISC24_DATATYPE_NAME, H5L_TYPE_SOFT, file_id, MISC24_DATATYPE_LINK); - CHECK(ret, FAIL, "H5Glink2"); + ret = H5Lcreate_soft(MISC24_DATATYPE_NAME, file_id, MISC24_DATATYPE_LINK, H5P_DEFAULT, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lcreate_soft"); /* Close IDs for objects */ ret = H5Dclose(dset_id); diff --git a/test/tunicode.c b/test/tunicode.c index 93f2cda..b959da1 100644 --- a/test/tunicode.c +++ b/test/tunicode.c @@ -486,13 +486,13 @@ void test_objnames(hid_t fid, const char* string) grp3_id = H5Gcreate2(fid, GROUP3_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(grp3_id, FAIL, "H5Gcreate2"); - ret = H5Glink2(fid, GROUP2_NAME, H5G_LINK_HARD, grp3_id, GROUP2_NAME); - CHECK(ret, FAIL, "H5Glink2"); + ret = H5Lcreate_hard(fid, GROUP2_NAME, grp3_id, GROUP2_NAME, H5P_DEFAULT, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lcreate_hard"); HDstrcpy(path_buf, GROUP2_NAME); HDstrcat(path_buf, "/"); HDstrcat(path_buf, string); - ret = H5Glink2(grp3_id, path_buf, H5G_LINK_SOFT, H5G_SAME_LOC, string); - CHECK(ret, FAIL, "H5Glink2"); + ret = H5Lcreate_hard(grp3_id, path_buf, H5G_SAME_LOC, string, H5P_DEFAULT, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lcreate_hard"); /* Open named datatype using soft link */ type_id = H5Topen(grp3_id, string); diff --git a/test/unlink.c b/test/unlink.c index 87ee412..6a81e20 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -180,56 +180,54 @@ test_many(hid_t file) TESTING("forward unlink"); for(i = 0; i < how_many; i++) { sprintf(name, "obj_%05d", i); - if(H5Glink2(work, "/test_many_foo", H5L_TYPE_HARD, H5G_SAME_LOC, name) < 0) TEST_ERROR - } - for (i=0; i<how_many; i++) { + if(H5Lcreate_hard(work, "/test_many_foo", H5G_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + } /* end for */ + for(i = 0; i < how_many; i++) { sprintf(name, "obj_%05d", i); - if (H5Gunlink(work, name) < 0) TEST_ERROR - } + if(H5Gunlink(work, name) < 0) FAIL_STACK_ERROR + } /* end for */ PASSED(); /* Create a bunch of names and unlink them in reverse order */ TESTING("backward unlink"); for(i = 0; i < how_many; i++) { sprintf(name, "obj_%05d", i); - if(H5Glink2(work, "/test_many_foo", H5L_TYPE_HARD, H5G_SAME_LOC, name) < 0) TEST_ERROR - } - for (i=how_many-1; i>=0; --i) { + if(H5Lcreate_hard(work, "/test_many_foo", H5G_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + } /* end for */ + for(i = (how_many - 1); i >= 0; --i) { sprintf(name, "obj_%05d", i); - if (H5Gunlink(work, name) < 0) TEST_ERROR - } + if(H5Gunlink(work, name) < 0) FAIL_STACK_ERROR + } /* end for */ PASSED(); /* Create a bunch of names and unlink them from both directions */ TESTING("inward unlink"); for(i = 0; i < how_many; i++) { sprintf(name, "obj_%05d", i); - if(H5Glink2(work, "/test_many_foo", H5L_TYPE_HARD, H5G_SAME_LOC, name) < 0) TEST_ERROR - } - for (i=0; i<how_many; i++) { - if (i%2) { - sprintf(name, "obj_%05d", how_many-(1+i/2)); - } else { - sprintf(name, "obj_%05d", i/2); - } - if (H5Gunlink(work, name) < 0) TEST_ERROR - } + if(H5Lcreate_hard(work, "/test_many_foo", H5G_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + } /* end for */ + for(i = 0; i < how_many; i++) { + if(i % 2) + sprintf(name, "obj_%05d", how_many - (1 + i / 2)); + else + sprintf(name, "obj_%05d", i / 2); + if(H5Gunlink(work, name) < 0) FAIL_STACK_ERROR + } /* end for */ PASSED(); /* Create a bunch of names and unlink them from the midle */ TESTING("outward unlink"); for(i = 0; i < how_many; i++) { sprintf(name, "obj_%05d", i); - if(H5Glink2(work, "/test_many_foo", H5L_TYPE_HARD, H5G_SAME_LOC, name) < 0) TEST_ERROR - } - for (i=how_many-1; i>=0; --i) { - if (i%2) { - sprintf(name, "obj_%05d", how_many-(1+i/2)); - } else { - sprintf(name, "obj_%05d", i/2); - } - if (H5Gunlink(work, name) < 0) TEST_ERROR - } + if(H5Lcreate_hard(work, "/test_many_foo", H5G_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + } /* end for */ + for(i = (how_many - 1); i >= 0; --i) { + if(i % 2) + sprintf(name, "obj_%05d", how_many - (1 + i / 2)); + else + sprintf(name, "obj_%05d", i / 2); + if(H5Gunlink(work, name) < 0) FAIL_STACK_ERROR + } /* end for */ PASSED(); @@ -370,13 +368,13 @@ test_new_move(hid_t fapl) if((file_b = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create groups in first file */ - if((grp_1 = H5Gcreate2(file_a, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((grp_2 = H5Gcreate2(file_a, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((grp_move = H5Gcreate2(grp_1, "group_move", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((grp_1 = H5Gcreate2(file_a, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((grp_2 = H5Gcreate2(file_a, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((grp_move = H5Gcreate2(grp_1, "group_move", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create hard and soft links. */ - if(H5Glink2(grp_1, "group_move", H5L_TYPE_HARD, H5G_SAME_LOC, "hard") < 0) TEST_ERROR - if(H5Glink2(grp_1, "/group1/group_move", H5L_TYPE_SOFT, grp_2, "soft") < 0) TEST_ERROR + if(H5Lcreate_hard(grp_1, "group_move", H5G_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("/group1/group_move", grp_1, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Move a group within the file. Both of source and destination use * H5G_SAME_LOC. Should fail. */ @@ -1320,7 +1318,7 @@ static int test_link_slashes(hid_t fapl) { hid_t fid; /* File ID */ - hid_t gid,gid2; /* Group ID */ + hid_t gid, gid2; /* Group ID */ char filename[1024]; TESTING("creating links with multiple slashes"); @@ -1329,37 +1327,37 @@ test_link_slashes(hid_t fapl) h5_fixname(FILENAME[5], fapl, filename, sizeof filename); /* Create a file */ - if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create a group in the root group */ - if((gid = H5Gcreate2(fid, SLASHES_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, SLASHES_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create a nested group in the root group */ - if((gid2 = H5Gcreate2(gid, SLASHES_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid2 = H5Gcreate2(gid, SLASHES_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close the nested group */ - if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR /* Create a hard link to the nested group */ - if(H5Glink2(gid, SLASHES_GROUP_NAME, H5L_TYPE_HARD, H5G_SAME_LOC, SLASHES_HARDLINK_NAME) < 0) TEST_ERROR + if(H5Lcreate_hard(gid, SLASHES_GROUP_NAME, H5L_SAME_LOC, SLASHES_HARDLINK_NAME, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Create a soft link with a relative path to the nested group */ - if(H5Glink2(gid, SLASHES_GROUP_NAME, H5L_TYPE_SOFT, H5G_SAME_LOC, SLASHES_SOFTLINK_NAME) < 0) TEST_ERROR + if(H5Lcreate_soft(SLASHES_GROUP_NAME, gid, SLASHES_SOFTLINK_NAME, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Create a soft link with the full path to the nested group */ - if(H5Glink2(gid, "////"SLASHES_GROUP_NAME""SLASHES_GROUP_NAME, H5L_TYPE_SOFT, H5G_SAME_LOC, SLASHES_SOFTLINK2_NAME) < 0) TEST_ERROR + if(H5Lcreate_soft("////"SLASHES_GROUP_NAME""SLASHES_GROUP_NAME, gid, SLASHES_SOFTLINK2_NAME, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Create a soft link to the root group */ - if(H5Glink2(gid, "////", H5L_TYPE_SOFT, H5G_SAME_LOC, SLASHES_ROOTLINK_NAME) < 0) TEST_ERROR + if(H5Lcreate_soft("////", gid, SLASHES_ROOTLINK_NAME, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close the group */ - if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Create a hard link to the existing group */ - if(H5Glink2(fid, SLASHES_GROUP_NAME, H5L_TYPE_HARD, H5G_SAME_LOC, SLASHES_HARDLINK_NAME) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, SLASHES_GROUP_NAME, H5L_SAME_LOC, SLASHES_HARDLINK_NAME, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close the file */ - if(H5Fclose(fid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); return 0; @@ -1825,35 +1823,35 @@ test_resurrect_dataset(hid_t fapl) h5_fixname(FILENAME[6], fapl, filename, sizeof filename); /* Create the file */ - if((f = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((f = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create a dataset in the file */ - if((s = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR - if((d = H5Dcreate(f, DATASETNAME, H5T_NATIVE_INT, s, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Sclose(s) < 0) TEST_ERROR + if((s = H5Screate(H5S_SCALAR)) < 0) FAIL_STACK_ERROR + if((d = H5Dcreate(f, DATASETNAME, H5T_NATIVE_INT, s, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Sclose(s) < 0) FAIL_STACK_ERROR /* Unlink the dataset while it's open (will mark it for deletion when closed) */ - if(H5Gunlink(f, DATASETNAME) < 0) TEST_ERROR + if(H5Gunlink(f, DATASETNAME) < 0) FAIL_STACK_ERROR /* Check that dataset name is NULL */ - if(H5Iget_name(d, NULL, (size_t)0) != 0) TEST_ERROR + if(H5Iget_name(d, NULL, (size_t)0) != 0) FAIL_STACK_ERROR /* Re-link the dataset to the group hierarchy (shouldn't get deleted now) */ - if(H5Glink2(d, ".", H5L_TYPE_HARD, f, DATASET2NAME) < 0) TEST_ERROR + if(H5Lcreate_hard(d, ".", f, DATASET2NAME, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close things */ - if(H5Dclose(d) < 0) TEST_ERROR - if(H5Fclose(f) < 0) TEST_ERROR + if(H5Dclose(d) < 0) FAIL_STACK_ERROR + if(H5Fclose(f) < 0) FAIL_STACK_ERROR /* Re-open the file */ - if((f=H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + if((f=H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR /* Attempt to open the dataset under the new name */ - if((d=H5Dopen(f,DATASET2NAME)) < 0) TEST_ERROR + if((d = H5Dopen(f,DATASET2NAME)) < 0) FAIL_STACK_ERROR /* Close things */ - if(H5Dclose(d) < 0) TEST_ERROR - if(H5Fclose(f) < 0) TEST_ERROR + if(H5Dclose(d) < 0) FAIL_STACK_ERROR + if(H5Fclose(f) < 0) FAIL_STACK_ERROR PASSED(); return 0; @@ -1887,7 +1885,7 @@ error: static int test_resurrect_datatype(hid_t fapl) { - hid_t file=-1, type=-1; + hid_t file = -1, type = -1; char filename[1024]; TESTING("resurrecting datatype after deletion"); @@ -1896,34 +1894,34 @@ test_resurrect_datatype(hid_t fapl) h5_fixname(FILENAME[7], fapl, filename, sizeof filename); /* Create the file */ - if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create a named datatype in the file */ - if((type = H5Tcopy (H5T_NATIVE_INT)) < 0) TEST_ERROR - if(H5Tcommit (file, TYPENAME, type) < 0) TEST_ERROR + if((type = H5Tcopy (H5T_NATIVE_INT)) < 0) FAIL_STACK_ERROR + if(H5Tcommit (file, TYPENAME, type) < 0) FAIL_STACK_ERROR /* Unlink the datatype while it's open (will mark it for deletion when closed) */ - if(H5Gunlink(file, TYPENAME) < 0) TEST_ERROR + if(H5Gunlink(file, TYPENAME) < 0) FAIL_STACK_ERROR /* Check that datatype name is NULL */ - if(H5Iget_name(type, NULL, (size_t)0) != 0) TEST_ERROR + if(H5Iget_name(type, NULL, (size_t)0) != 0) FAIL_STACK_ERROR /* Re-link the datatype to the group hierarchy (shouldn't get deleted now) */ - if(H5Glink2(type, ".", H5L_TYPE_HARD, file, TYPE2NAME) < 0) TEST_ERROR + if(H5Lcreate_hard(type, ".", file, TYPE2NAME, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close things */ - if(H5Tclose(type) < 0) TEST_ERROR - if(H5Fclose(file) < 0) TEST_ERROR + if(H5Tclose(type) < 0) FAIL_STACK_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR /* Re-open the file */ - if((file=H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR /* Attempt to open the datatype under the new name */ - if((type=H5Topen(file,TYPE2NAME)) < 0) TEST_ERROR + if((type = H5Topen(file,TYPE2NAME)) < 0) FAIL_STACK_ERROR /* Close things */ - if(H5Tclose(type) < 0) TEST_ERROR - if(H5Fclose(file) < 0) TEST_ERROR + if(H5Tclose(type) < 0) FAIL_STACK_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR PASSED(); return 0; @@ -1956,7 +1954,7 @@ error: static int test_resurrect_group(hid_t fapl) { - hid_t file=-1, group=-1; + hid_t file = -1, group = -1; char filename[1024]; TESTING("resurrecting group after deletion"); @@ -1965,33 +1963,33 @@ test_resurrect_group(hid_t fapl) h5_fixname(FILENAME[8], fapl, filename, sizeof filename); /* Create the file */ - if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create a group in the file */ - if((group = H5Gcreate2(file, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((group = H5Gcreate2(file, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Unlink the group while it's open (will mark it for deletion when closed) */ - if(H5Gunlink(file, GROUPNAME) < 0) TEST_ERROR + if(H5Gunlink(file, GROUPNAME) < 0) FAIL_STACK_ERROR /* Check that group's name is NULL */ - if(H5Iget_name(group, NULL, (size_t)0) != 0) TEST_ERROR + if(H5Iget_name(group, NULL, (size_t)0) != 0) FAIL_STACK_ERROR /* Re-link the group into the group hierarchy (shouldn't get deleted now) */ - if(H5Glink2(group, ".", H5L_TYPE_HARD, file, GROUP2NAME) < 0) TEST_ERROR + if(H5Lcreate_hard(group, ".", file, GROUP2NAME, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close things */ - if(H5Gclose(group) < 0) TEST_ERROR - if(H5Fclose(file) < 0) TEST_ERROR + if(H5Gclose(group) < 0) FAIL_STACK_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR /* Re-open the file */ - if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR /* Attempt to open the datatype under the new name */ if((group = H5Gopen2(file, GROUP2NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close things */ - if(H5Gclose(group) < 0) TEST_ERROR - if(H5Fclose(file) < 0) TEST_ERROR + if(H5Gclose(group) < 0) FAIL_STACK_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR PASSED(); return 0; @@ -2122,51 +2120,51 @@ test_full_group_compact(hid_t fapl) h5_fixname(FILENAME[10], fapl, filename, sizeof filename); /* Create the file */ - if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create group to link objects to */ - if((gid = H5Gcreate2(file_id, "/keep", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Gcreate2(file_id, "/keep", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create several objects to link to */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { sprintf(objname, "keep %u\n", u); - if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid2) < 0) TEST_ERROR + if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR } /* end for */ /* Close group with objects to keep */ - if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR /* Get the size of the file with only the objects to keep */ if((keep_size = h5_get_file_size(filename)) < 0) TEST_ERROR /* Re-open the file */ - if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR /* Create group to delete */ - if((gid = H5Gcreate2(file_id, "/delete", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Gcreate2(file_id, "/delete", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create external link (doesn't matter if it dangles) */ - if(H5Lcreate_external("foo.h5", "/dst", gid, "external", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external("foo.h5", "/dst", gid, "external", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Create soft link (doesn't matter if it dangles) */ - if(H5Glink2(file_id, "/foo", H5L_TYPE_SOFT, gid, "soft") < 0) TEST_ERROR + if(H5Lcreate_soft("/foo", file_id, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Create hard links to objects in group to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { sprintf(objname, "/keep/keep %u\n", u); sprintf(objname2, "keep %u\n", u); - if(H5Glink2(file_id, objname, H5L_TYPE_HARD, gid, objname2) < 0) TEST_ERROR + if(H5Lcreate_hard(file_id, objname, gid, objname2, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ /* Create several objects to delete */ for(u = 0; u < FULL_GROUP_NUM_DELETE_COMPACT; u++) { sprintf(objname, "delete %u\n", u); - if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid2) < 0) TEST_ERROR + if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR } /* end for */ /* Check on group's status */ @@ -2175,34 +2173,34 @@ test_full_group_compact(hid_t fapl) if(H5G_has_stab_test(gid) == TRUE) TEST_ERROR /* Close group with objects to delete */ - if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { sprintf(objname, "/keep/keep %u\n", u); - if(H5Gget_objinfo(file_id, objname, TRUE, &sb) < 0) TEST_ERROR + if(H5Gget_objinfo(file_id, objname, TRUE, &sb) < 0) FAIL_STACK_ERROR if(sb.nlink != 2) TEST_ERROR } /* end for */ /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR /* Re-open the file */ - if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR /* Delete the full group */ - if(H5Gunlink(file_id, "/delete") < 0) TEST_ERROR + if(H5Gunlink(file_id, "/delete") < 0) FAIL_STACK_ERROR /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { sprintf(objname, "/keep/keep %u\n", u); - if(H5Gget_objinfo(file_id, objname, TRUE, &sb) < 0) TEST_ERROR + if(H5Gget_objinfo(file_id, objname, TRUE, &sb) < 0) FAIL_STACK_ERROR if(sb.nlink != 1) TEST_ERROR } /* end for */ /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR /* Get the size of the file */ if((file_size = h5_get_file_size(filename)) < 0) TEST_ERROR @@ -2256,33 +2254,33 @@ test_full_group_dense(hid_t fapl) h5_fixname(FILENAME[10], fapl, filename, sizeof filename); /* Create the file */ - if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create group to link objects to */ - if((gid = H5Gcreate2(file_id, "/keep", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Gcreate2(file_id, "/keep", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create several objects to link to */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { sprintf(objname, "keep %u\n", u); - if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid2) < 0) TEST_ERROR + if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR } /* end for */ /* Close group with objects to keep */ - if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR /* Get the size of the file with only the objects to keep */ if((keep_size = h5_get_file_size(filename)) < 0) TEST_ERROR /* Re-open the file */ - if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR /* Set group creation "est. link info" closer to what will actually occur */ - if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR - if(H5Pset_est_link_info(gcpl, FULL_GROUP_EST_NUM_ENTRIES, FULL_GROUP_EST_ENTRY_LEN) < 0) TEST_ERROR + if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0) FAIL_STACK_ERROR + if(H5Pset_est_link_info(gcpl, FULL_GROUP_EST_NUM_ENTRIES, FULL_GROUP_EST_ENTRY_LEN) < 0) FAIL_STACK_ERROR /* Create group to delete */ /* (use non-default GCPL, in order to make certain that the group's object @@ -2290,29 +2288,29 @@ test_full_group_dense(hid_t fapl) * another object header message chunk - in order to make the file size * computation below easier/correct - QAK) */ - if((gid = H5Gcreate2(file_id, "/delete", H5P_DEFAULT, gcpl, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Gcreate2(file_id, "/delete", H5P_DEFAULT, gcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close GCPL */ - if(H5Pclose(gcpl) < 0) TEST_ERROR + if(H5Pclose(gcpl) < 0) FAIL_STACK_ERROR /* Create external link (doesn't matter if it dangles) */ - if(H5Lcreate_external("foo.h5", "/dst", gid, "external", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external("foo.h5", "/dst", gid, "external", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Create soft link (doesn't matter if it dangles) */ - if(H5Glink2(file_id, "/foo", H5L_TYPE_SOFT, gid, "soft") < 0) TEST_ERROR + if(H5Lcreate_soft("/foo", file_id, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Create hard links to objects in group to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { sprintf(objname, "/keep/keep %u\n", u); sprintf(objname2, "keep %u\n", u); - if(H5Glink2(file_id, objname, H5L_TYPE_HARD, gid, objname2) < 0) TEST_ERROR + if(H5Lcreate_hard(file_id, objname, gid, objname2, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ /* Create several objects to delete */ for(u = 0; u < FULL_GROUP_NUM_DELETE_DENSE; u++) { sprintf(objname, "delete %u\n", u); - if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid2) < 0) TEST_ERROR + if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR } /* end for */ /* Check on group's status */ @@ -2321,34 +2319,34 @@ test_full_group_dense(hid_t fapl) if(H5G_is_new_dense_test(gid) != TRUE) TEST_ERROR /* Close group with objects to delete */ - if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { sprintf(objname, "/keep/keep %u\n", u); - if(H5Gget_objinfo(file_id, objname, TRUE, &sb) < 0) TEST_ERROR + if(H5Gget_objinfo(file_id, objname, TRUE, &sb) < 0) FAIL_STACK_ERROR if(sb.nlink != 2) TEST_ERROR } /* end for */ /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR /* Re-open the file */ - if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR /* Delete the full group */ - if(H5Gunlink(file_id, "/delete") < 0) TEST_ERROR + if(H5Gunlink(file_id, "/delete") < 0) FAIL_STACK_ERROR /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { sprintf(objname, "/keep/keep %u\n", u); - if(H5Gget_objinfo(file_id, objname, TRUE, &sb) < 0) TEST_ERROR + if(H5Gget_objinfo(file_id, objname, TRUE, &sb) < 0) FAIL_STACK_ERROR if(sb.nlink != 1) TEST_ERROR } /* end for */ /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR /* Get the size of the file */ if((file_size = h5_get_file_size(filename)) < 0) TEST_ERROR diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c index 1d0264a..c21b858 100644 --- a/tools/h5repack/h5repacktst.c +++ b/tools/h5repack/h5repacktst.c @@ -1706,9 +1706,9 @@ int make_hlinks(hid_t loc_id) if((group3_id = H5Gcreate2(group2_id, "g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) return -1; - if(H5Glink2(loc_id, "g1", H5L_TYPE_HARD, group2_id, "link1 to g1")<0) + if(H5Lcreate_hard(loc_id, "g1", group2_id, "link1 to g1", H5P_DEFAULT, H5P_DEFAULT) < 0) return -1; - if(H5Glink2(group1_id, "g2", H5L_TYPE_HARD, group3_id, "link1 to g2")<0) + if(H5Lcreate_hard(group1_id, "g2", group3_id, "link1 to g2", H5P_DEFAULT, H5P_DEFAULT) < 0) return -1; H5Gclose(group1_id); |