diff options
author | Larry Knox <lrknox@hdfgroup.org> | 2021-09-14 13:37:22 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-14 13:37:22 (GMT) |
commit | 3cf0d48272f0ec6afbec318c90c945e91b7ba56d (patch) | |
tree | 37be804e96f3a1a9ed19a04717067616ca67f543 /src/H5Ztrans.c | |
parent | 876b720d6f0d2f639f32c04c1d2a35567f6ba80e (diff) | |
download | hdf5-3cf0d48272f0ec6afbec318c90c945e91b7ba56d.zip hdf5-3cf0d48272f0ec6afbec318c90c945e91b7ba56d.tar.gz hdf5-3cf0d48272f0ec6afbec318c90c945e91b7ba56d.tar.bz2 |
H5Ztrans: (feature) Improved H5Z_xform_noop() and H5Z_xform_create() … (#933) (#1007)
* 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>
Co-authored-by: Jan-Willem Blokland <Jan-Willem.Blokland@Shell.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'src/H5Ztrans.c')
-rw-r--r-- | src/H5Ztrans.c | 18 |
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() */ |