summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChris Hogan <chogan@hdfgroup.org>2019-11-04 20:42:08 (GMT)
committerChris Hogan <chogan@hdfgroup.org>2019-11-04 20:42:08 (GMT)
commit77a0f4087f4aeea7f1cf43ef5bc44cd1ce1bf5f3 (patch)
treeab0e6e27571bdaa85c175a52976f78c1e035ef91 /src
parente6d63889051caa9393afcbac277ad41913a020a0 (diff)
downloadhdf5-77a0f4087f4aeea7f1cf43ef5bc44cd1ce1bf5f3.zip
hdf5-77a0f4087f4aeea7f1cf43ef5bc44cd1ce1bf5f3.tar.gz
hdf5-77a0f4087f4aeea7f1cf43ef5bc44cd1ce1bf5f3.tar.bz2
Add character encoding to lcpl context
Diffstat (limited to 'src')
-rw-r--r--src/H5CX.c87
-rw-r--r--src/H5CXprivate.h4
-rw-r--r--src/H5L.c6
3 files changed, 54 insertions, 43 deletions
diff --git a/src/H5CX.c b/src/H5CX.c
index f63fc1a..b7e1e1b 100644
--- a/src/H5CX.c
+++ b/src/H5CX.c
@@ -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.
diff --git a/src/H5CXprivate.h b/src/H5CXprivate.h
index 422832e..e3e9780 100644
--- a/src/H5CXprivate.h
+++ b/src/H5CXprivate.h
@@ -43,6 +43,7 @@
typedef struct H5CX_state_t {
hid_t dxpl_id; /* DXPL for operation */
hid_t lapl_id; /* LAPL for operation */
+ hid_t lcpl_id; /* LCPL for operation */
void *vol_wrap_ctx; /* VOL connector's "wrap context" for creating IDs */
H5VL_connector_prop_t vol_connector_prop; /* VOL connector property */
@@ -124,7 +125,8 @@ H5_DLL herr_t H5CX_get_vlen_alloc_info(H5T_vlen_alloc_info_t *vl_alloc_info);
H5_DLL herr_t H5CX_get_dt_conv_cb(H5T_conv_cb_t *cb_struct);
/* "Getter" routines for LCPL properties cached in API context */
-H5_DLL herr_t H5CX_get_create_intermediate_group(unsigned* crt_intermed_group);
+H5_DLL herr_t H5CX_get_encoding(H5T_cset_t* encoding);
+H5_DLL herr_t H5CX_get_intermediate_group(unsigned* crt_intermed_group);
/* "Getter" routines for LAPL properties cached in API context */
H5_DLL herr_t H5CX_get_nlinks(size_t *nlinks);
diff --git a/src/H5L.c b/src/H5L.c
index 794585c..5f9ed73 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -1859,8 +1859,8 @@ H5L__link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t H5_ATT
/* Check for non-default link creation properties */
if(udata->lc_plist) {
/* Get character encoding property */
- if(H5P_get(udata->lc_plist, H5P_STRCRT_CHAR_ENCODING_NAME, &udata->lnk->cset) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get property value for character encoding")
+ if(H5CX_get_encoding(&udata->lnk->cset) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get 'character set' property")
} /* end if */
else
udata->lnk->cset = H5F_DEFAULT_CSET; /* Default character encoding for link */
@@ -2001,7 +2001,7 @@ H5L__create_real(const H5G_loc_t *link_loc, const char *link_name,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
/* Get intermediate group creation property */
- if(H5CX_get_create_intermediate_group(&crt_intmd_group) < 0)
+ if(H5CX_get_intermediate_group(&crt_intmd_group) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get 'create intermediate group' property")
if(crt_intmd_group > 0)