diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2004-05-05 19:29:09 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2004-05-05 19:29:09 (GMT) |
commit | 7f99a80b0abee64d09ada9be749196cf8185eaf2 (patch) | |
tree | aa50771017835e0be9617240cdcb63c09504ae49 /src/H5Pdxpl.c | |
parent | 14aaec71d7fe418fa6abb1b5c0ff92e092a77835 (diff) | |
download | hdf5-7f99a80b0abee64d09ada9be749196cf8185eaf2.zip hdf5-7f99a80b0abee64d09ada9be749196cf8185eaf2.tar.gz hdf5-7f99a80b0abee64d09ada9be749196cf8185eaf2.tar.bz2 |
[svn-r8482] Purpose:
Code cleanup
Description:
Refactored data transform code to reduce amount of symbols in the global
scope and also cleaned up & simplified the code a bit.
Platforms tested:
h5committest (minus copper, plus serial modi4)
FreeBSD 4.9 (sleipnir) w & w/o parallel
Diffstat (limited to 'src/H5Pdxpl.c')
-rw-r--r-- | src/H5Pdxpl.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index 36bf77e..94b115e 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -31,6 +31,7 @@ static int interface_initialize_g = 0; /* Static function prototypes */ + /*------------------------------------------------------------------------- * Function: H5Pset_data_transform * @@ -48,15 +49,14 @@ static int interface_initialize_g = 0; * *------------------------------------------------------------------------- */ -herr_t H5Pset_data_transform(hid_t plist_id, char* expression) +herr_t H5Pset_data_transform(hid_t plist_id, const char* expression) { H5P_genplist_t *plist; /* Property list pointer */ + H5Z_data_xform_t *data_xform_prop=NULL; /* New data xform property */ herr_t ret_value=SUCCEED; /* return value */ FUNC_ENTER_API(H5Pset_data_transform, FAIL); - /* H5TRACE4("e","izxx",plist_id,expression); */ - /* Check arguments */ if (expression == NULL) HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "expression cannot be NULL"); @@ -65,17 +65,24 @@ herr_t H5Pset_data_transform(hid_t plist_id, char* expression) if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + /* Create data transform info from expression */ + if((data_xform_prop=H5Z_xform_create(expression))==NULL) + HGOTO_ERROR (H5E_PLINE, H5E_NOSPACE, FAIL, "unable to create data transform info") + /* Update property list */ - if(H5P_set(plist, H5D_XFER_XFORM, &expression)<0) + if(H5P_set(plist, H5D_XFER_XFORM_NAME, &data_xform_prop)<0) HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Error setting data transform expression"); done: + if(ret_value<0) { + if(data_xform_prop) + if(H5Z_xform_destroy(data_xform_prop)<0) + HDONE_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "unable to release data transform expression") + } /* end if */ + FUNC_LEAVE_API(ret_value); } - - - /*------------------------------------------------------------------------- * Function: H5Pset_buffer |