diff options
author | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2012-06-28 19:51:46 (GMT) |
---|---|---|
committer | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2012-06-28 19:51:46 (GMT) |
commit | 5f34b5703d93fd795f136054a191008affb80011 (patch) | |
tree | 2360311955cb5ad8090ebdaeff28e02adc2418c2 /src/H5Toh.c | |
parent | df961a00414a440b8967983f62281b6205b9627c (diff) | |
download | hdf5-5f34b5703d93fd795f136054a191008affb80011.zip hdf5-5f34b5703d93fd795f136054a191008affb80011.tar.gz hdf5-5f34b5703d93fd795f136054a191008affb80011.tar.bz2 |
[svn-r22501] change the interface callbacks for the VOL to use objects pointers and public VL structure instead of IDs.
tests will fail now because of named datatypes.
Diffstat (limited to 'src/H5Toh.c')
-rw-r--r-- | src/H5Toh.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/H5Toh.c b/src/H5Toh.c index 7961706..e76070f 100644 --- a/src/H5Toh.c +++ b/src/H5Toh.c @@ -27,6 +27,7 @@ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ #include "H5Opkg.h" /* Object headers */ #include "H5Tpkg.h" /* Datatypes */ @@ -132,6 +133,9 @@ 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) { + size_t nalloc; + unsigned char *buf = NULL; + void *dt = NULL; /* datatype token from VOL plugin */ H5T_t *type = NULL; /* Datatype opened */ hid_t ret_value; /* Return value */ @@ -143,6 +147,16 @@ H5O_dtype_open(const H5G_loc_t *obj_loc, hid_t UNUSED lapl_id, hid_t dxpl_id, hb if(NULL == (type = H5T_open(obj_loc, dxpl_id))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to open datatype") + if(H5T_encode(type, NULL, &nalloc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't determine serialized length of datatype") + buf = (unsigned char *) H5MM_malloc (nalloc); + if(H5T_encode(type, buf, &nalloc) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "can't serialize datatype") + if(NULL == (dt = H5T_decode(buf))) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't decode datatype") + type->vol_obj = dt; + H5MM_free(buf); + /* 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") |