summaryrefslogtreecommitdiffstats
path: root/src/H5A.c
diff options
context:
space:
mode:
authorJerome Soumagne <jsoumagne@hdfgroup.org>2015-10-02 20:30:14 (GMT)
committerJerome Soumagne <jsoumagne@hdfgroup.org>2015-10-02 20:30:14 (GMT)
commit259ea41679d9c126248c2dda8230f17121f3952d (patch)
tree80d241c56719f0f182152d3de24724d855114c52 /src/H5A.c
parent0e1fa6f0410b77751cfa2a8acce61c1637921a40 (diff)
downloadhdf5-259ea41679d9c126248c2dda8230f17121f3952d.zip
hdf5-259ea41679d9c126248c2dda8230f17121f3952d.tar.gz
hdf5-259ea41679d9c126248c2dda8230f17121f3952d.tar.bz2
[svn-r27940] Merge r27938 from trunk
Fix private/public H5A_get_type and H5A_get_space
Diffstat (limited to 'src/H5A.c')
-rw-r--r--src/H5A.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/H5A.c b/src/H5A.c
index 513b764..f1a6408 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -666,6 +666,7 @@ hid_t
H5Aget_space(hid_t attr_id)
{
H5A_t *attr; /* Attribute object for ID */
+ H5S_t *ds = NULL;
hid_t ret_value;
FUNC_ENTER_API(FAIL)
@@ -675,10 +676,19 @@ H5Aget_space(hid_t attr_id)
if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
- if((ret_value = H5A_get_space(attr)) < 0)
+ if(NULL == (ds = H5A_get_space(attr)))
HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get space ID of attribute")
+ /* Atomize */
+ if((ret_value = H5I_register(H5I_DATASPACE, ds, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom")
+
done:
+ if(ret_value < 0) {
+ if(ds && (H5S_close(ds) < 0))
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace")
+ } /* end if */
+
FUNC_LEAVE_API(ret_value)
} /* H5Aget_space() */
@@ -703,6 +713,7 @@ hid_t
H5Aget_type(hid_t attr_id)
{
H5A_t *attr; /* Attribute object for ID */
+ H5T_t *dt = NULL;
hid_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -712,10 +723,19 @@ H5Aget_type(hid_t attr_id)
if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
- if((ret_value = H5A_get_type(attr)) < 0)
+ if(NULL == (dt = H5A_get_type(attr)))
HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get space ID of attribute")
+ /* Create an atom */
+ 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")
+ } /* end if */
+
FUNC_LEAVE_API(ret_value)
} /* H5Aget_type() */