summaryrefslogtreecommitdiffstats
path: root/src/H5Gstab.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Gstab.c')
-rw-r--r--src/H5Gstab.c41
1 files changed, 37 insertions, 4 deletions
diff --git a/src/H5Gstab.c b/src/H5Gstab.c
index 9c4311c..72c0d25 100644
--- a/src/H5Gstab.c
+++ b/src/H5Gstab.c
@@ -121,6 +121,10 @@ done:
*
* Modifications:
*
+ * Pedro Vicente, <pvn@ncsa.uiuc.edu> 22 Aug 2002
+ * Added `id to name' support.
+ * Added a deep copy of the symbol table entry
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -131,6 +135,8 @@ H5G_stab_find(H5G_entry_t *grp_ent, const char *name,
H5O_stab_t stab; /*symbol table message */
herr_t ret_value=SUCCEED; /* Return value */
+ obj_ent->name=NULL;
+
FUNC_ENTER_NOAPI(H5G_stab_find, FAIL);
/* Check arguments */
@@ -146,10 +152,28 @@ H5G_stab_find(H5G_entry_t *grp_ent, const char *name,
udata.heap_addr = stab.heap_addr;
/* search the B-tree */
- if (H5B_find(grp_ent->file, H5B_SNODE, stab.btree_addr, &udata) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "not found");
- if (obj_ent)
- *obj_ent = udata.ent;
+ if (H5B_find(grp_ent->file, H5B_SNODE, stab.btree_addr, &udata) < 0) {
+ HRETURN_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "not found");
+ }
+
+ /* change OBJ_ENT only if found */
+ else
+ {
+ if (obj_ent) {
+
+ /* do a deep copy */
+ if (H5G_ent_copy( &(udata.ent), obj_ent )<0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to copy entry");
+
+ /* insert the name into the symbol entry OBJ_ENT */
+ if (H5G_insert_name( grp_ent, obj_ent, name ) < 0) {
+ HRETURN_ERROR(H5E_SYM, H5E_CANTINIT, FAIL,
+ "cannot insert name");
+ }
+
+ }
+ }
+
done:
FUNC_LEAVE(ret_value);
@@ -173,6 +197,9 @@ done:
*
* Modifications:
*
+ * Pedro Vicente, <pvn@ncsa.uiuc.edu> 22 Aug 2002
+ * Added `id to name' support.
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -207,6 +234,12 @@ H5G_stab_insert(H5G_entry_t *grp_ent, const char *name, H5G_entry_t *obj_ent)
/* update the name offset in the entry */
obj_ent->name_off = udata.ent.name_off;
+ /* insert the name into the symbol entry OBJ_ENT */
+ if (H5G_insert_name( grp_ent, obj_ent, name ) < 0) {
+ HRETURN_ERROR(H5E_SYM, H5E_CANTINIT, FAIL,
+ "cannot insert name");
+ }
+
done:
FUNC_LEAVE(ret_value);
}