summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5Gdense.c3
-rw-r--r--src/H5Gdeprec.c5
-rw-r--r--src/H5Gobj.c17
-rw-r--r--src/H5Gstab.c9
-rw-r--r--src/H5L.c1
5 files changed, 28 insertions, 7 deletions
diff --git a/src/H5Gdense.c b/src/H5Gdense.c
index 7fd7883..e495076 100644
--- a/src/H5Gdense.c
+++ b/src/H5Gdense.c
@@ -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() */
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c
index b11ca88..b780b0d 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -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;
diff --git a/src/H5Gobj.c b/src/H5Gobj.c
index 84819cd..c1d81b5 100644
--- a/src/H5Gobj.c
+++ b/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")
diff --git a/src/H5Gstab.c b/src/H5Gstab.c
index c982b6b..76cefe1 100644
--- a/src/H5Gstab.c
+++ b/src/H5Gstab.c
@@ -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(&ltable, H5L_INDEX_NAME, order) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSORT, FAIL, "error sorting link messages")
diff --git a/src/H5L.c b/src/H5L.c
index b9306be..d6a9fa7 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -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;