Skip to content

Commit

Permalink
Check if lib conversion func is in use
Browse files Browse the repository at this point in the history
  • Loading branch information
mattjala committed Nov 15, 2023
1 parent dd784b1 commit 30d6091
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
17 changes: 10 additions & 7 deletions src/H5T.c
Original file line number Diff line number Diff line change
Expand Up @@ -5174,10 +5174,10 @@ H5T_path_noop(const H5T_path_t *p)
/*-------------------------------------------------------------------------
* Function: H5T_path_compound_subset
*
* Purpose: Checks if the source and destination types are both compound.
* Tells whether whether the source members are a subset of
* destination, and the order is the same, and no conversion
* is needed. For example:
* Purpose: Checks if the library's compound conversion function
* is in use. Tells whether whether the source members are
* a subset of destination, and the order is the same, and
* no conversion is needed. For example:
* struct source { struct destination {
* TYPE1 A; --> TYPE1 A;
* TYPE2 B; --> TYPE2 B;
Expand All @@ -5186,8 +5186,9 @@ H5T_path_noop(const H5T_path_t *p)
* TYPE5 E;
* };
*
* Return: A pointer to the subset info struct in p, or NULL if there are
* no compounds. Points directly into the H5T_path_t structure.
* Return: A pointer to the subset info struct in p, or NULL if the
* library's compound conversion function is not in use.
* Points directly into the H5T_path_t structure.
*
*-------------------------------------------------------------------------
*/
Expand All @@ -5200,7 +5201,9 @@ H5T_path_compound_subset(const H5T_path_t *p)

assert(p);

if (p->are_compounds)
/* Only retrieve private info if the library compound conversion
* function is in use */
if (!p->conv.is_app && (p->conv.u.lib_func == H5T__conv_struct))
ret_value = H5T__conv_struct_subset(&(p->cdata));

FUNC_LEAVE_NOAPI(ret_value)
Expand Down
15 changes: 4 additions & 11 deletions src/H5Tconv.c
Original file line number Diff line number Diff line change
Expand Up @@ -2156,23 +2156,16 @@ H5T__conv_struct_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata)
H5T_subset_info_t *
H5T__conv_struct_subset(const H5T_cdata_t *cdata)
{
H5T_conv_struct_t *priv = NULL;
H5T_subset_info_t *ret_value = NULL;
H5T_conv_struct_t *priv = NULL;

FUNC_ENTER_PACKAGE_NOERR

assert(cdata);
assert(cdata->priv);

if (cdata->priv) {
priv = (H5T_conv_struct_t *)(cdata->priv);
ret_value = &priv->subset_info;
}
else {
ret_value = (H5T_subset_info_t *)NULL;
}

FUNC_LEAVE_NOAPI(ret_value)
priv = (H5T_conv_struct_t *)(cdata->priv);

FUNC_LEAVE_NOAPI((H5T_subset_info_t *)&priv->subset_info)
} /* end H5T__conv_struct_subset() */

/*-------------------------------------------------------------------------
Expand Down

0 comments on commit 30d6091

Please sign in to comment.