summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-09-13 17:04:36 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-09-13 17:04:36 (GMT)
commit095762a736c3125c0190409b7c3ca01c42605ad7 (patch)
tree9dea87bb7845bafb44a9df81ef09ce560807d269 /test
parent579284f422b6ed25b7a5f4a518c19740fff297c8 (diff)
downloadhdf5-095762a736c3125c0190409b7c3ca01c42605ad7.zip
hdf5-095762a736c3125c0190409b7c3ca01c42605ad7.tar.gz
hdf5-095762a736c3125c0190409b7c3ca01c42605ad7.tar.bz2
[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)
Diffstat (limited to 'test')
-rw-r--r--test/links.c17
-rwxr-xr-xtest/objcopy.c4
-rw-r--r--test/titerate.c106
-rw-r--r--test/trefer.c6
4 files changed, 68 insertions, 65 deletions
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");