summaryrefslogtreecommitdiffstats
path: root/src/H5EA.c
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2018-12-15 01:06:25 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2018-12-15 01:06:25 (GMT)
commit22bc8ba7bfb2c82b6cea6b5f5d1da2f2119c348b (patch)
treea15437bcf06df4a5c30b924fbcd7be135c992037 /src/H5EA.c
parent1cffc3ff0f3454fedf6edcdb93dcde5ed1b910d6 (diff)
downloadhdf5-22bc8ba7bfb2c82b6cea6b5f5d1da2f2119c348b.zip
hdf5-22bc8ba7bfb2c82b6cea6b5f5d1da2f2119c348b.tar.gz
hdf5-22bc8ba7bfb2c82b6cea6b5f5d1da2f2119c348b.tar.bz2
Addressed HDFFV-10661
Description: - Fixed a bug triggered by tests in chunk_info.c. The returned value from a callback function was not checked in H5EA_iterate(), H5FA_iterate(), and H5D__none_idx_iterate(). This oversight caused a callback function to continue iterating even though it's supposed to stop. Vailin confirmed. - Addressed review comments and made various improvements on the tests. Platforms tested: Linux/64 (jelly) Linux/64 (platypus) Darwin (osx1010test)
Diffstat (limited to 'src/H5EA.c')
-rw-r--r--src/H5EA.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/H5EA.c b/src/H5EA.c
index 9ceb144..f3a7d9e 100644
--- a/src/H5EA.c
+++ b/src/H5EA.c
@@ -999,10 +999,9 @@ H5EA_iterate(H5EA_t *ea, H5EA_operator_t op, void *udata))
/* Local variables */
uint8_t *elmt = NULL;
hsize_t u;
+ int ret_value = H5_ITER_CONT; /* Return value from callback */
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(ea);
HDassert(op);
HDassert(udata);
@@ -1012,17 +1011,15 @@ H5EA_iterate(H5EA_t *ea, H5EA_operator_t op, void *udata))
H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array element")
/* Iterate over all elements in array */
- for(u = 0; u < ea->hdr->stats.stored.max_idx_set; u++) {
- int cb_ret; /* Return value from callback */
-
+ for(u = 0; u < ea->hdr->stats.stored.max_idx_set && ret_value == H5_ITER_CONT; u++) {
/* Get array element */
if(H5EA_get(ea, u, elmt) < 0)
H5E_THROW(H5E_CANTGET, "unable to delete fixed array")
/* Make callback */
- if((cb_ret = (*op)(u, elmt, udata)) < 0) {
+ if((ret_value = (*op)(u, elmt, udata)) < 0) {
H5E_PRINTF(H5E_BADITER, "iterator function failed");
- H5_LEAVE(cb_ret)
+ H5_LEAVE(ret_value)
} /* end if */
} /* end for */