summaryrefslogtreecommitdiffstats
path: root/src/H5Tvlen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Tvlen.c')
-rw-r--r--src/H5Tvlen.c45
1 files changed, 36 insertions, 9 deletions
diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c
index e1515ab..6932d70 100644
--- a/src/H5Tvlen.c
+++ b/src/H5Tvlen.c
@@ -18,6 +18,7 @@
#include "H5Eprivate.h" /* Errors */
#include "H5HGprivate.h" /* Global Heaps */
#include "H5Iprivate.h" /* IDs */
+#include "H5Pprivate.h" /* Property Lists */
#include "H5MMprivate.h" /* Memory Allocation */
#include "H5Tpkg.h" /* Datatypes */
@@ -202,8 +203,10 @@ herr_t H5T_vlen_seq_mem_read(H5F_t UNUSED *f, void *vl_addr, void *buf, size_t l
*
*-------------------------------------------------------------------------
*/
-herr_t H5T_vlen_seq_mem_write(const H5D_xfer_t *xfer_parms, H5F_t UNUSED *f, void *vl_addr, void *buf, hsize_t seq_len, hsize_t base_size)
+herr_t H5T_vlen_seq_mem_write(hid_t plist_id, H5F_t UNUSED *f, void *vl_addr, void *buf, hsize_t seq_len, hsize_t base_size)
{
+ H5MM_allocate_t alloc_func; /* Vlen allocation function */
+ void *alloc_info; /* Vlen allocation information */
hvl_t *vl=(hvl_t *)vl_addr; /* Pointer to the user's hvl_t information */
size_t len=seq_len*base_size;
@@ -216,8 +219,15 @@ herr_t H5T_vlen_seq_mem_write(const H5D_xfer_t *xfer_parms, H5F_t UNUSED *f, voi
if(seq_len!=0) {
/* Use the user's memory allocation routine is one is defined */
assert((seq_len*base_size)==(hsize_t)((size_t)(seq_len*base_size))); /*check for overflow*/
- if(xfer_parms->vlen_alloc!=NULL) {
- if(NULL==(vl->p=(xfer_parms->vlen_alloc)((size_t)(seq_len*base_size),xfer_parms->alloc_info)))
+
+ /* Get the allocation function & info */
+ if (H5P_get(plist_id,H5D_XFER_VLEN_ALLOC_NAME,&alloc_func)<0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value");
+ if (H5P_get(plist_id,H5D_XFER_VLEN_ALLOC_INFO_NAME,&alloc_info)<0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value");
+
+ if(alloc_func!=NULL) {
+ if(NULL==(vl->p=(alloc_func)((size_t)(seq_len*base_size),alloc_info)))
HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for VL data");
} /* end if */
else { /* Default to system malloc */
@@ -313,8 +323,10 @@ herr_t H5T_vlen_str_mem_read(H5F_t UNUSED *f, void *vl_addr, void *buf, size_t l
*
*-------------------------------------------------------------------------
*/
-herr_t H5T_vlen_str_mem_write(const H5D_xfer_t *xfer_parms, H5F_t UNUSED *f, void *vl_addr, void *buf, hsize_t seq_len, hsize_t base_size)
+herr_t H5T_vlen_str_mem_write(hid_t plist_id, H5F_t UNUSED *f, void *vl_addr, void *buf, hsize_t seq_len, hsize_t base_size)
{
+ H5MM_allocate_t alloc_func; /* Vlen allocation function */
+ void *alloc_info; /* Vlen allocation information */
char **s=(char **)vl_addr; /* Pointer to the user's hvl_t information */
size_t len=seq_len*base_size;
@@ -325,8 +337,15 @@ herr_t H5T_vlen_str_mem_write(const H5D_xfer_t *xfer_parms, H5F_t UNUSED *f, voi
/* Use the user's memory allocation routine is one is defined */
assert(((seq_len+1)*base_size)==(hsize_t)((size_t)((seq_len+1)*base_size))); /*check for overflow*/
- if(xfer_parms->vlen_alloc!=NULL) {
- if(NULL==(*s=(xfer_parms->vlen_alloc)((size_t)((seq_len+1)*base_size),xfer_parms->alloc_info)))
+
+ /* Get the allocation function & info */
+ if (H5P_get(plist_id,H5D_XFER_VLEN_ALLOC_NAME,&alloc_func)<0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value");
+ if (H5P_get(plist_id,H5D_XFER_VLEN_ALLOC_INFO_NAME,&alloc_info)<0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value");
+
+ if(alloc_func!=NULL) {
+ if(NULL==(*s=(alloc_func)((size_t)((seq_len+1)*base_size),alloc_info)))
HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for VL data");
} /* end if */
else { /* Default to system malloc */
@@ -430,7 +449,7 @@ herr_t H5T_vlen_disk_read(H5F_t *f, void *vl_addr, void *buf, size_t UNUSED len)
*
*-------------------------------------------------------------------------
*/
-herr_t H5T_vlen_disk_write(const H5D_xfer_t UNUSED *xfer_parms, H5F_t *f, void *vl_addr, void *buf, hsize_t seq_len, hsize_t base_size)
+herr_t H5T_vlen_disk_write(hid_t plist_id, H5F_t *f, void *vl_addr, void *buf, hsize_t seq_len, hsize_t base_size)
{
uint8_t *vl=(uint8_t *)vl_addr; /* Pointer to the user's hvl_t information */
H5HG_t hobjid;
@@ -600,7 +619,9 @@ done:
herr_t
H5T_vlen_reclaim(void *elem, hid_t type_id, hsize_t UNUSED ndim, hssize_t UNUSED *point, void *op_data)
{
- H5D_xfer_t *xfer_parms = (H5D_xfer_t *)op_data; /* Dataset transfer plist from iterator */
+ hid_t plist_id = *(hid_t *)op_data; /* Dataset transfer plist from iterator */
+ H5MM_free_t free_func; /* Vlen free function */
+ void *free_info=NULL; /* Vlen free information */
H5T_t *dt = NULL;
herr_t ret_value = FAIL;
@@ -613,8 +634,14 @@ H5T_vlen_reclaim(void *elem, hid_t type_id, hsize_t UNUSED ndim, hssize_t UNUSED
if (H5I_DATATYPE!=H5I_get_type(type_id) || NULL==(dt=H5I_object(type_id)))
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
+ /* Get the free func & information */
+ if (H5P_get(plist_id,H5D_XFER_VLEN_FREE_NAME,&free_func)<0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value");
+ if (H5P_get(plist_id,H5D_XFER_VLEN_FREE_INFO_NAME,&free_info)<0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value");
+
/* Pull the free function and free info pointer out of the op_data and call the recurse datatype free function */
- ret_value=H5T_vlen_reclaim_recurse(elem,dt,xfer_parms->vlen_free,xfer_parms->free_info);
+ ret_value=H5T_vlen_reclaim_recurse(elem,dt,free_func,free_info);
#ifdef LATER
done: