diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2001-08-10 20:47:05 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2001-08-10 20:47:05 (GMT) |
commit | 95862451f78960cab031031011e5c6a131e0d026 (patch) | |
tree | 391101ca102fbecbfe9cee1f608b90bb87d49b1a /src/H5Tvlen.c | |
parent | 4049965d1337bc54a21a4d3af71aa793e4baf029 (diff) | |
download | hdf5-95862451f78960cab031031011e5c6a131e0d026.zip hdf5-95862451f78960cab031031011e5c6a131e0d026.tar.gz hdf5-95862451f78960cab031031011e5c6a131e0d026.tar.bz2 |
[svn-r4324] Purpose:
New Features!
Description:
Start migrating the internal use of property lists in the library from the
older implementation to the new generic property lists.
Currently, only the dataset transfer property lists are migrated to the
new architecture, all the rest of the property list types are still using
the older architecture.
Also, the backward compatibility features are not implemented yet, so
applications which use dataset transfer properties may need to make the
following changes:
H5Pcreate(H5P_DATASET_XFER) -> H5Pcreate_list(H5P_DATASET_XFER_NEW)
and
H5Pclose(<a dataset transfer property list>) -> H5Pclose_list(id)
This still may have some bugs in it, especially with Fortran, but I should
be wrapping up those later today.
Platforms tested:
FreeBSD 4.4 (hawkwind)
Diffstat (limited to 'src/H5Tvlen.c')
-rw-r--r-- | src/H5Tvlen.c | 45 |
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: |