diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2012-08-15 15:25:42 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2012-08-15 15:25:42 (GMT) |
commit | bdb3343f30acaae14a56b1d6386729623a47888f (patch) | |
tree | ee29b3760fd7eb1483187ce1a95c0834b041a781 /src/H5Pdxpl.c | |
parent | 2ab1d8cc0c91d691e7b0778d49d1c596c9a21d16 (diff) | |
download | hdf5-bdb3343f30acaae14a56b1d6386729623a47888f.zip hdf5-bdb3343f30acaae14a56b1d6386729623a47888f.tar.gz hdf5-bdb3343f30acaae14a56b1d6386729623a47888f.tar.bz2 |
[svn-r22682] Description:
Bring r22681 from trunk to 1.8 branch:
Clean up file driver property handling, along with some misc. warnings.
Tested on:
Mac OSX/64 10.7.4 (amazon) w/debug, gcc 4.7.1, C++, FORTRAN & threadsafe
(h5committest upcoming)
Diffstat (limited to 'src/H5Pdxpl.c')
-rw-r--r-- | src/H5Pdxpl.c | 474 |
1 files changed, 136 insertions, 338 deletions
diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index 9d27d82..593beb5 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -49,49 +49,43 @@ #define H5D_XFER_MAX_TEMP_BUF_SIZE sizeof(size_t) #define H5D_XFER_MAX_TEMP_BUF_DEF H5D_TEMP_BUF_SIZE /* Definitions for type conversion buffer property */ -#define H5D_XFER_TCONV_BUF_SIZE sizeof(void *) -#define H5D_XFER_TCONV_BUF_DEF NULL +#define H5D_XFER_TCONV_BUF_SIZE sizeof(void *) +#define H5D_XFER_TCONV_BUF_DEF NULL /* Definitions for background buffer property */ -#define H5D_XFER_BKGR_BUF_SIZE sizeof(void *) -#define H5D_XFER_BKGR_BUF_DEF NULL +#define H5D_XFER_BKGR_BUF_SIZE sizeof(void *) +#define H5D_XFER_BKGR_BUF_DEF NULL /* Definitions for background buffer type property */ -#define H5D_XFER_BKGR_BUF_TYPE_SIZE sizeof(H5T_bkg_t) +#define H5D_XFER_BKGR_BUF_TYPE_SIZE sizeof(H5T_bkg_t) #define H5D_XFER_BKGR_BUF_TYPE_DEF H5T_BKG_NO /* Definitions for B-tree node splitting ratio property */ /* (These default B-tree node splitting ratios are also used for splitting * group's B-trees as well as chunked dataset's B-trees - QAK) */ -#define H5D_XFER_BTREE_SPLIT_RATIO_SIZE sizeof(double[3]) -#define H5D_XFER_BTREE_SPLIT_RATIO_DEF {0.1, 0.5, 0.9} +#define H5D_XFER_BTREE_SPLIT_RATIO_SIZE sizeof(double[3]) +#define H5D_XFER_BTREE_SPLIT_RATIO_DEF {0.1, 0.5, 0.9} /* Definitions for vlen allocation function property */ -#define H5D_XFER_VLEN_ALLOC_SIZE sizeof(H5MM_allocate_t) -#define H5D_XFER_VLEN_ALLOC_DEF H5D_VLEN_ALLOC +#define H5D_XFER_VLEN_ALLOC_SIZE sizeof(H5MM_allocate_t) +#define H5D_XFER_VLEN_ALLOC_DEF H5D_VLEN_ALLOC /* Definitions for vlen allocation info property */ -#define H5D_XFER_VLEN_ALLOC_INFO_SIZE sizeof(void *) -#define H5D_XFER_VLEN_ALLOC_INFO_DEF H5D_VLEN_ALLOC_INFO +#define H5D_XFER_VLEN_ALLOC_INFO_SIZE sizeof(void *) +#define H5D_XFER_VLEN_ALLOC_INFO_DEF H5D_VLEN_ALLOC_INFO /* Definitions for vlen free function property */ -#define H5D_XFER_VLEN_FREE_SIZE sizeof(H5MM_free_t) -#define H5D_XFER_VLEN_FREE_DEF H5D_VLEN_FREE +#define H5D_XFER_VLEN_FREE_SIZE sizeof(H5MM_free_t) +#define H5D_XFER_VLEN_FREE_DEF H5D_VLEN_FREE /* Definitions for vlen free info property */ -#define H5D_XFER_VLEN_FREE_INFO_SIZE sizeof(void *) -#define H5D_XFER_VLEN_FREE_INFO_DEF H5D_VLEN_FREE_INFO -/* Definitions for file driver ID property */ -#define H5D_XFER_VFL_ID_SIZE sizeof(hid_t) -#define H5D_XFER_VFL_ID_DEF H5FD_VFD_DEFAULT -/* Definitions for file driver info property */ -#define H5D_XFER_VFL_INFO_SIZE sizeof(void *) -#define H5D_XFER_VFL_INFO_DEF NULL +#define H5D_XFER_VLEN_FREE_INFO_SIZE sizeof(void *) +#define H5D_XFER_VLEN_FREE_INFO_DEF H5D_VLEN_FREE_INFO /* Definitions for hyperslab vector size property */ /* (Be cautious about increasing the default size, there are arrays allocated * on the stack which depend on it - QAK) */ -#define H5D_XFER_HYPER_VECTOR_SIZE_SIZE sizeof(size_t) -#define H5D_XFER_HYPER_VECTOR_SIZE_DEF H5D_IO_VECTOR_SIZE +#define H5D_XFER_HYPER_VECTOR_SIZE_SIZE sizeof(size_t) +#define H5D_XFER_HYPER_VECTOR_SIZE_DEF H5D_IO_VECTOR_SIZE #ifdef H5_HAVE_PARALLEL /* Definitions for I/O transfer mode property */ -#define H5D_XFER_IO_XFER_MODE_SIZE sizeof(H5FD_mpio_xfer_t) -#define H5D_XFER_IO_XFER_MODE_DEF H5FD_MPIO_INDEPENDENT +#define H5D_XFER_IO_XFER_MODE_SIZE sizeof(H5FD_mpio_xfer_t) +#define H5D_XFER_IO_XFER_MODE_DEF H5FD_MPIO_INDEPENDENT /* Definitions for optimization of MPI-IO transfer mode property */ #define H5D_XFER_MPIO_COLLECTIVE_OPT_SIZE sizeof(H5FD_mpio_collective_opt_t) #define H5D_XFER_MPIO_COLLECTIVE_OPT_DEF H5FD_MPIO_COLLECTIVE_IO @@ -127,9 +121,9 @@ /* Definitions for data transform property */ #define H5D_XFER_XFORM_SIZE sizeof(void *) #define H5D_XFER_XFORM_DEF NULL -#define H5D_XFER_XFORM_DEL H5P_dxfr_xform_del -#define H5D_XFER_XFORM_COPY H5P_dxfr_xform_copy -#define H5D_XFER_XFORM_CLOSE H5P_dxfr_xform_close +#define H5D_XFER_XFORM_DEL H5P__dxfr_xform_del +#define H5D_XFER_XFORM_COPY H5P__dxfr_xform_copy +#define H5D_XFER_XFORM_CLOSE H5P__dxfr_xform_close /******************/ /* Local Typedefs */ @@ -146,15 +140,12 @@ /********************/ /* Property class callbacks */ -static herr_t H5P_dxfr_reg_prop(H5P_genclass_t *pclass); -static herr_t H5P_dxfr_create(hid_t dxpl_id, void *create_data); -static herr_t H5P_dxfr_copy(hid_t dst_dxpl_id, hid_t src_dxpl_id, void *copy_data); -static herr_t H5P_dxfr_close(hid_t dxpl_id, void *close_data); +static herr_t H5P__dxfr_reg_prop(H5P_genclass_t *pclass); /* Property list callbacks */ -static herr_t H5P_dxfr_xform_del(hid_t prop_id, const char* name, size_t size, void* value); -static herr_t H5P_dxfr_xform_copy(const char* name, size_t size, void* value); -static herr_t H5P_dxfr_xform_close(const char* name, size_t size, void* value); +static herr_t H5P__dxfr_xform_del(hid_t prop_id, const char* name, size_t size, void* value); +static herr_t H5P__dxfr_xform_copy(const char* name, size_t size, void* value); +static herr_t H5P__dxfr_xform_close(const char* name, size_t size, void* value); /*********************/ @@ -168,12 +159,12 @@ const H5P_libclass_t H5P_CLS_DXFR[1] = {{ &H5P_CLS_ROOT_g, /* Parent class ID */ &H5P_CLS_DATASET_XFER_g, /* Pointer to class ID */ &H5P_LST_DATASET_XFER_g, /* Pointer to default property list ID */ - H5P_dxfr_reg_prop, /* Default property registration routine */ - H5P_dxfr_create, /* Class creation callback */ + H5P__dxfr_reg_prop, /* Default property registration routine */ + NULL, /* Class creation callback */ NULL, /* Class creation callback info */ - H5P_dxfr_copy, /* Class copy callback */ + NULL, /* Class copy callback */ NULL, /* Class copy callback info */ - H5P_dxfr_close, /* Class close callback */ + NULL, /* Class close callback */ NULL /* Class close callback info */ }}; @@ -185,7 +176,7 @@ const H5P_libclass_t H5P_CLS_DXFR[1] = {{ /*------------------------------------------------------------------------- - * Function: H5P_dxfr_reg_prop + * Function: H5P__dxfr_reg_prop * * Purpose: Register the data transfer property list class's properties * @@ -196,7 +187,7 @@ const H5P_libclass_t H5P_CLS_DXFR[1] = {{ *------------------------------------------------------------------------- */ static herr_t -H5P_dxfr_reg_prop(H5P_genclass_t *pclass) +H5P__dxfr_reg_prop(H5P_genclass_t *pclass) { size_t def_max_temp_buf = H5D_XFER_MAX_TEMP_BUF_DEF; /* Default value for maximum temp buffer size */ void *def_tconv_buf = H5D_XFER_TCONV_BUF_DEF; /* Default value for type conversion buffer */ @@ -207,8 +198,6 @@ H5P_dxfr_reg_prop(H5P_genclass_t *pclass) void *def_vlen_alloc_info = H5D_XFER_VLEN_ALLOC_INFO_DEF; /* Default value for vlen allocation information */ H5MM_free_t def_vlen_free = H5D_XFER_VLEN_FREE_DEF; /* Default value for vlen free function */ void *def_vlen_free_info = H5D_XFER_VLEN_FREE_INFO_DEF; /* Default value for vlen free information */ - hid_t def_vfl_id = H5D_XFER_VFL_ID_DEF; /* Default value for file driver ID */ - void *def_vfl_info = H5D_XFER_VFL_INFO_DEF; /* Default value for file driver info */ size_t def_hyp_vec_size = H5D_XFER_HYPER_VECTOR_SIZE_DEF; /* Default value for vector size */ #ifdef H5_HAVE_PARALLEL H5FD_mpio_xfer_t def_io_xfer_mode = H5D_XFER_IO_XFER_MODE_DEF; /* Default value for I/O transfer mode */ @@ -227,7 +216,7 @@ H5P_dxfr_reg_prop(H5P_genclass_t *pclass) void *def_xfer_xform = H5D_XFER_XFORM_DEF; /* Default value for data transform */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Register the max. temp buffer size property */ if(H5P_register_real(pclass, H5D_XFER_MAX_TEMP_BUF_NAME, H5D_XFER_MAX_TEMP_BUF_SIZE, &def_max_temp_buf, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) @@ -265,14 +254,6 @@ H5P_dxfr_reg_prop(H5P_genclass_t *pclass) if(H5P_register_real(pclass, H5D_XFER_VLEN_FREE_INFO_NAME, H5D_XFER_VLEN_FREE_INFO_SIZE, &def_vlen_free_info, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - /* Register the file driver ID property */ - if(H5P_register_real(pclass, H5D_XFER_VFL_ID_NAME, H5D_XFER_VFL_ID_SIZE, &def_vfl_id, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the file driver info property */ - if(H5P_register_real(pclass, H5D_XFER_VFL_INFO_NAME, H5D_XFER_VFL_INFO_SIZE, &def_vfl_info, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - /* Register the vector size property */ if(H5P_register_real(pclass, H5D_XFER_HYPER_VECTOR_SIZE_NAME, H5D_XFER_HYPER_VECTOR_SIZE_SIZE, &def_hyp_vec_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") @@ -294,7 +275,7 @@ H5P_dxfr_reg_prop(H5P_genclass_t *pclass) if(H5P_register_real(pclass, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_SIZE, &def_mpio_actual_chunk_opt_mode, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - /* Register the actual io mode property. */ + /* Register the actual I/O mode property. */ if(H5P_register_real(pclass, H5D_MPIO_ACTUAL_IO_MODE_NAME, H5D_MPIO_ACTUAL_IO_MODE_SIZE, &def_mpio_actual_io_mode, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") @@ -328,157 +309,9 @@ H5P_dxfr_reg_prop(H5P_genclass_t *pclass) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_dxfr_reg_prop() */ - - -/*------------------------------------------------------------------------- - * Function: H5P_dxfr_create - * - * Purpose: Callback routine which is called whenever any dataset transfer - * property list is created. This routine performs any generic - * initialization needed on the properties the library put into - * the list. - * Right now, it's just allocating the driver-specific dataset - * transfer information. - * - * Return: Success: Non-negative - * - * Failure: Negative - * - * Programmer: Quincey Koziol - * Thursday, August 2, 2001 - * - *------------------------------------------------------------------------- - */ -/* ARGSUSED */ -static herr_t -H5P_dxfr_create(hid_t dxpl_id, void UNUSED *create_data) -{ - hid_t driver_id; /* VFL driver ID */ - void *driver_info; /* VFL driver info */ - H5P_genplist_t *plist; /* Property list */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Check arguments */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list") - - /* Get the driver information */ - if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve VFL driver ID") - if(H5P_get(plist, H5D_XFER_VFL_INFO_NAME, &driver_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve VFL driver info") - - /* Check if we have a valid driver ID */ - if(driver_id > 0) { - /* Set the driver for the property list */ - if(H5FD_dxpl_open(plist, driver_id, driver_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver") - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_dxfr_create() */ - - -/*------------------------------------------------------------------------- - * Function: H5P_dxfr_copy - * - * Purpose: Callback routine which is called whenever any dataset - * transfer property list is copied. This routine copies - * the properties from the old list to the new list. - * - * Return: Success: Non-negative - * - * Failure: Negative - * - * Programmer: Raymond Lu - * Tuesday, October 2, 2001 - * - *------------------------------------------------------------------------- - */ -/* ARGSUSED */ -static herr_t -H5P_dxfr_copy(hid_t dst_dxpl_id, hid_t src_dxpl_id, void UNUSED *copy_data) -{ - hid_t driver_id; - void* driver_info; - H5P_genplist_t *dst_plist; /* Destination property list */ - H5P_genplist_t *src_plist; /* Source property list */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - if(NULL == (dst_plist = (H5P_genplist_t *)H5I_object(dst_dxpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") - if(NULL == (src_plist = (H5P_genplist_t *)H5I_object(src_dxpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") - - /* Get values from old property list */ - if(H5P_get(src_plist, H5D_XFER_VFL_ID_NAME, &driver_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve VFL driver ID") - if(H5P_get(src_plist, H5D_XFER_VFL_INFO_NAME, &driver_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get drver info") - - if(driver_id > 0) { - /* Set the driver for the property list */ - if(H5FD_dxpl_open(dst_plist, driver_id, driver_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver") - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_dxfr_copy() */ +} /* end H5P__dxfr_reg_prop() */ -/*------------------------------------------------------------------------- - * Function: H5P_dxfr_close - * - * Purpose: Callback routine which is called whenever any dataset transfer - * property list is closed. This routine performs any generic - * cleanup needed on the properties the library put into the list. - * Right now, it's just freeing the driver-specific dataset - * transfer information. - * - * Return: Success: Non-negative - * - * Failure: Negative - * - * Programmer: Quincey Koziol - * Wednesday, July 11, 2001 - * - *------------------------------------------------------------------------- - */ -/* ARGSUSED */ -static herr_t -H5P_dxfr_close(hid_t dxpl_id, void UNUSED *close_data) -{ - hid_t driver_id; /* VFL driver ID */ - void *driver_info; /* VFL driver info */ - H5P_genplist_t *plist; /* Property list */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Check arguments */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list") - - if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID") - if(H5P_get(plist, H5D_XFER_VFL_INFO_NAME, &driver_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver info") - if(driver_id > 0) { - /* Close the driver for the property list */ - if(H5FD_dxpl_close(driver_id, driver_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't reset driver") - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_dxfr_close() */ /*------------------------------------------------------------------------- @@ -496,11 +329,11 @@ done: */ /* ARGSUSED */ static herr_t -H5P_dxfr_xform_del(hid_t UNUSED prop_id, const char UNUSED *name, size_t UNUSED size, void *value) +H5P__dxfr_xform_del(hid_t UNUSED prop_id, const char UNUSED *name, size_t UNUSED size, void *value) { - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(value); @@ -509,11 +342,11 @@ H5P_dxfr_xform_del(hid_t UNUSED prop_id, const char UNUSED *name, size_t UNUSED done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_dxfr_xform_del() */ +} /* end H5P__dxfr_xform_del() */ /*------------------------------------------------------------------------- - * Function: H5P_dxfr_xform_copy + * Function: H5P__dxfr_xform_copy * * Purpose: Creates a copy of the user's data transform string and its * associated parse tree. @@ -528,11 +361,11 @@ done: */ /* ARGSUSED */ static herr_t -H5P_dxfr_xform_copy(const char UNUSED *name, size_t UNUSED size, void *value) +H5P__dxfr_xform_copy(const char UNUSED *name, size_t UNUSED size, void *value) { - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(value); @@ -541,11 +374,11 @@ H5P_dxfr_xform_copy(const char UNUSED *name, size_t UNUSED size, void *value) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_dxfr_xform_copy() */ +} /* end H5P__dxfr_xform_copy() */ /*------------------------------------------------------------------------- - * Function: H5P_dxfr_xform_close + * Function: H5P__dxfr_xform_close * * Purpose: Frees memory allocated by H5P_dxfr_xform_set * @@ -559,11 +392,11 @@ done: */ /* ARGSUSED */ static herr_t -H5P_dxfr_xform_close(const char UNUSED *name, size_t UNUSED size, void *value) +H5P__dxfr_xform_close(const char UNUSED *name, size_t UNUSED size, void *value) { - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(value); @@ -572,18 +405,15 @@ H5P_dxfr_xform_close(const char UNUSED *name, size_t UNUSED size, void *value) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_dxfr_xform_close() */ +} /* end H5P__dxfr_xform_close() */ /*------------------------------------------------------------------------- * Function: H5Pset_data_transform * - * Purpose: - * Sets data transform expression. - * - * - * Return: Returns a non-negative value if successful; otherwise returns a negative value. + * Purpose: Sets data transform expression. * + * Return: Non-negative on success/Negative on failure * * Programmer: Leon Arber * Monday, March 07, 2004 @@ -605,7 +435,7 @@ H5Pset_data_transform(hid_t plist_id, const char *expression) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "expression cannot be NULL") /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER))) + if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* See if a data transform is already set, and free it if it is */ @@ -622,9 +452,8 @@ H5Pset_data_transform(hid_t plist_id, const char *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") + if(data_xform_prop && 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) @@ -634,10 +463,9 @@ done: /*------------------------------------------------------------------------- * Function: H5Pget_data_transform * - * Purpose: - * Gets data transform expression. + * Purpose: Gets data transform expression. * - * Return: Returns a non-negative value if successful; otherwise returns a negative value. + * Return: Non-negative on success/Negative on failure * * Comments: * If `expression' is non-NULL then write up to `size' bytes into that @@ -677,9 +505,7 @@ H5Pget_data_transform(hid_t plist_id, char *expression /*out*/, size_t size) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "data transform has not been set") /* Get the data transform string */ - pexp = H5Z_xform_extract_xform_str(data_xform_prop); - - if(!pexp) + if(NULL == (pexp = H5Z_xform_extract_xform_str(data_xform_prop))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "failed to retrieve transform expression") len = HDstrlen(pexp); @@ -693,9 +519,8 @@ H5Pget_data_transform(hid_t plist_id, char *expression /*out*/, size_t size) 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") + if(data_xform_prop && 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) @@ -727,7 +552,7 @@ herr_t H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg) { H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* return value */ + herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "iz*x*x", plist_id, size, tconv, bkg); @@ -778,27 +603,27 @@ H5Pget_buffer(hid_t plist_id, void **tconv/*out*/, void **bkg/*out*/) H5TRACE3("z", "ixx", plist_id, tconv, bkg); /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER))) + if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, 0, "can't find object for ID") /* Return values */ - if (tconv) - if(H5P_get(plist, H5D_XFER_TCONV_BUF_NAME, tconv)<0) + if(tconv) + if(H5P_get(plist, H5D_XFER_TCONV_BUF_NAME, tconv) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, 0, "Can't get transfer type conversion buffer") - if (bkg) - if(H5P_get(plist, H5D_XFER_BKGR_BUF_NAME, bkg)<0) + if(bkg) + if(H5P_get(plist, H5D_XFER_BKGR_BUF_NAME, bkg) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, 0, "Can't get background type conversion buffer") /* Get the size */ - if(H5P_get(plist, H5D_XFER_MAX_TEMP_BUF_NAME, &size)<0) + if(H5P_get(plist, H5D_XFER_MAX_TEMP_BUF_NAME, &size) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, 0, "Can't set transfer buffer size") /* Set the return value */ - ret_value=size; + ret_value = size; done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Pget_buffer() */ /*------------------------------------------------------------------------- @@ -815,32 +640,30 @@ done: * Programmer: Robb Matzke * Tuesday, March 17, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t H5Pset_preserve(hid_t plist_id, hbool_t status) { - H5T_bkg_t need_bkg; /* Value for background buffer type */ H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* return value */ + H5T_bkg_t need_bkg; /* Value for background buffer type */ + herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "ib", plist_id, status); /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER))) + if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Update property list */ need_bkg = status ? H5T_BKG_YES : H5T_BKG_NO; - if (H5P_set(plist,H5D_XFER_BKGR_BUF_TYPE_NAME,&need_bkg)<0) + if(H5P_set(plist, H5D_XFER_BKGR_BUF_TYPE_NAME, &need_bkg) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Pset_preserve() */ /*------------------------------------------------------------------------- @@ -855,8 +678,6 @@ done: * Programmer: Robb Matzke * Tuesday, March 17, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ int @@ -870,19 +691,19 @@ H5Pget_preserve(hid_t plist_id) H5TRACE1("Is", "i", plist_id); /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER))) + if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get value */ - if (H5P_get(plist,H5D_XFER_BKGR_BUF_TYPE_NAME,&need_bkg)<0) + if(H5P_get(plist, H5D_XFER_BKGR_BUF_TYPE_NAME, &need_bkg) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value") /* Set return value */ - ret_value= need_bkg ? TRUE : FALSE; + ret_value = need_bkg ? TRUE : FALSE; done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Pget_preserve() */ /*------------------------------------------------------------------------- @@ -898,21 +719,19 @@ done: * Programmer: Raymond Lu * Jan 3, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t H5Pset_edc_check(hid_t plist_id, H5Z_EDC_t check) { H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* return value */ + herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "iZe", plist_id, check); /* Check argument */ - if (check != H5Z_ENABLE_EDC && check != H5Z_DISABLE_EDC) + if(check != H5Z_ENABLE_EDC && check != H5Z_DISABLE_EDC) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid value") /* Get the plist structure */ @@ -920,12 +739,12 @@ H5Pset_edc_check(hid_t plist_id, H5Z_EDC_t check) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Update property list */ - if (H5P_set(plist,H5D_XFER_EDC_NAME,&check)<0) + if(H5P_set(plist, H5D_XFER_EDC_NAME, &check) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Pset_edc_check() */ /*------------------------------------------------------------------------- @@ -941,15 +760,13 @@ done: * Programmer: Raymond Lu * Jan 3, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ H5Z_EDC_t H5Pget_edc_check(hid_t plist_id) { H5P_genplist_t *plist; /* Property list pointer */ - H5Z_EDC_t ret_value; /* return value */ + H5Z_EDC_t ret_value; /* Return value */ FUNC_ENTER_API(H5Z_ERROR_EDC) H5TRACE1("Ze", "i", plist_id); @@ -959,16 +776,12 @@ H5Pget_edc_check(hid_t plist_id) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5Z_ERROR_EDC, "can't find object for ID") /* Update property list */ - if (H5P_get(plist,H5D_XFER_EDC_NAME,&ret_value)<0) + if(H5P_get(plist, H5D_XFER_EDC_NAME, &ret_value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5Z_ERROR_EDC, "unable to set value") - /* check valid value */ - if (ret_value != H5Z_ENABLE_EDC && ret_value != H5Z_DISABLE_EDC) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_ERROR_EDC, "not a valid value") - done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Pget_edc_check() */ /*------------------------------------------------------------------------- @@ -1111,40 +924,38 @@ done: * Programmer: Robb Matzke * Monday, September 28, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t H5Pget_btree_ratios(hid_t plist_id, double *left/*out*/, double *middle/*out*/, - double *right/*out*/) + double *right/*out*/) { + H5P_genplist_t *plist; /* Property list pointer */ double btree_split_ratio[3]; /* B-tree node split ratios */ - H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "ixxx", plist_id, left, middle, right); /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER))) + if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get the split ratios */ - if (H5P_get(plist,H5D_XFER_BTREE_SPLIT_RATIO_NAME,&btree_split_ratio)<0) + if(H5P_get(plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &btree_split_ratio) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value") /* Get values */ - if (left) + if(left) *left = btree_split_ratio[0]; - if (middle) + if(middle) *middle = btree_split_ratio[1]; - if (right) + if(right) *right = btree_split_ratio[2]; done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Pget_btree_ratios() */ /*------------------------------------------------------------------------- @@ -1165,28 +976,26 @@ done: * Programmer: Robb Matzke * Monday, September 28, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t H5Pset_btree_ratios(hid_t plist_id, double left, double middle, - double right) + double right) { - double split_ratio[3]; /* B-tree node split ratios */ H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* return value */ + double split_ratio[3]; /* B-tree node split ratios */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "iddd", plist_id, left, middle, right); /* Check arguments */ - if (left<0.0 || left>1.0 || middle<0.0 || middle>1.0 || - right<0.0 || right>1.0) + if(left < 0.0 || left > 1.0 || middle < 0.0 || middle > 1.0 || + right < 0.0 || right > 1.0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "split ratio must satisfy 0.0<=X<=1.0") /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER))) + if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Set values */ @@ -1195,12 +1004,12 @@ H5Pset_btree_ratios(hid_t plist_id, double left, double middle, split_ratio[2] = right; /* Set the split ratios */ - if (H5P_set(plist,H5D_XFER_BTREE_SPLIT_RATIO_NAME,&split_ratio)<0) + if(H5P_set(plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &split_ratio) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Pset_btree_ratios() */ /*------------------------------------------------------------------------- @@ -1220,28 +1029,26 @@ done: * Programmer: Quincey Koziol * Thursday, July 1, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t H5P_set_vlen_mem_manager(H5P_genplist_t *plist, H5MM_allocate_t alloc_func, - void *alloc_info, H5MM_free_t free_func, void *free_info) + void *alloc_info, H5MM_free_t free_func, void *free_info) { - herr_t ret_value=SUCCEED; /* return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - assert(plist); + HDassert(plist); /* Update property list */ - if (H5P_set(plist,H5D_XFER_VLEN_ALLOC_NAME,&alloc_func)<0) + if(H5P_set(plist, H5D_XFER_VLEN_ALLOC_NAME, &alloc_func) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") - if (H5P_set(plist,H5D_XFER_VLEN_ALLOC_INFO_NAME,&alloc_info)<0) + if(H5P_set(plist, H5D_XFER_VLEN_ALLOC_INFO_NAME, &alloc_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") - if (H5P_set(plist,H5D_XFER_VLEN_FREE_NAME,&free_func)<0) + if(H5P_set(plist, H5D_XFER_VLEN_FREE_NAME, &free_func) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") - if (H5P_set(plist,H5D_XFER_VLEN_FREE_INFO_NAME,&free_info)<0) + if(H5P_set(plist, H5D_XFER_VLEN_FREE_INFO_NAME, &free_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") done: @@ -1266,27 +1073,24 @@ done: * Programmer: Quincey Koziol * Thursday, July 1, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t H5Pset_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t alloc_func, - void *alloc_info, H5MM_free_t free_func, void *free_info) + void *alloc_info, H5MM_free_t free_func, void *free_info) { H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE5("e", "ix*xx*x", plist_id, alloc_func, alloc_info, free_func, - free_info); + H5TRACE5("e", "ix*xx*x", plist_id, alloc_func, alloc_info, free_func, free_info); /* Check arguments */ - if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER))) + if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list") /* Update property list */ - if (H5P_set_vlen_mem_manager(plist,alloc_func,alloc_info,free_func,free_info)<0) + if(H5P_set_vlen_mem_manager(plist, alloc_func, alloc_info, free_func, free_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set values") done: @@ -1304,42 +1108,38 @@ done: * Programmer: Quincey Koziol * Thursday, July 1, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t H5Pget_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t *alloc_func/*out*/, - void **alloc_info/*out*/, - H5MM_free_t *free_func/*out*/, - void **free_info/*out*/) + void **alloc_info/*out*/, H5MM_free_t *free_func/*out*/, void **free_info/*out*/) { H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "ixxxx", plist_id, alloc_func, alloc_info, free_func, free_info); /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER))) + if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - if(alloc_func!=NULL) - if (H5P_get(plist,H5D_XFER_VLEN_ALLOC_NAME,alloc_func)<0) + if(alloc_func) + if(H5P_get(plist, H5D_XFER_VLEN_ALLOC_NAME, alloc_func) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value") - if(alloc_info!=NULL) - if (H5P_get(plist,H5D_XFER_VLEN_ALLOC_INFO_NAME,alloc_info)<0) + if(alloc_info) + if(H5P_get(plist, H5D_XFER_VLEN_ALLOC_INFO_NAME, alloc_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value") - if(free_func!=NULL) - if (H5P_get(plist,H5D_XFER_VLEN_FREE_NAME,free_func)<0) + if(free_func) + if(H5P_get(plist, H5D_XFER_VLEN_FREE_NAME, free_func) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value") - if(free_info!=NULL) - if (H5P_get(plist,H5D_XFER_VLEN_FREE_INFO_NAME,free_info)<0) + if(free_info) + if(H5P_get(plist, H5D_XFER_VLEN_FREE_INFO_NAME, free_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value") done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Pget_vlen_mem_manager() */ /*------------------------------------------------------------------------- @@ -1361,29 +1161,27 @@ done: * Programmer: Quincey Koziol * Monday, July 9, 2001 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t H5Pset_hyper_vector_size(hid_t plist_id, size_t vector_size) { H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "iz", plist_id, vector_size); /* Check arguments */ - if (vector_size<1) + if(vector_size < 1) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "vector size too small") /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER))) + if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Update property list */ - if (H5P_set(plist,H5D_XFER_HYPER_VECTOR_SIZE_NAME,&vector_size)<0) + if(H5P_set(plist, H5D_XFER_HYPER_VECTOR_SIZE_NAME, &vector_size) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") done: @@ -1401,34 +1199,32 @@ done: * Programmer: Quincey Koziol * Monday, July 9, 2001 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t H5Pget_hyper_vector_size(hid_t plist_id, size_t *vector_size/*out*/) { H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "ix", plist_id, vector_size); /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER))) + if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Return values */ - if (vector_size) - if (H5P_get(plist,H5D_XFER_HYPER_VECTOR_SIZE_NAME,vector_size)<0) + if(vector_size) + if(H5P_get(plist, H5D_XFER_HYPER_VECTOR_SIZE_NAME, vector_size) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value") done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_hyper_vector_size() */ - #ifdef H5_HAVE_PARALLEL + /*------------------------------------------------------------------------- * Function: H5Pget_mpio_actual_chunk_opt_mode * @@ -1438,6 +1234,7 @@ done: * * Programmer: Jacob Gruber * Wednesday, May 4, 2011 + * *------------------------------------------------------------------------- */ herr_t @@ -1473,6 +1270,7 @@ done: * * Programmer: Jacob Gruber * Wednesday, May 4, 2011 + * *------------------------------------------------------------------------- */ herr_t |