summaryrefslogtreecommitdiffstats
path: root/src/H5Aint.c
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2012-07-03 22:06:42 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2012-07-03 22:06:42 (GMT)
commite4a60d86caa7a76001dd4e09af246c4c0fad19ea (patch)
tree98f4a575adade88f83e264264faa8804d14bd5a8 /src/H5Aint.c
parent34050a7d9c9ae16326711cfb69c575bfe75e422e (diff)
downloadhdf5-e4a60d86caa7a76001dd4e09af246c4c0fad19ea.zip
hdf5-e4a60d86caa7a76001dd4e09af246c4c0fad19ea.tar.gz
hdf5-e4a60d86caa7a76001dd4e09af246c4c0fad19ea.tar.bz2
[svn-r22513] fix some committed datatype issues
update get_type routines to construct a VOL datatype if the type is named
Diffstat (limited to 'src/H5Aint.c')
-rw-r--r--src/H5Aint.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/H5Aint.c b/src/H5Aint.c
index 3a4bfd4..687dfc9 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -743,6 +743,7 @@ hid_t
H5A_get_type(H5A_t *attr)
{
H5T_t *dt = NULL;
+ H5T_t *type = NULL;
hid_t ret_value = FAIL;
FUNC_ENTER_NOAPI_NOINIT
@@ -767,14 +768,38 @@ H5A_get_type(H5A_t *attr)
if(H5T_lock(dt, FALSE) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to lock transient datatype")
- /* Atomize */
- if((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype ID")
+ /* Create an atom */
+ if(H5T_committed(dt)) {
+ /* If this is a committed datatype, we need to recreate the
+ two level IDs, where the VOL object is a copy of the
+ returned datatype */
+ ssize_t nalloc = 0;
+ size_t size;
+ unsigned char *buf = NULL;
+
+ /* 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);
+
+ if((ret_value = H5I_register(H5I_DATATYPE, type, TRUE)) < 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 vol info to ID")
+ }
+ else {
+ if((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype")
+ }
done:
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_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype")
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)