diff options
author | Chris Hogan <chogan@hdfgroup.org> | 2019-11-04 20:42:08 (GMT) |
---|---|---|
committer | Chris Hogan <chogan@hdfgroup.org> | 2019-11-04 20:42:08 (GMT) |
commit | 77a0f4087f4aeea7f1cf43ef5bc44cd1ce1bf5f3 (patch) | |
tree | ab0e6e27571bdaa85c175a52976f78c1e035ef91 /src/H5CX.c | |
parent | e6d63889051caa9393afcbac277ad41913a020a0 (diff) | |
download | hdf5-77a0f4087f4aeea7f1cf43ef5bc44cd1ce1bf5f3.zip hdf5-77a0f4087f4aeea7f1cf43ef5bc44cd1ce1bf5f3.tar.gz hdf5-77a0f4087f4aeea7f1cf43ef5bc44cd1ce1bf5f3.tar.bz2 |
Add character encoding to lcpl context
Diffstat (limited to 'src/H5CX.c')
-rw-r--r-- | src/H5CX.c | 87 |
1 files changed, 48 insertions, 39 deletions
@@ -283,6 +283,9 @@ typedef struct H5CX_t { #endif /* H5_HAVE_PARALLEL */ /* Cached LCPL properties */ + H5T_cset_t encoding; /* Link name character encoding */ + hbool_t encoding_valid; /* Whether link name character encoding is valid */ + unsigned intermediate_group; /* Whether to create intermediate groups */ hbool_t intermediate_group_valid; /* Whether create intermediate group flag is valid */ @@ -357,6 +360,7 @@ typedef struct H5CX_dxpl_cache_t { /* Typedef for cached default link creation property list information */ /* (Same as the cached DXPL struct, above, except for the default LCPL) */ typedef struct H5CX_lcpl_cache_t { + H5T_cset_t encoding; /* Link name character encoding */ unsigned intermediate_group; /* Whether to create intermediate groups */ } H5CX_lcpl_cache_t; @@ -543,9 +547,6 @@ H5CX__init_package(void) if(H5P_get(dx_plist, H5D_XFER_CONV_CB_NAME, &H5CX_def_dxpl_cache.dt_conv_cb) < 0) HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve datatype conversion exception callback") - /* Reset the "default LAPL cache" information */ - HDmemset(&H5CX_def_lapl_cache, 0, sizeof(H5CX_lapl_cache_t)); - /* Reset the "default LCPL cache" information */ HDmemset(&H5CX_def_lcpl_cache, 0, sizeof(H5CX_lcpl_cache_t)); @@ -555,10 +556,17 @@ H5CX__init_package(void) if(NULL == (lc_plist = (H5P_genplist_t *)H5I_object(H5P_LINK_CREATE_DEFAULT))) HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a link creation property list") + /* Get link name character encoding */ + if(H5P_get(lc_plist, H5P_STRCRT_CHAR_ENCODING_NAME, &H5CX_def_lcpl_cache.encoding) < 0) + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve link name encoding") + /* Get flag whether to create intermediate groups */ if(H5P_get(lc_plist, H5L_CRT_INTERMEDIATE_GROUP_NAME, &H5CX_def_lcpl_cache.intermediate_group) < 0) HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve intermediate group creation flag") + /* Reset the "default LAPL cache" information */ + HDmemset(&H5CX_def_lapl_cache, 0, sizeof(H5CX_lapl_cache_t)); + /* Get the default LAPL cache information */ /* Get the default link access property list */ @@ -2432,7 +2440,42 @@ done: /*------------------------------------------------------------------------- - * Function: H5CX_get_create_intermediate_group + * Function: H5CX_get_encoding + * + * Purpose: Retrieves the character encoding for the current API call context. + * + * Return: Non-negative on success / Negative on failure + * + * Programmer: Gerd Heber + * October 21, 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5CX_get_encoding(H5T_cset_t* encoding) +{ + H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(encoding); + HDassert(head && *head); + HDassert(H5P_DEFAULT != (*head)->ctx.lcpl_id); + + H5CX_RETRIEVE_PROP_VALID(lcpl, H5P_LINK_CREATE_DEFAULT, H5P_STRCRT_CHAR_ENCODING_NAME, encoding) + + /* Get the value */ + *encoding = (*head)->ctx.encoding; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5CX_get_encoding() */ + + +/*------------------------------------------------------------------------- + * Function: H5CX_get_intermediate_group * * Purpose: Retrieves the create intermediate group flag for the current API call context. * @@ -2444,7 +2487,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5CX_get_create_intermediate_group(unsigned* crt_intermed_group) +H5CX_get_intermediate_group(unsigned* crt_intermed_group) { H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2972,40 +3015,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5CX_set_create_intermediate_group - * - * Purpose: Sets the create intermediate group flag for the current API call context. - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Gerd Heber - * October 21, 2019 - * - *------------------------------------------------------------------------- - */ -herr_t -H5CX_set_create_intermediate_group(unsigned crt_intermed_group) -{ - H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity check */ - HDassert(head && *head); - - /* Set the API context value */ - (*head)->ctx.intermediate_group = crt_intermed_group; - - /* Mark the value as valid */ - (*head)->ctx.intermediate_group_valid = TRUE; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5CX_set_create_intermediate_group() */ - - -/*------------------------------------------------------------------------- * Function: H5CX_set_nlinks * * Purpose: Sets the # of soft / UD links to traverse for the current API call context. |