diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2007-09-06 15:54:22 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2007-09-06 15:54:22 (GMT) |
commit | 3bed8703631cbcffb215ccd82235fcc293e14218 (patch) | |
tree | bf56b0bcd4f41986f17138059f6349df78f0c059 /test | |
parent | 3eb8c81b8046d282ced9c2d94e7132058243013e (diff) | |
download | hdf5-3bed8703631cbcffb215ccd82235fcc293e14218.zip hdf5-3bed8703631cbcffb215ccd82235fcc293e14218.tar.gz hdf5-3bed8703631cbcffb215ccd82235fcc293e14218.tar.bz2 |
[svn-r14136] Description:
Move H5Gget_num_objs() and several minor macros, etc. to deprecated
symbols section, replacing it with H5Gget_info().
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 5.10 (linew)
Mac OS X/32 10.4.10 (amazon)
Diffstat (limited to 'test')
-rw-r--r-- | test/dt_arith.c | 4 | ||||
-rw-r--r-- | test/links.c | 9 | ||||
-rwxr-xr-x | test/objcopy.c | 16 | ||||
-rw-r--r-- | test/th5o.c | 16 | ||||
-rw-r--r-- | test/titerate.c | 52 | ||||
-rw-r--r-- | test/trefer.c | 10 |
6 files changed, 56 insertions, 51 deletions
diff --git a/test/dt_arith.c b/test/dt_arith.c index 1932e3d..52fd5bf 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -4947,7 +4947,7 @@ run_int_fp_conv(const char *name) nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_LONG, H5T_NATIVE_LDOUBLE); nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_ULONG, H5T_NATIVE_LDOUBLE); #endif -#ifdef H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG +#if H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG #if H5_LLONG_TO_LDOUBLE_CORRECT nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_LLONG, H5T_NATIVE_LDOUBLE); #else /* H5_LLONG_TO_LDOUBLE_CORRECT */ @@ -5071,7 +5071,7 @@ run_fp_int_conv(const char *name) nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_ULONG); #endif -#ifdef H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG +#if H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG if(!strcmp(name, "hw")) { /* Hardware conversion */ /* Windows .NET 2003 doesn't work for hardware conversion of this case. * .NET should define this macro H5_HW_FP_TO_LLONG_NOT_WORKS. */ diff --git a/test/links.c b/test/links.c index 96aa255..fb6fdb6 100644 --- a/test/links.c +++ b/test/links.c @@ -1476,6 +1476,7 @@ test_compat(hid_t fapl, hbool_t new_format) hid_t group1_id = -1; hid_t group2_id = -1; 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]; @@ -1503,6 +1504,12 @@ test_compat(hid_t fapl, hbool_t new_format) 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 number of objects in a group */ + if(H5Gget_num_objs(file_id, &num_objs) < 0) FAIL_STACK_ERROR + if(num_objs != 2) TEST_ERROR + if(H5Gget_num_objs(group1_id, &num_objs) < 0) FAIL_STACK_ERROR + if(num_objs != 1) TEST_ERROR + /* Test that H5Glink created hard links properly */ if(H5Gget_objinfo(file_id, "/group2", TRUE, &sb_hard1) < 0) FAIL_STACK_ERROR if(H5Gget_objinfo(file_id, "/group1/link_to_group2", TRUE, &sb_hard2) < 0) FAIL_STACK_ERROR @@ -1556,7 +1563,7 @@ test_compat(hid_t fapl, hbool_t new_format) if(H5Gopen2(file_id, "moved_group1/moved_group2", H5P_DEFAULT) >=0) TEST_ERROR } H5E_END_TRY; - if(H5Fclose(file_id) < 0) TEST_ERROR + if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR PASSED(); return 0; diff --git a/test/objcopy.c b/test/objcopy.c index 3c6e03f..331add3 100755 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -1242,8 +1242,8 @@ error: static int compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) { - hsize_t num_objs; /* Number of objects in group */ - hsize_t num_objs2; /* Number of objects in group */ + H5G_info_t ginfo; /* Group info struct */ + H5G_info_t ginfo2; /* Group info struct */ hsize_t idx; /* Index over the objects in group */ unsigned cpy_flags; /* Object copy flags */ @@ -1255,17 +1255,17 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) cpy_flags = 0; /* Check if both groups have the same # of objects */ - if(H5Gget_num_objs(gid, &num_objs) < 0) TEST_ERROR - if(H5Gget_num_objs(gid2, &num_objs2) < 0) TEST_ERROR + if(H5Gget_info(gid, ".", &ginfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Gget_info(gid2, ".", &ginfo2, H5P_DEFAULT) < 0) TEST_ERROR if((cpy_flags & H5O_COPY_SHALLOW_HIERARCHY_FLAG) && depth == 0) { - if(num_objs2 != 0) TEST_ERROR + if(ginfo2.nlinks != 0) TEST_ERROR } /* end if */ else { - if(num_objs != num_objs2) TEST_ERROR + if(ginfo.nlinks != ginfo2.nlinks) TEST_ERROR } /* end if */ /* Check contents of groups */ - if(num_objs2 > 0) { + if(ginfo2.nlinks > 0) { char objname[NAME_BUF_SIZE]; /* Name of object in group */ char objname2[NAME_BUF_SIZE]; /* Name of object in group */ H5G_obj_t objtype; /* Type of object in group */ @@ -1277,7 +1277,7 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) hid_t oid, oid2; /* IDs of objects within group */ /* Loop over contents of groups */ - for(idx = 0; idx < num_objs; idx++) { + 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 diff --git a/test/th5o.c b/test/th5o.c index 86c8c84..ff434d6 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -47,7 +47,7 @@ test_h5o_open(void) hid_t grp, dset, dtype, dspace; /* Object identifiers */ hsize_t dims[RANK]; H5I_type_t id_type; /* Type of IDs returned from H5Oopen */ - hsize_t num_objs = 0; /* Number of objects in the group */ + H5G_info_t ginfo; /* Group info struct */ H5T_class_t type_class; /* Class of the datatype */ herr_t ret; /* Value returned from API calls */ @@ -102,9 +102,9 @@ test_h5o_open(void) VERIFY(id_type, H5I_DATASET, "H5Iget_type for dataset ID"); /* Do something more complex with each of the IDs to make sure they "work" */ - ret = H5Gget_num_objs(grp, &num_objs); - CHECK(ret, FAIL, "H5Gget_num_objs"); - VERIFY(num_objs, 1, "H5Gget_num_objs"); /* There should be one object, the datatype */ + ret = H5Gget_info(grp, ".", &ginfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Gget_info"); + VERIFY(ginfo.nlinks, 1, "H5Gget_info"); /* There should be one object, the datatype */ type_class = H5Tget_class(dtype); VERIFY(type_class, H5T_INTEGER, "H5Tget_class"); @@ -249,7 +249,7 @@ test_h5o_open_by_addr(void) haddr_t dtype_addr; hsize_t dims[RANK]; H5I_type_t id_type; /* Type of IDs returned from H5Oopen */ - hsize_t num_objs = 0; /* Number of objects in the group */ + H5G_info_t ginfo; /* Group info struct */ H5T_class_t type_class; /* Class of the datatype */ herr_t ret; /* Value returned from API calls */ @@ -315,9 +315,9 @@ test_h5o_open_by_addr(void) VERIFY(id_type, H5I_DATASET, "H5Iget_type for dataset ID"); /* Do something more complex with each of the IDs to make sure they "work" */ - ret = H5Gget_num_objs(grp, &num_objs); - CHECK(ret, FAIL, "H5Gget_num_objs"); - VERIFY(num_objs, 1, "H5Gget_num_objs"); /* There should be one object, the datatype */ + ret = H5Gget_info(grp, ".", &ginfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Gget_info"); + VERIFY(ginfo.nlinks, 1, "H5Gget_info"); /* There should be one object, the datatype */ type_class = H5Tget_class(dtype); VERIFY(type_class, H5T_INTEGER, "H5Tget_class"); diff --git a/test/titerate.c b/test/titerate.c index 3c27bdd..99f099c 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -132,7 +132,7 @@ test_iter_group(hid_t fapl, hbool_t new_format) char *lnames[NDATASETS + 2];/* Names of the links created */ char dataset_name[NAMELEN]; /* dataset name */ iter_info info; /* Custom iteration information */ - hsize_t num_membs; /* Number of group members */ + H5G_info_t ginfo; /* Buffer for querying object's info */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -203,18 +203,18 @@ 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_num_objs and H5Gget_objname_by_idx, actually + /* These two functions, H5Gget_objtype_by_idx and H5Gget_objname_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"); - ret = H5Gget_num_objs(root_group, &num_membs); - CHECK(ret, FAIL, "H5Gget_num_objs"); - VERIFY(num_membs, (NDATASETS + 2), "H5Gget_num_objs"); + 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)num_membs; i++) { + 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); @@ -233,16 +233,16 @@ test_iter_group(hid_t fapl, hbool_t new_format) CHECK(ret, FAIL, "H5Gclose"); } - /* These two functions, H5Gget_num_objs and H5Gget_objname_by_idx, actually + /* These two functions, H5Gget_objtype_by_idx and H5Gget_objname_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_num_objs(file, &num_membs); - CHECK(ret, FAIL, "H5Gget_num_objs"); - VERIFY(num_membs, NDATASETS + 2, "H5Gget_num_objs"); + ret = H5Gget_info(file, ".", &ginfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Gget_info"); + VERIFY(ginfo.nlinks, NDATASETS + 2, "H5Gget_info"); - for(i = 0; i< (int)num_membs; i++) { + 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(file, (hsize_t)i, dataset_name, (size_t)NAMELEN); @@ -708,7 +708,7 @@ static void test_grp_memb_funcs(hid_t fapl) char *obj_names[NDATASETS+2];/* Names of the objects in group */ char dataset_name[NAMELEN]; /* dataset name */ ssize_t name_len; /* Length of object's name */ - hsize_t num_membs; /* Number of group members */ + H5G_info_t ginfo; /* Buffer for querying object's info */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -772,17 +772,17 @@ static void test_grp_memb_funcs(hid_t fapl) file = H5Fopen(DATAFILE, H5F_ACC_RDONLY, fapl); CHECK(file, FAIL, "H5Fopen"); - /* These two functions, H5Gget_num_objs and H5Gget_objname_by_idx, actually + /* These two functions, H5Gget_objtype_by_idx and H5Gget_objname_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"); - ret = H5Gget_num_objs(root_group, &num_membs); - CHECK(ret, FAIL, "H5Gget_num_objs"); - VERIFY(num_membs,NDATASETS+2,"H5Gget_num_objs"); + 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)num_membs; i++) { + for(i=0; i< (int)ginfo.nlinks; i++) { H5G_obj_t obj_type; /* Type of object in file */ /* Test with NULL for name, to query length */ @@ -819,7 +819,7 @@ static void test_grp_memb_funcs(hid_t fapl) HDqsort(obj_names, (size_t)(NDATASETS + 2), sizeof(char *), iter_strcmp); /* Compare object names */ - for(i = 0; i< (int)num_membs; i++) { + for(i = 0; i< (int)ginfo.nlinks; i++) { ret = HDstrcmp(dnames[i], obj_names[i]); VERIFY(ret, 0, "HDstrcmp"); } /* end for */ @@ -848,11 +848,11 @@ static void test_links(hid_t fapl) hid_t file; /* File ID */ char obj_name[NAMELEN]; /* Names of the object in group */ ssize_t name_len; /* Length of object's name */ - herr_t ret; /* Generic return value */ hid_t gid, gid1; - hsize_t i; H5G_obj_t obj_type; /* Type of object */ - hsize_t nobjs; /* Number of objects */ + H5G_info_t ginfo; /* Buffer for querying object's info */ + hsize_t i; + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Soft and Hard Link Iteration Functionality\n")); @@ -875,12 +875,12 @@ static void test_links(hid_t fapl) 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"); - VERIFY(nobjs,3,"H5Gget_num_objs"); + ret = H5Gget_info(gid, ".", &ginfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Gget_info"); + VERIFY(ginfo.nlinks, 3, "H5Gget_info"); - /* Test these two functions, H5Gget_num_objs and H5Gget_objname_by_idx */ - for(i = 0; i < nobjs; i++) { + /* Test these two functions, H5Gget_objtype_by_idx and H5Gget_objname_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"); diff --git a/test/trefer.c b/test/trefer.c index 318858e..ad4b219 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -985,7 +985,7 @@ test_reference_group(void) hid_t sid; /* Dataspace ID */ hobj_ref_t wref; /* Reference to write */ hobj_ref_t rref; /* Reference to read */ - hsize_t nobjs; + H5G_info_t ginfo; /* Group info struct */ char objname[NAME_SIZE]; /* Buffer to store name */ H5G_obj_t objtype; /* Object type */ int count = 0; /* Count within iterated group */ @@ -1065,14 +1065,12 @@ test_reference_group(void) CHECK(ret, FAIL, "H5Literate"); /* Various queries on the group opened */ - ret = H5Gget_num_objs(gid, &nobjs); - CHECK(ret, FAIL, "H5Gget_num_objs"); - - VERIFY(nobjs, 3, "H5Gget_num_objs"); + ret = H5Gget_info(gid, ".", &ginfo, H5P_DEFAULT); + 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"); objtype = H5Gget_objtype_by_idx(gid, (hsize_t)0); |