summaryrefslogtreecommitdiffstats
path: root/src/H5Ztrans.c
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2021-09-14 13:37:38 (GMT)
committerGitHub <noreply@github.com>2021-09-14 13:37:38 (GMT)
commitd110a16912657d45fcc284305daa2cd69322c5ba (patch)
tree0389ef34390b84805f919ef7ca841e1555221879 /src/H5Ztrans.c
parentb30a44973e97c56bf7772cdbf767b98f84122397 (diff)
downloadhdf5-d110a16912657d45fcc284305daa2cd69322c5ba.zip
hdf5-d110a16912657d45fcc284305daa2cd69322c5ba.tar.gz
hdf5-d110a16912657d45fcc284305daa2cd69322c5ba.tar.bz2
H5Ztrans: (feature) Improved H5Z_xform_noop() and H5Z_xform_create() … (#933) (#1008)
* 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.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() */