summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan-Willem Blokland <Jan-Willem.Blokland@Shell.com>2021-09-13 20:05:19 (GMT)
committerGitHub <noreply@github.com>2021-09-13 20:05:19 (GMT)
commit7c973deaf1e602cf165a39860e574a9b5468d164 (patch)
treedb87dd6d8292e3edf3d9054e930824d5048d9954 /src
parentf6f1a0234410e2cf13f0a078c3499a33e5bd056b (diff)
downloadhdf5-7c973deaf1e602cf165a39860e574a9b5468d164.zip
hdf5-7c973deaf1e602cf165a39860e574a9b5468d164.tar.gz
hdf5-7c973deaf1e602cf165a39860e574a9b5468d164.tar.bz2
H5Ztrans: (feature) Improved H5Z_xform_noop() and H5Z_xform_create() … (#933)
* H5Ztrans: (feature) Improved H5Z_xform_noop() and H5Z_xform_create() function - Made a small improvement for H5Z_xform_noop() function. Now, the function will also return TRUE if the data transform function expression = "x". For this case, the HDF5 library behaves in a similar fashion as the case when no data transform function has been specified. - Improved the inline documentation of the function H5Z_xform_create() such it is more inline with the rest of the code. * Committing clang-format changes * H5Ztrans: (feature) Added 3 tests for improved H5Z_xform_noop() function - Added serial test with data transform expression = "x" to verify the improved H5Z_xform_noop() function behaves as expected. - Added 2 parallel tests with data transform expression = "x" in combination with a filter. Before, these tests will fail but with the improved H5Z_xform_noop() function they work and result in the expected behavior. - Small bug fix for one of parallel filter tests. * Committing clang-format changes * H5Ztrans: (feature) Added release note about detection of the simple data transform function "x". - Added a brief explanation about the implemented improvement of the detection of the simple data transform function "x" to the RELEASE.txt file. Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'src')
-rw-r--r--src/H5Ztrans.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c
index 7d55efd..ab7e9be 100644
--- a/src/H5Ztrans.c
+++ b/src/H5Ztrans.c
@@ -1547,11 +1547,11 @@ H5Z_xform_create(const char *expr)
(HDisdigit(expr[i - 1]) || (expr[i - 1] == '.')) &&
(HDisdigit(expr[i + 1]) || (expr[i + 1] == '-') || (expr[i + 1] == '+')))
continue;
- }
+ } /* end if */
count++;
- }
- }
+ } /* end if */
+ } /* end for */
/* When there are no "x"'s in the equation (ie, simple transform case),
* we don't need to allocate any space since no array will have to be
@@ -1749,11 +1749,19 @@ done:
hbool_t
H5Z_xform_noop(const H5Z_data_xform_t *data_xform_prop)
{
- hbool_t ret_value = FALSE; /* Return value */
+ hbool_t ret_value = TRUE; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
- ret_value = (data_xform_prop ? FALSE : TRUE);
+ if (data_xform_prop) {
+ ret_value = FALSE;
+
+ /* Check for trivial data tranformation: expression = "x" */
+ if ((HDstrlen(data_xform_prop->xform_exp) == 1) && data_xform_prop->dat_val_pointers &&
+ (data_xform_prop->dat_val_pointers->num_ptrs == 1)) {
+ ret_value = TRUE;
+ } /* end if */
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5Z_xform_noop() */