From 095762a736c3125c0190409b7c3ca01c42605ad7 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 13 Sep 2007 12:04:36 -0500 Subject: [svn-r14145] Description: Move H5Gget_objname_by_idx() to deprecated symbols section. Replace internal usage with H5Lget_name_by_idx(). Tested on: FreeBSD/32 6.2 (duty) FreeBSD/64 6.2 (liberty) Linux/32 2.6 (kagiso) Linux/64 2.6 (smirom) AIX/32 5.3 (copper) Solaris/32 2.10 (linew) Mac OS X/32 10.4.10 (amazon) --- c++/src/H5CommonFG.cpp | 12 +++--- fortran/src/H5Gf.c | 2 +- src/H5Gdeprec.c | 110 +++++++++++++++++++++++++------------------------ src/H5Gobj.c | 3 +- src/H5Gpublic.h | 4 +- test/links.c | 17 +++++--- test/objcopy.c | 4 +- test/titerate.c | 106 +++++++++++++++++++++++------------------------ test/trefer.c | 6 +-- 9 files changed, 134 insertions(+), 130 deletions(-) diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index b76d8b0..af684d0 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -1010,16 +1010,16 @@ hsize_t CommonFG::getNumObjs() const //-------------------------------------------------------------------------- H5std_string CommonFG::getObjnameByIdx(hsize_t idx) const { - // call H5Gget_objname_by_idx with name as NULL to get its length - ssize_t name_len = H5Gget_objname_by_idx(getLocId(), idx, NULL, 0); + // call H5Lget_name_by_idx with name as NULL to get its length + ssize_t name_len = H5Lget_name_by_idx(getLocId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, NULL, 0, H5P_DEFAULT); if(name_len < 0) { - throwException("getObjnameByIdx", "H5Gget_objname_by_idx failed"); + throwException("getObjnameByIdx", "H5Lget_name_by_idx failed"); } // now, allocate C buffer to get the name char* name_C = new char[name_len+1]; - name_len = H5Gget_objname_by_idx(getLocId(), idx, name_C, name_len+1); + name_len = H5Lget_name_by_idx(getLocId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, name_C, name_len+1, H5P_DEFAULT); // clean up and return the string H5std_string name = H5std_string(name_C); @@ -1047,10 +1047,10 @@ H5std_string CommonFG::getObjnameByIdx(hsize_t idx) const ssize_t CommonFG::getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size) const { char* name_C = new char[size]; - ssize_t name_len = H5Gget_objname_by_idx(getLocId(), idx, name_C, size); + ssize_t name_len = H5Lget_name_by_idx(getLocId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, name_C, size, H5P_DEFAULT); if(name_len < 0) { - throwException("getObjnameByIdx", "H5Gget_objname_by_idx failed"); + throwException("getObjnameByIdx", "H5Lget_name_by_idx failed"); } name = H5std_string(name_C); delete []name_C; diff --git a/fortran/src/H5Gf.c b/fortran/src/H5Gf.c index 5fbaec27..120bb99 100644 --- a/fortran/src/H5Gf.c +++ b/fortran/src/H5Gf.c @@ -170,7 +170,7 @@ nh5gget_obj_info_idx_c(hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *idx, goto DONE; /* Query the object's information */ - if(H5Gget_objname_by_idx(gid, c_idx, c_obj_name, c_obj_namelen) < 0) + if(H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, c_idx, c_obj_name, c_obj_namelen, H5P_DEFAULT) < 0) goto DONE; if((type = H5Gget_objtype_by_idx(gid, c_idx)) == H5G_UNKNOWN) goto DONE; diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 54e2cd3..03b8322 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -138,6 +138,8 @@ H5G_init_deprec_interface(void) * group. If a non-positive value is supplied for the SIZE_HINT * then a default size is chosen. * + * Note: Deprecated in favor of H5Gcreate2 + * * Return: Success: The object ID of a new, empty group open for * writing. Call H5Gclose() when finished with * the group. @@ -221,6 +223,8 @@ done: * Purpose: Opens an existing group for modification. When finished, * call H5Gclose() to close it and release resources. * + * Note: Deprecated in favor of H5Gopen2 + * * Return: Success: Object ID of the group. * * Failure: FAIL @@ -581,59 +585,7 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/) done: FUNC_LEAVE_API(ret_value) } /* end H5Gget_linkval() */ -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - - -/*------------------------------------------------------------------------- - * Function: H5Gget_objname_by_idx - * - * Purpose: Returns the name of objects in the group by giving index. - * If `name' is non-NULL then write up to `size' bytes into that - * buffer and always return the length of the entry name. - * Otherwise `size' is ignored and the function does not store the name, - * just returning the number of characters required to store the name. - * If an error occurs then the buffer pointed to by `name' (NULL or non-NULL) - * is unchanged and the function returns a negative value. - * If a zero is returned for the name's length, then there is no name - * associated with the ID. - * - * Note: Deprecated in favor of H5Lget_name_by_idx - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Raymond Lu - * Nov 20, 2002 - * - *------------------------------------------------------------------------- - */ -ssize_t -H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size) -{ - H5G_loc_t loc; /* Object location */ - H5O_type_t obj_type; /* Type of object at location */ - ssize_t ret_value; - - FUNC_ENTER_API(H5Gget_objname_by_idx, FAIL) - H5TRACE4("Zs", "ih*sz", loc_id, idx, name, size); - - /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") - if(H5O_obj_type(loc.oloc, &obj_type, H5AC_ind_dxpl_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get object type") - if(obj_type != H5O_TYPE_GROUP) - HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a group") - - /* Call internal function */ - if((ret_value = H5G_obj_get_name_by_idx(loc.oloc, H5_INDEX_NAME, H5_ITER_INC, idx, name, size, H5AC_ind_dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "can't get object name") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Gget_objname_by_idx() */ -#ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- * Function: H5Gset_comment @@ -643,7 +595,7 @@ done: * one comment at a time. Passing NULL for the COMMENT argument * will remove the comment property from the object. * - * Note: Deprecated in favor of using attributes on object + * Note: Deprecated in favor of H5Oset_comment * * Return: Non-negative on success/Negative on failure * @@ -684,7 +636,7 @@ done: * have a comment value then no bytes are copied to the BUF * buffer. * - * Note: Deprecated in favor of using attributes on group + * Note: Deprecated in favor of H5Oget_comment * * Return: Success: Number of characters in the comment counting * the null terminator. The value returned may @@ -1028,6 +980,56 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_get_objinfo() */ + +/*------------------------------------------------------------------------- + * Function: H5Gget_objname_by_idx + * + * Purpose: Returns the name of objects in the group by giving index. + * If `name' is non-NULL then write up to `size' bytes into that + * buffer and always return the length of the entry name. + * Otherwise `size' is ignored and the function does not store the name, + * just returning the number of characters required to store the name. + * If an error occurs then the buffer pointed to by `name' (NULL or non-NULL) + * is unchanged and the function returns a negative value. + * If a zero is returned for the name's length, then there is no name + * associated with the ID. + * + * Note: Deprecated in favor of H5Lget_name_by_idx + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Raymond Lu + * Nov 20, 2002 + * + *------------------------------------------------------------------------- + */ +ssize_t +H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size) +{ + H5G_loc_t loc; /* Object location */ + H5O_type_t obj_type; /* Type of object at location */ + ssize_t ret_value; + + FUNC_ENTER_API(H5Gget_objname_by_idx, FAIL) + H5TRACE4("Zs", "ih*sz", loc_id, idx, name, size); + + /* Check args */ + if(H5G_loc(loc_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") + if(H5O_obj_type(loc.oloc, &obj_type, H5AC_ind_dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get object type") + if(obj_type != H5O_TYPE_GROUP) + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a group") + + /* Call internal function */ + if((ret_value = H5G_obj_get_name_by_idx(loc.oloc, H5_INDEX_NAME, H5_ITER_INC, idx, name, size, H5AC_ind_dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "can't get object name") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Gget_objname_by_idx() */ + #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Gobj.c b/src/H5Gobj.c index 2f573f5..a4855b2 100644 --- a/src/H5Gobj.c +++ b/src/H5Gobj.c @@ -767,8 +767,7 @@ done: /*------------------------------------------------------------------------- * Function: H5G_obj_get_name_by_idx * - * Purpose: Private function for H5Gget_objname_by_idx. - * Returns the name of objects in the group by giving index. + * Purpose: Returns the name of link in a group by giving index. * * Return: Success: Non-negative, length of name * Failure: Negative diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h index 510c920..1e479b4 100644 --- a/src/H5Gpublic.h +++ b/src/H5Gpublic.h @@ -107,8 +107,6 @@ typedef enum H5G_obj_t { H5G_RESERVED_7 /* Reserved for future use */ } H5G_obj_t; -H5_DLL ssize_t H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char* name, - size_t size); H5_DLL H5G_obj_t H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx); /* Symbols defined for compatibility with previous versions of the HDF5 API. * @@ -171,6 +169,8 @@ H5_DLL herr_t H5Giterate(hid_t loc_id, const char *name, int *idx, H5_DLL herr_t H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs); H5_DLL herr_t H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, H5G_stat_t *statbuf/*out*/); +H5_DLL ssize_t H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char* name, + size_t size); #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/test/links.c b/test/links.c index 3ef66a0..d341fee 100644 --- a/test/links.c +++ b/test/links.c @@ -1480,7 +1480,7 @@ test_compat(hid_t fapl, hbool_t new_format) H5G_stat_t sb_hard1, sb_hard2, sb_soft1; hsize_t num_objs; /* Number of objects in a group */ char filename[1024]; - char linkval[1024]; + char tmpstr[1024]; if(new_format) TESTING("backwards compatibility (w/new group format)") @@ -1498,14 +1498,21 @@ test_compat(hid_t fapl, hbool_t new_format) /* Test H5Gset and get comment */ if(H5Gset_comment(file_id, "group1", "comment") < 0) FAIL_STACK_ERROR - if(H5Gget_comment(file_id, "group1", sizeof(linkval), linkval) < 0) FAIL_STACK_ERROR - if(HDstrcmp(linkval, "comment")) TEST_ERROR + if(H5Gget_comment(file_id, "group1", sizeof(tmpstr), tmpstr) < 0) FAIL_STACK_ERROR + if(HDstrcmp(tmpstr, "comment")) TEST_ERROR /* Create links using H5Glink and H5Glink2 */ if(H5Glink(file_id, H5G_LINK_HARD, "group2", "group1/link_to_group2") < 0) FAIL_STACK_ERROR if(H5Glink2(file_id, "group1", H5G_LINK_HARD, group2_id, "link_to_group1") < 0) FAIL_STACK_ERROR if(H5Glink2(file_id, "link_to_group1", H5G_LINK_SOFT, H5G_SAME_LOC, "group2/soft_link_to_group1") < 0) FAIL_STACK_ERROR + /* Test getting the names for objects */ + if(H5Gget_objname_by_idx(group1_id, (hsize_t)0, tmpstr, sizeof(tmpstr)) < 0) FAIL_STACK_ERROR + if(HDstrcmp(tmpstr, "link_to_group2")) TEST_ERROR + H5E_BEGIN_TRY { + if(H5Gget_objname_by_idx(group1_id, (hsize_t)1, tmpstr, sizeof(tmpstr)) >= 0) TEST_ERROR + } H5E_END_TRY; + /* Test getting the number of objects in a group */ if(H5Gget_num_objs(file_id, &num_objs) < 0) FAIL_STACK_ERROR if(num_objs != 2) TEST_ERROR @@ -1539,8 +1546,8 @@ test_compat(hid_t fapl, hbool_t new_format) if(sb_soft1.type != H5G_LINK) TEST_ERROR if(sb_soft1.linklen != HDstrlen("link_to_group1") + 1) TEST_ERROR - if(H5Gget_linkval(group2_id, "soft_link_to_group1", sb_soft1.linklen, linkval) < 0) FAIL_STACK_ERROR - if(HDstrcmp("link_to_group1", linkval)) TEST_ERROR + if(H5Gget_linkval(group2_id, "soft_link_to_group1", sb_soft1.linklen, tmpstr) < 0) FAIL_STACK_ERROR + if(HDstrcmp("link_to_group1", tmpstr)) TEST_ERROR /* Test H5Gmove and H5Gmove2 */ diff --git a/test/objcopy.c b/test/objcopy.c index 88ee026..5d2afd2 100755 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -1269,8 +1269,8 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) /* Loop over contents of groups */ for(idx = 0; idx < ginfo.nlinks; idx++) { /* Check name of objects */ - if(H5Gget_objname_by_idx(gid, idx, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(H5Gget_objname_by_idx(gid2, idx, objname2, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, idx, objname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_name_by_idx(gid2, ".", H5_INDEX_NAME, H5_ITER_INC, idx, objname2, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR if(HDstrcmp(objname, objname2)) TEST_ERROR /* Check type of objects */ diff --git a/test/titerate.c b/test/titerate.c index bbb57b3..e52c93b 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -203,61 +203,57 @@ test_iter_group(hid_t fapl, hbool_t new_format) file = H5Fopen(DATAFILE, H5F_ACC_RDONLY, fapl); CHECK(file, FAIL, "H5Fopen"); - /* These two functions, H5Gget_objtype_by_idx and H5Gget_objname_by_idx, actually + /* These two functions, H5Gget_objtype_by_idx and H5Lget_name_by_idx, actually * iterate through B-tree for group members in internal library design. */ - { - root_group = H5Gopen2(file, "/", H5P_DEFAULT); - CHECK(root_group, FAIL, "H5Gopen2"); + root_group = H5Gopen2(file, "/", H5P_DEFAULT); + CHECK(root_group, FAIL, "H5Gopen2"); - ret = H5Gget_info(root_group, ".", &ginfo, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Gget_info"); - VERIFY(ginfo.nlinks, (NDATASETS + 2), "H5Gget_info"); + ret = H5Gget_info(root_group, ".", &ginfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Gget_info"); + VERIFY(ginfo.nlinks, (NDATASETS + 2), "H5Gget_info"); - for(i = 0; i< (int)ginfo.nlinks; i++) { - H5G_obj_t obj_type; /* Type of object in file */ + for(i = 0; i< (int)ginfo.nlinks; i++) { + H5G_obj_t obj_type; /* Type of object in file */ - ret = (herr_t)H5Gget_objname_by_idx(root_group, (hsize_t)i, dataset_name, (size_t)NAMELEN); - CHECK(ret, FAIL, "H5Gget_objname_by_idx"); + ret = (herr_t)H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, dataset_name, (size_t)NAMELEN, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_name_by_idx"); - obj_type = H5Gget_objtype_by_idx(root_group, (hsize_t)i); - CHECK(obj_type, H5G_UNKNOWN, "H5Gget_objtype_by_idx"); - } /* end for */ + obj_type = H5Gget_objtype_by_idx(root_group, (hsize_t)i); + CHECK(obj_type, H5G_UNKNOWN, "H5Gget_objtype_by_idx"); + } /* end for */ - H5E_BEGIN_TRY { - ret = (herr_t)H5Gget_objname_by_idx(root_group, (hsize_t)(NDATASETS+3), dataset_name, (size_t)NAMELEN); - } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Gget_objname_by_idx"); + H5E_BEGIN_TRY { + ret = (herr_t)H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)(NDATASETS+3), dataset_name, (size_t)NAMELEN, H5P_DEFAULT); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Lget_name_by_idx"); - ret = H5Gclose(root_group); - CHECK(ret, FAIL, "H5Gclose"); - } + ret = H5Gclose(root_group); + CHECK(ret, FAIL, "H5Gclose"); - /* These two functions, H5Gget_objtype_by_idx and H5Gget_objname_by_idx, actually + /* These two functions, H5Gget_objtype_by_idx and H5Lget_name_by_idx, actually * iterate through B-tree for group members in internal library design. * (Same as test above, but with the file ID instead of opening the root group) */ - { - ret = H5Gget_info(file, ".", &ginfo, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Gget_info"); - VERIFY(ginfo.nlinks, NDATASETS + 2, "H5Gget_info"); - - for(i = 0; i< (int)ginfo.nlinks; i++) { - H5G_obj_t obj_type; /* Type of object in file */ + ret = H5Gget_info(file, ".", &ginfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Gget_info"); + VERIFY(ginfo.nlinks, NDATASETS + 2, "H5Gget_info"); - ret = (herr_t)H5Gget_objname_by_idx(file, (hsize_t)i, dataset_name, (size_t)NAMELEN); - CHECK(ret, FAIL, "H5Gget_objname_by_idx"); + for(i = 0; i< (int)ginfo.nlinks; i++) { + H5G_obj_t obj_type; /* Type of object in file */ - obj_type = H5Gget_objtype_by_idx(file, (hsize_t)i); - CHECK(obj_type, H5G_UNKNOWN, "H5Gget_objtype_by_idx"); - } + ret = (herr_t)H5Lget_name_by_idx(file, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, dataset_name, (size_t)NAMELEN, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_name_by_idx"); - H5E_BEGIN_TRY { - ret = (herr_t)H5Gget_objname_by_idx(file, (hsize_t)(NDATASETS + 3), dataset_name, (size_t)NAMELEN); - } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Gget_objname_by_idx"); + obj_type = H5Gget_objtype_by_idx(file, (hsize_t)i); + CHECK(obj_type, H5G_UNKNOWN, "H5Gget_objtype_by_idx"); } + H5E_BEGIN_TRY { + ret = (herr_t)H5Lget_name_by_idx(file, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)(NDATASETS + 3), dataset_name, (size_t)NAMELEN, H5P_DEFAULT); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Lget_name_by_idx"); + /* Test invalid indices for starting iteration */ info.command = RET_ZERO; idx = (hsize_t)-1; @@ -772,7 +768,7 @@ static void test_grp_memb_funcs(hid_t fapl) file = H5Fopen(DATAFILE, H5F_ACC_RDONLY, fapl); CHECK(file, FAIL, "H5Fopen"); - /* These two functions, H5Gget_objtype_by_idx and H5Gget_objname_by_idx, actually + /* These two functions, H5Gget_objtype_by_idx and H5Lget_name_by_idx, actually * iterate through B-tree for group members in internal library design. */ root_group = H5Gopen2(file, "/", H5P_DEFAULT); @@ -786,14 +782,14 @@ static void test_grp_memb_funcs(hid_t fapl) H5G_obj_t obj_type; /* Type of object in file */ /* Test with NULL for name, to query length */ - name_len = H5Gget_objname_by_idx(root_group, (hsize_t)i, NULL, (size_t)NAMELEN); - CHECK(name_len, FAIL, "H5Gget_objname_by_idx"); + name_len = H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, NULL, (size_t)NAMELEN, H5P_DEFAULT); + CHECK(name_len, FAIL, "H5Lget_name_by_idx"); - ret = (herr_t)H5Gget_objname_by_idx(root_group, (hsize_t)i, dataset_name, (size_t)(name_len + 1)); - CHECK(ret, FAIL, "H5Gget_objname_by_idx"); + ret = (herr_t)H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, dataset_name, (size_t)(name_len + 1), H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_name_by_idx"); /* Double-check that the length is the same */ - VERIFY(ret, name_len, "H5Gget_objname_by_idx"); + VERIFY(ret, name_len, "H5Lget_name_by_idx"); /* Keep a copy of the dataset names around for later */ obj_names[i] = HDstrdup(dataset_name); @@ -803,17 +799,17 @@ static void test_grp_memb_funcs(hid_t fapl) CHECK(obj_type, H5G_UNKNOWN, "H5Gget_objtype_by_idx"); if(!HDstrcmp(dataset_name, "grp")) - VERIFY(obj_type, H5G_GROUP, "H5Gget_objname_by_idx"); + VERIFY(obj_type, H5G_GROUP, "H5Lget_name_by_idx"); if(!HDstrcmp(dataset_name, "dtype")) - VERIFY(obj_type, H5G_TYPE, "H5Gget_objname_by_idx"); + VERIFY(obj_type, H5G_TYPE, "H5Lget_name_by_idx"); if(!HDstrncmp(dataset_name, "Dataset", (size_t)7)) - VERIFY(obj_type, H5G_DATASET, "H5Gget_objname_by_idx"); + VERIFY(obj_type, H5G_DATASET, "H5Lget_name_by_idx"); } /* end for */ H5E_BEGIN_TRY { - ret = (herr_t)H5Gget_objname_by_idx(root_group, (hsize_t)(NDATASETS+3), dataset_name, (size_t)NAMELEN); + ret = (herr_t)H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)(NDATASETS+3), dataset_name, (size_t)NAMELEN, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Gget_objname_by_idx"); + VERIFY(ret, FAIL, "H5Lget_name_by_idx"); /* Sort the dataset names */ HDqsort(obj_names, (size_t)(NDATASETS + 2), sizeof(char *), iter_strcmp); @@ -879,21 +875,21 @@ static void test_links(hid_t fapl) CHECK(ret, FAIL, "H5Gget_info"); VERIFY(ginfo.nlinks, 3, "H5Gget_info"); - /* Test these two functions, H5Gget_objtype_by_idx and H5Gget_objname_by_idx */ + /* Test these two functions, H5Gget_objtype_by_idx and H5Lget_name_by_idx */ for(i = 0; i < ginfo.nlinks; i++) { /* Get object name */ - name_len = H5Gget_objname_by_idx(gid, i, obj_name, (size_t)NAMELEN); - CHECK(name_len, FAIL, "H5Gget_objname_by_idx"); + name_len = H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, i, obj_name, (size_t)NAMELEN, H5P_DEFAULT); + CHECK(name_len, FAIL, "H5Lget_name_by_idx"); obj_type = H5Gget_objtype_by_idx(gid, i); CHECK(obj_type, H5G_UNKNOWN, "H5Gget_objtype_by_idx"); if(!HDstrcmp(obj_name, "g1.1")) - VERIFY(obj_type, H5G_GROUP, "H5Gget_objname_by_idx"); + VERIFY(obj_type, H5G_GROUP, "H5Lget_name_by_idx"); else if(!HDstrcmp(obj_name, "hardlink")) - VERIFY(obj_type, H5G_GROUP, "H5Gget_objname_by_idx"); + VERIFY(obj_type, H5G_GROUP, "H5Lget_name_by_idx"); else if(!HDstrcmp(obj_name, "softlink")) - VERIFY(obj_type, H5G_LINK, "H5Gget_objname_by_idx"); + VERIFY(obj_type, H5G_LINK, "H5Lget_name_by_idx"); else CHECK(0, 0, "unknown object name"); } diff --git a/test/trefer.c b/test/trefer.c index ad4b219..802ab79 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -1069,9 +1069,9 @@ test_reference_group(void) CHECK(ret, FAIL, "H5Gget_info"); VERIFY(ginfo.nlinks, 3, "H5Gget_info"); - ret = H5Gget_objname_by_idx(gid, (hsize_t)0, objname, (size_t)NAME_SIZE); - CHECK(ret, FAIL, "H5Gget_objname_by_idx"); - VERIFY_STR(objname, DSETNAME2, "H5Gget_objname_by_idx"); + ret = H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, objname, (size_t)NAME_SIZE, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_name_by_idx"); + VERIFY_STR(objname, DSETNAME2, "H5Lget_name_by_idx"); objtype = H5Gget_objtype_by_idx(gid, (hsize_t)0); VERIFY(objtype, H5G_DATASET, "H5Gget_objtype_by_idx"); -- cgit v0.12