summaryrefslogtreecommitdiffstats
path: root/src/H5R.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5R.c')
-rw-r--r--src/H5R.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/H5R.c b/src/H5R.c
index 3bbb5e5..ba699e8 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -324,8 +324,9 @@ done:
static hid_t
H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref)
{
+ H5D_t *dset; /* Pointer to dataset to open */
+ H5T_t *type; /* Pointer to datatype to open */
H5G_t *group; /* Pointer to group to open */
- H5T_t *datatype; /* Pointer to datatype to open */
H5G_entry_t ent; /* Symbol table entry */
uint8_t *p; /* Pointer to OID to store */
int oid_type; /* type of object being dereferenced */
@@ -389,14 +390,14 @@ H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref)
if(H5O_link(&ent,0,dxpl_id)<=0)
HGOTO_ERROR(H5E_REFERENCE, H5E_LINKCOUNT, FAIL, "dereferencing deleted object");
- /* Open the dataset object */
+ /* Open the object */
oid_type=H5G_get_type(&ent,dxpl_id);
switch(oid_type) {
case H5G_GROUP:
- if ((group=H5G_open_oid(&ent,dxpl_id)) == NULL)
+ if ((group=H5G_open(&ent,dxpl_id)) == NULL)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "not found");
- /* Create an atom for the dataset */
+ /* Create an atom for the group */
if ((ret_value = H5I_register(H5I_GROUP, group)) < 0) {
H5G_close(group);
HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "can't register group");
@@ -404,20 +405,26 @@ H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref)
break;
case H5G_TYPE:
- if ((datatype=H5T_open_oid(&ent, dxpl_id)) == NULL)
+ if ((type=H5T_open(&ent, dxpl_id)) == NULL)
HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "not found");
- /* Create an atom for the dataset */
- if ((ret_value = H5I_register(H5I_DATATYPE, datatype)) < 0) {
- H5T_close(datatype);
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "can't register group");
+ /* Create an atom for the datatype */
+ if ((ret_value = H5I_register(H5I_DATATYPE, type)) < 0) {
+ H5T_close(type);
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "can't register datatype");
}
break;
case H5G_DATASET:
/* Open the dataset */
- if ((ret_value=H5D_open(&ent,dxpl_id)) < 0)
+ if ((dset=H5D_open(&ent,dxpl_id)) <0)
HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, FAIL, "not found");
+
+ /* Create an atom for the dataset */
+ if ((ret_value = H5I_register(H5I_DATASET, dset)) < 0) {
+ H5D_close(dset);
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "can't register dataset");
+ }
break;
default: