mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-02-23 16:20:57 +08:00
[svn-r12952] Description:
Add tests for H5Literate(), in all combinations. Sweep up a few minor issues with H5Literate() that the tests exposed. Tested on: Linux/32 2.6 (chicago) Linux/64 2.6 (chicago2)
This commit is contained in:
parent
8d9964cf02
commit
335978f235
@ -585,8 +585,9 @@ H5G_dense_lookup_by_idx_fh_cb(const void *obj, size_t UNUSED obj_len, void *_uda
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy link message")
|
||||
|
||||
done:
|
||||
/* Release the space allocated for the link */
|
||||
if(tmp_lnk)
|
||||
H5O_reset(H5O_LINK_ID, tmp_lnk);
|
||||
H5O_free(H5O_LINK_ID, tmp_lnk);
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5G_dense_lookup_by_idx_fh_cb() */
|
||||
|
@ -733,11 +733,6 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op,
|
||||
if((ret_value = H5G_obj_iterate(loc_id, name, H5L_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data, H5AC_ind_dxpl_id)) < 0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed")
|
||||
|
||||
/* Check for too high of a starting index (ex post facto :-) */
|
||||
/* (Skipping exactly as many entries as are in the group is currently an error) */
|
||||
if(idx > 0 && idx >= last_obj)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified")
|
||||
|
||||
/* Set the index we stopped at */
|
||||
if(idx_p)
|
||||
*idx_p = (int)last_obj;
|
||||
|
17
src/H5Gobj.c
17
src/H5Gobj.c
@ -611,6 +611,19 @@ H5G_obj_iterate(hid_t loc_id, const char *group_name,
|
||||
if(skip > 0 && (size_t)skip >= linfo.nlinks)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "index out of bound")
|
||||
|
||||
/* Check for creation order tracking, if creation order index lookup requested */
|
||||
if(idx_type == H5L_INDEX_CRT_ORDER) {
|
||||
H5O_ginfo_t ginfo; /* Group info message */
|
||||
|
||||
/* Get group info message, to see if creation order is tracked for links in this group */
|
||||
if(NULL == H5O_read(&(grp->oloc), H5O_GINFO_ID, 0, &ginfo, dxpl_id))
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info message for group")
|
||||
|
||||
/* Check if creation order is tracked */
|
||||
if(!ginfo.track_corder)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "creation order not tracked for links in group")
|
||||
} /* end if */
|
||||
|
||||
if(H5F_addr_defined(linfo.link_fheap_addr)) {
|
||||
/* Iterate over the links in the group, building a table of the link messages */
|
||||
if((ret_value = H5G_dense_iterate(grp->oloc.file, dxpl_id, &linfo, idx_type, order, skip, last_lnk, gid, lnk_op, op_data)) < 0)
|
||||
@ -626,6 +639,10 @@ H5G_obj_iterate(hid_t loc_id, const char *group_name,
|
||||
/* Clear error stack from not finding the link info message */
|
||||
H5E_clear_stack(NULL);
|
||||
|
||||
/* Can only perform name lookups on groups with symbol tables */
|
||||
if(idx_type != H5L_INDEX_NAME)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no creation order index to query")
|
||||
|
||||
/* Iterate over symbol table */
|
||||
if((ret_value = H5G_stab_iterate(&(grp->oloc), dxpl_id, order, skip, last_lnk, gid, lnk_op, op_data)) < 0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over symbol table")
|
||||
|
@ -470,6 +470,11 @@ H5G_stab_iterate(H5O_loc_t *oloc, hid_t dxpl_id, H5_iter_order_t order,
|
||||
if((ret_value = H5B_iterate(oloc->file, dxpl_id, H5B_SNODE,
|
||||
H5G_node_iterate, stab.btree_addr, &udata)) < 0)
|
||||
HERROR(H5E_SYM, H5E_CANTNEXT, "iteration operator failed");
|
||||
|
||||
/* Check for too high of a starting index (ex post facto :-) */
|
||||
/* (Skipping exactly as many entries as are in the group is currently an error) */
|
||||
if(skip > 0 && skip >= *last_lnk)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified")
|
||||
} /* end if */
|
||||
else {
|
||||
H5G_bt_it_bt_t udata; /* User data to pass to B-tree callback */
|
||||
@ -484,6 +489,10 @@ H5G_stab_iterate(H5O_loc_t *oloc, hid_t dxpl_id, H5_iter_order_t order,
|
||||
stab.btree_addr, &udata) < 0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to build link table")
|
||||
|
||||
/* Check for skipping out of bounds */
|
||||
if(skip > 0 && (size_t)skip >= ltable.nlinks)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "index out of bound")
|
||||
|
||||
/* Sort link table in correct iteration order */
|
||||
if(H5G_link_sort_table(<able, H5L_INDEX_NAME, order) < 0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTSORT, FAIL, "error sorting link messages")
|
||||
|
@ -1160,7 +1160,6 @@ H5Literate(hid_t loc_id, const char *group_name,
|
||||
if((ret_value = H5G_obj_iterate(loc_id, group_name, idx_type, order, idx, &last_lnk, &lnk_op, op_data, H5AC_ind_dxpl_id)) < 0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed")
|
||||
|
||||
|
||||
/* Set the index we stopped at */
|
||||
if(idx_p)
|
||||
*idx_p = last_lnk;
|
||||
|
904
test/links.c
904
test/links.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user