summaryrefslogtreecommitdiffstats
path: root/src/H5Toh.c
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2012-07-06 22:44:35 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2012-07-06 22:44:35 (GMT)
commit843ccf86dd147e245bab269520741b0f103b4d6b (patch)
tree0af8a96abba787fa04f1d3d92af2400066fa133d /src/H5Toh.c
parent7a070012c08c4ef16a6effc01e03c2ca7cd8fa00 (diff)
downloadhdf5-843ccf86dd147e245bab269520741b0f103b4d6b.zip
hdf5-843ccf86dd147e245bab269520741b0f103b4d6b.tar.gz
hdf5-843ccf86dd147e245bab269520741b0f103b4d6b.tar.bz2
[svn-r22523] - rework how IDs for VOL objects are created
- change how the vlose routine is registered with VOL IDs - some bug fixes
Diffstat (limited to 'src/H5Toh.c')
-rw-r--r--src/H5Toh.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/H5Toh.c b/src/H5Toh.c
index 8454467..e90d22f 100644
--- a/src/H5Toh.c
+++ b/src/H5Toh.c
@@ -133,28 +133,34 @@ done:
static hid_t
H5O_dtype_open(const H5G_loc_t *obj_loc, hid_t UNUSED lapl_id, hid_t dxpl_id, hbool_t app_ref)
{
- H5T_t *type = NULL; /* Datatype opened */
- hid_t ret_value; /* Return value */
+ H5T_t *type = NULL, *dt = NULL; /* Datatype opened */
+ hid_t ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
HDassert(obj_loc);
/* Open the datatype */
- if(NULL == (type = H5T_open(obj_loc, dxpl_id)))
+ if(NULL == (dt = H5T_open(obj_loc, dxpl_id)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to open datatype")
- /* Register an ID for the datatype */
- if((ret_value = H5I_register(H5I_DATATYPE, type, app_ref)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype")
- if(H5VL_native_register_aux(ret_value) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "can't attach native vol info to ID")
+ /* Copy the dataset's datatype */
+ if(NULL == (type = H5T_copy(dt, H5T_COPY_REOPEN)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to copy datatype")
+
+ H5T_set_vol_object(type, (void *)dt);
+
+ /* Get an atom for the datatype */
+ if((ret_value = H5VL_native_register(H5I_DATATYPE, type, app_ref)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataset")
done:
- if(ret_value < 0)
+ if(ret_value < 0) {
+ if(dt && H5T_close(dt) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype")
if(type && H5T_close(type) < 0)
HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to release datatype")
-
+ }
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_dtype_open() */